Add an admin action that rebuilds preview proxies

A library imported by an older pipeline keeps whatever proxy it was given, and
the editor can only show those bytes. The Storage tab now re-decodes every
camera raw from its original, writing a fresh JPEG proxy, thumbnail, 16-bit
sidecar and denoise prune, then stamps previewVersion so browsers refetch.

The decode loop runs one photo at a time on the server behind a status route:
an hour of LibRaw work would time out as a request, and parallel decodes would
starve the editor. The single-photo reprocess route shares the same helper.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 06:20:44 +00:00
parent 2bec4102a2
commit 158dccddf1
6 changed files with 342 additions and 30 deletions
+26
View File
@@ -760,6 +760,32 @@ export function adminTestImmich(): Promise<ImmichTestResult> {
return request<ImmichTestResult>('/api/admin/immich/test', { method: 'POST' });
}
export interface PreviewRebuildStatus {
state: 'idle' | 'running' | 'done';
total: number;
/** Photos attempted so far, including the failures. */
done: number;
failed: number;
/** Rebuilt proxies that also wrote a 16-bit sidecar. */
sidecars: number;
startedAt: number | null;
finishedAt: number | null;
errors: string[];
}
/** Starts a server-side rebuild and returns its first progress snapshot. */
export function adminRebuildPreviews(): Promise<PreviewRebuildStatus> {
return request<{ rebuild: PreviewRebuildStatus }>('/api/admin/previews/rebuild', {
method: 'POST',
}).then((res) => res.rebuild);
}
export function adminPreviewRebuildStatus(): Promise<PreviewRebuildStatus> {
return request<{ rebuild: PreviewRebuildStatus }>('/api/admin/previews/rebuild').then(
(res) => res.rebuild,
);
}
export function adminDisconnectImmich(): Promise<ImmichStatus> {
return request<{ immich: ImmichStatus }>('/api/admin/immich', { method: 'DELETE' }).then(
(res) => res.immich,