Add daemon restart, preview diagnostics, browse caching, and rate-limit pauses

This commit is contained in:
Fisto
2026-09-17 07:33:35 +02:00
parent cba7ae8143
commit dea1724eb3
13 changed files with 367 additions and 56 deletions
+27
View File
@@ -75,6 +75,8 @@ export interface WebUiDeps {
transcripts: TranscriptStore;
preferences: PreferencesStore;
media: MediaService;
/** Replace the daemon process with a fresh copy, keeping the client running. */
restartDaemon: () => void;
connectAudioDevices: () => Promise<{ connected: boolean; message: string }>;
}
@@ -267,6 +269,22 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
})
);
app.post(
"/api/daemon/restart",
wrap(async (_req, res) => {
res.json({ ok: true, result: { restarting: true } });
deps.restartDaemon();
})
);
app.get(
"/api/media/preview-failures",
wrap(async (req, res) => {
const limit = clampLimit(req.query.limit, 50, 500);
res.json({ ok: true, result: deps.media.previewFailures(limit) });
})
);
app.post(
"/api/core/restart",
wrap(async (req, res) => {
@@ -764,6 +782,15 @@ export function startWebUi(deps: WebUiDeps): WebUiHandle {
})
);
app.get(
"/api/media/:scrapeId/:itemId/anim",
wrap(async (req, res) => {
const file = deps.media.getMediaAnim(String(req.params.scrapeId), Number(req.params.itemId));
if (!file || !existsSync(file.path)) throw new HttpError(404, "anim not found");
res.type(file.contentType).sendFile(file.path);
})
);
app.get(
"/api/media/:scrapeId/:itemId/file",
wrap(async (req, res) => {