mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
napcat native
This commit is contained in:
parent
cfd7808169
commit
1ce8cd2100
BIN
src/native/external/MoeHoo.win32.node
vendored
Normal file
BIN
src/native/external/MoeHoo.win32.node
vendored
Normal file
Binary file not shown.
15
src/native/index.ts
Normal file
15
src/native/index.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { constants } from "node:os";
|
||||||
|
import path from "path";
|
||||||
|
import { dlopen } from "process";
|
||||||
|
export class Native {
|
||||||
|
platform: string;
|
||||||
|
supportedPlatforms = ['win32'];
|
||||||
|
MoeHooExport: any = { exports: {} };
|
||||||
|
constructor(nodePath: string, platform: string = process.platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
if (!this.supportedPlatforms.includes(this.platform)) {
|
||||||
|
throw new Error(`Platform ${this.platform} is not supported`);
|
||||||
|
}
|
||||||
|
dlopen(this.MoeHooExport, path.join(nodePath, './native/MoeHoo.win32.node'), constants.dlopen.RTLD_LAZY);
|
||||||
|
}
|
||||||
|
}
|
@ -29,6 +29,7 @@ import { InitWebUi } from '@/webui';
|
|||||||
import { WebUiDataRuntime } from '@/webui/src/helper/Data';
|
import { WebUiDataRuntime } from '@/webui/src/helper/Data';
|
||||||
import { napCatVersion } from '@/common/version';
|
import { napCatVersion } from '@/common/version';
|
||||||
import { NodeIO3MiscListener } from '@/core/listeners/NodeIO3MiscListener';
|
import { NodeIO3MiscListener } from '@/core/listeners/NodeIO3MiscListener';
|
||||||
|
import { Native } from '@/native';
|
||||||
|
|
||||||
program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
|
program.option('-q, --qq [number]', 'QQ号').parse(process.argv);
|
||||||
const cmdOptions = program.opts();
|
const cmdOptions = program.opts();
|
||||||
@ -55,6 +56,11 @@ export async function NCoreInitShell() {
|
|||||||
|
|
||||||
const session = wrapper.NodeIQQNTWrapperSession.create();
|
const session = wrapper.NodeIQQNTWrapperSession.create();
|
||||||
|
|
||||||
|
let appNative = new Native(pathWrapper.binaryPath);
|
||||||
|
appNative.MoeHooExport.exports.registMsgPush((...args: any[]) => {
|
||||||
|
console.log(args);
|
||||||
|
});
|
||||||
|
console.log(appNative);
|
||||||
// from get dataPath
|
// from get dataPath
|
||||||
const [dataPath, dataPathGlobal] = (() => {
|
const [dataPath, dataPathGlobal] = (() => {
|
||||||
if (os.platform() === 'darwin') {
|
if (os.platform() === 'darwin') {
|
||||||
|
@ -41,6 +41,7 @@ const FrameworkBaseConfigPlugin: PluginOption[] = [
|
|||||||
const ShellBaseConfigPlugin: PluginOption[] = [
|
const ShellBaseConfigPlugin: PluginOption[] = [
|
||||||
cp({
|
cp({
|
||||||
targets: [
|
targets: [
|
||||||
|
{ src: './src/native/external', dest: 'dist/native', flatten: false },
|
||||||
{ src: './static/', dest: 'dist/static/', flatten: false },
|
{ src: './static/', dest: 'dist/static/', flatten: false },
|
||||||
{ src: './src/core/external/napcat.json', dest: 'dist/config/' },
|
{ src: './src/core/external/napcat.json', dest: 'dist/config/' },
|
||||||
{ src: './src/onebot/config/onebot11.json', dest: 'dist/config/' },
|
{ src: './src/onebot/config/onebot11.json', dest: 'dist/config/' },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user