Merge pull request #370 from NapNeko/28060

for: 28060
This commit is contained in:
手瓜一十雪 2024-09-16 20:54:54 +08:00 committed by GitHub
commit de48b0f940
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 71 additions and 57 deletions

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -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

View File

@ -1 +0,0 @@
require('./launcher.node').load('external_index', module);

23
launcher/qqnt.json Normal file
View File

@ -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"
}

View File

@ -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');

View File

@ -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';
}
}

View File

@ -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"
}
}

View File

@ -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);

View File

@ -103,18 +103,21 @@ export async function NCoreInitShell() {
const selfInfo = await new Promise<SelfInfo>((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();
}