feat(webui): notify when a newer release is available

Advisory, read-only update check: the core polls GitHub's latest stable release, compares it against the running build, and surfaces a notice in the sidebar footer plus a detailed card (changelog + download link + platform-matched asset hint) in Settings → About.

SnowLuma never downloads or applies anything itself — cross-platform self-update is a minefield (Windows locks loaded .node/.dll, Docker bakes the app into image layers, bare installs have no supervisor), so the user downloads and applies manually.

The backend caches results for 6h to stay under GitHub's unauthenticated rate limit, degrades silently on failure, and can be disabled via SNOWLUMA_UPDATE_CHECK=0.
This commit is contained in:
DrSmoothl committed 2026-06-05 16:08:38 +08:00
1 parent 28db1d1079
commit 56dc934106
9 files changed
+362 -5

No files matched your search

+7 -1
View File
@@ -1,4 +1,4 @@
import type { AccountConnections, HookProcessInfo, LogEntry, LogLevel, QQInfo, SystemInfo } from '@/types';
import type { AccountConnections, HookProcessInfo, LogEntry, LogLevel, QQInfo, SystemInfo, UpdateInfo } from '@/types';
import type { PasswordRule } from '@/components/pages/change-password-page';
import { normalizeOneBotConfig } from '@/lib/onebot-config';
import {
@@ -42,6 +42,7 @@ class HttpApiClient implements ApiClient {
readonly processes: ApiClient['processes'];
readonly config: ApiClient['config'];
readonly logs: ApiClient['logs'];
readonly update: ApiClient['update'];
constructor(opts: CreateApiClientOptions = {}) {
this.tokenStore = opts.tokenStore ?? localStorageTokenStore(DEFAULT_TOKEN_KEY);
@@ -89,6 +90,11 @@ class HttpApiClient implements ApiClient {
setLevel: (level) =>
this.postJson<{ level: LogLevel; levels: LogLevel[] }>(`/api/logs/level`, { level }),
};
this.update = {
check: (force) =>
this.getJson<UpdateInfo>(`/api/update/check${force ? '?force=true' : ''}`),
};
}
// ---------- HTTP helpers ----------
+7
View File
@@ -6,6 +6,7 @@ import type {
OneBotConfig,
QQInfo,
SystemInfo,
UpdateInfo,
} from '@/types';
import type { PasswordRule } from '@/components/pages/change-password-page';
@@ -69,6 +70,12 @@ export interface ApiClient {
save(uin: string, config: OneBotConfig): Promise<OneBotConfig>;
};
// ---- update check ----
update: {
/** Advisory check for a newer stable release. Read-only — never downloads. */
check(force?: boolean): Promise<UpdateInfo>;
};
// ---- logs ----
logs: {
list(limit?: number): Promise<LogEntry[]>;