From ea9e88a18a99c4f41e7f15050fcf45e5b1d44ee3 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 15:31:50 +0800 Subject: [PATCH 01/10] =?UTF-8?q?fix:=20=E4=B8=8D=E5=8F=AF=E6=8A=97?= =?UTF-8?q?=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/log.ts | 12 +++++------- src/onebot/api/msg.ts | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/common/log.ts b/src/common/log.ts index 1154321a..99b989e3 100644 --- a/src/common/log.ts +++ b/src/common/log.ts @@ -139,9 +139,8 @@ export class LogWrapper { logMessage(msg: RawMessage, selfInfo: SelfInfo) { const isSelfSent = msg.senderUin === selfInfo.uin; - this.log(`${ - isSelfSent ? '发送 ->' : '接收 <-' - } ${rawMessageToText(msg)}`); + this.log(`${isSelfSent ? '发送 ->' : '接收 <-' + } ${rawMessageToText(msg)}`); } } @@ -180,13 +179,12 @@ export function rawMessageToText(msg: RawMessage, recursiveLevel = 0): string { const recordMsgOrNull = msg.records.find( record => element.replyElement!.sourceMsgIdInRecords === record.msgId, ); - return `[回复消息 ${ - recordMsgOrNull && - recordMsgOrNull.peerUin != '284840486' // 非转发消息; 否则定位不到 + return `[回复消息 ${recordMsgOrNull && + recordMsgOrNull.peerUin != '284840486' && recordMsgOrNull.peerUin != '1094950020'// 非转发消息; 否则定位不到 ? rawMessageToText(recordMsgOrNull, recursiveLevel + 1) : `未找到消息记录 (MsgId = ${element.replyElement.sourceMsgIdInRecords})` - }]`; + }]`; } if (element.picElement) { diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index e77e652b..73cffa13 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -212,7 +212,7 @@ export class OneBotMsgApi { }, }); - if (records.peerUin === '284840486') { + if (records.peerUin === '284840486' || records.peerUin === '1094950020') { return createReplyData(records.msgId); } const replyMsg = (await this.core.apis.MsgApi.queryMsgsWithFilterExWithSeqV2(peer, element.replayMsgSeq, element.replyMsgTime, [element.senderUidStr])) @@ -234,7 +234,7 @@ export class OneBotMsgApi { //读取视频链接并兜底 let videoUrlWrappers: Awaited> | undefined; - if (msg.peerUin === '284840486') { + if (msg.peerUin === '284840486' || msg.peerUin === '1094950020') { //TODO: 合并消息内部 应该进行特殊处理 可能需要重写peer 待测试与研究 Mlikiowa Tagged } try { From 7d709f44a8d48de28d53ec8c0b87a9eb9f2c0de6 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 15:37:07 +0800 Subject: [PATCH 02/10] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot/api/msg.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index 73cffa13..fbf95550 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -235,18 +235,28 @@ export class OneBotMsgApi { let videoUrlWrappers: Awaited> | undefined; if (msg.peerUin === '284840486' || msg.peerUin === '1094950020') { - //TODO: 合并消息内部 应该进行特殊处理 可能需要重写peer 待测试与研究 Mlikiowa Tagged - } - try { - videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({ - chatType: msg.chatType, - peerUid: msg.peerUid, - guildId: '0', - }, msg.msgId, elementWrapper.elementId); - } catch (error) { - this.core.context.logger.logWarn('获取视频 URL 失败'); + try { + videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({ + chatType: msg.chatType, + peerUid: msg.peerUid, + guildId: '0', + }, msg.parentMsgIdList[0] ?? msg.msgId, elementWrapper.elementId); + } catch (error) { + this.core.context.logger.logWarn('合并获取视频 URL 失败'); + } + } else { + try { + videoUrlWrappers = await this.core.apis.FileApi.getVideoUrl({ + chatType: msg.chatType, + peerUid: msg.peerUid, + guildId: '0', + }, msg.msgId, elementWrapper.elementId); + } catch (error) { + this.core.context.logger.logWarn('获取视频 URL 失败'); + } } + //读取在线URL let videoDownUrl: string | undefined; From 1c212ff2b49909795b435602c1ba0da944f22ad6 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 15:54:24 +0800 Subject: [PATCH 03/10] feat: new --- src/core/entities/msg.ts | 3 ++- src/core/services/NodeIKernelGroupService.ts | 7 ++++++- src/onebot/api/msg.ts | 12 +++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/core/entities/msg.ts b/src/core/entities/msg.ts index 7e21f807..20cb2685 100644 --- a/src/core/entities/msg.ts +++ b/src/core/entities/msg.ts @@ -659,7 +659,8 @@ export interface GrayTipElement { export enum FaceType { normal = 1, // 小黄脸 normal2 = 2, // 新小黄脸, 从faceIndex 222开始? - dice = 3 // 骰子 + dice = 3, // 骰子 + poke = 5 // 拍一拍 } export enum FaceIndex { diff --git a/src/core/services/NodeIKernelGroupService.ts b/src/core/services/NodeIKernelGroupService.ts index 284727e6..6dfb0fbf 100644 --- a/src/core/services/NodeIKernelGroupService.ts +++ b/src/core/services/NodeIKernelGroupService.ts @@ -240,7 +240,12 @@ export interface NodeIKernelGroupService { getGroupRecommendContactArkJson(groupCode: string): unknown; - getJoinGroupLink(groupCode: string): unknown; + getJoinGroupLink(param: { + groupCode: string, + srcId: number,//73 + needShortUrl: boolean,//true + additionalParam: string//'' + }): Promise; modifyGroupExtInfo(groupCode: string, arg: unknown): void; diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index fbf95550..90084664 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -457,7 +457,17 @@ export class OneBotMsgApi { }, }; }, - + // { + // elementId: '0', + // elementType: 6, + // faceElement: { + // faceIndex: 0, + // faceType: 5, + // msgType: 0, + // pokeType: 1, + // pokeStrength: 0 + // } + // } [OB11MessageDataType.mface]: async ({ data: { emoji_package_id, emoji_id, key, summary, From 90906b90192871b253e850948768456a9c8c002a 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 16:08:50 +0800 Subject: [PATCH 04/10] style: lint --- src/common/log.ts | 10 +++++----- src/core/index.ts | 18 +++++++++--------- src/onebot/api/friend.ts | 6 +++--- src/onebot/api/group.ts | 3 --- src/onebot/api/msg.ts | 41 ++++++++++++++-------------------------- src/shell/napcat.ts | 24 +++++++++++------------ 6 files changed, 43 insertions(+), 59 deletions(-) diff --git a/src/common/log.ts b/src/common/log.ts index 99b989e3..0fdcbcd2 100644 --- a/src/common/log.ts +++ b/src/common/log.ts @@ -140,7 +140,7 @@ export class LogWrapper { logMessage(msg: RawMessage, selfInfo: SelfInfo) { const isSelfSent = msg.senderUin === selfInfo.uin; this.log(`${isSelfSent ? '发送 ->' : '接收 <-' - } ${rawMessageToText(msg)}`); + } ${rawMessageToText(msg)}`); } } @@ -181,10 +181,10 @@ export function rawMessageToText(msg: RawMessage, recursiveLevel = 0): string { ); return `[回复消息 ${recordMsgOrNull && recordMsgOrNull.peerUin != '284840486' && recordMsgOrNull.peerUin != '1094950020'// 非转发消息; 否则定位不到 - ? - rawMessageToText(recordMsgOrNull, recursiveLevel + 1) : - `未找到消息记录 (MsgId = ${element.replyElement.sourceMsgIdInRecords})` - }]`; + ? + rawMessageToText(recordMsgOrNull, recursiveLevel + 1) : + `未找到消息记录 (MsgId = ${element.replyElement.sourceMsgIdInRecords})` + }]`; } if (element.picElement) { diff --git a/src/core/index.ts b/src/core/index.ts index 5a5f89f5..20dcad9e 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -260,15 +260,15 @@ export async function genSessionConfig( //os.platform() let systemPlatform = PlatformType.KWINDOWS; switch (os.platform()) { - case 'win32': - systemPlatform = PlatformType.KWINDOWS; - break; - case 'darwin': - systemPlatform = PlatformType.KMAC; - break; - case 'linux': - systemPlatform = PlatformType.KLINUX; - break; + case 'win32': + systemPlatform = PlatformType.KWINDOWS; + break; + case 'darwin': + systemPlatform = PlatformType.KMAC; + break; + case 'linux': + systemPlatform = PlatformType.KLINUX; + break; } return { selfUin, diff --git a/src/onebot/api/friend.ts b/src/onebot/api/friend.ts index d87ba1c3..329e59b1 100644 --- a/src/onebot/api/friend.ts +++ b/src/onebot/api/friend.ts @@ -15,14 +15,14 @@ export class OneBotFriendApi { //使用前预先判断 busiId 1061 async parsePrivatePokeEvent(grayTipElement: GrayTipElement) { const json = JSON.parse(grayTipElement.jsonGrayTipElement.jsonStr); - let pokedetail: any[] = json.items; + let pokedetail: Array<{ uid: string }> = json.items; //筛选item带有uid的元素 pokedetail = pokedetail.filter(item => item.uid); if (pokedetail.length == 2) { return new OB11FriendPokeEvent( this.core, - parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[0].uid))!), - parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[1].uid))!), + parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[0].uid))), + parseInt((await this.core.apis.UserApi.getUinByUidV2(pokedetail[1].uid))), pokedetail, ); } diff --git a/src/onebot/api/group.ts b/src/onebot/api/group.ts index 5a5ad8a1..19c7a800 100644 --- a/src/onebot/api/group.ts +++ b/src/onebot/api/group.ts @@ -96,7 +96,6 @@ export class OneBotGroupApi { if (GroupIncreaseEvent) return GroupIncreaseEvent; } - //代码歧义 GrayTipElementSubType.MEMBER_NEW_TITLE else if (element.grayTipElement.subElementType == NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) { const json = JSON.parse(element.grayTipElement.jsonGrayTipElement.jsonStr); if (element.grayTipElement.jsonGrayTipElement.busiId == 1061) { @@ -139,7 +138,6 @@ export class OneBotGroupApi { // 获取MsgSeq+Peer可获取具体消息 } if (element.grayTipElement.jsonGrayTipElement.busiId == 2407) { - //下面得改 上面也是错的grayTipElement.subElementType == GrayTipElementSubType.MEMBER_NEW_TITLE const type = json.items[json.items.length - 1]?.txt; switch (type) { case "头衔": { @@ -207,7 +205,6 @@ export class OneBotGroupApi { while ((match = regex.exec(xmlElement.content)) !== null) { matches.push(match[1]); } - // log("新人进群匹配到的QQ号", matches) if (matches.length === 2) { const [inviter, invitee] = matches; return new OB11GroupIncreaseEvent( diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index 90084664..630ae294 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -457,17 +457,6 @@ export class OneBotMsgApi { }, }; }, - // { - // elementId: '0', - // elementType: 6, - // faceElement: { - // faceIndex: 0, - // faceType: 5, - // msgType: 0, - // pokeType: 1, - // pokeStrength: 0 - // } - // } [OB11MessageDataType.mface]: async ({ data: { emoji_package_id, emoji_id, key, summary, @@ -530,13 +519,12 @@ export class OneBotMsgApi { faceElement: { faceIndex: FaceIndex.dice, faceType: FaceType.dice, - 'faceText': '[骰子]', - 'packId': '1', - 'stickerId': '33', - 'sourceType': 1, - 'stickerType': 2, - // resultId: resultId.toString(), - 'surpriseId': '', + faceText: '[骰子]', + packId: '1', + stickerId: '33', + sourceType: 1, + stickerType: 2, + surpriseId: '', // "randomType": 1, }, }), @@ -545,15 +533,14 @@ export class OneBotMsgApi { elementType: ElementType.FACE, elementId: '', faceElement: { - 'faceIndex': FaceIndex.RPS, - 'faceText': '[包剪锤]', - 'faceType': 3, - 'packId': '1', - 'stickerId': '34', - 'sourceType': 1, - 'stickerType': 2, - // 'resultId': resultId.toString(), - 'surpriseId': '', + faceIndex: FaceIndex.RPS, + faceText: '[包剪锤]', + faceType: 3, + packId: '1', + stickerId: '34', + sourceType: 1, + stickerType: 2, + surpriseId: '', // "randomType": 1, }, }), diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index 36f82c06..d48c725c 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -72,15 +72,15 @@ export async function NCoreInitShell() { })(); let systemPlatform = PlatformType.KWINDOWS; switch (os.platform()) { - case 'win32': - systemPlatform = PlatformType.KWINDOWS; - break; - case 'darwin': - systemPlatform = PlatformType.KMAC; - break; - case 'linux': - systemPlatform = PlatformType.KLINUX; - break; + case 'win32': + systemPlatform = PlatformType.KWINDOWS; + break; + case 'darwin': + systemPlatform = PlatformType.KMAC; + break; + case 'linux': + systemPlatform = PlatformType.KLINUX; + break; } if (!basicInfoWrapper.QQVersionAppid || !basicInfoWrapper.QQVersionQua) throw new Error('QQVersionAppid or QQVersionQua is not defined'); // from initConfig @@ -119,7 +119,7 @@ export async function NCoreInitShell() { quickLoginUin = ''; } } - let dataTimestape = new Date().getTime().toString(); + const dataTimestape = new Date().getTime().toString(); o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']); const selfInfo = await new Promise((resolve) => { const loginListener = new NodeIKernelLoginListener(); @@ -234,13 +234,13 @@ export async function NCoreInitShell() { logger.log(`可用于快速登录的 QQ:\n${historyLoginList .map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`) .join('\n') - }`); + }`); } loginService.getQRCodePicture(); } }); // BEFORE LOGGING IN - let amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129'; + const amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129'; o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex'))); // AFTER LOGGING IN //99b15bdb4c984fc69d5aa1feb9aa16xx --> 99b15bdb-4c98-4fc6-9d5a-a1feb9aa16xx From 34d4358bfc974ea1729e6508f6b4e8a773c19731 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 16:10:52 +0800 Subject: [PATCH 05/10] =?UTF-8?q?feat:=20=E4=BE=9D=E8=B5=96=E7=AE=80?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index 7b0fa9f7..6a535eca 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "typescript": "^5.3.3", "vite": "^5.2.6", "vite-plugin-cp": "^4.0.8", - "vite-plugin-dts": "^3.8.2", "vite-tsconfig-paths": "^4.3.2" }, "dependencies": { @@ -49,7 +48,6 @@ "protobufjs": "~7.4.0", "qrcode-terminal": "^0.12.0", "silk-wasm": "^3.6.1", - "strtok3": "8.0.1", "ws": "^8.18.0" } } \ No newline at end of file From 199690f45fee557c389a149c680d31365d02c107 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 08:20:36 +0000 Subject: [PATCH 06/10] chore(deps-dev): bump @types/express from 4.17.21 to 5.0.0 Bumps [@types/express](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express) from 4.17.21 to 5.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express) --- updated-dependencies: - dependency-name: "@types/express" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b0fa9f7..36d39487 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-typescript": "^11.1.6", "@types/cors": "^2.8.17", - "@types/express": "^4.17.21", + "@types/express": "^5.0.0", "@types/fluent-ffmpeg": "^2.1.24", "@types/node": "^22.0.1", "@types/qrcode-terminal": "^0.12.2", From 652fe8d21e2e5d102fc245c0166158a466bb6061 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 16:22:21 +0800 Subject: [PATCH 07/10] =?UTF-8?q?feat:=20FrameWork=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/path.ts | 3 ++- src/framework/napcat.ts | 9 ++++++++- src/framework/preload.cjs | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/common/path.ts b/src/common/path.ts index b204cb20..28f747c1 100644 --- a/src/common/path.ts +++ b/src/common/path.ts @@ -21,7 +21,8 @@ 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(this.binaryPath, 'static'); + //这个必然和本体一起 + this.staticPath = path.join(dirname(fileURLToPath(import.meta.url)), '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 cc1c3f23..8576876a 100644 --- a/src/framework/napcat.ts +++ b/src/framework/napcat.ts @@ -23,7 +23,14 @@ export async function NCoreInitFramework( ) { //在进入本层前是否登录未进行判断 console.log('NapCat Framework App Loading...'); - const pathWrapper = new NapCatPathWrapper(); + let dataPath: string | undefined; + try { + dataPath = (global as any).LiteLoader.plugins['NapCatQQ'].path.data; + } catch (error) { + dataPath = undefined; + } + + const pathWrapper = new NapCatPathWrapper(dataPath); 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 eef7e759..dd6dfab5 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); From 1a543928b10428a15aad817adffe12bd5658d428 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 16:33:04 +0800 Subject: [PATCH 08/10] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/napcat.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/framework/napcat.ts b/src/framework/napcat.ts index 8576876a..4cfbbdb1 100644 --- a/src/framework/napcat.ts +++ b/src/framework/napcat.ts @@ -9,6 +9,7 @@ import { NodeIKernelLoginService } from '@/core/services'; import { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper'; import { InitWebUi, WebUiConfig } from '@/webui'; import { NapCatOneBot11Adapter } from '@/onebot'; +import { mkdir, mkdirSync } from 'fs'; //Framework ES入口文件 export async function getWebUiUrl() { @@ -26,8 +27,12 @@ export async function NCoreInitFramework( let dataPath: string | undefined; try { dataPath = (global as any).LiteLoader.plugins['NapCatQQ'].path.data; + if (dataPath) { + mkdirSync(dataPath, { recursive: true }); + } } catch (error) { dataPath = undefined; + } const pathWrapper = new NapCatPathWrapper(dataPath); From dc92ace85ef06f154d1b12d9350453d17c555472 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:13 +0800 Subject: [PATCH 09/10] =?UTF-8?q?Revert=20"feat:=20=E8=B0=83=E6=95=B4"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1a543928b10428a15aad817adffe12bd5658d428. --- src/framework/napcat.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/framework/napcat.ts b/src/framework/napcat.ts index 4cfbbdb1..8576876a 100644 --- a/src/framework/napcat.ts +++ b/src/framework/napcat.ts @@ -9,7 +9,6 @@ import { NodeIKernelLoginService } from '@/core/services'; import { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper'; import { InitWebUi, WebUiConfig } from '@/webui'; import { NapCatOneBot11Adapter } from '@/onebot'; -import { mkdir, mkdirSync } from 'fs'; //Framework ES入口文件 export async function getWebUiUrl() { @@ -27,12 +26,8 @@ export async function NCoreInitFramework( let dataPath: string | undefined; try { dataPath = (global as any).LiteLoader.plugins['NapCatQQ'].path.data; - if (dataPath) { - mkdirSync(dataPath, { recursive: true }); - } } catch (error) { dataPath = undefined; - } const pathWrapper = new NapCatPathWrapper(dataPath); 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 10/10] =?UTF-8?q?Revert=20"feat:=20FrameWork=E8=B0=83?= =?UTF-8?q?=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);