feat(updates): auto-apply and self-restart on new dashboard versions

Adds POST /api/updates/apply (pull, rebuild, restart) plus an "Update now"
button and hourly auto-check in the UI, for checkouts that are safely
fast-forwardable. Reintroduces self-restart (previously removed in edc25ca
for cross-environment reliability concerns) per explicit user request.
This commit is contained in:
2026-08-18 16:04:27 +07:00
parent f053051a5d
commit 8e49d2b300
15 changed files with 502 additions and 19 deletions
+17
View File
@@ -557,6 +557,23 @@ export const api = {
method: "POST",
body: JSON.stringify({}),
}),
/**
* POST /api/updates/apply - fast-forward, rebuild, and restart.
*
* Only acts when the checkout is fast-forwardable (`tracking_canonical`
* or `fork_or_diverged_tracking`); a 409 response means it declined
* (`applied: false`, `reason` explains why). On success the server
* restarts itself right after responding, so the caller should poll
* `status()` until it answers again rather than expect the connection
* to outlive the call.
*
* @returns {@link UpdateStatusPayload} with `applied` set.
*/
apply: () =>
request<UpdateStatusPayload>("/updates/apply", {
method: "POST",
body: JSON.stringify({}),
}),
},
// ──────────────────────────────── Stats API ────────────────────────────────