feat(storage): show unreferenced files in Admin > Storage, with the switch and a check

Desktop and phone show what the last check found (can be freed, unused for
less than a week, freed), why a category was skipped, the switch that lets
the nightly run delete and a report-only check on demand, through the
shared storage panel hook. All 28 languages, and the Admin-Storage wiki
page explains the check, the week's wait and when to leave it off.
This commit is contained in:
Maurice
2026-11-01 14:30:01 +01:00
parent b31666d1c9
commit a1d9cdc8f2
42 changed files with 1179 additions and 3 deletions
@@ -12,6 +12,7 @@ import type {
import { useTranslation } from '../../../i18n';
import { formatBytes } from '../../../utils/formatBytes';
import { useToast } from '../../shared/Toast';
import { reclaimView } from './reclaimModel';
import {
adoptedMirrorFor,
computeMigrationCandidates,
@@ -165,6 +166,19 @@ export function useStoragePanel() {
if (error) toast.error(error);
};
const [reclaimChecking, setReclaimChecking] = useState(false);
const handleReclaimCheck = async () => {
setReclaimChecking(true);
const error = await admin.checkReclaim();
setReclaimChecking(false);
if (error) toast.error(error);
};
const handleReclaimDelete = async (enabled: boolean) => {
const error = await admin.setReclaimDelete(enabled);
if (error) toast.error(error);
};
const reclaim = reclaimView(admin.state?.reclaim ?? null);
const handleStartBackfill = async (row: FoldedBackendRow) => {
if (!row.mirrorName) return;
setSyncPrompt((prev) => (prev === row.name ? null : prev));
@@ -371,6 +385,10 @@ export function useStoragePanel() {
migrationQueue,
handleCancelMigration,
handleRefreshStats,
reclaim,
reclaimChecking,
handleReclaimCheck,
handleReclaimDelete,
handleStartBackfill,
handleCancelBackfill,
loaded,