Add backend and frontend support for NapCat auto-update

Introduces backend API and router for updating NapCat, including update logic and pending update application on startup. Adds frontend integration with update button and request handling. Refactors system info component to remove legacy new version tip. Updates types and runtime to track working environment for update selection. Implements lazy loading for pty in unixTerminal to avoid early initialization.
This commit is contained in:
手瓜一十雪
2025-11-19 21:05:08 +08:00
parent c123b34d5f
commit 2cdc9bdc09
11 changed files with 641 additions and 164 deletions

View File

@@ -1,8 +1,9 @@
import store from 'napcat-common/src/store';
import { napCatVersion } from 'napcat-common/src/version';
import type { LoginRuntimeType } from '../types';
import { NapCatCoreWorkingEnv, type LoginRuntimeType } from '../types';
const LoginRuntime: LoginRuntimeType = {
workingEnv: NapCatCoreWorkingEnv.Unknown,
LoginCurrentTime: Date.now(),
LoginCurrentRate: 0,
QQLoginStatus: false, // 已实现 但太傻了 得去那边注册个回调刷新
@@ -36,6 +37,12 @@ const LoginRuntime: LoginRuntimeType = {
},
};
export const WebUiDataRuntime = {
setWorkingEnv (env: NapCatCoreWorkingEnv): void {
LoginRuntime.workingEnv = env;
},
getWorkingEnv (): NapCatCoreWorkingEnv {
return LoginRuntime.workingEnv;
},
setWebUiTokenChangeCallback (func: (token: string) => Promise<void>): void {
LoginRuntime.onWebUiTokenChange = func;
},