From 60724df45aa9533c15672f6ffbb9bf4056df0e69 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 21 Feb 2025 23:17:19 +0700 Subject: [PATCH 1/3] fix channel about response type --- frontend/src/api/loader/loadChannelById.ts | 3 ++- frontend/src/pages/ChannelAbout.tsx | 18 +++++++----------- frontend/src/pages/Channels.tsx | 14 +++++++------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/frontend/src/api/loader/loadChannelById.ts b/frontend/src/api/loader/loadChannelById.ts index 05c72722..a0f0c1af 100644 --- a/frontend/src/api/loader/loadChannelById.ts +++ b/frontend/src/api/loader/loadChannelById.ts @@ -1,6 +1,7 @@ import APIClient from '../../functions/APIClient'; +import { ChannelResponseType } from '../../pages/ChannelBase'; -const loadChannelById = async (youtubeChannelId: string) => { +const loadChannelById = async (youtubeChannelId: string): Promise => { return APIClient(`/api/channel/${youtubeChannelId}/`); }; diff --git a/frontend/src/pages/ChannelAbout.tsx b/frontend/src/pages/ChannelAbout.tsx index 9fc4aa59..b23e68a8 100644 --- a/frontend/src/pages/ChannelAbout.tsx +++ b/frontend/src/pages/ChannelAbout.tsx @@ -63,20 +63,16 @@ const ChannelAbout = () => { const channelResponse = await loadChannelById(channelId); setChannelResponse(channelResponse); - setDownloadFormat(channelResponse?.data?.channel_overwrites?.download_format ?? null); - setAutoDeleteAfter(channelResponse?.data?.channel_overwrites?.autodelete_days ?? null); - setIndexPlaylists(channelResponse?.data?.channel_overwrites?.index_playlists ?? null); - setEnableSponsorblock( - channelResponse?.data?.channel_overwrites?.integrate_sponsorblock ?? null, - ); - setPageSizeVideo( - channelResponse?.data?.channel_overwrites?.subscriptions_channel_size ?? null, - ); + setDownloadFormat(channelResponse?.channel_overwrites?.download_format ?? null); + setAutoDeleteAfter(channelResponse?.channel_overwrites?.autodelete_days ?? null); + setIndexPlaylists(channelResponse?.channel_overwrites?.index_playlists ?? false); + setEnableSponsorblock(channelResponse?.channel_overwrites?.integrate_sponsorblock ?? null); + setPageSizeVideo(channelResponse?.channel_overwrites?.subscriptions_channel_size ?? null); setPageSizeShorts( - channelResponse?.data?.channel_overwrites?.subscriptions_shorts_channel_size ?? null, + channelResponse?.channel_overwrites?.subscriptions_shorts_channel_size ?? null, ); setPageSizeStreams( - channelResponse?.data?.channel_overwrites?.subscriptions_live_channel_size ?? null, + channelResponse?.channel_overwrites?.subscriptions_live_channel_size ?? null, ); setRefresh(false); diff --git a/frontend/src/pages/Channels.tsx b/frontend/src/pages/Channels.tsx index 57c8d998..0ec3bbc9 100644 --- a/frontend/src/pages/Channels.tsx +++ b/frontend/src/pages/Channels.tsx @@ -17,13 +17,13 @@ import { useUserConfigStore } from '../stores/UserConfigStore'; import updateUserConfig, { UserConfigType } from '../api/actions/updateUserConfig'; type ChannelOverwritesType = { - download_format?: string; - autodelete_days?: number; - index_playlists?: boolean; - integrate_sponsorblock?: boolean | null; - subscriptions_channel_size?: number; - subscriptions_live_channel_size?: number; - subscriptions_shorts_channel_size?: number; + download_format: string | null; + autodelete_days: number | null; + index_playlists: boolean | null; + integrate_sponsorblock: boolean | null; + subscriptions_channel_size: number | null; + subscriptions_live_channel_size: number | null; + subscriptions_shorts_channel_size: number | null; }; export type ChannelType = { From cc6ebae295df933b9a06ebc78ee33c95a76c62e9 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 21 Feb 2025 23:31:45 +0700 Subject: [PATCH 2/3] clean logs --- backend/video/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/video/views.py b/backend/video/views.py index 88d53003..a679552c 100644 --- a/backend/video/views.py +++ b/backend/video/views.py @@ -228,7 +228,6 @@ class VideoProgressView(ApiBaseView): current_progress.update({"watched": watched}) redis_con.set_message(key, current_progress, expire=expire) - print(current_progress) response_serializer = PlayerSerializer(current_progress) From 5751f133858ab7b005900e43f7ddabbe4df62f37 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 21 Feb 2025 23:42:13 +0700 Subject: [PATCH 3/3] ignore keyboard events with modifier --- frontend/src/functions/useKeypressHook.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/functions/useKeypressHook.tsx b/frontend/src/functions/useKeypressHook.tsx index 55287795..9037e8b7 100644 --- a/frontend/src/functions/useKeypressHook.tsx +++ b/frontend/src/functions/useKeypressHook.tsx @@ -6,7 +6,13 @@ export function useKeyPress(targetKey: string) { useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { - if (event.key === targetKey) { + if ( + event.key === targetKey && + !event.ctrlKey && + !event.metaKey && + !event.altKey && + !event.altKey + ) { setIsKeyPressed(true); } };