feat: 支持新版本
This commit is contained in:
1 parent
b2b7ed87c6
commit
162c6db1ac
5 files changed
+49
-10
No files matched your search
+8
@@ -778,5 +778,13 @@
|
|||||||
"9.9.36-53644": {
|
"9.9.36-53644": {
|
||||||
"appid": 537391628,
|
"appid": 537391628,
|
||||||
"qua": "V1_WIN_NQ_9.9.36_53644_GW_B"
|
"qua": "V1_WIN_NQ_9.9.36_53644_GW_B"
|
||||||
|
},
|
||||||
|
"9.9.37-54276": {
|
||||||
|
"appid": 537403570,
|
||||||
|
"qua": "V1_WIN_NQ_9.9.37_54276_GW_B"
|
||||||
|
},
|
||||||
|
"7.0.3-54276": {
|
||||||
|
"appid": 537403594,
|
||||||
|
"qua": "V1_MAC_NQ_7.0.3_54276_GW_B"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
@@ -482,5 +482,17 @@
|
|||||||
"7.0.2-53644-x64": {
|
"7.0.2-53644-x64": {
|
||||||
"send": "309B1BB",
|
"send": "309B1BB",
|
||||||
"recv": "C47262"
|
"recv": "C47262"
|
||||||
|
},
|
||||||
|
"9.9.37-54276-x64": {
|
||||||
|
"send": "C5927F",
|
||||||
|
"recv": "24CC2B5"
|
||||||
|
},
|
||||||
|
"7.0.3-54276-arm64": {
|
||||||
|
"send": "2BA91CC",
|
||||||
|
"recv": "B84728"
|
||||||
|
},
|
||||||
|
"7.0.3-54276-x64": {
|
||||||
|
"send": "30C611B",
|
||||||
|
"recv": "C5B84E"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
@@ -994,5 +994,17 @@
|
|||||||
"7.0.2-53644-x64": {
|
"7.0.2-53644-x64": {
|
||||||
"send": "54F11F0",
|
"send": "54F11F0",
|
||||||
"recv": "54F3DA8"
|
"recv": "54F3DA8"
|
||||||
|
},
|
||||||
|
"9.9.37-54276-x64": {
|
||||||
|
"send": "3870410",
|
||||||
|
"recv": "3873BD0"
|
||||||
|
},
|
||||||
|
"7.0.3-54276-arm64": {
|
||||||
|
"send": "4BF0068",
|
||||||
|
"recv": "4BF2B80"
|
||||||
|
},
|
||||||
|
"7.0.3-54276-x64": {
|
||||||
|
"send": "5547088",
|
||||||
|
"recv": "5549C40"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,14 +247,6 @@ async function startWorker (passQuickLogin: boolean = true, secretKey?: string,
|
|||||||
...(preferredPort ? { NAPCAT_WEBUI_PREFERRED_PORT: String(preferredPort) } : {}),
|
...(preferredPort ? { NAPCAT_WEBUI_PREFERRED_PORT: String(preferredPort) } : {}),
|
||||||
},
|
},
|
||||||
stdio: isElectron ? 'pipe' : ['inherit', 'pipe', 'pipe', 'ipc'],
|
stdio: isElectron ? 'pipe' : ['inherit', 'pipe', 'pipe', 'ipc'],
|
||||||
// --no-sandbox 是 Chromium 开关,仅当子进程完整引导 Electron(未设 ELECTRON_RUN_AS_NODE)时
|
|
||||||
// 才会被解析;纯 Node / Electron node 模式子进程会因 bad option 以退出码 9 拒绝启动
|
|
||||||
// (ELECTRON_RUN_AS_NODE 变量存在即触发 node 模式,与取值无关)
|
|
||||||
...(!isElectron &&
|
|
||||||
process.versions['electron'] &&
|
|
||||||
process.env['ELECTRON_RUN_AS_NODE'] === undefined
|
|
||||||
? { execArgv: ['--no-sandbox'] }
|
|
||||||
: {}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
currentWorker = child;
|
currentWorker = child;
|
||||||
|
|||||||
@@ -116,7 +116,19 @@ class NodeProcessManager implements IProcessManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createWorker (modulePath: string, args: string[], options: ProcessOptions): IWorkerProcess {
|
createWorker (modulePath: string, args: string[], options: ProcessOptions): IWorkerProcess {
|
||||||
const child = this.forkFn(modulePath, args, options as any);
|
let execArgv = options.execArgv;
|
||||||
|
if (execArgv === undefined && process.versions['electron']) {
|
||||||
|
// macOS QQ 的 Electron fork 会自动设置 ELECTRON_RUN_AS_NODE 并使用 QQ Helper,
|
||||||
|
// 即使父进程没有该变量,子进程也只接受 Node 参数。
|
||||||
|
const runsAsNode = process.platform === 'darwin' || options.env['ELECTRON_RUN_AS_NODE'] !== undefined;
|
||||||
|
execArgv = runsAsNode
|
||||||
|
? process.execArgv.filter(arg => arg !== '--no-sandbox')
|
||||||
|
: ['--no-sandbox'];
|
||||||
|
}
|
||||||
|
const child = this.forkFn(modulePath, args, {
|
||||||
|
...options,
|
||||||
|
...(execArgv !== undefined ? { execArgv } : {}),
|
||||||
|
} as any);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
get pid () { return child.pid; },
|
get pid () { return child.pid; },
|
||||||
@@ -169,7 +181,10 @@ export async function createProcessManager (): Promise<{
|
|||||||
manager: IProcessManager;
|
manager: IProcessManager;
|
||||||
isElectron: boolean;
|
isElectron: boolean;
|
||||||
}> {
|
}> {
|
||||||
const isElectron = process.env['NAPCAT_FORCE_NODE_PROCESS'] !== '1' && typeof process.versions['electron'] !== 'undefined';
|
// Electron 的 Node 模式仍保留 versions.electron,但没有 utilityProcess API。
|
||||||
|
const isElectron = process.env['NAPCAT_FORCE_NODE_PROCESS'] !== '1' &&
|
||||||
|
process.env['ELECTRON_RUN_AS_NODE'] === undefined &&
|
||||||
|
typeof process.versions['electron'] !== 'undefined';
|
||||||
|
|
||||||
if (isElectron) {
|
if (isElectron) {
|
||||||
// @ts-ignore - electron 运行时存在但类型声明可能缺失
|
// @ts-ignore - electron 运行时存在但类型声明可能缺失
|
||||||
|
|||||||
Reference in new issue
Block a user