mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
refactor: versionGet
This commit is contained in:
@@ -1,61 +1,32 @@
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import os from 'node:os';
|
|
||||||
import { systemPlatform } from '@/common/utils/system';
|
import { systemPlatform } from '@/common/utils/system';
|
||||||
import { logError } from '@/common/utils/log';
|
import { getDefaultQQVersionConfigInfo, getQQVersionConfigPath } from './helper';
|
||||||
export const exePath = process.execPath;
|
|
||||||
|
|
||||||
export const pkgInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'package.json');
|
//基础目录获取
|
||||||
let configVersionInfoPath;
|
export let QQMainPath = process.execPath;
|
||||||
|
export let QQPackageInfoPath: string = path.join(path.dirname(QQMainPath), 'resources', 'app', 'package.json');
|
||||||
|
export let QQVersionConfigPath: string | undefined = getQQVersionConfigPath();
|
||||||
|
|
||||||
if (os.platform() !== 'linux') {
|
//基础信息获取 无快更则启用默认模板填充
|
||||||
configVersionInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'versions', 'config.json');
|
export let QQVersionAppid: string = systemPlatform === 'linux' ? '537237950' : '537237765';
|
||||||
} else {
|
export let isQuickUpdate: boolean = !!QQVersionConfigPath;
|
||||||
const userPath = os.homedir();
|
export let QQVersionConfig: QQVersionConfigType = isQuickUpdate ? JSON.parse(fs.readFileSync(QQVersionConfigPath!).toString()) : getDefaultQQVersionConfigInfo();
|
||||||
const appDataPath = path.resolve(userPath, './.config/QQ');
|
export let QQPackageInfo: QQPackageInfoType = JSON.parse(fs.readFileSync(QQPackageInfoPath).toString());
|
||||||
configVersionInfoPath = path.resolve(appDataPath, './versions/config.json');
|
|
||||||
|
//基础函数
|
||||||
|
export function getQQBuildStr() {
|
||||||
|
return isQuickUpdate ? QQVersionConfig.buildId : QQPackageInfo.buildVersion;
|
||||||
}
|
}
|
||||||
|
export function getFullQQVesion() {
|
||||||
if (typeof configVersionInfoPath !== 'string') {
|
return isQuickUpdate ? QQVersionConfig.curVersion : QQPackageInfo.version;
|
||||||
throw new Error('Something went wrong when load QQ info path');
|
|
||||||
}
|
}
|
||||||
|
export function requireMinNTQQBuild(buildStr: string) {
|
||||||
export { configVersionInfoPath };
|
return parseInt(getQQBuildStr()) >= parseInt(buildStr);
|
||||||
|
|
||||||
type QQPkgInfo = {
|
|
||||||
version: string;
|
|
||||||
buildVersion: string;
|
|
||||||
platform: string;
|
|
||||||
eleArch: string;
|
|
||||||
}
|
}
|
||||||
type QQVersionConfigInfo = {
|
export function getQUA() {
|
||||||
baseVersion: string;
|
return systemPlatform === 'linux' ? `V1_LNX_NQ_${getFullQQVesion()}_${getQQBuildStr()}_GW_B` : `V1_WIN_NQ_${getFullQQVesion()}_${getQQBuildStr()}_GW_B`;
|
||||||
curVersion: string;
|
|
||||||
prevVersion: string;
|
|
||||||
onErrorVersions: Array<any>;
|
|
||||||
buildId: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let _qqVersionConfigInfo: QQVersionConfigInfo = {
|
|
||||||
'baseVersion': '9.9.15-26702',
|
|
||||||
'curVersion': '9.9.15-26702',
|
|
||||||
'prevVersion': '',
|
|
||||||
'onErrorVersions': [],
|
|
||||||
'buildId': '26702'
|
|
||||||
};
|
|
||||||
|
|
||||||
if (fs.existsSync(configVersionInfoPath)) {
|
|
||||||
try {
|
|
||||||
const _ = JSON.parse(fs.readFileSync(configVersionInfoPath).toString());
|
|
||||||
_qqVersionConfigInfo = Object.assign(_qqVersionConfigInfo, _);
|
|
||||||
} catch (e) {
|
|
||||||
logError('Load QQ version config info failed, Use default version', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const qqVersionConfigInfo: QQVersionConfigInfo = _qqVersionConfigInfo;
|
|
||||||
//V1_WIN_NQ_9.9.12_25765_GW_B
|
|
||||||
export const qqPkgInfo: QQPkgInfo = JSON.parse(fs.readFileSync(pkgInfoPath).toString());
|
|
||||||
// platform_type: 3,
|
// platform_type: 3,
|
||||||
// app_type: 4,
|
// app_type: 4,
|
||||||
// app_version: '9.9.12-25765',
|
// app_version: '9.9.12-25765',
|
||||||
@@ -63,16 +34,6 @@ export const qqPkgInfo: QQPkgInfo = JSON.parse(fs.readFileSync(pkgInfoPath).toSt
|
|||||||
// appid: '537234702',
|
// appid: '537234702',
|
||||||
// platVer: '10.0.26100',
|
// platVer: '10.0.26100',
|
||||||
// clientVer: '9.9.9-25765',
|
// clientVer: '9.9.9-25765',
|
||||||
|
|
||||||
// Linux
|
// Linux
|
||||||
// app_version: '3.2.9-25765',
|
// app_version: '3.2.9-25765',
|
||||||
// qua: 'V1_LNX_NQ_3.2.10_25765_GW_B',
|
// qua: 'V1_LNX_NQ_3.2.10_25765_GW_B',
|
||||||
export function requireMinNTQBuild(buildStr: string) {
|
|
||||||
return parseInt(qqVersionConfigInfo.buildId) >= parseInt(buildStr);
|
|
||||||
}
|
|
||||||
let _appid: string = '537237765'; // 默认为 Windows 平台的 appid
|
|
||||||
if (systemPlatform === 'linux') {
|
|
||||||
_appid = '537237950';
|
|
||||||
}
|
|
||||||
// todo: mac 平台的 appid
|
|
||||||
export const appid = _appid;
|
|
@@ -1,10 +1,11 @@
|
|||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'fs/promises';
|
import fs from 'fs';
|
||||||
import { log, logDebug } from './log';
|
import { log, logDebug } from './log';
|
||||||
import { dirname } from 'node:path';
|
import { dirname } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import * as fsPromise from 'node:fs/promises';
|
import * as fsPromise from 'node:fs/promises';
|
||||||
|
import os from 'node:os';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = dirname(__filename);
|
const __dirname = dirname(__filename);
|
||||||
@@ -304,14 +305,14 @@ export function migrateConfig(oldConfig: any) {
|
|||||||
}
|
}
|
||||||
// 升级旧的配置到新的
|
// 升级旧的配置到新的
|
||||||
export async function UpdateConfig() {
|
export async function UpdateConfig() {
|
||||||
const configFiles = await fs.readdir(path.join(__dirname, 'config'));
|
const configFiles = await fsPromise.readdir(path.join(__dirname, 'config'));
|
||||||
for (const file of configFiles) {
|
for (const file of configFiles) {
|
||||||
if (file.match(/^onebot11_\d+.json$/)) {
|
if (file.match(/^onebot11_\d+.json$/)) {
|
||||||
const CurrentConfig = JSON.parse(await fs.readFile(path.join(__dirname, 'config', file), 'utf8'));
|
const CurrentConfig = JSON.parse(await fsPromise.readFile(path.join(__dirname, 'config', file), 'utf8'));
|
||||||
if (isValidOldConfig(CurrentConfig)) {
|
if (isValidOldConfig(CurrentConfig)) {
|
||||||
log('正在迁移旧配置到新配置 File:', file);
|
log('正在迁移旧配置到新配置 File:', file);
|
||||||
const NewConfig = migrateConfig(CurrentConfig);
|
const NewConfig = migrateConfig(CurrentConfig);
|
||||||
await fs.writeFile(path.join(__dirname, 'config', file), JSON.stringify(NewConfig, null, 2));
|
await fsPromise.writeFile(path.join(__dirname, 'config', file), JSON.stringify(NewConfig, null, 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +332,42 @@ export function isEqual(obj1: any, obj2: any) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
export function getDefaultQQVersionConfigInfo(): QQVersionConfigType {
|
||||||
|
if (os.platform() === 'linux') {
|
||||||
|
return {
|
||||||
|
baseVersion: '3.2.12-26702',
|
||||||
|
curVersion: '3.2.12-26702',
|
||||||
|
prevVersion: '',
|
||||||
|
onErrorVersions: [],
|
||||||
|
buildId: '26702'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
baseVersion: '9.9.15-26702',
|
||||||
|
curVersion: '9.9.15-26702',
|
||||||
|
prevVersion: '',
|
||||||
|
onErrorVersions: [],
|
||||||
|
buildId: '26702'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getQQVersionConfigPath(exePath: string = ""): string | undefined {
|
||||||
|
let configVersionInfoPath;
|
||||||
|
if (os.platform() !== 'linux') {
|
||||||
|
configVersionInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'versions', 'config.json');
|
||||||
|
} else {
|
||||||
|
const userPath = os.homedir();
|
||||||
|
const appDataPath = path.resolve(userPath, './.config/QQ');
|
||||||
|
configVersionInfoPath = path.resolve(appDataPath, './versions/config.json');
|
||||||
|
}
|
||||||
|
if (typeof configVersionInfoPath !== 'string') {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(configVersionInfoPath)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return configVersionInfoPath;
|
||||||
|
}
|
||||||
export async function deleteOldFiles(directoryPath: string, daysThreshold: number) {
|
export async function deleteOldFiles(directoryPath: string, daysThreshold: number) {
|
||||||
try {
|
try {
|
||||||
const files = await fsPromise.readdir(directoryPath);
|
const files = await fsPromise.readdir(directoryPath);
|
||||||
|
@@ -1,31 +1,14 @@
|
|||||||
/**
|
//QQVersionType
|
||||||
* 运行时类型转换与检查类
|
type QQPackageInfoType = {
|
||||||
*/
|
version: string;
|
||||||
export class TypeCheck {
|
buildVersion: string;
|
||||||
static isEmpty(value: any): boolean {
|
platform: string;
|
||||||
return value === null || value === undefined || value === '' ||
|
eleArch: string;
|
||||||
(Array.isArray(value) && value.length === 0) || (typeof value === 'object' && Object.keys(value).length === 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
type QQVersionConfigType = {
|
||||||
export class TypeConvert {
|
baseVersion: string;
|
||||||
static toNumber(value: any): number {
|
curVersion: string;
|
||||||
const num = Number(value);
|
prevVersion: string;
|
||||||
if (isNaN(num)) {
|
onErrorVersions: Array<any>;
|
||||||
throw new Error(`无法将输入转换为数字: ${value}`);
|
buildId: string;
|
||||||
}
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
static toString(value: any): string {
|
|
||||||
return String(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static toBoolean(value: any): boolean {
|
|
||||||
return Boolean(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static toArray(value: any): any[] {
|
|
||||||
return Array.isArray(value) ? value : [value];
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -7,7 +7,7 @@ import { onGroupFileInfoUpdateParamType } from '@/core/listeners';
|
|||||||
import { GeneralCallResult } from '@/core/services/common';
|
import { GeneralCallResult } from '@/core/services/common';
|
||||||
import { MessageUnique } from '../../../common/utils/MessageUnique';
|
import { MessageUnique } from '../../../common/utils/MessageUnique';
|
||||||
import { NTEventDispatch } from '@/common/utils/EventTask';
|
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) {
|
async function LoadMessageIdList(Peer: Peer, msgId: string) {
|
||||||
let msgList = await NTQQMsgApi.getMsgHistory(Peer, msgId, 50);
|
let msgList = await NTQQMsgApi.getMsgHistory(Peer, msgId, 50);
|
||||||
@@ -231,7 +231,7 @@ export class NTQQMsgApi {
|
|||||||
return retMsg;
|
return retMsg;
|
||||||
}
|
}
|
||||||
static async getMsgUnique(chatType: number, time: string) {
|
static async getMsgUnique(chatType: number, time: string) {
|
||||||
if (requireMinNTQBuild('26702')) {
|
if (requireMinNTQQBuild('26702')) {
|
||||||
return napCatCore.session.getMsgService().generateMsgUniqueId(chatType, time);
|
return napCatCore.session.getMsgService().generateMsgUniqueId(chatType, time);
|
||||||
}
|
}
|
||||||
return napCatCore.session.getMsgService().getMsgUniqueId(time);
|
return napCatCore.session.getMsgService().getMsgUniqueId(time);
|
||||||
|
@@ -7,7 +7,7 @@ import { RequestUtil } from '@/common/utils/request';
|
|||||||
import { logWarn } from '@/common/utils/log';
|
import { logWarn } from '@/common/utils/log';
|
||||||
import { NTEventDispatch } from '@/common/utils/EventTask';
|
import { NTEventDispatch } from '@/common/utils/EventTask';
|
||||||
import { NodeIKernelProfileService, ProfileBizType, UserDetailSource } from '@/core/services';
|
import { NodeIKernelProfileService, ProfileBizType, UserDetailSource } from '@/core/services';
|
||||||
import { requireMinNTQBuild } from '@/common/utils/QQBasicInfo';
|
import { requireMinNTQQBuild } from '@/common/utils/QQBasicInfo';
|
||||||
|
|
||||||
export class NTQQUserApi {
|
export class NTQQUserApi {
|
||||||
static async getProfileLike(uid: string) {
|
static async getProfileLike(uid: string) {
|
||||||
@@ -50,14 +50,6 @@ export class NTQQUserApi {
|
|||||||
static async setGroupAvatar(gc: string, filePath: string) {
|
static async setGroupAvatar(gc: string, filePath: string) {
|
||||||
return napCatCore.session.getGroupService().setHeader(gc, filePath);
|
return napCatCore.session.getGroupService().setHeader(gc, filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getSelfInfo() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static async getUserInfo(uid: string) {
|
|
||||||
|
|
||||||
}
|
|
||||||
// enum ProfileBizType {
|
// enum ProfileBizType {
|
||||||
// KALL,
|
// KALL,
|
||||||
// KBASEEXTEND,
|
// KBASEEXTEND,
|
||||||
@@ -139,7 +131,7 @@ export class NTQQUserApi {
|
|||||||
return RetUser;
|
return RetUser;
|
||||||
}
|
}
|
||||||
static async getUserDetailInfo(uid: string) {
|
static async getUserDetailInfo(uid: string) {
|
||||||
if (requireMinNTQBuild('26702')) {
|
if (requireMinNTQQBuild('26702')) {
|
||||||
return this.fetchUserDetailInfo(uid);
|
return this.fetchUserDetailInfo(uid);
|
||||||
}
|
}
|
||||||
return this.getUserDetailInfoOld(uid);
|
return this.getUserDetailInfoOld(uid);
|
||||||
|
@@ -15,7 +15,7 @@ import { DependsAdapter, DispatcherAdapter, GlobalAdapter, NodeIGlobalAdapter }
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import fs from 'node:fs';
|
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 { hostname, systemVersion } from '@/common/utils/system';
|
||||||
import { genSessionConfig } from '@/core/sessionConfig';
|
import { genSessionConfig } from '@/core/sessionConfig';
|
||||||
import { sleep } from '@/common/utils/helper';
|
import { sleep } from '@/common/utils/helper';
|
||||||
@@ -139,10 +139,10 @@ export class NapCatCore {
|
|||||||
base_path_prefix: '',
|
base_path_prefix: '',
|
||||||
platform_type: 3,
|
platform_type: 3,
|
||||||
app_type: 4,
|
app_type: 4,
|
||||||
app_version: qqVersionConfigInfo.curVersion,
|
app_version: getFullQQVesion(),
|
||||||
os_version: 'Windows 10 Pro',
|
os_version: 'Windows 10 Pro',
|
||||||
use_xlog: true,
|
use_xlog: true,
|
||||||
qua: `V1_WIN_NQ_${qqVersionConfigInfo.curVersion.replace('-', '_')}_GW_B`,
|
qua: getQUA(),
|
||||||
global_path_config: {
|
global_path_config: {
|
||||||
desktopGlobalPath: this.dataPathGlobal,
|
desktopGlobalPath: this.dataPathGlobal,
|
||||||
},
|
},
|
||||||
@@ -150,10 +150,10 @@ export class NapCatCore {
|
|||||||
}, new QQWrapper.NodeIGlobalAdapter(new GlobalAdapter()));
|
}, new QQWrapper.NodeIGlobalAdapter(new GlobalAdapter()));
|
||||||
this.loginService.initConfig({
|
this.loginService.initConfig({
|
||||||
machineId: '',
|
machineId: '',
|
||||||
appid,
|
appid: QQVersionAppid,
|
||||||
platVer: systemVersion,
|
platVer: systemVersion,
|
||||||
commonPath: this.dataPathGlobal,
|
commonPath: this.dataPathGlobal,
|
||||||
clientVer: qqVersionConfigInfo.curVersion,
|
clientVer: getFullQQVesion(),
|
||||||
hostName: hostname
|
hostName: hostname
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -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 { hostname, systemName, systemVersion } from '@/common/utils/system';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
@@ -79,7 +79,7 @@ export async function genSessionConfig(selfUin: string, selfUid: string, account
|
|||||||
fs.mkdirSync(downloadPath, { recursive: true });
|
fs.mkdirSync(downloadPath, { recursive: true });
|
||||||
let guid: string = await getMachineId();
|
let guid: string = await getMachineId();
|
||||||
//console.log(guid);
|
//console.log(guid);
|
||||||
// guid = '52afb776-82f6-4e59-9d38-44705b112d0a';
|
// guid = '52afb776-82f6-4e59-9d38-44705b112d0a';
|
||||||
//let guid: string = await getMachineId();
|
//let guid: string = await getMachineId();
|
||||||
const config: WrapperSessionInitConfig = {
|
const config: WrapperSessionInitConfig = {
|
||||||
selfUin,
|
selfUin,
|
||||||
@@ -87,14 +87,14 @@ export async function genSessionConfig(selfUin: string, selfUid: string, account
|
|||||||
desktopPathConfig: {
|
desktopPathConfig: {
|
||||||
account_path // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取
|
account_path // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取
|
||||||
},
|
},
|
||||||
clientVer: qqVersionConfigInfo.curVersion, // 9.9.8-22355
|
clientVer: getFullQQVesion(), // 9.9.8-22355
|
||||||
a2: '',
|
a2: '',
|
||||||
d2: '',
|
d2: '',
|
||||||
d2Key: '',
|
d2Key: '',
|
||||||
machineId: '',
|
machineId: '',
|
||||||
platform: 3, // 3是Windows?
|
platform: 3, // 3是Windows?
|
||||||
platVer: systemVersion, // 系统版本号, 应该可以固定
|
platVer: systemVersion, // 系统版本号, 应该可以固定
|
||||||
appid: appid,
|
appid: QQVersionAppid,
|
||||||
rdeliveryConfig: {
|
rdeliveryConfig: {
|
||||||
appKey: '',
|
appKey: '',
|
||||||
systemId: 0,
|
systemId: 0,
|
||||||
@@ -110,18 +110,18 @@ export async function genSessionConfig(selfUin: string, selfUid: string, account
|
|||||||
serverUrl: '',
|
serverUrl: '',
|
||||||
fixedAfterHitKeys: ['']
|
fixedAfterHitKeys: ['']
|
||||||
},
|
},
|
||||||
'defaultFileDownloadPath': downloadPath,
|
defaultFileDownloadPath: downloadPath,
|
||||||
'deviceInfo': {
|
deviceInfo: {
|
||||||
guid,
|
guid,
|
||||||
'buildVer': qqPkgInfo.version,
|
buildVer: getFullQQVesion(),
|
||||||
'localId': 2052,
|
localId: 2052,
|
||||||
'devName': hostname,
|
devName: hostname,
|
||||||
'devType': systemName,
|
devType: systemName,
|
||||||
'vendorName': '',
|
vendorName: '',
|
||||||
'osVer': systemVersion,
|
osVer: systemVersion,
|
||||||
'vendorOsName': systemName,
|
vendorOsName: systemName,
|
||||||
'setMute': false,
|
setMute: false,
|
||||||
'vendorType': 0
|
vendorType: 0
|
||||||
},
|
},
|
||||||
'deviceConfig': '{"appearance":{"isSplitViewMode":true},"msg":{}}'
|
'deviceConfig': '{"appearance":{"isSplitViewMode":true},"msg":{}}'
|
||||||
};
|
};
|
||||||
|
@@ -26,7 +26,6 @@ import {
|
|||||||
NodeIKernelRichMediaService,
|
NodeIKernelRichMediaService,
|
||||||
NodeIKernelAvatarService,
|
NodeIKernelAvatarService,
|
||||||
} from './services';
|
} from './services';
|
||||||
import { qqVersionConfigInfo } from '@/common/utils/QQBasicInfo';
|
|
||||||
import { NodeIKernelStorageCleanService } from './services/NodeIKernelStorageCleanService';
|
import { NodeIKernelStorageCleanService } from './services/NodeIKernelStorageCleanService';
|
||||||
import { NodeIKernelRobotService } from './services/NodeIKernelRobotService';
|
import { NodeIKernelRobotService } from './services/NodeIKernelRobotService';
|
||||||
import { dirname } from "node:path"
|
import { dirname } from "node:path"
|
||||||
@@ -43,6 +42,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 { getFullQQVesion } from '@/common/utils/QQBasicInfo';
|
||||||
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
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');
|
let wrapperNodePath = path.resolve(path.dirname(process.execPath), './resources/app/wrapper.node');
|
||||||
if (!fs.existsSync(wrapperNodePath)) {
|
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: {} };
|
const nativemodule: any = { exports: {} };
|
||||||
process.dlopen(nativemodule, wrapperNodePath);
|
process.dlopen(nativemodule, wrapperNodePath);
|
||||||
|
Reference in New Issue
Block a user