mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
91b794d66d | ||
![]() |
0d65e1e314 | ||
![]() |
2d8f58c6d8 | ||
![]() |
65888fa816 | ||
![]() |
857e882c6e | ||
![]() |
add2931834 | ||
![]() |
cdda5f45ee | ||
![]() |
5f73d6a913 | ||
![]() |
0637882fbc | ||
![]() |
3f785bab20 | ||
![]() |
a4ca89bdd6 | ||
![]() |
1a64e796bd | ||
![]() |
a8b85a34f7 | ||
![]() |
e7bec7d6b0 | ||
![]() |
a582026037 | ||
![]() |
1a67a001c5 | ||
![]() |
406deac592 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "qq-chat",
|
"name": "qq-chat",
|
||||||
"version": "9.9.15-28060",
|
"version": "9.9.15-28131",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "QQ",
|
"description": "QQ",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"qd": "externals/devtools/cli/index.js"
|
"qd": "externals/devtools/cli/index.js"
|
||||||
},
|
},
|
||||||
"main": "./loadNapCat.js",
|
"main": "./loadNapCat.js",
|
||||||
"buildVersion": "28060",
|
"buildVersion": "28131",
|
||||||
"isPureShell": true,
|
"isPureShell": true,
|
||||||
"isByteCodeShell": true,
|
"isByteCodeShell": true,
|
||||||
"platform": "win32",
|
"platform": "win32",
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "2.6.2",
|
"version": "2.6.10",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.6.2",
|
"version": "2.6.10",
|
||||||
"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",
|
||||||
@@ -52,4 +52,4 @@
|
|||||||
"strtok3": "8.0.1",
|
"strtok3": "8.0.1",
|
||||||
"ws": "^8.18.0"
|
"ws": "^8.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -45,9 +45,9 @@ async function handleWavFile(
|
|||||||
): Promise<{input: Buffer, sampleRate: number}> {
|
): Promise<{input: Buffer, sampleRate: number}> {
|
||||||
const { fmt } = getWavFileInfo(file);
|
const { fmt } = getWavFileInfo(file);
|
||||||
if (!ALLOW_SAMPLE_RATE.includes(fmt.sampleRate)) {
|
if (!ALLOW_SAMPLE_RATE.includes(fmt.sampleRate)) {
|
||||||
return {input: await convert(filePath, pcmPath, logger), sampleRate: 24000};
|
return { input: await convert(filePath, pcmPath, logger), sampleRate: 24000 };
|
||||||
}
|
}
|
||||||
return {input: file, sampleRate: fmt.sampleRate};
|
return { input: file, sampleRate: fmt.sampleRate };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: LogWrapper) {
|
export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: LogWrapper) {
|
||||||
@@ -59,7 +59,7 @@ export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: Log
|
|||||||
const pcmPath = `${pttPath}.pcm`;
|
const pcmPath = `${pttPath}.pcm`;
|
||||||
const { input, sampleRate } = isWav(file)
|
const { input, sampleRate } = isWav(file)
|
||||||
? (await handleWavFile(file, filePath, pcmPath, logger))
|
? (await handleWavFile(file, filePath, pcmPath, logger))
|
||||||
: {input: await convert(filePath, pcmPath, logger), sampleRate: 24000};
|
: { input: await convert(filePath, pcmPath, logger), sampleRate: 24000 };
|
||||||
const silk = await encode(input, sampleRate);
|
const silk = await encode(input, sampleRate);
|
||||||
await fsPromise.writeFile(pttPath, silk.data);
|
await fsPromise.writeFile(pttPath, silk.data);
|
||||||
logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration);
|
logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration);
|
||||||
|
@@ -187,7 +187,7 @@ export class NTEventWrapper {
|
|||||||
const id = randomUUID();
|
const id = randomUUID();
|
||||||
let complete = 0;
|
let complete = 0;
|
||||||
let retData: Parameters<ListenerType> | undefined = undefined;
|
let retData: Parameters<ListenerType> | undefined = undefined;
|
||||||
let retEvent: any = {};
|
const retEvent: any = {};
|
||||||
|
|
||||||
function sendDataCallback() {
|
function sendDataCallback() {
|
||||||
if (complete == 0) {
|
if (complete == 0) {
|
||||||
|
@@ -144,7 +144,7 @@ async function tryDownload(options: string | HttpDownloadOptions, useReferer: bo
|
|||||||
}
|
}
|
||||||
if (useReferer && !headers['Referer']) {
|
if (useReferer && !headers['Referer']) {
|
||||||
headers['Referer'] = url;
|
headers['Referer'] = url;
|
||||||
};
|
}
|
||||||
const fetchRes = await fetch(url, { headers }).catch((err) => {
|
const fetchRes = await fetch(url, { headers }).catch((err) => {
|
||||||
if (err.cause) {
|
if (err.cause) {
|
||||||
throw err.cause;
|
throw err.cause;
|
||||||
|
@@ -180,11 +180,11 @@ export function getDefaultQQVersionConfigInfo(): QQVersionConfigType {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
baseVersion: '9.9.15-28060',
|
baseVersion: '9.9.15-28131',
|
||||||
curVersion: '9.9.15-28060',
|
curVersion: '9.9.15-28131',
|
||||||
prevVersion: '',
|
prevVersion: '',
|
||||||
onErrorVersions: [],
|
onErrorVersions: [],
|
||||||
buildId: '28060',
|
buildId: '28131',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,23 +55,23 @@ export class QQBasicInfoWrapper {
|
|||||||
//此方法不要直接使用
|
//此方法不要直接使用
|
||||||
getQUAInternal() {
|
getQUAInternal() {
|
||||||
switch (systemPlatform) {
|
switch (systemPlatform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return `V1_LNX_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
return `V1_LNX_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return `V1_MAC_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
return `V1_MAC_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
||||||
default:
|
default:
|
||||||
return `V1_WIN_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
return `V1_WIN_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppidInternal() {
|
getAppidInternal() {
|
||||||
switch (systemPlatform) {
|
switch (systemPlatform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
return '537246140';
|
return '537246140';
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return '537246140';
|
return '537246140';
|
||||||
default:
|
default:
|
||||||
return '537246092';
|
return '537246092';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +1,8 @@
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { networkInterfaces } from 'os';
|
|
||||||
import { randomUUID } from 'crypto';
|
|
||||||
|
|
||||||
// 缓解Win7设备兼容性问题
|
// 缓解Win7设备兼容性问题
|
||||||
let osName: string;
|
let osName: string;
|
||||||
// 设备ID
|
|
||||||
let machineId: Promise<string>;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
osName = os.hostname();
|
osName = os.hostname();
|
||||||
@@ -14,54 +10,6 @@ try {
|
|||||||
osName = 'NapCat'; // + crypto.randomUUID().substring(0, 4);
|
osName = 'NapCat'; // + crypto.randomUUID().substring(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
const invalidMacAddresses = new Set([
|
|
||||||
'00:00:00:00:00:00',
|
|
||||||
'ff:ff:ff:ff:ff:ff',
|
|
||||||
'ac:de:48:00:11:22',
|
|
||||||
]);
|
|
||||||
|
|
||||||
function validateMacAddress(candidate: string): boolean {
|
|
||||||
// eslint-disable-next-line no-useless-escape
|
|
||||||
const tempCandidate = candidate.replace(/\-/g, ':').toLowerCase();
|
|
||||||
return !invalidMacAddresses.has(tempCandidate);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getMachineId(): Promise<string> {
|
|
||||||
if (!machineId) {
|
|
||||||
machineId = (async () => {
|
|
||||||
const id = await getMacMachineId();
|
|
||||||
return id ?? randomUUID(); // fallback, generate a UUID
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
|
|
||||||
return machineId;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getMac(): string {
|
|
||||||
const ifaces = networkInterfaces();
|
|
||||||
for (const name in ifaces) {
|
|
||||||
const networkInterface = ifaces[name];
|
|
||||||
if (networkInterface) {
|
|
||||||
for (const { mac } of networkInterface) {
|
|
||||||
if (validateMacAddress(mac)) {
|
|
||||||
return mac;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error('Unable to retrieve mac address (unexpected format)');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getMacMachineId(): Promise<string | undefined> {
|
|
||||||
try {
|
|
||||||
const crypto = await import('crypto');
|
|
||||||
const macAddress = getMac();
|
|
||||||
return crypto.createHash('sha256').update(macAddress, 'utf8').digest('hex');
|
|
||||||
} catch (err) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const homeDir = os.homedir();
|
const homeDir = os.homedir();
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '2.6.2';
|
export const napCatVersion = '2.6.10';
|
||||||
|
14
src/core/external/appid.json
vendored
14
src/core/external/appid.json
vendored
@@ -1,10 +1,18 @@
|
|||||||
{
|
{
|
||||||
"9.9.15-28060":{
|
"9.9.15-28060": {
|
||||||
"appid": 537246092,
|
"appid": 537246092,
|
||||||
"qua": "V1_WIN_NQ_9.9.15_28060_GW_B"
|
"qua": "V1_WIN_NQ_9.9.15_28060_GW_B"
|
||||||
},
|
},
|
||||||
"3.2.12-28060":{
|
"9.9.15-28131": {
|
||||||
|
"appid": 537246092,
|
||||||
|
"qua": "V1_WIN_NQ_9.9.15_28131_GW_B"
|
||||||
|
},
|
||||||
|
"3.2.12-28060": {
|
||||||
"appid": 537246140,
|
"appid": 537246140,
|
||||||
"qua": "V1_LNX_NQ_3.2.12_28060_GW_B"
|
"qua": "V1_LNX_NQ_3.2.12_28060_GW_B"
|
||||||
|
},
|
||||||
|
"3.2.12-28131": {
|
||||||
|
"appid": 537246140,
|
||||||
|
"qua": "V1_LNX_NQ_3.2.12_28131_GW_B"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -22,7 +22,7 @@ import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
|||||||
import { NapCatPathWrapper } from '@/common/path';
|
import { NapCatPathWrapper } from '@/common/path';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { getMachineId, hostname, systemName, systemVersion } from '@/common/system';
|
import { hostname, systemName, systemVersion } from '@/common/system';
|
||||||
import { NTEventWrapper } from '@/common/event';
|
import { NTEventWrapper } from '@/common/event';
|
||||||
import { DataSource, GroupMember, KickedOffLineInfo, 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';
|
||||||
@@ -247,22 +247,41 @@ export class NapCatCore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function genSessionConfig(QQVersionAppid: string, QQVersion: string, selfUin: string, selfUid: string, account_path: string): Promise<WrapperSessionInitConfig> {
|
export async function genSessionConfig(
|
||||||
|
guid:string,
|
||||||
|
QQVersionAppid: string,
|
||||||
|
QQVersion: string,
|
||||||
|
selfUin: string,
|
||||||
|
selfUid: string,
|
||||||
|
account_path: string
|
||||||
|
): 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 });
|
||||||
const guid: string = await getMachineId();//26702 支持JS获取guid值 在LoginService中获取 TODO mlikiow a
|
//os.platform()
|
||||||
|
let systemPlatform = PlatformType.KWINDOWS;
|
||||||
|
switch (os.platform()) {
|
||||||
|
case 'win32':
|
||||||
|
systemPlatform = PlatformType.KWINDOWS;
|
||||||
|
break;
|
||||||
|
case 'darwin':
|
||||||
|
systemPlatform = PlatformType.KMAC;
|
||||||
|
break;
|
||||||
|
case 'linux':
|
||||||
|
systemPlatform = PlatformType.KLINUX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
selfUin,
|
selfUin,
|
||||||
selfUid,
|
selfUid,
|
||||||
desktopPathConfig: {
|
desktopPathConfig: {
|
||||||
account_path, // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取
|
account_path, // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取
|
||||||
},
|
},
|
||||||
clientVer: QQVersion, // 9.9.8-22355
|
clientVer: QQVersion,
|
||||||
a2: '',
|
a2: '',
|
||||||
d2: '',
|
d2: '',
|
||||||
d2Key: '',
|
d2Key: '',
|
||||||
machineId: '',
|
machineId: '',
|
||||||
platform: PlatformType.KWINDOWS, // 3是Windows?
|
platform: systemPlatform, // 3是Windows?
|
||||||
platVer: systemVersion, // 系统版本号, 应该可以固定
|
platVer: systemVersion, // 系统版本号, 应该可以固定
|
||||||
appid: QQVersionAppid,
|
appid: QQVersionAppid,
|
||||||
rdeliveryConfig: {
|
rdeliveryConfig: {
|
||||||
@@ -270,7 +289,7 @@ export async function genSessionConfig(QQVersionAppid: string, QQVersion: string
|
|||||||
systemId: 0,
|
systemId: 0,
|
||||||
appId: '',
|
appId: '',
|
||||||
logicEnvironment: '',
|
logicEnvironment: '',
|
||||||
platform: PlatformType.KWINDOWS,
|
platform: systemPlatform,
|
||||||
language: '',
|
language: '',
|
||||||
sdkVersion: '',
|
sdkVersion: '',
|
||||||
userId: '',
|
userId: '',
|
||||||
|
5
src/core/listeners/NodeIO3MiscListener.ts
Normal file
5
src/core/listeners/NodeIO3MiscListener.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export class NodeIO3MiscListener {
|
||||||
|
getOnAmgomDataPiece(...arg: unknown[]) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
import { NodeIKernelLoginListener } from '@/core/listeners/NodeIKernelLoginListener';
|
import { NodeIKernelLoginListener } from '@/core/listeners/NodeIKernelLoginListener';
|
||||||
|
import { GeneralCallResult } from './common';
|
||||||
|
|
||||||
export interface LoginInitConfig {
|
export interface LoginInitConfig {
|
||||||
machineId: '';
|
machineId: '';
|
||||||
@@ -59,6 +60,9 @@ export interface QuickLoginResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface NodeIKernelLoginService {
|
export interface NodeIKernelLoginService {
|
||||||
|
setLoginMiscData(arg0: string, value: string): unknown;
|
||||||
|
getMachineGuid(): string;
|
||||||
|
|
||||||
get(): NodeIKernelLoginService;
|
get(): NodeIKernelLoginService;
|
||||||
|
|
||||||
connect(): boolean;
|
connect(): boolean;
|
||||||
@@ -69,7 +73,7 @@ export interface NodeIKernelLoginService {
|
|||||||
|
|
||||||
initConfig(config: LoginInitConfig): void;
|
initConfig(config: LoginInitConfig): void;
|
||||||
|
|
||||||
getLoginMiscData(cb: (r: unknown) => void): void;
|
getLoginMiscData(data: string): Promise<GeneralCallResult & { value: string }>;
|
||||||
|
|
||||||
getLoginList(): Promise<{
|
getLoginList(): Promise<{
|
||||||
result: number, // 0是ok
|
result: number, // 0是ok
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { GeneralCallResult } from './common';
|
import { GeneralCallResult } from './common';
|
||||||
|
|
||||||
export interface NodeIKernelNodeMiscService {
|
export interface NodeIKernelNodeMiscService {
|
||||||
|
writeVersionToRegistry: any;
|
||||||
getMiniAppPath(): unknown;
|
getMiniAppPath(): unknown;
|
||||||
|
|
||||||
setMiniAppVersion(version: string): unknown;
|
setMiniAppVersion(version: string): unknown;
|
||||||
|
@@ -4,14 +4,14 @@ export interface NodeIKernelUnitedConfigService {
|
|||||||
|
|
||||||
removeKernelUnitedConfigListener(listenerId:number): void;
|
removeKernelUnitedConfigListener(listenerId:number): void;
|
||||||
|
|
||||||
fetchUnitedCommendConfig(...args: any[]): unknown;// needs 1 arguments
|
|
||||||
|
|
||||||
fetchUnitedSwitchConfig(...args: any[]): unknown;// needs 1 arguments
|
fetchUnitedSwitchConfig(...args: any[]): unknown;// needs 1 arguments
|
||||||
|
|
||||||
loadUnitedConfig(...args: any[]): unknown;// needs 1 arguments
|
|
||||||
|
|
||||||
isUnitedConfigSwitchOn(...args: any[]): unknown;// needs 1 arguments
|
isUnitedConfigSwitchOn(...args: any[]): unknown;// needs 1 arguments
|
||||||
|
|
||||||
registerUnitedConfigPushGroupList(...args: any[]): unknown;// needs 1 arguments
|
registerUnitedConfigPushGroupList(...args: any[]): unknown;// needs 1 arguments
|
||||||
|
|
||||||
|
fetchUnitedCommendConfig(ids: `${string}`[]): void
|
||||||
|
|
||||||
|
loadUnitedConfig(id: string): Promise<unknown>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
11
src/core/services/NodeIO3MiscService.ts
Normal file
11
src/core/services/NodeIO3MiscService.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { NodeIO3MiscListener } from "../listeners/NodeIO3MiscListener";
|
||||||
|
|
||||||
|
export interface NodeIO3MiscService {
|
||||||
|
get(): NodeIO3MiscService;
|
||||||
|
|
||||||
|
addO3MiscListener(listeners: NodeIO3MiscListener): number;
|
||||||
|
|
||||||
|
setAmgomDataPiece(appid: string, dataPiece: Uint8Array): void;
|
||||||
|
|
||||||
|
reportAmgomWeather(type: string, uk2: string, arg: Array<string>): void;
|
||||||
|
}
|
@@ -26,6 +26,7 @@ import { NodeIKernelRecentContactService } from './services/NodeIKernelRecentCon
|
|||||||
import { NodeIKernelMSFService } from './services/NodeIKernelMSFService';
|
import { NodeIKernelMSFService } from './services/NodeIKernelMSFService';
|
||||||
import { NodeIkernelTestPerformanceService } from './services/NodeIkernelTestPerformanceService';
|
import { NodeIkernelTestPerformanceService } from './services/NodeIkernelTestPerformanceService';
|
||||||
import { NodeIKernelECDHService } from './services/NodeIKernelECDHService';
|
import { NodeIKernelECDHService } from './services/NodeIKernelECDHService';
|
||||||
|
import { NodeIO3MiscService } from './services/NodeIO3MiscService';
|
||||||
|
|
||||||
export interface NodeQQNTWrapperUtil {
|
export interface NodeQQNTWrapperUtil {
|
||||||
get(): unknown;
|
get(): unknown;
|
||||||
@@ -144,7 +145,7 @@ export interface NodeQQNTWrapperUtil {
|
|||||||
|
|
||||||
export interface NodeIQQNTWrapperSession {
|
export interface NodeIQQNTWrapperSession {
|
||||||
create(): NodeIQQNTWrapperSession;
|
create(): NodeIQQNTWrapperSession;
|
||||||
|
|
||||||
init(
|
init(
|
||||||
wrapperSessionInitConfig: WrapperSessionInitConfig,
|
wrapperSessionInitConfig: WrapperSessionInitConfig,
|
||||||
nodeIDependsAdapter: NodeIDependsAdapter,
|
nodeIDependsAdapter: NodeIDependsAdapter,
|
||||||
@@ -249,11 +250,11 @@ export interface NodeIQQNTWrapperSession {
|
|||||||
|
|
||||||
export interface EnginInitDesktopConfig {
|
export interface EnginInitDesktopConfig {
|
||||||
base_path_prefix: string;
|
base_path_prefix: string;
|
||||||
platform_type: 3;
|
platform_type: PlatformType;
|
||||||
app_type: 4;
|
app_type: 4;
|
||||||
app_version: string;
|
app_version: string;
|
||||||
os_version: string;
|
os_version: string;
|
||||||
use_xlog: true;
|
use_xlog: boolean;
|
||||||
qua: string;
|
qua: string;
|
||||||
global_path_config: {
|
global_path_config: {
|
||||||
desktopGlobalPath: string;
|
desktopGlobalPath: string;
|
||||||
@@ -262,28 +263,26 @@ export interface EnginInitDesktopConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface NodeIQQNTWrapperEngine {
|
export interface NodeIQQNTWrapperEngine {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
get(): NodeIQQNTWrapperEngine;
|
||||||
new(): NodeIQQNTWrapperEngine;
|
|
||||||
|
|
||||||
initWithDeskTopConfig(config: EnginInitDesktopConfig, nodeIGlobalAdapter: NodeIGlobalAdapter): void;
|
initWithDeskTopConfig(config: EnginInitDesktopConfig, nodeIGlobalAdapter: NodeIGlobalAdapter): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WrapperNodeApi {
|
export interface WrapperNodeApi {
|
||||||
[key: string]: any;
|
NodeIO3MiscService: NodeIO3MiscService;
|
||||||
|
|
||||||
NodeQQNTWrapperUtil: NodeQQNTWrapperUtil;
|
NodeQQNTWrapperUtil: NodeQQNTWrapperUtil;
|
||||||
NodeIQQNTWrapperSession: NodeIQQNTWrapperSession;
|
NodeIQQNTWrapperSession: NodeIQQNTWrapperSession;
|
||||||
NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngine;
|
NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngine;
|
||||||
NodeIKernelLoginService: NodeIKernelLoginService;
|
NodeIKernelLoginService: NodeIKernelLoginService;
|
||||||
NodeIKernelProfileService: NodeIKernelProfileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
export enum PlatformType {
|
export enum PlatformType {
|
||||||
KUNKNOWN,
|
KUNKNOWN,
|
||||||
KANDROID,
|
KANDROID,
|
||||||
KIOS,
|
KIOS,
|
||||||
KWINDOWS,
|
KWINDOWS,
|
||||||
KMAC,
|
KMAC,
|
||||||
|
KLINUX
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum DeviceType {
|
export enum DeviceType {
|
||||||
|
@@ -23,7 +23,7 @@ class GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> {
|
|||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
const groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(payload.group_id.toString());
|
const groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(payload.group_id.toString());
|
||||||
const groupMembersArr = Array.from(groupMembers.values());
|
const groupMembersArr = Array.from(groupMembers.values());
|
||||||
let uids = groupMembersArr.map(item => item.uid);
|
const uids = groupMembersArr.map(item => item.uid);
|
||||||
//let CoreAndBase = await this.core.apis.GroupApi.getCoreAndBaseInfo(uids)
|
//let CoreAndBase = await this.core.apis.GroupApi.getCoreAndBaseInfo(uids)
|
||||||
let _groupMembers = groupMembersArr.map(item => {
|
let _groupMembers = groupMembersArr.map(item => {
|
||||||
return OB11Entities.groupMember(payload.group_id.toString(), item);
|
return OB11Entities.groupMember(payload.group_id.toString(), item);
|
||||||
|
@@ -574,9 +574,10 @@ export class OneBotMsgApi {
|
|||||||
} else {
|
} else {
|
||||||
postData = data;
|
postData = data;
|
||||||
}
|
}
|
||||||
const signUrl = this.obContext.configLoader.configData.musicSignUrl;
|
let signUrl = this.obContext.configLoader.configData.musicSignUrl;
|
||||||
if (!signUrl) {
|
if (!signUrl) {
|
||||||
throw Error('音乐消息签名地址未配置');
|
signUrl = 'https://ss.xingzhige.com/music_card/card';//感谢思思!
|
||||||
|
//throw Error('音乐消息签名地址未配置');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const musicJson = await RequestUtil.HttpGetJson<any>(signUrl, 'POST', postData);
|
const musicJson = await RequestUtil.HttpGetJson<any>(signUrl, 'POST', postData);
|
||||||
@@ -609,7 +610,7 @@ export class OneBotMsgApi {
|
|||||||
[OB11MessageDataType.miniapp]: async () => undefined,
|
[OB11MessageDataType.miniapp]: async () => undefined,
|
||||||
|
|
||||||
[OB11MessageDataType.contact]: async ({ data }, context) => {
|
[OB11MessageDataType.contact]: async ({ data }, context) => {
|
||||||
let arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(data.id.toString(), '');
|
const arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(data.id.toString(), '');
|
||||||
return this.ob11ToRawConverters.json({
|
return this.ob11ToRawConverters.json({
|
||||||
data: { data: arkJson.arkMsg },
|
data: { data: arkJson.arkMsg },
|
||||||
type: OB11MessageDataType.json
|
type: OB11MessageDataType.json
|
||||||
|
@@ -48,8 +48,8 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
//鉴权
|
//鉴权
|
||||||
this.authorize(token, wsClient, wsReq);
|
this.authorize(token, wsClient, wsReq);
|
||||||
const paramUrl = wsReq.url?.indexOf('?') !== -1 ? wsReq.url?.substring(0, wsReq.url?.indexOf('?')) : wsReq.url;
|
const paramUrl = wsReq.url?.indexOf('?') !== -1 ? wsReq.url?.substring(0, wsReq.url?.indexOf('?')) : wsReq.url;
|
||||||
const isEventConnect = paramUrl === '/event' || paramUrl === '' || paramUrl === '/';
|
const isApiConnect = paramUrl === '/api' || paramUrl === '/api/';
|
||||||
if (isEventConnect) {
|
if (!isApiConnect) {
|
||||||
this.connectEvent(core, wsClient);
|
this.connectEvent(core, wsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
await this.wsClientsMutex.runExclusive(async () => {
|
await this.wsClientsMutex.runExclusive(async () => {
|
||||||
if(isEventConnect){
|
if (!isApiConnect) {
|
||||||
this.wsClientWithEvent.push(wsClient);
|
this.wsClientWithEvent.push(wsClient);
|
||||||
}
|
}
|
||||||
this.wsClients.push(wsClient);
|
this.wsClients.push(wsClient);
|
||||||
|
@@ -11,6 +11,7 @@ import {
|
|||||||
NapCatCore,
|
NapCatCore,
|
||||||
NapCatCoreWorkingEnv,
|
NapCatCoreWorkingEnv,
|
||||||
NodeIQQNTWrapperSession,
|
NodeIQQNTWrapperSession,
|
||||||
|
PlatformType,
|
||||||
WrapperNodeApi,
|
WrapperNodeApi,
|
||||||
} from '@/core';
|
} from '@/core';
|
||||||
import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
||||||
@@ -27,6 +28,7 @@ import { NapCatOneBot11Adapter } from '@/onebot';
|
|||||||
import { InitWebUi } from '@/webui';
|
import { InitWebUi } from '@/webui';
|
||||||
import { WebUiDataRuntime } from '@/webui/src/helper/Data';
|
import { WebUiDataRuntime } from '@/webui/src/helper/Data';
|
||||||
import { napCatVersion } from '@/common/version';
|
import { napCatVersion } from '@/common/version';
|
||||||
|
import { NodeIO3MiscListener } from '@/core/listeners/NodeIO3MiscListener';
|
||||||
|
|
||||||
program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
|
program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
|
||||||
const cmdOptions = program.opts();
|
const cmdOptions = program.opts();
|
||||||
@@ -39,13 +41,18 @@ export async function NCoreInitShell() {
|
|||||||
const logger = new LogWrapper(pathWrapper.logsPath);
|
const logger = new LogWrapper(pathWrapper.logsPath);
|
||||||
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
|
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
|
||||||
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
|
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());
|
||||||
|
|
||||||
|
const o3Service = wrapper.NodeIO3MiscService.get();
|
||||||
|
o3Service.addO3MiscListener(new NodeIO3MiscListener());
|
||||||
|
|
||||||
logger.log(`[NapCat] [Core] NapCat.Core Version: ` + napCatVersion);
|
logger.log(`[NapCat] [Core] NapCat.Core Version: ` + napCatVersion);
|
||||||
InitWebUi(logger, pathWrapper).then().catch(logger.logError);
|
InitWebUi(logger, pathWrapper).then().catch(logger.logError);
|
||||||
|
|
||||||
// from constructor
|
// from constructor
|
||||||
const engine = new wrapper.NodeIQQNTWrapperEngine();
|
const engine = wrapper.NodeIQQNTWrapperEngine.get();
|
||||||
//const util = wrapper.NodeQQNTWrapperUtil.get();
|
//const util = wrapper.NodeQQNTWrapperUtil.get();
|
||||||
const loginService = wrapper.NodeIKernelLoginService.get();
|
const loginService = wrapper.NodeIKernelLoginService.get();
|
||||||
|
|
||||||
const session = wrapper.NodeIQQNTWrapperSession.create();
|
const session = wrapper.NodeIQQNTWrapperSession.create();
|
||||||
|
|
||||||
// from get dataPath
|
// from get dataPath
|
||||||
@@ -63,17 +70,29 @@ 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;
|
||||||
|
switch (os.platform()) {
|
||||||
|
case 'win32':
|
||||||
|
systemPlatform = PlatformType.KWINDOWS;
|
||||||
|
break;
|
||||||
|
case 'darwin':
|
||||||
|
systemPlatform = PlatformType.KMAC;
|
||||||
|
break;
|
||||||
|
case 'linux':
|
||||||
|
systemPlatform = PlatformType.KLINUX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!basicInfoWrapper.QQVersionAppid || !basicInfoWrapper.QQVersionQua) throw new Error('QQVersionAppid or QQVersionQua is not defined');
|
||||||
// from initConfig
|
// from initConfig
|
||||||
engine.initWithDeskTopConfig(
|
engine.initWithDeskTopConfig(
|
||||||
{
|
{
|
||||||
base_path_prefix: '',
|
base_path_prefix: '',
|
||||||
platform_type: 3,
|
platform_type: systemPlatform,
|
||||||
app_type: 4,
|
app_type: 4,
|
||||||
app_version: basicInfoWrapper.getFullQQVesion(),
|
app_version: basicInfoWrapper.getFullQQVesion(),
|
||||||
os_version: 'Windows 10 Pro',
|
os_version: systemVersion,
|
||||||
use_xlog: true,
|
use_xlog: false,
|
||||||
qua: basicInfoWrapper.QQVersionQua!,
|
qua: basicInfoWrapper.QQVersionQua,
|
||||||
global_path_config: {
|
global_path_config: {
|
||||||
desktopGlobalPath: dataPathGlobal,
|
desktopGlobalPath: dataPathGlobal,
|
||||||
},
|
},
|
||||||
@@ -83,7 +102,7 @@ export async function NCoreInitShell() {
|
|||||||
);
|
);
|
||||||
loginService.initConfig({
|
loginService.initConfig({
|
||||||
machineId: '',
|
machineId: '',
|
||||||
appid: basicInfoWrapper.QQVersionAppid!,
|
appid: basicInfoWrapper.QQVersionAppid,
|
||||||
platVer: systemVersion,
|
platVer: systemVersion,
|
||||||
commonPath: dataPathGlobal,
|
commonPath: dataPathGlobal,
|
||||||
clientVer: basicInfoWrapper.getFullQQVesion(),
|
clientVer: basicInfoWrapper.getFullQQVesion(),
|
||||||
@@ -100,7 +119,8 @@ export async function NCoreInitShell() {
|
|||||||
quickLoginUin = '';
|
quickLoginUin = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let dataTimestape = new Date().getTime().toString();
|
||||||
|
o3Service.reportAmgomWeather('login', 'a1', [dataTimestape, '0', '0']);
|
||||||
const selfInfo = await new Promise<SelfInfo>((resolve) => {
|
const selfInfo = await new Promise<SelfInfo>((resolve) => {
|
||||||
const loginListener = new NodeIKernelLoginListener();
|
const loginListener = new NodeIKernelLoginListener();
|
||||||
let isLogined = false;
|
let isLogined = false;
|
||||||
@@ -117,7 +137,7 @@ export async function NCoreInitShell() {
|
|||||||
nick: '', // 获取不到
|
nick: '', // 获取不到
|
||||||
online: true,
|
online: true,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
loginListener.onQRCodeGetPicture = ({ pngBase64QrcodeData, qrcodeUrl }) => {
|
loginListener.onQRCodeGetPicture = ({ pngBase64QrcodeData, qrcodeUrl }) => {
|
||||||
//设置WebuiQrcode
|
//设置WebuiQrcode
|
||||||
@@ -166,7 +186,14 @@ export async function NCoreInitShell() {
|
|||||||
// 遍历 res.LocalLoginInfoList[x].isQuickLogin是否可以 res.LocalLoginInfoList[x].uin 转为string 加入string[] 最后遍历完成调用WebUiDataRuntime.setQQQuickLoginList
|
// 遍历 res.LocalLoginInfoList[x].isQuickLogin是否可以 res.LocalLoginInfoList[x].uin 转为string 加入string[] 最后遍历完成调用WebUiDataRuntime.setQQQuickLoginList
|
||||||
WebUiDataRuntime.setQQQuickLoginList(res.LocalLoginInfoList.filter((item) => item.isQuickLogin).map((item) => item.uin.toString()));
|
WebUiDataRuntime.setQQQuickLoginList(res.LocalLoginInfoList.filter((item) => item.isQuickLogin).map((item) => item.uin.toString()));
|
||||||
});
|
});
|
||||||
|
if (basicInfoWrapper.QQVersionConfig?.curVersion) {
|
||||||
|
loginService.getLoginMiscData('hotUpdateSign').then((res) => {
|
||||||
|
if (res.result === 0) {
|
||||||
|
loginService.setLoginMiscData('hotUpdateSign', res.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
session.getNodeMiscService().writeVersionToRegistry(basicInfoWrapper.QQVersionConfig?.curVersion);
|
||||||
|
}
|
||||||
WebUiDataRuntime.setQuickLoginCall(async (uin: string) => {
|
WebUiDataRuntime.setQuickLoginCall(async (uin: string) => {
|
||||||
return await new Promise((resolve) => {
|
return await new Promise((resolve) => {
|
||||||
if (uin) {
|
if (uin) {
|
||||||
@@ -215,12 +242,24 @@ export async function NCoreInitShell() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// BEFORE LOGGING IN
|
// BEFORE LOGGING IN
|
||||||
|
let amgomDataPiece = 'eb1fd6ac257461580dc7438eb099f23aae04ca679f4d88f53072dc56e3bb1129';
|
||||||
|
o3Service.setAmgomDataPiece(basicInfoWrapper.QQVersionAppid, new Uint8Array(Buffer.from(amgomDataPiece, 'hex')));
|
||||||
// AFTER LOGGING IN
|
// AFTER LOGGING IN
|
||||||
|
//99b15bdb4c984fc69d5aa1feb9aa16xx --> 99b15bdb-4c98-4fc6-9d5a-a1feb9aa16xx
|
||||||
|
//把guid从左向右转换为guid格式 loginService.getMachineGuid()
|
||||||
|
|
||||||
|
let guid = loginService.getMachineGuid();
|
||||||
|
guid = guid.slice(0, 8) + '-' + guid.slice(8, 12) + '-' + guid.slice(12, 16) + '-' + guid.slice(16, 20) + '-' + guid.slice(20);
|
||||||
|
//console.log('guid:', guid);
|
||||||
|
//NodeIO3MiscService/reportAmgomWeather login a6 [ '1726748166943', '184', '329' ]
|
||||||
|
o3Service.reportAmgomWeather('login', 'a6', [dataTimestape, '184', '329']);
|
||||||
|
// if(session.getUnitedConfigService()){
|
||||||
|
// session.getUnitedConfigService().fetchUnitedCommendConfig([]);
|
||||||
|
// }
|
||||||
// from initSession
|
// from initSession
|
||||||
await new Promise<void>(async (resolve, reject) => {
|
await new Promise<void>(async (resolve, reject) => {
|
||||||
const sessionConfig = await genSessionConfig(
|
const sessionConfig = await genSessionConfig(
|
||||||
|
guid,
|
||||||
basicInfoWrapper.QQVersionAppid!,
|
basicInfoWrapper.QQVersionAppid!,
|
||||||
basicInfoWrapper.getFullQQVesion(),
|
basicInfoWrapper.getFullQQVesion(),
|
||||||
selfInfo.uin,
|
selfInfo.uin,
|
||||||
|
@@ -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.2', 'napcat-update-button', 'secondary'),
|
SettingButton('V2.6.10', '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.2", "napcat-update-button", "secondary")
|
SettingButton("V2.6.10", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user