mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
feat: 追平NT逻辑
This commit is contained in:
parent
e7bec7d6b0
commit
a8b85a34f7
@ -144,7 +144,7 @@ export interface NodeQQNTWrapperUtil {
|
||||
|
||||
export interface NodeIQQNTWrapperSession {
|
||||
create(): NodeIQQNTWrapperSession;
|
||||
|
||||
|
||||
init(
|
||||
wrapperSessionInitConfig: WrapperSessionInitConfig,
|
||||
nodeIDependsAdapter: NodeIDependsAdapter,
|
||||
@ -249,7 +249,7 @@ export interface NodeIQQNTWrapperSession {
|
||||
|
||||
export interface EnginInitDesktopConfig {
|
||||
base_path_prefix: string;
|
||||
platform_type: 3;
|
||||
platform_type: PlatformType;
|
||||
app_type: 4;
|
||||
app_version: string;
|
||||
os_version: string;
|
||||
@ -262,8 +262,7 @@ export interface EnginInitDesktopConfig {
|
||||
}
|
||||
|
||||
export interface NodeIQQNTWrapperEngine {
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-new
|
||||
new(): NodeIQQNTWrapperEngine;
|
||||
get(): NodeIQQNTWrapperEngine;
|
||||
|
||||
initWithDeskTopConfig(config: EnginInitDesktopConfig, nodeIGlobalAdapter: NodeIGlobalAdapter): void;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
NapCatCore,
|
||||
NapCatCoreWorkingEnv,
|
||||
NodeIQQNTWrapperSession,
|
||||
PlatformType,
|
||||
WrapperNodeApi,
|
||||
} from '@/core';
|
||||
import { QQBasicInfoWrapper } from '@/common/qq-basic-info';
|
||||
@ -43,7 +44,7 @@ export async function NCoreInitShell() {
|
||||
InitWebUi(logger, pathWrapper).then().catch(logger.logError);
|
||||
|
||||
// from constructor
|
||||
const engine = new wrapper.NodeIQQNTWrapperEngine();
|
||||
const engine = wrapper.NodeIQQNTWrapperEngine.get();
|
||||
//const util = wrapper.NodeQQNTWrapperUtil.get();
|
||||
const loginService = wrapper.NodeIKernelLoginService.get();
|
||||
const session = wrapper.NodeIQQNTWrapperSession.create();
|
||||
@ -63,17 +64,29 @@ export async function NCoreInitShell() {
|
||||
const dataPathGlobal = path.resolve(dataPath, './nt_qq/global');
|
||||
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
|
||||
engine.initWithDeskTopConfig(
|
||||
{
|
||||
base_path_prefix: '',
|
||||
platform_type: 3,
|
||||
platform_type: systemPlatform,
|
||||
app_type: 4,
|
||||
app_version: basicInfoWrapper.getFullQQVesion(),
|
||||
os_version: 'Windows 10 Pro',
|
||||
os_version: systemVersion,
|
||||
use_xlog: true,
|
||||
qua: basicInfoWrapper.QQVersionQua!,
|
||||
qua: basicInfoWrapper.QQVersionQua,
|
||||
global_path_config: {
|
||||
desktopGlobalPath: dataPathGlobal,
|
||||
},
|
||||
@ -83,7 +96,7 @@ export async function NCoreInitShell() {
|
||||
);
|
||||
loginService.initConfig({
|
||||
machineId: '',
|
||||
appid: basicInfoWrapper.QQVersionAppid!,
|
||||
appid: basicInfoWrapper.QQVersionAppid,
|
||||
platVer: systemVersion,
|
||||
commonPath: dataPathGlobal,
|
||||
clientVer: basicInfoWrapper.getFullQQVesion(),
|
||||
@ -209,7 +222,7 @@ export async function NCoreInitShell() {
|
||||
logger.log(`可用于快速登录的 QQ:\n${historyLoginList
|
||||
.map((u, index) => `${index + 1}. ${u.uin} ${u.nickName}`)
|
||||
.join('\n')
|
||||
}`);
|
||||
}`);
|
||||
}
|
||||
loginService.getQRCodePicture();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user