Compare commits

...

4 Commits

Author SHA1 Message Date
phelogges
05f8e8f3c3 fix: 修复了Unix终端打开失败的bug (#1355)
Bug复现:
mlikiowa/napcat-docker:v4.9.23,登陆账号后,在WebUI中打开系统终端失败,查看容器日志报错如下
Failed to create terminal: TypeError: Cannot read properties of undefined (reading 'fork')
    at new UnixTerminal (file:///app/napcat/napcat.mjs:67721:22)
    at spawn (file:///app/napcat/napcat.mjs:67873:10)
    at TerminalManager.createTerminal (file:///app/napcat/napcat.mjs:67963:17)
    at CreateTerminalHandler (file:///app/napcat/napcat.mjs:68069:36)
    at Layer.handleRequest (/app/napcat/node_modules/router/lib/layer.js:152:17)
    at next (/app/napcat/node_modules/router/lib/route.js:157:13)
    at Route.dispatch (/app/napcat/node_modules/router/lib/route.js:117:3)
    at handle (/app/napcat/node_modules/router/index.js:435:11)
    at Layer.handleRequest (/app/napcat/node_modules/router/lib/layer.js:152:17)
    at /app/napcat/node_modules/router/index.js:295:15

定位到源码https://github.com/NapNeko/NapCatQQ/blob/main/src/pty/prebuild-loader.ts#L5
注意到源码中的pty.node路径与容器中实际不符,修改为正确的路径

验证测试:
笔者没有重新构建,而是保持代码逻辑,反过来将pty.node的路径复制到代码中要求的位置,测试发现bug修复

Extra:
注意到native模块中不止有pty模块,还有ffmpeg等其他模块,笔者没有继续看其他模块的加载情况了,如有必要可能需要确认一并load路径
2025-11-04 17:51:46 +08:00
Mlikiowa
e760876470 release: v4.9.23 2025-11-03 15:18:57 +00:00
手瓜一十雪
e0ec4d4ebb Refactor busiId type and comparisons in group API
Changed the type of jsonGrayTipElement.busiId to always be a string in element types. Updated related group API logic to compare busiId as a string directly, improving type consistency and reducing unnecessary conversions.
2025-11-03 23:18:34 +08:00
Mlikiowa
79fa0ade0d release: v4.9.22 2025-11-03 15:13:03 +00:00
6 changed files with 8 additions and 8 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ", "name": "NapCatQQ",
"slug": "NapCat.Framework", "slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现", "description": "高性能的 OneBot 11 协议实现",
"version": "4.9.21", "version": "4.9.23",
"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": "4.9.21", "version": "4.9.23",
"scripts": { "scripts": {
"build:universal": "npm run build:webui && npm run dev:universal || exit 1", "build:universal": "npm run build:webui && npm run dev:universal || exit 1",
"build:framework": "npm run build:webui && npm run dev:framework || exit 1", "build:framework": "npm run build:webui && npm run dev:framework || exit 1",

View File

@@ -1 +1 @@
export const napCatVersion = '4.9.21'; export const napCatVersion = '4.9.23';

View File

@@ -88,7 +88,7 @@ export interface GrayTipElement {
templId: string; templId: string;
}; };
jsonGrayTipElement: { jsonGrayTipElement: {
busiId?: number | string; busiId: string;
jsonStr: string; jsonStr: string;
recentAbstract?: string; recentAbstract?: string;
isServer?: boolean; isServer?: boolean;

View File

@@ -351,11 +351,11 @@ export class OneBotGroupApi {
} }
} else if (grayTipElement.subElementType === NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) { } else if (grayTipElement.subElementType === NTGrayTipElementSubTypeV2.GRAYTIP_ELEMENT_SUBTYPE_JSON) {
// 解析json事件 busiId好像是string类型的 // 解析json事件 busiId好像是string类型的
if (grayTipElement.jsonGrayTipElement.busiId?.toString() === '1061') { if (grayTipElement.jsonGrayTipElement.busiId === '1061') {
return await this.parsePaiYiPai(msg, grayTipElement.jsonGrayTipElement.jsonStr); return await this.parsePaiYiPai(msg, grayTipElement.jsonGrayTipElement.jsonStr);
} else if (grayTipElement.jsonGrayTipElement.busiId === JsonGrayBusiId.AIO_GROUP_ESSENCE_MSG_TIP) { } else if (grayTipElement.jsonGrayTipElement.busiId === JsonGrayBusiId.AIO_GROUP_ESSENCE_MSG_TIP.toString()) {
return await this.parseEssenceMsg(msg, grayTipElement.jsonGrayTipElement.jsonStr); return await this.parseEssenceMsg(msg, grayTipElement.jsonGrayTipElement.jsonStr);
} else if ((grayTipElement.jsonGrayTipElement.busiId ?? 0).toString() === '51') { } else if (grayTipElement.jsonGrayTipElement.busiId === '51') {
// 51是什么{"align":"center","items":[{"txt":"下一秒起床通过王者荣耀加入群","type":"nor"}] // 51是什么{"align":"center","items":[{"txt":"下一秒起床通过王者荣耀加入群","type":"nor"}]
return await this.parse51TypeEvent(msg, grayTipElement); return await this.parse51TypeEvent(msg, grayTipElement);
} else { } else {

View File

@@ -2,7 +2,7 @@ import { require_dlopen } from '.';
export function pty_loader () { export function pty_loader () {
let pty: any; let pty: any;
try { try {
pty = require_dlopen('./pty/' + process.platform + '.' + process.arch + '/pty.node'); pty = require_dlopen('./native/pty/' + process.platform + '.' + process.arch + '/pty.node');
} catch { } catch {
pty = undefined; pty = undefined;
} }