From d172c376d1cd0e539c46936e8a5e52cc241cebc7 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Tue, 23 Sep 2025 11:21:02 +0800 Subject: [PATCH] Remove unused code --- src/redux/thunks/filemanager.ts | 1 - src/redux/thunks/thumb.ts | 50 --------------------------------- 2 files changed, 51 deletions(-) delete mode 100644 src/redux/thunks/thumb.ts diff --git a/src/redux/thunks/filemanager.ts b/src/redux/thunks/filemanager.ts index 37f6d54..64247e0 100644 --- a/src/redux/thunks/filemanager.ts +++ b/src/redux/thunks/filemanager.ts @@ -97,7 +97,6 @@ let generation = 0; export interface NavigateReconcileOptions { next_page?: boolean; sync_view?: boolean; - min_transition_time?: number; // in ms } const pageSize = (fm: SingleManager) => { diff --git a/src/redux/thunks/thumb.ts b/src/redux/thunks/thumb.ts deleted file mode 100644 index 0fb3278..0000000 --- a/src/redux/thunks/thumb.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { AppThunk } from "../store.ts"; -import { getThumbExts } from "../../api/api.ts"; - -// --- Cached supported thumbnail extensions helpers --- -let __thumbExtsCache: Set | null | undefined = undefined; // undefined: not fetched, null: unknown/fallback - -// Get supported thumbnail file extensions by reading enabled generators' settings -export function getSupportedThumbExts(): AppThunk> { - return async (dispatch, _getState) => { - // Read from new site config endpoint; fallback to empty list. - try { - const remote = await dispatch(getThumbExts()); - const list = remote?.thumb_exts ?? []; - return Array.isArray(list) ? list : []; - } catch (_e) { - // Treat as unsupported when not available - return []; - } - }; -} - -// Prime cache once per page. Safe to call multiple times. -export function primeThumbExtsCache(): AppThunk> { - return async (dispatch, _getState) => { - if (__thumbExtsCache !== undefined) return; - try { - const exts = await dispatch(getSupportedThumbExts()); - __thumbExtsCache = new Set(exts.map((e) => e.toLowerCase())); - } catch (_e) { - // Mark as unknown to fall back to legacy behavior - __thumbExtsCache = null; - } - }; -} - -export function getCachedThumbExts(): Set | null | undefined { - return __thumbExtsCache; -} - -// Check if a file name is likely supported based on cached exts -// Returns undefined if cache is not ready (treat as supported by caller). -export function isThumbExtSupportedSync(fileName: string): boolean | undefined { - const cache = __thumbExtsCache; - if (cache === undefined) return undefined; - if (cache === null) return true; // unknown => allow - const idx = fileName.lastIndexOf("."); - const ext = idx >= 0 ? fileName.substring(idx + 1).toLowerCase() : ""; - if (!ext) return false; - return cache.has(ext); -}