release: 2.6.2

This commit is contained in:
手瓜一十雪 2024-09-17 13:01:02 +08:00
parent d8b7726440
commit e719ae0676
9 changed files with 24 additions and 18 deletions

View File

@ -4,7 +4,7 @@
"name": "NapCatQQ", "name": "NapCatQQ",
"slug": "NapCat.Framework", "slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现", "description": "高性能的 OneBot 11 协议实现",
"version": "2.6.1", "version": "2.6.2",
"icon": "./logo.png", "icon": "./logo.png",
"authors": [ "authors": [
{ {

View File

@ -2,7 +2,7 @@
"name": "napcat", "name": "napcat",
"private": true, "private": true,
"type": "module", "type": "module",
"version": "2.6.1", "version": "2.6.2",
"scripts": { "scripts": {
"build:framework": "vite build --mode framework", "build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell", "build:shell": "vite build --mode shell",

View File

@ -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') { 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') { } 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 { } 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 { export function getQQVersionConfigPath(exePath: string = ''): string | undefined {
@ -214,6 +220,10 @@ export function getQQVersionConfigPath(exePath: string = ''): string | undefined
if (typeof configVersionInfoPath !== 'string') { if (typeof configVersionInfoPath !== 'string') {
return undefined; return undefined;
} }
//老版本兼容 未来去掉
if (!fs.existsSync(configVersionInfoPath)) {
configVersionInfoPath = path.join(path.dirname(exePath), './resources/app/versions/config.json');
}
if (!fs.existsSync(configVersionInfoPath)) { if (!fs.existsSync(configVersionInfoPath)) {
return undefined; return undefined;
} }

View File

@ -28,7 +28,7 @@ export class QQBasicInfoWrapper {
? JSON.parse(fs.readFileSync(this.QQVersionConfigPath!).toString()) ? JSON.parse(fs.readFileSync(this.QQVersionConfigPath!).toString())
: getDefaultQQVersionConfigInfo(); : 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()); this.QQPackageInfo = JSON.parse(fs.readFileSync(this.QQPackageInfoPath).toString());
const { appid: IQQVersionAppid, qua: IQQVersionQua } = this.getAppidV2(); const { appid: IQQVersionAppid, qua: IQQVersionQua } = this.getAppidV2();
this.QQVersionAppid = IQQVersionAppid; this.QQVersionAppid = IQQVersionAppid;

View File

@ -1 +1 @@
export const napCatVersion = '2.6.1'; export const napCatVersion = '2.6.2';

View File

@ -54,6 +54,10 @@ export function loadQQWrapper(QQVersion: string): WrapperNodeApi {
if (!fs.existsSync(wrapperNodePath)) { if (!fs.existsSync(wrapperNodePath)) {
wrapperNodePath = path.join(appPath, `./resources/app/wrapper.node`); 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: {} }; const nativemodule: any = { exports: {} };
process.dlopen(nativemodule, wrapperNodePath); process.dlopen(nativemodule, wrapperNodePath);
return nativemodule.exports; return nativemodule.exports;

View File

@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem( SettingItem(
'<span id="napcat-update-title">Napcat</span>', '<span id="napcat-update-title">Napcat</span>',
undefined, undefined,
SettingButton('V2.6.1', 'napcat-update-button', 'secondary'), SettingButton('V2.6.2', 'napcat-update-button', 'secondary'),
), ),
]), ]),
SettingList([ SettingList([

View File

@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem( SettingItem(
'<span id="napcat-update-title">Napcat</span>', '<span id="napcat-update-title">Napcat</span>',
void 0, void 0,
SettingButton("V2.6.1", "napcat-update-button", "secondary") SettingButton("V2.6.2", "napcat-update-button", "secondary")
) )
]), ]),
SettingList([ SettingList([

View File

@ -1,4 +1,3 @@
// import PreprocessorDirectives from 'unplugin-preprocessor-directives/vite';
import cp from 'vite-plugin-cp'; import cp from 'vite-plugin-cp';
import { defineConfig, PluginOption, UserConfig } from 'vite'; import { defineConfig, PluginOption, UserConfig } from 'vite';
import { resolve } from 'path'; import { resolve } from 'path';
@ -35,25 +34,18 @@ const FrameworkBaseConfigPlugin: PluginOption[] = [
{ src: './src/framework/renderer.js', dest: 'dist' }, { src: './src/framework/renderer.js', dest: 'dist' },
{ src: './package.json', dest: 'dist' }, { src: './package.json', dest: 'dist' },
{ src: './logo.png', dest: 'dist' }, { src: './logo.png', dest: 'dist' },
//...external.map(genCpModule)
], ],
}), }),
nodeResolve(), nodeResolve(),
]; ];
const ShellBaseConfigPlugin: PluginOption[] = [ const ShellBaseConfigPlugin: PluginOption[] = [
// PreprocessorDirectives(),
cp({ cp({
targets: [ targets: [
// ...external.map(genCpModule),
// { src: './src/napcat.json', dest: 'dist/config/' },
{ src: './static/', dest: 'dist/static/', flatten: false }, { 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/core/external/napcat.json', dest: 'dist/config/' },
{ src: './src/onebot/config/onebot11.json', dest: 'dist/config/' }, { src: './src/onebot/config/onebot11.json', dest: 'dist/config/' },
{ src: './package.json', dest: 'dist' }, { src: './package.json', dest: 'dist' },
{ src: './launcher/', dest: 'dist', flatten: true }, { src: './launcher/', dest: 'dist', flatten: true },
// { src: './README.md', dest: 'dist' },
// { src: './logo.png', dest: 'dist/logs' },
...(startScripts.map((startScript) => { ...(startScripts.map((startScript) => {
return { src: startScript, dest: 'dist' }; return { src: startScript, dest: 'dist' };
})), })),