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
+42
View File
@@ -2440,6 +2440,48 @@ function createOpenApiSpec() {
},
},
},
"/api/updates/apply": {
post: {
tags: ["Updates"],
summary: "Pull, rebuild, and restart the dashboard when fast-forwardable",
operationId: "applyUpdate",
responses: {
200: {
description:
"Checkout fast-forwarded and rebuilt; the process is about to self-restart",
content: {
"application/json": {
schema: {
type: "object",
additionalProperties: true,
description: "Same shape as GET /api/updates/status, plus applied: true.",
},
},
},
},
409: {
description:
"Declined - nothing to apply, or the checkout isn't safely fast-forwardable",
content: {
"application/json": {
schema: {
type: "object",
additionalProperties: true,
description:
'applied: false plus reason: "up_to_date" | "not_fast_forwardable".',
},
},
},
},
500: {
description: "Update apply failed",
content: {
"application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } },
},
},
},
},
},
"/api/alerts": {
get: {
tags: ["Alerts"],