{t("player.menus.episodes.unairedEpisodes")}
+ ) : null} ); } diff --git a/src/components/player/utils/aired.ts b/src/components/player/utils/aired.ts new file mode 100644 index 00000000..26011316 --- /dev/null +++ b/src/components/player/utils/aired.ts @@ -0,0 +1,11 @@ +const hasAiredCache: { [key: string]: boolean } = {}; + +export function hasAired(date: string) { + if (hasAiredCache[date]) return hasAiredCache[date]; + + const now = new Date(); + const airDate = new Date(date); + + hasAiredCache[date] = airDate < now; + return hasAiredCache[date]; +} diff --git a/src/hooks/auth/useAuthData.ts b/src/hooks/auth/useAuthData.ts index d38ba136..ae33faac 100644 --- a/src/hooks/auth/useAuthData.ts +++ b/src/hooks/auth/useAuthData.ts @@ -20,6 +20,7 @@ export function useAuthData() { const loggedIn = !!useAuthStore((s) => s.account); const setAccount = useAuthStore((s) => s.setAccount); const removeAccount = useAuthStore((s) => s.removeAccount); + const setProxySet = useAuthStore((s) => s.setProxySet); const clearBookmarks = useBookmarkStore((s) => s.clear); const clearProgress = useProgressStore((s) => s.clear); const setTheme = useThemeStore((s) => s.setTheme); @@ -80,6 +81,10 @@ export function useAuthData() { if (settings.applicationTheme) { setTheme(settings.applicationTheme); } + + if (settings.proxyUrls) { + setProxySet(settings.proxyUrls); + } }, [ replaceBookmarks, @@ -87,6 +92,7 @@ export function useAuthData() { setAppLanguage, importSubtitleLanguage, setTheme, + setProxySet, ], ); diff --git a/src/hooks/useRandomTranslation.ts b/src/hooks/useRandomTranslation.ts index 69d71e87..4351ffad 100644 --- a/src/hooks/useRandomTranslation.ts +++ b/src/hooks/useRandomTranslation.ts @@ -14,7 +14,10 @@ export function useRandomTranslation() { const defaultTitle = t(`${key}.default`) ?? ""; if (!shouldJoke) return defaultTitle; - const keys = t(`${key}.extra`, { returnObjects: true }); + const keys = t(`${key}.extra`, { + returnObjects: true, + defaultValue: defaultTitle, + }); if (Array.isArray(keys)) { if (keys.length === 0) return defaultTitle; return keys[Math.floor(seed * keys.length)]; diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 3d40a4cf..0fb27d85 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -140,10 +140,15 @@ export function SettingsPage() { const saveChanges = useCallback(async () => { if (account) { - if (state.appLanguage.changed || state.theme.changed) { + if ( + state.appLanguage.changed || + state.theme.changed || + state.proxyUrls.changed + ) { await updateSettings(backendUrl, account, { applicationLanguage: state.appLanguage.state, applicationTheme: state.theme.state, + proxyUrls: state.proxyUrls.state?.filter((v) => v !== "") ?? null, }); } if (state.deviceName.changed) { @@ -166,7 +171,7 @@ export function SettingsPage() { setAppLanguage(state.appLanguage.state); setTheme(state.theme.state); setSubStyling(state.subtitleStyling.state); - setProxySet(state.proxyUrls.state); + setProxySet(state.proxyUrls.state?.filter((v) => v !== "") ?? null); if (state.profile.state) { updateProfile(state.profile.state); diff --git a/src/pages/parts/auth/VerifyPassphrasePart.tsx b/src/pages/parts/auth/VerifyPassphrasePart.tsx index ab64b51c..2f040ccb 100644 --- a/src/pages/parts/auth/VerifyPassphrasePart.tsx +++ b/src/pages/parts/auth/VerifyPassphrasePart.tsx @@ -74,6 +74,7 @@ export function VerifyPassphrase(props: VerifyPassphraseProps) { applicationLanguage, defaultSubtitleLanguage: defaultSubtitleLanguage ?? undefined, applicationTheme: applicationTheme ?? undefined, + proxyUrls: undefined, }); await restore(account);