Files
WebSpeak-client-for-TeamSpeak/src/shared/update.ts
T
OddTurtleHead 2de2e23fd3 feat: add verified console self-update for release packages
Check official GitHub Releases, require SHA256SUMS, safely extract and swap release-package code, roll back on failed health checks, and persist task state across restarts. Docker and source deployments stay check-only. Add updater tests, route security tests and five-language admin copy.
2026-11-24 01:44:24 +08:00

79 lines
1.8 KiB
TypeScript

/**
* Browser-safe projections of the administrator update API.
*
* The console never receives download URLs or local paths. It selects a
* version, and the server re-resolves the official GitHub release asset
* before doing any work.
*/
export type UpdateDeploymentMode = "docker" | "release-package" | "source";
export type UpdateUpgradePath = "docker-compose" | "release-package" | "source";
export type UpdateTaskStatus =
| "downloading"
| "verifying"
| "extracting"
| "staging"
| "restarting"
| "succeeded"
| "failed";
export type UpdateStepStatus = "running" | "succeeded" | "failed";
export interface UpdateStepView {
name: string;
status: UpdateStepStatus;
at: string;
detail?: string;
}
export interface UpdateTaskView {
id: string;
status: UpdateTaskStatus;
fromVersion: string;
targetVersion: string;
startedAt: string;
updatedAt: string;
finishedAt: string | null;
errorCode: string | null;
errorMessage: string | null;
rolledBack: boolean;
steps: UpdateStepView[];
}
export interface UpdateDeploymentView {
mode: UpdateDeploymentMode;
platform: string;
architecture: string;
applyAllowed: boolean;
reasonCode: string | null;
upgradePath: UpdateUpgradePath;
}
export interface UpdateStatusView {
currentVersion: string;
deployment: UpdateDeploymentView;
task: UpdateTaskView | null;
}
export interface UpdateReleaseView {
version: string;
tag: string;
publishedAt: string;
releaseUrl: string;
assetName: string;
assetSize: number;
assetAvailable: boolean;
hasChecksums: boolean;
digest: string | null;
canApply: boolean;
blockedReason: string | null;
}
export interface UpdateCheckView {
currentVersion: string;
releases: UpdateReleaseView[];
}
export interface UpdateApplyInput {
version: string;
confirmVersion: string;
}