From 50e84c3c9e268e9336847770780d03bcf3a4d18a 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: Thu, 26 Sep 2024 17:01:18 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20FrameWork=E8=B0=83=E6=95=B4"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 652fe8d21e2e5d102fc245c0166158a466bb6061. --- src/common/path.ts | 3 +-- src/framework/napcat.ts | 9 +-------- src/framework/preload.cjs | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/common/path.ts b/src/common/path.ts index 28f747c1..b204cb20 100644 --- a/src/common/path.ts +++ b/src/common/path.ts @@ -21,8 +21,7 @@ export class NapCatPathWrapper { this.logsPath = path.join(writePath, 'logs'); this.configPath = path.join(writePath, 'config'); this.cachePath = path.join(writePath, 'cache'); - //这个必然和本体一起 - this.staticPath = path.join(dirname(fileURLToPath(import.meta.url)), 'static'); + this.staticPath = path.join(this.binaryPath, 'static'); if (!fs.existsSync(this.logsPath)) { fs.mkdirSync(this.logsPath, { recursive: true }); } diff --git a/src/framework/napcat.ts b/src/framework/napcat.ts index 8576876a..cc1c3f23 100644 --- a/src/framework/napcat.ts +++ b/src/framework/napcat.ts @@ -23,14 +23,7 @@ export async function NCoreInitFramework( ) { //在进入本层前是否登录未进行判断 console.log('NapCat Framework App Loading...'); - let dataPath: string | undefined; - try { - dataPath = (global as any).LiteLoader.plugins['NapCatQQ'].path.data; - } catch (error) { - dataPath = undefined; - } - - const pathWrapper = new NapCatPathWrapper(dataPath); + const pathWrapper = new NapCatPathWrapper(); const logger = new LogWrapper(pathWrapper.logsPath); const basicInfoWrapper = new QQBasicInfoWrapper({ logger }); const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion()); diff --git a/src/framework/preload.cjs b/src/framework/preload.cjs index dd6dfab5..eef7e759 100644 --- a/src/framework/preload.cjs +++ b/src/framework/preload.cjs @@ -4,7 +4,7 @@ const { ipcRenderer } = require('electron'); const napcat = { getWebUiUrl: async () => { return ipcRenderer.invoke('napcat_get_webtoken'); - } + }, }; // 在window对象下导出只读对象 contextBridge.exposeInMainWorld('napcat', napcat);