Skip to content

Commit

Permalink
release: 2.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Sep 17, 2024
1 parent d8b7726 commit e719ae0
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "2.6.1",
"version": "2.6.2",
"icon": "./logo.png",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 14 additions & 4 deletions src/common/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/qq-basic-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/common/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const napCatVersion = '2.6.1';
export const napCatVersion = '2.6.2';
4 changes: 4 additions & 0 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/webui/ui/NapCat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
undefined,
SettingButton('V2.6.1', 'napcat-update-button', 'secondary'),
SettingButton('V2.6.2', 'napcat-update-button', 'secondary'),
),
]),
SettingList([
Expand Down
2 changes: 1 addition & 1 deletion static/assets/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
void 0,
SettingButton("V2.6.1", "napcat-update-button", "secondary")
SettingButton("V2.6.2", "napcat-update-button", "secondary")
)
]),
SettingList([
Expand Down
8 changes: 0 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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' };
})),
Expand Down

0 comments on commit e719ae0

Please sign in to comment.