mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: 追平NT逻辑
This commit is contained in:
parent
e7bec7d6b0
commit
a8b85a34f7
@ -249,7 +249,7 @@ 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;
|
||||||
@ -262,8 +262,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -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';
|
||||||
@ -43,7 +44,7 @@ export async function NCoreInitShell() {
|
|||||||
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();
|
||||||
@ -63,17 +64,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.KANDROID; //Android 怎么不算Linux!
|
||||||
|
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: true,
|
||||||
qua: basicInfoWrapper.QQVersionQua!,
|
qua: basicInfoWrapper.QQVersionQua,
|
||||||
global_path_config: {
|
global_path_config: {
|
||||||
desktopGlobalPath: dataPathGlobal,
|
desktopGlobalPath: dataPathGlobal,
|
||||||
},
|
},
|
||||||
@ -83,7 +96,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(),
|
||||||
@ -209,7 +222,7 @@ export async function NCoreInitShell() {
|
|||||||
logger.log(`可用于快速登录的 QQ:\n${historyLoginList
|
logger.log(`可用于快速登录的 QQ:\n${historyLoginList
|
||||||
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
|
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
|
||||||
.join('\n')
|
.join('\n')
|
||||||
}`);
|
}`);
|
||||||
}
|
}
|
||||||
loginService.getQRCodePicture();
|
loginService.getQRCodePicture();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user