mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b23c357f73 | ||
![]() |
f561c2b0fa | ||
![]() |
5a8eea668f | ||
![]() |
777143e502 | ||
![]() |
0d8c9a82fe | ||
![]() |
d10ab1cce3 | ||
![]() |
ec25e09d73 |
@@ -33,7 +33,7 @@ if not exist "%QQpath%" (
|
|||||||
exit /b
|
exit /b
|
||||||
)
|
)
|
||||||
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
|
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
|
||||||
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > %NAPCAT_LOAD_PATH%
|
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
|
||||||
|
|
||||||
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
|
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "2.6.21",
|
"version": "2.6.24",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
27
package.json
27
package.json
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.6.21",
|
"version": "2.6.24",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "vite build --mode framework",
|
"build:framework": "vite build --mode framework",
|
||||||
"build:shell": "vite build --mode shell",
|
"build:shell": "vite build --mode shell",
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-typescript": "^7.24.7",
|
"@babel/preset-typescript": "^7.24.7",
|
||||||
"@log4js-node/log4js-api": "^1.0.2",
|
"@log4js-node/log4js-api": "^1.0.2",
|
||||||
"@protobuf-ts/runtime": "^2.9.4",
|
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||||
"@rollup/plugin-typescript": "^11.1.6",
|
"@rollup/plugin-typescript": "^11.1.6",
|
||||||
"@types/cors": "^2.8.17",
|
"@types/cors": "^2.8.17",
|
||||||
@@ -30,24 +29,24 @@
|
|||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"vite": "^5.2.6",
|
"vite": "^5.2.6",
|
||||||
"vite-plugin-cp": "^4.0.8",
|
"vite-plugin-cp": "^4.0.8",
|
||||||
"vite-tsconfig-paths": "^4.3.2"
|
"vite-tsconfig-paths": "^4.3.2",
|
||||||
},
|
"@protobuf-ts/runtime": "^2.9.4",
|
||||||
"dependencies": {
|
|
||||||
"ajv": "^8.13.0",
|
"ajv": "^8.13.0",
|
||||||
"@protobuf-ts/plugin": "^2.9.4",
|
"fast-xml-parser": "^4.3.6",
|
||||||
"async-mutex": "^0.5.0",
|
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"commander": "^12.1.0",
|
"commander": "^12.1.0",
|
||||||
"cors": "^2.8.5",
|
"async-mutex": "^0.5.0",
|
||||||
"express": "^5.0.0-beta.2",
|
|
||||||
"fast-xml-parser": "^4.3.6",
|
|
||||||
"file-type": "^19.0.0",
|
"file-type": "^19.0.0",
|
||||||
"fluent-ffmpeg": "^2.1.2",
|
|
||||||
"image-size": "^1.1.1",
|
|
||||||
"json-schema-to-ts": "^3.1.0",
|
"json-schema-to-ts": "^3.1.0",
|
||||||
"log4js": "^6.9.1",
|
"image-size": "^1.1.1",
|
||||||
|
"cors": "^2.8.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
"qrcode-terminal": "^0.12.0",
|
"qrcode-terminal": "^0.12.0",
|
||||||
|
"fluent-ffmpeg": "^2.1.2",
|
||||||
|
"express": "^5.0.0-beta.2",
|
||||||
|
"log4js": "^6.9.1",
|
||||||
"silk-wasm": "^3.6.1",
|
"silk-wasm": "^3.6.1",
|
||||||
"ws": "^8.18.0"
|
"ws": "^8.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -53,26 +53,22 @@ export class QQBasicInfoWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//此方法不要直接使用
|
//此方法不要直接使用
|
||||||
getQUAInternal() {
|
getQUAFallback() {
|
||||||
switch (systemPlatform) {
|
const platformMapping: Partial<Record<NodeJS.Platform, string>> = {
|
||||||
case 'linux':
|
win32: `V1_WIN_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`,
|
||||||
return `V1_LNX_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
darwin: `V1_MAC_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`,
|
||||||
case 'darwin':
|
linux: `V1_LNX_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`,
|
||||||
return `V1_MAC_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
};
|
||||||
default:
|
return platformMapping[systemPlatform] ?? (platformMapping.win32)!;
|
||||||
return `V1_WIN_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppidInternal() {
|
getAppIdFallback() {
|
||||||
switch (systemPlatform) {
|
const platformMapping: Partial<Record<NodeJS.Platform, string>> = {
|
||||||
case 'linux':
|
win32: '537246092',
|
||||||
return '537246140';
|
darwin: '537246140',
|
||||||
case 'darwin':
|
linux: '537246140',
|
||||||
return '537246140';
|
};
|
||||||
default:
|
return platformMapping[systemPlatform] ?? '537246092';
|
||||||
return '537246092';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppidV2(): { appid: string; qua: string } {
|
getAppidV2(): { appid: string; qua: string } {
|
||||||
@@ -88,6 +84,6 @@ export class QQBasicInfoWrapper {
|
|||||||
// else
|
// else
|
||||||
this.context.logger.log(`[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常`);
|
this.context.logger.log(`[QQ版本兼容性检测] 获取Appid异常 请检测NapCat/QQNT是否正常`);
|
||||||
this.context.logger.log(`[QQ版本兼容性检测] ${fullVersion} 版本兼容性不佳,可能会导致一些功能无法正常使用`,);
|
this.context.logger.log(`[QQ版本兼容性检测] ${fullVersion} 版本兼容性不佳,可能会导致一些功能无法正常使用`,);
|
||||||
return { appid: this.getAppidInternal(), qua: this.getQUAInternal() };
|
return { appid: this.getAppIdFallback(), qua: this.getQUAFallback() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '2.6.21';
|
export const napCatVersion = '2.6.24';
|
||||||
|
@@ -396,7 +396,9 @@ export class NTQQFileApi {
|
|||||||
return IMAGE_HTTP_HOST + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;
|
return IMAGE_HTTP_HOST + `/download?appid=${imageAppid}&fileid=${imageFileId}&rkey=${rkey}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (fileMd5 || md5HexStr) {
|
}
|
||||||
|
//到这里说明可能是旧客户端
|
||||||
|
if (fileMd5 || md5HexStr) {
|
||||||
return `${IMAGE_HTTP_HOST}/gchatpic_new/0/0-0-${(fileMd5 ?? md5HexStr)!.toUpperCase()}/0`;
|
return `${IMAGE_HTTP_HOST}/gchatpic_new/0/0-0-${(fileMd5 ?? md5HexStr)!.toUpperCase()}/0`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,11 +20,11 @@ import { LogLevel, LogWrapper } from '@/common/log';
|
|||||||
import { NodeIKernelLoginService } from '@/core/services';
|
import { NodeIKernelLoginService } from '@/core/services';
|
||||||
import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
||||||
import { NapCatPathWrapper } from '@/common/path';
|
import { NapCatPathWrapper } from '@/common/path';
|
||||||
import path, { resolve } from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { hostname, systemName, systemVersion } from '@/common/system';
|
import { hostname, systemName, systemVersion } from '@/common/system';
|
||||||
import { NTEventWrapper } from '@/common/event';
|
import { NTEventWrapper } from '@/common/event';
|
||||||
import { ChatType, DataSource, GroupMember, KickedOffLineInfo, Peer, SelfInfo, SelfStatusInfo } from '@/core/entities';
|
import { DataSource, GroupMember, KickedOffLineInfo, SelfInfo, SelfStatusInfo } from '@/core/entities';
|
||||||
import { NapCatConfigLoader } from '@/core/helper/config';
|
import { NapCatConfigLoader } from '@/core/helper/config';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import { NodeIKernelGroupListener, NodeIKernelMsgListener, NodeIKernelProfileListener } from '@/core/listeners';
|
import { NodeIKernelGroupListener, NodeIKernelMsgListener, NodeIKernelProfileListener } from '@/core/listeners';
|
||||||
@@ -257,19 +257,12 @@ export async function genSessionConfig(
|
|||||||
): Promise<WrapperSessionInitConfig> {
|
): Promise<WrapperSessionInitConfig> {
|
||||||
const downloadPath = path.join(account_path, 'NapCat', 'temp');
|
const downloadPath = path.join(account_path, 'NapCat', 'temp');
|
||||||
fs.mkdirSync(downloadPath, { recursive: true });
|
fs.mkdirSync(downloadPath, { recursive: true });
|
||||||
//os.platform()
|
const platformMapping: Partial<Record<NodeJS.Platform, PlatformType>> = {
|
||||||
let systemPlatform = PlatformType.KWINDOWS;
|
win32: PlatformType.KWINDOWS,
|
||||||
switch (os.platform()) {
|
darwin: PlatformType.KMAC,
|
||||||
case 'win32':
|
linux: PlatformType.KLINUX,
|
||||||
systemPlatform = PlatformType.KWINDOWS;
|
};
|
||||||
break;
|
const systemPlatform = platformMapping[os.platform()] ?? PlatformType.KWINDOWS;
|
||||||
case 'darwin':
|
|
||||||
systemPlatform = PlatformType.KMAC;
|
|
||||||
break;
|
|
||||||
case 'linux':
|
|
||||||
systemPlatform = PlatformType.KLINUX;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
selfUin,
|
selfUin,
|
||||||
selfUid,
|
selfUid,
|
||||||
|
@@ -139,8 +139,7 @@ export class OneBotGroupApi {
|
|||||||
}
|
}
|
||||||
if (element.grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
if (element.grayTipElement.jsonGrayTipElement.busiId == 2407) {
|
||||||
const type = json.items[json.items.length - 1]?.txt;
|
const type = json.items[json.items.length - 1]?.txt;
|
||||||
switch (type) {
|
if (type === "头衔") {
|
||||||
case "头衔": {
|
|
||||||
const memberUin = json.items[1].param[0];
|
const memberUin = json.items[1].param[0];
|
||||||
const title = json.items[3].txt;
|
const title = json.items[3].txt;
|
||||||
logger.logDebug('收到群成员新头衔消息', json);
|
logger.logDebug('收到群成员新头衔消息', json);
|
||||||
@@ -150,11 +149,10 @@ export class OneBotGroupApi {
|
|||||||
parseInt(memberUin),
|
parseInt(memberUin),
|
||||||
title,
|
title,
|
||||||
);
|
);
|
||||||
}
|
} else if (type === "移出") {
|
||||||
case "移出":
|
|
||||||
logger.logDebug('收到机器人被踢消息', json);
|
logger.logDebug('收到机器人被踢消息', json);
|
||||||
return;
|
return;
|
||||||
default:
|
} else {
|
||||||
logger.logWarn('收到未知的灰条消息', json);
|
logger.logWarn('收到未知的灰条消息', json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -275,7 +275,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
msgListener.onRecvSysMsg = (msg) => {
|
msgListener.onRecvSysMsg = (msg) => {
|
||||||
this.apis.MsgApi.parseSysMessage(msg).then((event) => {
|
this.apis.MsgApi.parseSysMessage(msg).then((event) => {
|
||||||
if (event) this.networkManager.emitEvent(event);
|
if (event) this.networkManager.emitEvent(event);
|
||||||
}).catch(e => this.context.logger.logError.bind(this.context.logger)('constructSysMessage error: ', e));
|
}).catch(e => this.context.logger.logError.bind(this.context.logger)('constructSysMessage error: ', e, '\n Parse Hex:', Buffer.from(msg).toString('hex')));
|
||||||
};
|
};
|
||||||
|
|
||||||
msgListener.onInputStatusPush = async data => {
|
msgListener.onInputStatusPush = async data => {
|
||||||
|
@@ -69,18 +69,12 @@ export async function NCoreInitShell() {
|
|||||||
const dataPathGlobal = path.resolve(dataPath, './nt_qq/global');
|
const dataPathGlobal = path.resolve(dataPath, './nt_qq/global');
|
||||||
return [dataPath, dataPathGlobal];
|
return [dataPath, dataPathGlobal];
|
||||||
})();
|
})();
|
||||||
let systemPlatform = PlatformType.KWINDOWS;
|
const platformMapping: Partial<Record<NodeJS.Platform, PlatformType>> = {
|
||||||
switch (os.platform()) {
|
win32: PlatformType.KWINDOWS,
|
||||||
case 'win32':
|
darwin: PlatformType.KMAC,
|
||||||
systemPlatform = PlatformType.KWINDOWS;
|
linux: PlatformType.KLINUX,
|
||||||
break;
|
};
|
||||||
case 'darwin':
|
const systemPlatform = platformMapping[os.platform()] ?? PlatformType.KWINDOWS;
|
||||||
systemPlatform = PlatformType.KMAC;
|
|
||||||
break;
|
|
||||||
case 'linux':
|
|
||||||
systemPlatform = PlatformType.KLINUX;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!basicInfoWrapper.QQVersionAppid || !basicInfoWrapper.QQVersionQua) throw new Error('QQVersionAppid or QQVersionQua is not defined');
|
if (!basicInfoWrapper.QQVersionAppid || !basicInfoWrapper.QQVersionQua) throw new Error('QQVersionAppid or QQVersionQua is not defined');
|
||||||
// from initConfig
|
// from initConfig
|
||||||
engine.initWithDeskTopConfig(
|
engine.initWithDeskTopConfig(
|
||||||
|
@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
undefined,
|
undefined,
|
||||||
SettingButton('V2.6.21', 'napcat-update-button', 'secondary'),
|
SettingButton('V2.6.24', 'napcat-update-button', 'secondary'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V2.6.21", "napcat-update-button", "secondary")
|
SettingButton("V2.6.24", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user