refactor: versionGet

This commit is contained in:
手瓜一十雪
2024-08-04 14:03:28 +08:00
parent c79130d34f
commit 0466f28e16
8 changed files with 98 additions and 126 deletions

View File

@@ -7,7 +7,7 @@ import { onGroupFileInfoUpdateParamType } from '@/core/listeners';
import { GeneralCallResult } from '@/core/services/common';
import { MessageUnique } from '../../../common/utils/MessageUnique';
import { NTEventDispatch } from '@/common/utils/EventTask';
import { requireMinNTQBuild } from '@/common/utils/QQBasicInfo';
import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo';
async function LoadMessageIdList(Peer: Peer, msgId: string) {
let msgList = await NTQQMsgApi.getMsgHistory(Peer, msgId, 50);
@@ -231,7 +231,7 @@ export class NTQQMsgApi {
return retMsg;
}
static async getMsgUnique(chatType: number, time: string) {
if (requireMinNTQBuild('26702')) {
if (requireMinNTQQBuild('26702')) {
return napCatCore.session.getMsgService().generateMsgUniqueId(chatType, time);
}
return napCatCore.session.getMsgService().getMsgUniqueId(time);

View File

@@ -7,7 +7,7 @@ import { RequestUtil } from '@/common/utils/request';
import { logWarn } from '@/common/utils/log';
import { NTEventDispatch } from '@/common/utils/EventTask';
import { NodeIKernelProfileService, ProfileBizType, UserDetailSource } from '@/core/services';
import { requireMinNTQBuild } from '@/common/utils/QQBasicInfo';
import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo';
export class NTQQUserApi {
static async getProfileLike(uid: string) {
@@ -50,14 +50,6 @@ export class NTQQUserApi {
static async setGroupAvatar(gc: string, filePath: string) {
return napCatCore.session.getGroupService().setHeader(gc, filePath);
}
static async getSelfInfo() {
}
static async getUserInfo(uid: string) {
}
// enum ProfileBizType {
// KALL,
// KBASEEXTEND,
@@ -139,7 +131,7 @@ export class NTQQUserApi {
return RetUser;
}
static async getUserDetailInfo(uid: string) {
if (requireMinNTQBuild('26702')) {
if (requireMinNTQQBuild('26702')) {
return this.fetchUserDetailInfo(uid);
}
return this.getUserDetailInfoOld(uid);

View File

@@ -15,7 +15,7 @@ import { DependsAdapter, DispatcherAdapter, GlobalAdapter, NodeIGlobalAdapter }
import path from 'node:path';
import os from 'node:os';
import fs from 'node:fs';
import { appid, qqVersionConfigInfo } from '@/common/utils/QQBasicInfo';
import { getFullQQVesion, getQUA, QQVersionAppid } from '@/common/utils/QQBasicInfo';
import { hostname, systemVersion } from '@/common/utils/system';
import { genSessionConfig } from '@/core/sessionConfig';
import { sleep } from '@/common/utils/helper';
@@ -139,10 +139,10 @@ export class NapCatCore {
base_path_prefix: '',
platform_type: 3,
app_type: 4,
app_version: qqVersionConfigInfo.curVersion,
app_version: getFullQQVesion(),
os_version: 'Windows 10 Pro',
use_xlog: true,
qua: `V1_WIN_NQ_${qqVersionConfigInfo.curVersion.replace('-', '_')}_GW_B`,
qua: getQUA(),
global_path_config: {
desktopGlobalPath: this.dataPathGlobal,
},
@@ -150,10 +150,10 @@ export class NapCatCore {
}, new QQWrapper.NodeIGlobalAdapter(new GlobalAdapter()));
this.loginService.initConfig({
machineId: '',
appid,
appid: QQVersionAppid,
platVer: systemVersion,
commonPath: this.dataPathGlobal,
clientVer: qqVersionConfigInfo.curVersion,
clientVer: getFullQQVesion(),
hostName: hostname
});
}

View File

@@ -1,4 +1,4 @@
import { appid, qqPkgInfo, qqVersionConfigInfo } from '@/common/utils/QQBasicInfo';
import { getFullQQVesion, QQVersionAppid } from '@/common/utils/QQBasicInfo';
import { hostname, systemName, systemVersion } from '@/common/utils/system';
import path from 'node:path';
import fs from 'node:fs';
@@ -79,7 +79,7 @@ export async function genSessionConfig(selfUin: string, selfUid: string, account
fs.mkdirSync(downloadPath, { recursive: true });
let guid: string = await getMachineId();
//console.log(guid);
// guid = '52afb776-82f6-4e59-9d38-44705b112d0a';
// guid = '52afb776-82f6-4e59-9d38-44705b112d0a';
//let guid: string = await getMachineId();
const config: WrapperSessionInitConfig = {
selfUin,
@@ -87,14 +87,14 @@ export async function genSessionConfig(selfUin: string, selfUid: string, account
desktopPathConfig: {
account_path // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取
},
clientVer: qqVersionConfigInfo.curVersion, // 9.9.8-22355
clientVer: getFullQQVesion(), // 9.9.8-22355
a2: '',
d2: '',
d2Key: '',
machineId: '',
platform: 3, // 3是Windows?
platVer: systemVersion, // 系统版本号, 应该可以固定
appid: appid,
appid: QQVersionAppid,
rdeliveryConfig: {
appKey: '',
systemId: 0,
@@ -110,18 +110,18 @@ export async function genSessionConfig(selfUin: string, selfUid: string, account
serverUrl: '',
fixedAfterHitKeys: ['']
},
'defaultFileDownloadPath': downloadPath,
'deviceInfo': {
defaultFileDownloadPath: downloadPath,
deviceInfo: {
guid,
'buildVer': qqPkgInfo.version,
'localId': 2052,
'devName': hostname,
'devType': systemName,
'vendorName': '',
'osVer': systemVersion,
'vendorOsName': systemName,
'setMute': false,
'vendorType': 0
buildVer: getFullQQVesion(),
localId: 2052,
devName: hostname,
devType: systemName,
vendorName: '',
osVer: systemVersion,
vendorOsName: systemName,
setMute: false,
vendorType: 0
},
'deviceConfig': '{"appearance":{"isSplitViewMode":true},"msg":{}}'
};

View File

@@ -26,7 +26,6 @@ import {
NodeIKernelRichMediaService,
NodeIKernelAvatarService,
} from './services';
import { qqVersionConfigInfo } from '@/common/utils/QQBasicInfo';
import { NodeIKernelStorageCleanService } from './services/NodeIKernelStorageCleanService';
import { NodeIKernelRobotService } from './services/NodeIKernelRobotService';
import { dirname } from "node:path"
@@ -43,6 +42,7 @@ import { NodeIKernelRecentContactService } from './services/NodeIKernelRecentCon
import { NodeIKernelMSFService } from './services/NodeIKernelMSFService';
import { NodeIkernelTestPerformanceService } from './services/NodeIkernelTestPerformanceService';
import { NodeIKernelECDHService } from './services/NodeIKernelECDHService';
import { getFullQQVesion } from '@/common/utils/QQBasicInfo';
const __filename = fileURLToPath(import.meta.url);
@@ -292,7 +292,7 @@ export interface WrapperNodeApi {
let wrapperNodePath = path.resolve(path.dirname(process.execPath), './resources/app/wrapper.node');
if (!fs.existsSync(wrapperNodePath)) {
wrapperNodePath = path.join(path.dirname(process.execPath), `resources/app/versions/${qqVersionConfigInfo.curVersion}/wrapper.node`);
wrapperNodePath = path.join(path.dirname(process.execPath), `resources/app/versions/${getFullQQVesion()}/wrapper.node`);
}
const nativemodule: any = { exports: {} };
process.dlopen(nativemodule, wrapperNodePath);