diff --git a/launcher/NapCatWinBootHook.dll b/launcher/NapCatWinBootHook.dll index cd6ff346..0ad9943f 100644 Binary files a/launcher/NapCatWinBootHook.dll and b/launcher/NapCatWinBootHook.dll differ diff --git a/launcher/NapCatWinBootMain.exe b/launcher/NapCatWinBootMain.exe index 9cd3132b..5d054fbd 100644 Binary files a/launcher/NapCatWinBootMain.exe and b/launcher/NapCatWinBootMain.exe differ diff --git a/launcher/launcher-win10.bat b/launcher/launcher-win10.bat index c70be0a2..9ed9b106 100644 --- a/launcher/launcher-win10.bat +++ b/launcher/launcher-win10.bat @@ -9,7 +9,7 @@ if %errorLevel% == 0 ( exit ) -set NAPCAT_PATCH_PATH=%cd%\patchNapCat.js +set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe diff --git a/launcher/launcher.bat b/launcher/launcher.bat index 370bd1b1..c92f57b4 100644 --- a/launcher/launcher.bat +++ b/launcher/launcher.bat @@ -9,7 +9,7 @@ if %errorLevel% == 0 ( exit ) -set NAPCAT_PATCH_PATH=%cd%\patchNapCat.js +set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe diff --git a/launcher/patchNapCat.js b/launcher/patchNapCat.js deleted file mode 100644 index 83a04e1f..00000000 --- a/launcher/patchNapCat.js +++ /dev/null @@ -1 +0,0 @@ -require('./launcher.node').load('external_index', module); \ No newline at end of file diff --git a/launcher/qqnt.json b/launcher/qqnt.json new file mode 100644 index 00000000..9d3ef880 --- /dev/null +++ b/launcher/qqnt.json @@ -0,0 +1,23 @@ +{ + "name": "qq-chat", + "version": "9.9.15-28060", + "type": "module", + "private": true, + "description": "QQ", + "productName": "QQ", + "author": { + "name": "Tencent", + "email": "QQ-Team@tencent.com" + }, + "homepage": "https://im.qq.com", + "sideEffects": true, + "bin": { + "qd": "externals/devtools/cli/index.js" + }, + "main": "./loadNapCat.js", + "buildVersion": "28060", + "isPureShell": true, + "isByteCodeShell": true, + "platform": "win32", + "eleArch": "x64" +} \ No newline at end of file diff --git a/src/common/helper.ts b/src/common/helper.ts index 637fa803..11a6222f 100644 --- a/src/common/helper.ts +++ b/src/common/helper.ts @@ -163,8 +163,8 @@ export function isEqual(obj1: any, obj2: any) { export function getDefaultQQVersionConfigInfo(): QQVersionConfigType { if (os.platform() === 'linux') { return { - baseVersion: '3.2.12.27254', - curVersion: '3.2.12.27254', + baseVersion: '3.2.12.28060', + curVersion: '3.2.12.28060', prevVersion: '', onErrorVersions: [], buildId: '27254', @@ -172,34 +172,36 @@ export function getDefaultQQVersionConfigInfo(): QQVersionConfigType { } if (os.platform() === 'darwin') { return { - baseVersion: '6.9.53.27597', - curVersion: '6.9.53.27597', + baseVersion: '6.9.53.28060', + curVersion: '6.9.53.28060', prevVersion: '', onErrorVersions: [], - buildId: '27597', + buildId: '28060', }; } return { - baseVersion: '9.9.15-27597', - curVersion: '9.9.15-27597', + baseVersion: '9.9.15-28060', + curVersion: '9.9.15-28060', prevVersion: '', onErrorVersions: [], - buildId: '27597', + buildId: '28060', }; } -export function getQQPackageInfoPath(exePath: string = ''): string { +export function getQQPackageInfoPath(exePath: string = '', version: string): string { if (os.platform() === 'darwin') { return path.join(path.dirname(exePath), '..', 'Resources', 'app', 'package.json'); + } else if (os.platform() === 'linux') { + return path.join(path.dirname(exePath), './resources/app/package.json'); } else { - return path.join(path.dirname(exePath), 'resources', 'app', 'package.json'); + return path.join(path.dirname(exePath), './versions/' + version + '/resources/app/package.json'); } } export function getQQVersionConfigPath(exePath: string = ''): string | undefined { let configVersionInfoPath; if (os.platform() === 'win32') { - configVersionInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'versions', 'config.json'); + configVersionInfoPath = path.join(path.dirname(exePath), 'versions', 'config.json'); } else if (os.platform() === 'darwin') { const userPath = os.homedir(); const appDataPath = path.resolve(userPath, './Library/Application Support/QQ'); diff --git a/src/common/qq-basic-info.ts b/src/common/qq-basic-info.ts index 9d6aa50a..4209e974 100644 --- a/src/common/qq-basic-info.ts +++ b/src/common/qq-basic-info.ts @@ -19,14 +19,16 @@ export class QQBasicInfoWrapper { //基础目录获取 this.context = context; this.QQMainPath = process.execPath; - this.QQPackageInfoPath = getQQPackageInfoPath(this.QQMainPath); this.QQVersionConfigPath = getQQVersionConfigPath(this.QQMainPath); + //基础信息获取 无快更则启用默认模板填充 this.isQuickUpdate = !!this.QQVersionConfigPath; this.QQVersionConfig = this.isQuickUpdate ? JSON.parse(fs.readFileSync(this.QQVersionConfigPath!).toString()) : getDefaultQQVersionConfigInfo(); + + 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; @@ -65,11 +67,11 @@ export class QQBasicInfoWrapper { getAppidInternal() { switch (systemPlatform) { case 'linux': - return '537240795'; + return '537246140'; case 'darwin': - return '537243538'; + return '537246140'; default: - return '537243441'; + return '537246092'; } } diff --git a/src/core/external/appid.json b/src/core/external/appid.json index cdc03108..0c5c764c 100644 --- a/src/core/external/appid.json +++ b/src/core/external/appid.json @@ -1,29 +1,10 @@ { - - "3.2.12-27254":{ - "appid": 537240795, - "qua": "V1_LNX_NQ_3.2.12_27254_GW_B" - }, - "9.9.15-27254":{ - "appid": 537240709, - "qua": "V1_WIN_NQ_9.9.15_27254_GW_B" - }, - - "3.2.12-27597": { - "appid": 537243600, - "qua": "V1_LNX_NQ_3.2.12_27597_GW_B" - }, - "9.9.15-27597": { - "appid": 537243441, - "qua": "V1_WIN_NQ_9.9.15_27597_GW_B" - }, - "6.9.53-27597": { - "appid": 537243538, - "qua": "V1_MAC_NQ_6.9.53_27597_GW_B" - }, - "9.9.15-28060":{ "appid": 537246092, "qua": "V1_WIN_NQ_9.9.15_28060_GW_B" + }, + "3.2.12-28060":{ + "appid": 537246140, + "qua": "V1_LNX_NQ_3.2.12_28060_GW_B" } } diff --git a/src/core/index.ts b/src/core/index.ts index cf6667b2..0a44c32e 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -45,12 +45,14 @@ export function loadQQWrapper(QQVersion: string): WrapperNodeApi { let appPath; if (os.platform() === 'darwin') { appPath = path.resolve(path.dirname(process.execPath), '../Resources/app'); - } else { + } else if (os.platform() === 'linux') { appPath = path.resolve(path.dirname(process.execPath), './resources/app'); + } else { + appPath = path.resolve(path.dirname(process.execPath), `./versions/${QQVersion}/`); } let wrapperNodePath = path.resolve(appPath, 'wrapper.node'); if (!fs.existsSync(wrapperNodePath)) { - wrapperNodePath = path.join(appPath, `versions/${QQVersion}/wrapper.node`); + wrapperNodePath = path.join(appPath, `./resources/app/wrapper.node`); } const nativemodule: any = { exports: {} }; process.dlopen(nativemodule, wrapperNodePath); diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index bef7f21b..6943110f 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -103,18 +103,21 @@ export async function NCoreInitShell() { const selfInfo = await new Promise((resolve) => { const loginListener = new NodeIKernelLoginListener(); - + let isLogined = false; // from constructor loginListener.onUserLoggedIn = (userid: string) => { logger.logError(`当前账号(${userid})已登录,无法重复登录`); }; - loginListener.onQRCodeLoginSucceed = async (loginResult) => resolve({ - uid: loginResult.uid, - uin: loginResult.uin, - nick: '', // 获取不到 - online: true, - }); + loginListener.onQRCodeLoginSucceed = async (loginResult) => { + isLogined = true; + resolve({ + uid: loginResult.uid, + uin: loginResult.uin, + nick: '', // 获取不到 + online: true, + }); + } loginListener.onQRCodeGetPicture = ({ pngBase64QrcodeData, qrcodeUrl }) => { //设置WebuiQrcode @@ -138,11 +141,13 @@ export async function NCoreInitShell() { }; loginListener.onQRCodeSessionFailed = (errType: number, errCode: number, errMsg: string) => { //logger.logError('登录失败(onQRCodeSessionFailed)', errCode, errMsg); - logger.logError('[Core] [Login] Login Error,ErrCode: ', errCode, ' ErrMsg:', errMsg); - if (errType == 1 && errCode == 3) { - // 二维码过期刷新 + if (!isLogined) { + logger.logError('[Core] [Login] Login Error,ErrCode: ', errCode, ' ErrMsg:', errMsg); + if (errType == 1 && errCode == 3) { + // 二维码过期刷新 + } + loginService.getQRCodePicture(); } - loginService.getQRCodePicture(); }; loginListener.onLoginFailed = (args) => { //logger.logError('登录失败(onLoginFailed)', args); @@ -189,14 +194,14 @@ export async function NCoreInitShell() { .then(result => { if (result.loginErrorInfo.errMsg) { logger.logError('快速登录错误:', result.loginErrorInfo.errMsg); - loginService.getQRCodePicture(); + if (!isLogined) loginService.getQRCodePicture(); } }) .catch(); }, 1000); } else { logger.logError('快速登录失败,未找到该 QQ 历史登录记录,将使用二维码登录方式'); - loginService.getQRCodePicture(); + if (!isLogined) loginService.getQRCodePicture(); } } else { logger.log('没有 -q 指令指定快速登录,将使用二维码登录方式'); @@ -204,7 +209,7 @@ export async function NCoreInitShell() { logger.log(`可用于快速登录的 QQ:\n${historyLoginList .map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`) .join('\n') - }`); + }`); } loginService.getQRCodePicture(); }