Refactor version API to GetNapCatVersion endpoint

Replaces the PackageInfo API and related frontend usage with a dedicated GetNapCatVersion endpoint that returns only the NapCat version string. Updates backend handler, helper, types, router, and frontend components to use the new API for improved clarity and separation of concerns.
This commit is contained in:
手瓜一十雪
2025-11-14 12:10:57 +08:00
parent f553f9dc8d
commit e9856ac80f
7 changed files with 13 additions and 15 deletions

View File

@@ -1,5 +1,4 @@
import type { LoginRuntimeType } from '../types/data';
import packageJson from '../../../../package.json';
import store from 'napcat-common/src/store';
import { napCatVersion } from 'napcat-common/src/version';
@@ -31,12 +30,11 @@ const LoginRuntime: LoginRuntimeType = {
QQLoginList: [],
NewQQLoginList: [],
},
packageJson,
NapCatVersion: napCatVersion,
WebUiConfigQuickFunction: async () => {
},
};
packageJson.version = napCatVersion;
export const WebUiDataRuntime = {
setWebUiTokenChangeCallback (func: (token: string) => Promise<void>): void {
LoginRuntime.onWebUiTokenChange = func;
@@ -131,8 +129,8 @@ export const WebUiDataRuntime = {
return LoginRuntime.NapCatHelper.onOB11ConfigChanged(ob11);
} as LoginRuntimeType['NapCatHelper']['onOB11ConfigChanged'],
getPackageJson () {
return LoginRuntime.packageJson;
GetNapCatVersion () {
return LoginRuntime.NapCatVersion;
},
setQQVersion (version: string) {