mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3b5e6553cd | ||
![]() |
509390af20 | ||
![]() |
9ad511a9c0 | ||
![]() |
89c102513d |
82
.github/workflows/release.yml
vendored
82
.github/workflows/release.yml
vendored
@@ -30,34 +30,34 @@ jobs:
|
|||||||
ls
|
ls
|
||||||
node ./script/checkVersion.cjs
|
node ./script/checkVersion.cjs
|
||||||
sh ./checkVersion.sh
|
sh ./checkVersion.sh
|
||||||
# Build-LiteLoader:
|
Build-LiteLoader:
|
||||||
# needs: [check-version]
|
needs: [check-version]
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# steps:
|
steps:
|
||||||
# - name: Clone Main Repository
|
- name: Clone Main Repository
|
||||||
# uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
# with:
|
with:
|
||||||
# repository: 'NapNeko/NapCatQQ'
|
repository: 'NapNeko/NapCatQQ'
|
||||||
# submodules: true
|
submodules: true
|
||||||
# ref: main
|
ref: main
|
||||||
# token: ${{ secrets.NAPCAT_BUILD }}
|
token: ${{ secrets.NAPCAT_BUILD }}
|
||||||
# - name: Use Node.js 20.X
|
- name: Use Node.js 20.X
|
||||||
# uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
# with:
|
with:
|
||||||
# node-version: 20.x
|
node-version: 20.x
|
||||||
|
|
||||||
# - name: Build NuCat Framework
|
- name: Build NuCat Framework
|
||||||
# run: |
|
run: |
|
||||||
# npm i
|
npm i
|
||||||
# npm run build:framework
|
npm run build:framework
|
||||||
# cd dist
|
cd dist
|
||||||
# npm i --omit=dev
|
npm i --omit=dev
|
||||||
# cd ..
|
cd ..
|
||||||
# - name: Upload Artifact
|
- name: Upload Artifact
|
||||||
# uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
# with:
|
with:
|
||||||
# name: NapCat.Framework
|
name: NapCat.Framework
|
||||||
# path: dist
|
path: dist
|
||||||
Build-Shell:
|
Build-Shell:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [check-version]
|
needs: [check-version]
|
||||||
@@ -90,31 +90,30 @@ jobs:
|
|||||||
path: dist
|
path: dist
|
||||||
|
|
||||||
release-napcat:
|
release-napcat:
|
||||||
needs: [Build-Shell]
|
needs: [Build-LiteLoader,Build-Shell]
|
||||||
# needs: [Build-LiteLoader,Build-Shell]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download All Artifact
|
- name: Download All Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
- name: Compress subdirectories
|
|
||||||
run: |
|
|
||||||
cd ./NapCat.Shell/
|
|
||||||
zip -q -r NapCat.Shell.zip *
|
|
||||||
cd ..
|
|
||||||
rm ./NapCat.Shell.zip -rf
|
|
||||||
mv ./NapCat.Shell/NapCat.Shell.zip ./
|
|
||||||
# - name: Compress subdirectories
|
# - name: Compress subdirectories
|
||||||
# run: |
|
# run: |
|
||||||
# cd ./NapCat.Shell/
|
# cd ./NapCat.Shell/
|
||||||
# zip -q -r NapCat.Shell.zip *
|
# zip -q -r NapCat.Shell.zip *
|
||||||
# cd ..
|
# cd ..
|
||||||
# cd ./NapCat.Framework/
|
|
||||||
# zip -q -r NapCat.Framework.zip *
|
|
||||||
# cd ..
|
|
||||||
# rm ./NapCat.Shell.zip -rf
|
# rm ./NapCat.Shell.zip -rf
|
||||||
# rm ./NapCat.Framework.zip -rf
|
|
||||||
# mv ./NapCat.Shell/NapCat.Shell.zip ./
|
# mv ./NapCat.Shell/NapCat.Shell.zip ./
|
||||||
# mv ./NapCat.Framework/NapCat.Framework.zip ./
|
- name: Compress subdirectories
|
||||||
|
run: |
|
||||||
|
cd ./NapCat.Shell/
|
||||||
|
zip -q -r NapCat.Shell.zip *
|
||||||
|
cd ..
|
||||||
|
cd ./NapCat.Framework/
|
||||||
|
zip -q -r NapCat.Framework.zip *
|
||||||
|
cd ..
|
||||||
|
rm ./NapCat.Shell.zip -rf
|
||||||
|
rm ./NapCat.Framework.zip -rf
|
||||||
|
mv ./NapCat.Shell/NapCat.Shell.zip ./
|
||||||
|
mv ./NapCat.Framework/NapCat.Framework.zip ./
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
@@ -128,5 +127,6 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
body_path: CHANGELOG.md
|
body_path: CHANGELOG.md
|
||||||
files: |
|
files: |
|
||||||
|
NapCat.Framework.zip
|
||||||
NapCat.Shell.zip
|
NapCat.Shell.zip
|
||||||
draft: true
|
draft: true
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "2.1.0",
|
"version": "2.2.2",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.1.0",
|
"version": "2.2.2",
|
||||||
"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",
|
||||||
|
@@ -2,7 +2,7 @@ import path, { dirname } from 'path';
|
|||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
export const napcat_version = '2.1.0';
|
export const napcat_version = '2.2.2';
|
||||||
|
|
||||||
export class NapCatPathWrapper {
|
export class NapCatPathWrapper {
|
||||||
binaryPath: string;
|
binaryPath: string;
|
||||||
|
4
src/core/external/appid.json
vendored
4
src/core/external/appid.json
vendored
@@ -22,5 +22,9 @@
|
|||||||
"9.9.15-27254":{
|
"9.9.15-27254":{
|
||||||
"appid": 537240709,
|
"appid": 537240709,
|
||||||
"qua": "V1_WIN_NQ_9.9.15_27254_GW_B"
|
"qua": "V1_WIN_NQ_9.9.15_27254_GW_B"
|
||||||
|
},
|
||||||
|
"9.9.15-27333": {
|
||||||
|
"appid": 537240709,
|
||||||
|
"qua": "V1_WIN_NQ_9.9.15_27333_GW_B"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,82 +1,101 @@
|
|||||||
// https://github.com/NapNeko/LiteLoader-NapCatExample/blob/main/src/common/proxy.ts
|
/**
|
||||||
// By Mlikiowa
|
* @description 此代码禁止除NapCat外任何地方使用 使用需获取许可
|
||||||
|
*@author: Mlikiowa
|
||||||
|
*@date: 2024-08-23
|
||||||
|
*/
|
||||||
|
|
||||||
const process = require('process');
|
let Process = require('process');
|
||||||
const os = require('os');
|
let os = require('os');
|
||||||
const path = require('path');
|
let path = require('path');
|
||||||
|
Process.dlopenOrig = Process.dlopen;
|
||||||
|
|
||||||
|
let RealWrapper;
|
||||||
|
let loginService;
|
||||||
|
|
||||||
|
class LoginService {
|
||||||
|
constructor() {
|
||||||
|
console.log('[NapCat] Fuck LoginService Loading...');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let initCallBack;
|
||||||
|
let wrapperSession;
|
||||||
|
let wrapperLoginService;
|
||||||
const currentPath = path.dirname(__filename);
|
const currentPath = path.dirname(__filename);
|
||||||
|
|
||||||
const dlopenOrig = process.dlopen;
|
function CreateFuckService(ServiceName) {
|
||||||
|
return new Proxy(() => { }, {
|
||||||
|
get: function (target, FunctionName, receiver) {
|
||||||
|
console.log("Proxy... Event:", ServiceName + '/' + FunctionName);
|
||||||
|
if (ServiceName == 'NodeIKernelLoginService' && FunctionName == 'get') {
|
||||||
|
return function () {
|
||||||
|
let ret = new Proxy(new LoginService(), {
|
||||||
|
get: function (target, ClassFunName, receiver) {
|
||||||
|
return function () {
|
||||||
|
let ret = loginService[ClassFunName](...arguments);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
let wrapperSession;
|
}
|
||||||
let wrapperNodeApi;
|
})
|
||||||
let wrapperLoginService;
|
return ret;
|
||||||
let initCallBack;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Proxy dlopen
|
if (ServiceName == 'NodeIQQNTWrapperSession' && FunctionName == 'create') {
|
||||||
process.dlopen = (module, filename, flags = os.constants.dlopen.RTLD_LAZY) => {
|
return new Proxy(() => { }, {
|
||||||
dlopenOrig(module, filename, flags);
|
apply: function (target, thisArg, argArray) {
|
||||||
for (const export_name in module.exports) {
|
let Session = RealWrapper.NodeIQQNTWrapperSession[FunctionName](...argArray);
|
||||||
module.exports[export_name] = new Proxy(module.exports[export_name], {
|
//传递Session
|
||||||
construct: (target, args, _newTarget) => {
|
wrapperSession = Session;
|
||||||
let constructed;
|
|
||||||
if (export_name === 'NodeIKernelSessionListener') {
|
let ret = new Proxy(Session, {
|
||||||
let HookedArg = [];
|
get: function (target, ClassFunName, receiver) {
|
||||||
for (let ArgIndex in args) {
|
return function () {
|
||||||
if (args[ArgIndex] instanceof Object) {
|
if (ClassFunName == 'init') {
|
||||||
let HookArg = {};
|
let origin = arguments[3].onSessionInitComplete;
|
||||||
for (let ListenerName in args[ArgIndex]) {
|
arguments[3].onSessionInitComplete = function () {
|
||||||
HookArg[ListenerName] = function (...ListenerData) {
|
origin(...arguments);
|
||||||
try {
|
initCallBack.forEach((cb) => cb(...arguments));
|
||||||
if (ListenerName === 'onSessionInitComplete') {
|
|
||||||
//回调成功
|
|
||||||
initCallBack.forEach((cb) => cb(...ListenerData));
|
|
||||||
clearHook();
|
clearHook();
|
||||||
}
|
}
|
||||||
//console.log("Construct-ARG-Apply", ListenerName, JSON.stringify(ListenerData, null, 2));
|
|
||||||
} catch (error) {
|
|
||||||
// ignored
|
|
||||||
}
|
}
|
||||||
args[ArgIndex][ListenerName](...ListenerData);
|
let ret = Session[ClassFunName](...arguments);
|
||||||
};
|
return ret;
|
||||||
HookedArg.push(HookArg);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 其它类型
|
|
||||||
//console.log("Construct-ARG-NotProxy", args[keyArg]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
constructed = new target(...HookedArg);
|
});
|
||||||
} else {
|
return ret;
|
||||||
constructed = new target(...args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (export_name === 'NodeIQQNTWrapperSession') wrapperSession = constructed;
|
|
||||||
if (export_name === 'NodeIKernelLoginService') wrapperLoginService = constructed;
|
|
||||||
|
|
||||||
return constructed;
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (filename.toLowerCase().includes('wrapper.node')) {
|
|
||||||
wrapperNodeApi = module.exports;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
RealWrapper = module.exports;
|
||||||
|
loginService = new RealWrapper.NodeIKernelLoginService();
|
||||||
|
wrapperLoginService = loginService;
|
||||||
|
module.exports = new Proxy({}, {
|
||||||
|
get: function (target, ServiceName, receiver) {
|
||||||
|
if (ServiceName == 'NodeIKernelLoginService') return CreateFuckService(ServiceName);
|
||||||
|
if (ServiceName == 'NodeIQQNTWrapperSession') return CreateFuckService(ServiceName);
|
||||||
|
return RealWrapper[ServiceName];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return dlopenRet;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 清理 Hook
|
|
||||||
*/
|
|
||||||
function clearHook() {
|
function clearHook() {
|
||||||
initCallBack = [];
|
initCallBack = [];
|
||||||
process.dlopen = dlopenOrig;
|
process.dlopen = dlopenOrig;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ntIsInitialized_Internal() {
|
function ntIsInitialized_Internal() {
|
||||||
return wrapperSession !== undefined
|
return wrapperSession !== undefined;
|
||||||
&& wrapperNodeApi !== undefined
|
|
||||||
&& wrapperLoginService !== undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pollForNTInitializationCheck() {
|
function pollForNTInitializationCheck() {
|
||||||
@@ -111,7 +130,7 @@ async function fetchServices(timeout = 10000) {
|
|||||||
setTimeout(() => resolve(false), timeout);
|
setTimeout(() => resolve(false), timeout);
|
||||||
}),
|
}),
|
||||||
]).then(result => result ?
|
]).then(result => result ?
|
||||||
{ wrapperSession, wrapperNodeApi, wrapperLoginService } :
|
{ wrapperSession, wrapperLoginService } :
|
||||||
Promise.reject("fetchServices Timeout!"),
|
Promise.reject("fetchServices Timeout!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -171,7 +171,7 @@ const _handlers: {
|
|||||||
} else {
|
} else {
|
||||||
postData = data;
|
postData = data;
|
||||||
}
|
}
|
||||||
// Mlikiowa V2.1.0 Refactor Todo
|
// Mlikiowa V2.2.2 Refactor Todo
|
||||||
const signUrl = obContext.configLoader.configData.musicSignUrl;
|
const signUrl = obContext.configLoader.configData.musicSignUrl;
|
||||||
if (!signUrl) {
|
if (!signUrl) {
|
||||||
if (data.type === 'qq') {
|
if (data.type === 'qq') {
|
||||||
|
@@ -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.1.0', 'napcat-update-button', 'secondary'),
|
SettingButton('V2.2.2', 'napcat-update-button', 'secondary'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
@@ -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.1.0", "napcat-update-button", "secondary")
|
SettingButton("V2.2.2", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user