From e719ae0676fede8bd00bf24bb30da91b064844ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 17 Sep 2024 13:01:02 +0800 Subject: [PATCH] release: 2.6.2 --- manifest.json | 2 +- package.json | 2 +- src/common/helper.ts | 18 ++++++++++++++---- src/common/qq-basic-info.ts | 2 +- src/common/version.ts | 2 +- src/core/index.ts | 4 ++++ src/webui/ui/NapCat.ts | 2 +- static/assets/renderer.js | 2 +- vite.config.ts | 8 -------- 9 files changed, 24 insertions(+), 18 deletions(-) diff --git a/manifest.json b/manifest.json index f60dc6a1..d52e0477 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "2.6.1", + "version": "2.6.2", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 273c4a70..65b16a08 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "2.6.1", + "version": "2.6.2", "scripts": { "build:framework": "vite build --mode framework", "build:shell": "vite build --mode shell", diff --git a/src/common/helper.ts b/src/common/helper.ts index 11a6222f..4f091c6c 100644 --- a/src/common/helper.ts +++ b/src/common/helper.ts @@ -188,14 +188,20 @@ export function getDefaultQQVersionConfigInfo(): QQVersionConfigType { }; } -export function getQQPackageInfoPath(exePath: string = '', version: string): string { +export function getQQPackageInfoPath(exePath: string = '', version?: string): string { + let packagePath; if (os.platform() === 'darwin') { - return path.join(path.dirname(exePath), '..', 'Resources', 'app', 'package.json'); + packagePath = path.join(path.dirname(exePath), '..', 'Resources', 'app', 'package.json'); } else if (os.platform() === 'linux') { - return path.join(path.dirname(exePath), './resources/app/package.json'); + packagePath = path.join(path.dirname(exePath), './resources/app/package.json'); } else { - return path.join(path.dirname(exePath), './versions/' + version + '/resources/app/package.json'); + packagePath = path.join(path.dirname(exePath), './versions/' + version + '/resources/app/package.json'); } + //下面是老版本兼容 未来去掉 + if (!fs.existsSync(packagePath)) { + packagePath = path.join(path.dirname(exePath), './resources/app/versions/' + version + '/package.json'); + } + return packagePath; } export function getQQVersionConfigPath(exePath: string = ''): string | undefined { @@ -214,6 +220,10 @@ export function getQQVersionConfigPath(exePath: string = ''): string | undefined if (typeof configVersionInfoPath !== 'string') { return undefined; } + //老版本兼容 未来去掉 + if (!fs.existsSync(configVersionInfoPath)) { + configVersionInfoPath = path.join(path.dirname(exePath), './resources/app/versions/config.json'); + } if (!fs.existsSync(configVersionInfoPath)) { return undefined; } diff --git a/src/common/qq-basic-info.ts b/src/common/qq-basic-info.ts index 4209e974..4415f06b 100644 --- a/src/common/qq-basic-info.ts +++ b/src/common/qq-basic-info.ts @@ -28,7 +28,7 @@ export class QQBasicInfoWrapper { ? JSON.parse(fs.readFileSync(this.QQVersionConfigPath!).toString()) : getDefaultQQVersionConfigInfo(); - this.QQPackageInfoPath = getQQPackageInfoPath(this.QQMainPath, this.QQVersionConfig?.curVersion!); + this.QQPackageInfoPath = getQQPackageInfoPath(this.QQMainPath, this.QQVersionConfig?.curVersion); this.QQPackageInfo = JSON.parse(fs.readFileSync(this.QQPackageInfoPath).toString()); const { appid: IQQVersionAppid, qua: IQQVersionQua } = this.getAppidV2(); this.QQVersionAppid = IQQVersionAppid; diff --git a/src/common/version.ts b/src/common/version.ts index 925373fc..d22e0368 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '2.6.1'; +export const napCatVersion = '2.6.2'; diff --git a/src/core/index.ts b/src/core/index.ts index 0a44c32e..e8688dfa 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -54,6 +54,10 @@ export function loadQQWrapper(QQVersion: string): WrapperNodeApi { if (!fs.existsSync(wrapperNodePath)) { wrapperNodePath = path.join(appPath, `./resources/app/wrapper.node`); } + //老版本兼容 未来去掉 + if (!fs.existsSync(wrapperNodePath)) { + wrapperNodePath = path.join(path.dirname(process.execPath), `./resources/app/versions/${QQVersion}/wrapper.node`); + } const nativemodule: any = { exports: {} }; process.dlopen(nativemodule, wrapperNodePath); return nativemodule.exports; diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index 8896e0f6..7e55588b 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) { SettingItem( 'Napcat', undefined, - SettingButton('V2.6.1', 'napcat-update-button', 'secondary'), + SettingButton('V2.6.2', 'napcat-update-button', 'secondary'), ), ]), SettingList([ diff --git a/static/assets/renderer.js b/static/assets/renderer.js index b41bdb60..d821f76f 100644 --- a/static/assets/renderer.js +++ b/static/assets/renderer.js @@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) { SettingItem( 'Napcat', void 0, - SettingButton("V2.6.1", "napcat-update-button", "secondary") + SettingButton("V2.6.2", "napcat-update-button", "secondary") ) ]), SettingList([ diff --git a/vite.config.ts b/vite.config.ts index fde083d8..f5a4a17e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,3 @@ -// import PreprocessorDirectives from 'unplugin-preprocessor-directives/vite'; import cp from 'vite-plugin-cp'; import { defineConfig, PluginOption, UserConfig } from 'vite'; import { resolve } from 'path'; @@ -35,25 +34,18 @@ const FrameworkBaseConfigPlugin: PluginOption[] = [ { src: './src/framework/renderer.js', dest: 'dist' }, { src: './package.json', dest: 'dist' }, { src: './logo.png', dest: 'dist' }, - //...external.map(genCpModule) ], }), nodeResolve(), ]; const ShellBaseConfigPlugin: PluginOption[] = [ - // PreprocessorDirectives(), cp({ targets: [ - // ...external.map(genCpModule), - // { src: './src/napcat.json', dest: 'dist/config/' }, { src: './static/', dest: 'dist/static/', flatten: false }, - // { src: './src/onebot11/onebot11.json', dest: 'dist/config/' }, { src: './src/core/external/napcat.json', dest: 'dist/config/' }, { src: './src/onebot/config/onebot11.json', dest: 'dist/config/' }, { src: './package.json', dest: 'dist' }, { src: './launcher/', dest: 'dist', flatten: true }, - // { src: './README.md', dest: 'dist' }, - // { src: './logo.png', dest: 'dist/logs' }, ...(startScripts.map((startScript) => { return { src: startScript, dest: 'dist' }; })),