feat: mirror-all-to-NAS, content reset (danger zone), in-app changelog + CHANGELOG.md, How-To refresh
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNQ8ghPfzAfsyVYd6HgFb6
This commit is contained in:
@@ -69,6 +69,21 @@ export async function purgeSources(): Promise<{ purged: number }> {
|
||||
return { purged };
|
||||
}
|
||||
|
||||
/** Spiegelt alle fertigen Bilder aufs NAS (einmalige Nachsicherung). */
|
||||
export async function mirrorAllToNas(): Promise<{ mirrored: number; failed: number; total: number }> {
|
||||
const { mirrorItemToNas, loadNasConfig } = await import('./nas');
|
||||
if (!(await loadNasConfig())) return { mirrored: 0, failed: 0, total: 0 };
|
||||
const rows = await query<{ id: string }>(
|
||||
`SELECT id FROM items WHERE status='done' AND result_path IS NOT NULL
|
||||
AND (nas_status IS NULL OR nas_status <> 'mirrored') ORDER BY created_at`);
|
||||
let mirrored = 0, failed = 0;
|
||||
for (const it of rows) {
|
||||
const r = await mirrorItemToNas(it.id);
|
||||
r.ok ? mirrored++ : failed++;
|
||||
}
|
||||
return { mirrored, failed, total: rows.length };
|
||||
}
|
||||
|
||||
let timer: NodeJS.Timeout | null = null;
|
||||
/** Täglicher Retention-Lauf (falls in den Einstellungen aktiviert). */
|
||||
export function startMaintenance(): void {
|
||||
|
||||
Reference in New Issue
Block a user