diff --git a/src/core/helper/status.ts b/src/core/helper/status.ts index b4e12bfa7..efcd1818f 100644 --- a/src/core/helper/status.ts +++ b/src/core/helper/status.ts @@ -18,6 +18,7 @@ export interface SystemStatus { qq: string } }, + arch: string } export class StatusHelper { @@ -95,6 +96,7 @@ export class StatusHelper { qq: qqUsage.memory } }, + arch: `${os.platform()} ${os.arch()} ${os.release()}` }; } } diff --git a/src/onebot/index.ts b/src/onebot/index.ts index d4ff757f9..f74edfa08 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -164,6 +164,7 @@ export class NapCatOneBot11Adapter { this.initBuddyListener(); this.initGroupListener(); + WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVesion()); WebUiDataRuntime.setQQLoginInfo(selfInfo); WebUiDataRuntime.setQQLoginStatus(true); WebUiDataRuntime.setOnOB11ConfigChanged(async (newConfig) => { diff --git a/src/webui/src/api/BaseInfo.ts b/src/webui/src/api/BaseInfo.ts index e2043232f..12a5fd1fe 100644 --- a/src/webui/src/api/BaseInfo.ts +++ b/src/webui/src/api/BaseInfo.ts @@ -7,3 +7,9 @@ export const PackageInfoHandler: RequestHandler = (_, res) => { const data = WebUiDataRuntime.getPackageJson(); sendSuccess(res, data); }; + + +export const QQVersionHandler: RequestHandler = (_, res) => { + const data = WebUiDataRuntime.getQQVersion(); + sendSuccess(res, data); +}; diff --git a/src/webui/src/helper/Data.ts b/src/webui/src/helper/Data.ts index f07052cd8..8f1091c7f 100644 --- a/src/webui/src/helper/Data.ts +++ b/src/webui/src/helper/Data.ts @@ -11,6 +11,7 @@ const LoginRuntime: LoginRuntimeType = { uin: '', nick: '', }, + QQVersion: 'unknown', NapCatHelper: { onOB11ConfigChanged: async () => { return; @@ -100,4 +101,12 @@ export const WebUiDataRuntime = { getPackageJson() { return LoginRuntime.packageJson; }, + + setQQVersion(version: string) { + LoginRuntime.QQVersion = version; + }, + + getQQVersion() { + return LoginRuntime.QQVersion; + } }; diff --git a/src/webui/src/router/Base.ts b/src/webui/src/router/Base.ts index 1327fc92c..df476f8cb 100644 --- a/src/webui/src/router/Base.ts +++ b/src/webui/src/router/Base.ts @@ -1,9 +1,10 @@ import { Router } from 'express'; -import { PackageInfoHandler } from '../api/BaseInfo'; +import { PackageInfoHandler, QQVersionHandler } from '../api/BaseInfo'; import { StatusRealTimeHandler } from "@webapi/api/Status"; const router = Router(); // router: 获取nc的package.json信息 +router.get('/QQVersion', QQVersionHandler); router.get('/PackageInfo', PackageInfoHandler); router.get('/GetSysStatusRealTime', StatusRealTimeHandler); diff --git a/src/webui/src/types/data.d.ts b/src/webui/src/types/data.d.ts index 0da3ee19c..2eb6c4a8c 100644 --- a/src/webui/src/types/data.d.ts +++ b/src/webui/src/types/data.d.ts @@ -8,6 +8,7 @@ interface LoginRuntimeType { QQQRCodeURL: string; QQLoginUin: string; QQLoginInfo: SelfInfo; + QQVersion: string; NapCatHelper: { onQuickLoginRequested: (uin: string) => Promise<{ result: boolean; message: string }>; onOB11ConfigChanged: (ob11: OneBotConfig) => Promise;