mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
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.
This commit is contained in:
1 parent
ae6788a796
commit
2de2e23fd3
32 files changed
+3573
-16
No files matched your search
@@ -0,0 +1,38 @@
|
||||
/** Stable semantic versions only. Pre-release/rolling channels are deliberate non-goals. */
|
||||
export interface StableVersion {
|
||||
major: number;
|
||||
minor: number;
|
||||
patch: number;
|
||||
text: string;
|
||||
}
|
||||
|
||||
const STABLE = /^(\d{1,6})\.(\d{1,6})\.(\d{1,6})$/;
|
||||
|
||||
export function parseStableVersion(value: unknown): StableVersion | null {
|
||||
if (typeof value !== "string") return null;
|
||||
const match = STABLE.exec(value.trim());
|
||||
if (!match) return null;
|
||||
const [, major, minor, patch] = match;
|
||||
return { major: Number(major), minor: Number(minor), patch: Number(patch), text: `${Number(major)}.${Number(minor)}.${Number(patch)}` };
|
||||
}
|
||||
|
||||
/** `v1.2.3` is the only accepted release tag shape. */
|
||||
export function parseReleaseTag(value: unknown): StableVersion | null {
|
||||
if (typeof value !== "string" || !value.startsWith("v")) return null;
|
||||
return parseStableVersion(value.slice(1));
|
||||
}
|
||||
|
||||
export function isValidVersion(value: unknown): value is string {
|
||||
return parseStableVersion(value) !== null;
|
||||
}
|
||||
|
||||
export function compareVersions(left: string, right: string): number {
|
||||
const a = parseStableVersion(left);
|
||||
const b = parseStableVersion(right);
|
||||
if (!a || !b) return 0;
|
||||
return a.major - b.major || a.minor - b.minor || a.patch - b.patch;
|
||||
}
|
||||
|
||||
export function isNewerVersion(candidate: string, current: string): boolean {
|
||||
return compareVersions(candidate, current) > 0;
|
||||
}
|
||||
Reference in new issue
Block a user