/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import List from '@mui/material/List'; import ListItemText from '@mui/material/ListItemText'; import ListSubheader from '@mui/material/ListSubheader'; import ListItemButton from '@mui/material/ListItemButton'; import { useLingui } from '@lingui/react/macro'; import { useAppTitle } from '@/features/navigation-bar/hooks/useAppTitle.ts'; import { ListItemLink } from '@/base/components/lists/ListItemLink.tsx'; import { AppRoutes } from '@/base/AppRoute.constants.ts'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { ImageCache } from '@/lib/service-worker/ImageCache.ts'; import { makeToast } from '@/base/utils/Toast.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts'; export const ImagesSettings = () => { const { t } = useLingui(); useAppTitle(t`Images`); const [triggerClearServerCache, { loading: isClearingServerCache }] = requestManager.useClearServerCache(); const clearCache = async () => { try { await Promise.all([ triggerClearServerCache({ variables: { input: { cachedPages: true, cachedThumbnails: true } } }), ImageCache.clearAll(), ]); makeToast(t`Cleared the cache`, 'success'); } catch (e) { makeToast(t`Could not clear the cache`, 'error', getErrorMessage(e)); } }; return ( {t`Image processing`} } > ); };