fix: harden console self-update rollback and deployment checks

Recovered after the original 04bd82e object was lost from the worktree history; the working tree still contained the same ten-file fix (249 insertions).
This commit is contained in:
OddTurtleHead committed 2026-11-24 02:06:26 +08:00
1 parent 2de2e23fd3
commit eb6c4ba857
10 files changed
+249 -28

No files matched your search

+4 -3
View File
@@ -465,10 +465,11 @@ export function createAdminRouter(options: AdminRouterOptions): Router {
if (version !== confirmVersion) throw new UpdateError("UPDATE_CONFIRMATION_REQUIRED", "The confirmation does not match the selected version.");
const task = await options.updateService.applyUpdate(version, confirmVersion);
options.service.database.addAudit("ADMIN_UPDATE_STARTED", { version });
response.once("finish", () => {
setTimeout(() => options.restartAfterUpdate?.(), 250).unref();
});
response.status(202).json({ ok: true, task });
// Do not wait for the response to finish: a reverse proxy or a client
// that disconnects early must not leave the restart runner waiting for
// this process until its timeout expires.
setTimeout(() => options.restartAfterUpdate?.(), 250).unref();
} catch (error: unknown) {
sendUpdateError(response, error);
}