Compare commits

..

2 Commits

Author SHA1 Message Date
手瓜一十雪
3b5e6553cd chore 2024-08-23 11:04:47 +08:00
手瓜一十雪
509390af20 release: 2.2.2 2024-08-23 11:01:24 +08:00
7 changed files with 12 additions and 32 deletions

View File

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

View File

@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "2.2.1",
"version": "2.2.2",
"scripts": {
"build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell",
@@ -48,7 +48,7 @@
"ajv": "^8.13.0",
"async-mutex": "^0.5.0",
"chalk": "^5.3.0",
"commander": "^12.2.1",
"commander": "^12.1.0",
"cors": "^2.8.5",
"express": "^5.0.0-beta.2",
"fast-xml-parser": "^4.3.6",

View File

@@ -2,7 +2,7 @@ import path, { dirname } from 'path';
import { fileURLToPath } from 'url';
import fs from 'fs';
export const napcat_version = '2.2.1';
export const napcat_version = '2.2.2';
export class NapCatPathWrapper {
binaryPath: string;

View File

@@ -1,4 +1,8 @@
// 此代码禁止除NapCat外任何地方使用 使用需获取许可
/**
* @description 此代码禁止除NapCat外任何地方使用 使用需获取许可
*@author: Mlikiowa
*@date: 2024-08-23
*/
let Process = require('process');
let os = require('os');
@@ -8,14 +12,12 @@ Process.dlopenOrig = Process.dlopen;
let RealWrapper;
let loginService;
//Fuck LoginService
class LoginService {
constructor() {
console.log('[NapCat] Fuck LoginService Loading...');
}
}
//NapCat 专有逻辑
let initCallBack;
let wrapperSession;
let wrapperLoginService;
@@ -31,13 +33,6 @@ function CreateFuckService(ServiceName) {
get: function (target, ClassFunName, receiver) {
return function () {
let ret = loginService[ClassFunName](...arguments);
// if (ret instanceof Promise) {
// ret.then((data) => {
// console.log("Called ", '实例方法 NodeIKernelLoginService/' + ClassFunName, ' 参数:', ...arguments, '返回:', data);
// });
// } else {
// console.log("Called ", '实例方法 NodeIKernelLoginService/' + ClassFunName, ' 参数:', ...arguments, '返回:', ret);
// }
return ret;
}
@@ -60,21 +55,12 @@ function CreateFuckService(ServiceName) {
if (ClassFunName == 'init') {
let origin = arguments[3].onSessionInitComplete;
arguments[3].onSessionInitComplete = function () {
//console.log("Listner ", '注册方法 NodeIKernelSessionListener/onSessionInitComplete', ' 参数:', ...arguments);
origin(...arguments);
initCallBack.forEach((cb) => cb(...arguments));
clearHook();
}
}
let ret = Session[ClassFunName](...arguments);
// if (ret instanceof Promise) {
// ret.then((data) => {
// console.log("Called ", '实例方法 NodeIQQNTWrapperSession/' + ClassFunName, ' 参数:', ...arguments, '返回:', data);
// });
// } else {
// console.log("Called ", '实例方法 NodeIQQNTWrapperSession/' + ClassFunName, ' 参数:', ...arguments, '返回:', ret);
// }
return ret;
}
@@ -91,12 +77,9 @@ function CreateFuckService(ServiceName) {
Process.dlopen = function (module, filename, flags = os.constants.dlopen.RTLD_LAZY) {
let dlopenRet = this.dlopenOrig(module, filename, flags);
if (filename.indexOf('wrapper.node') == -1) return dlopenRet;
//仅对Wrapper.node进行处理
RealWrapper = module.exports;
//先行获取LoginService操作权
loginService = new RealWrapper.NodeIKernelLoginService();
wrapperLoginService = loginService;
//开始针对性处理
module.exports = new Proxy({}, {
get: function (target, ServiceName, receiver) {
if (ServiceName == 'NodeIKernelLoginService') return CreateFuckService(ServiceName);
@@ -104,11 +87,8 @@ Process.dlopen = function (module, filename, flags = os.constants.dlopen.RTLD_LA
return RealWrapper[ServiceName];
}
});
//返回预先构造的对象
return dlopenRet;
};
//辅助函数
function clearHook() {
initCallBack = [];
process.dlopen = dlopenOrig;

View File

@@ -171,7 +171,7 @@ const _handlers: {
} else {
postData = data;
}
// Mlikiowa V2.2.1 Refactor Todo
// Mlikiowa V2.2.2 Refactor Todo
const signUrl = obContext.configLoader.configData.musicSignUrl;
if (!signUrl) {
if (data.type === 'qq') {

View File

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

View File

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