diff --git a/src/common/helper.ts b/src/common/helper.ts index c758c3a9..198c44da 100644 --- a/src/common/helper.ts +++ b/src/common/helper.ts @@ -179,18 +179,18 @@ export function getDefaultQQVersionConfigInfo(): QQVersionConfigType { }; } -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 { - return path.join(path.dirname(exePath), 'resources', 'app', 'package.json'); + return path.join(path.dirname(exePath), './versions/9.9.15-28060/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'); diff --git a/src/common/qq-basic-info.ts b/src/common/qq-basic-info.ts index 4184902b..91570676 100644 --- a/src/common/qq-basic-info.ts +++ b/src/common/qq-basic-info.ts @@ -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; @@ -53,23 +55,23 @@ export class QQBasicInfoWrapper { //此方法不要直接使用 getQUAInternal() { switch (systemPlatform) { - case 'linux': - return `V1_LNX_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; - case 'darwin': - return `V1_MAC_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; - default: - return `V1_WIN_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; + case 'linux': + return `V1_LNX_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; + case 'darwin': + return `V1_MAC_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; + default: + return `V1_WIN_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; } } getAppidInternal() { switch (systemPlatform) { - case 'linux': - return '537243600'; - case 'darwin': - return '537243441'; - default: - return '537243538'; + case 'linux': + return '537243600'; + case 'darwin': + return '537243441'; + default: + return '537243538'; } } diff --git a/src/core/index.ts b/src/core/index.ts index cf6667b2..6f9791eb 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -46,14 +46,15 @@ export function loadQQWrapper(QQVersion: string): WrapperNodeApi { if (os.platform() === 'darwin') { appPath = path.resolve(path.dirname(process.execPath), '../Resources/app'); } else { - appPath = path.resolve(path.dirname(process.execPath), './resources/app'); + 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); + //\versions\9.9.15-28060\resources\app\wrapper.node return nativemodule.exports; }