Compare commits

...

3 Commits

Author SHA1 Message Date
手瓜一十雪
1a64e796bd release: 2.6.4 2024-09-17 23:17:19 +08:00
手瓜一十雪
a8b85a34f7 feat: 追平NT逻辑 2024-09-17 23:17:02 +08:00
手瓜一十雪
e7bec7d6b0 feat: systemPlatform标准化 2024-09-17 22:24:09 +08:00
8 changed files with 44 additions and 19 deletions

View File

@@ -4,7 +4,7 @@
"name": "NapCatQQ", "name": "NapCatQQ",
"slug": "NapCat.Framework", "slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现", "description": "高性能的 OneBot 11 协议实现",
"version": "2.6.3", "version": "2.6.4",
"icon": "./logo.png", "icon": "./logo.png",
"authors": [ "authors": [
{ {

View File

@@ -2,7 +2,7 @@
"name": "napcat", "name": "napcat",
"private": true, "private": true,
"type": "module", "type": "module",
"version": "2.6.3", "version": "2.6.4",
"scripts": { "scripts": {
"build:framework": "vite build --mode framework", "build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell", "build:shell": "vite build --mode shell",

View File

@@ -1 +1 @@
export const napCatVersion = '2.6.3'; export const napCatVersion = '2.6.4';

View File

@@ -251,18 +251,31 @@ export async function genSessionConfig(QQVersionAppid: string, QQVersion: string
const downloadPath = path.join(account_path, 'NapCat', 'temp'); const downloadPath = path.join(account_path, 'NapCat', 'temp');
fs.mkdirSync(downloadPath, { recursive: true }); fs.mkdirSync(downloadPath, { recursive: true });
const guid: string = await getMachineId();//26702 支持JS获取guid值 在LoginService中获取 TODO mlikiow a const guid: string = await getMachineId();//26702 支持JS获取guid值 在LoginService中获取 TODO mlikiow a
//os.platform()
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;
}
return { return {
selfUin, selfUin,
selfUid, selfUid,
desktopPathConfig: { desktopPathConfig: {
account_path, // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取 account_path, // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取
}, },
clientVer: QQVersion, // 9.9.8-22355 clientVer: QQVersion,
a2: '', a2: '',
d2: '', d2: '',
d2Key: '', d2Key: '',
machineId: '', machineId: '',
platform: PlatformType.KWINDOWS, // 3是Windows? platform: systemPlatform, // 3是Windows?
platVer: systemVersion, // 系统版本号, 应该可以固定 platVer: systemVersion, // 系统版本号, 应该可以固定
appid: QQVersionAppid, appid: QQVersionAppid,
rdeliveryConfig: { rdeliveryConfig: {
@@ -270,7 +283,7 @@ export async function genSessionConfig(QQVersionAppid: string, QQVersion: string
systemId: 0, systemId: 0,
appId: '', appId: '',
logicEnvironment: '', logicEnvironment: '',
platform: PlatformType.KWINDOWS, platform: systemPlatform,
language: '', language: '',
sdkVersion: '', sdkVersion: '',
userId: '', userId: '',

View File

@@ -144,7 +144,7 @@ export interface NodeQQNTWrapperUtil {
export interface NodeIQQNTWrapperSession { export interface NodeIQQNTWrapperSession {
create(): NodeIQQNTWrapperSession; create(): NodeIQQNTWrapperSession;
init( init(
wrapperSessionInitConfig: WrapperSessionInitConfig, wrapperSessionInitConfig: WrapperSessionInitConfig,
nodeIDependsAdapter: NodeIDependsAdapter, nodeIDependsAdapter: NodeIDependsAdapter,
@@ -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;
} }

View File

@@ -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();
} }

View File

@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem( SettingItem(
'<span id="napcat-update-title">Napcat</span>', '<span id="napcat-update-title">Napcat</span>',
undefined, undefined,
SettingButton('V2.6.3', 'napcat-update-button', 'secondary'), SettingButton('V2.6.4', 'napcat-update-button', 'secondary'),
), ),
]), ]),
SettingList([ SettingList([

View File

@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem( SettingItem(
'<span id="napcat-update-title">Napcat</span>', '<span id="napcat-update-title">Napcat</span>',
void 0, void 0,
SettingButton("V2.6.3", "napcat-update-button", "secondary") SettingButton("V2.6.4", "napcat-update-button", "secondary")
) )
]), ]),
SettingList([ SettingList([