mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Compare commits
4 Commits
edf7a97269
...
0d27ef7ebc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0d27ef7ebc | ||
![]() |
479e8c9d25 | ||
![]() |
e3dffa24f8 | ||
![]() |
30b8793ee1 |
@ -4,16 +4,12 @@
|
||||
"name": "LLOneBot",
|
||||
"slug": "LLOneBot",
|
||||
"description": "实现 OneBot 11 和 Satori 协议,用于 QQ 机器人开发",
|
||||
"version": "4.1.3",
|
||||
"version": "4.1.4",
|
||||
"icon": "./icon.webp",
|
||||
"authors": [
|
||||
{
|
||||
"name": "linyuchen",
|
||||
"link": "https://github.com/linyuchen"
|
||||
},
|
||||
{
|
||||
"name": "idranme",
|
||||
"link": "https://github.com/idranme"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
|
@ -26,7 +26,7 @@
|
||||
"cosmokit": "^1.6.3",
|
||||
"express": "^5.0.1",
|
||||
"fluent-ffmpeg": "^2.1.3",
|
||||
"minato": "^3.6.0",
|
||||
"minato": "^3.6.1",
|
||||
"protobufjs": "^7.4.0",
|
||||
"silk-wasm": "^3.6.3",
|
||||
"ts-case-convert": "^2.1.0",
|
||||
@ -35,14 +35,14 @@
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/fluent-ffmpeg": "^2.1.26",
|
||||
"@types/fluent-ffmpeg": "^2.1.27",
|
||||
"@types/node": "^20.14.15",
|
||||
"@types/ws": "^8.5.12",
|
||||
"@types/ws": "^8.5.13",
|
||||
"electron": "^31.4.0",
|
||||
"electron-vite": "^2.3.0",
|
||||
"protobufjs-cli": "^1.1.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.10 ",
|
||||
"vite": "^5.4.10",
|
||||
"vite-plugin-cp": "^4.0.8"
|
||||
},
|
||||
"packageManager": "yarn@4.5.1"
|
||||
|
9
src/common/utils/window.ts
Normal file
9
src/common/utils/window.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { BrowserWindow } from 'electron'
|
||||
import { log } from '@/common/utils'
|
||||
|
||||
export function getAllWindowIds(): number[] {
|
||||
const allWindows = BrowserWindow.getAllWindows();
|
||||
const ids = allWindows.map(window => window.id);
|
||||
log('getAllWindowIds', ids);
|
||||
return ids;
|
||||
}
|
@ -180,7 +180,6 @@ function onLoad() {
|
||||
if (self.uin) {
|
||||
clearInterval(intervalId)
|
||||
log('process pid', process.pid)
|
||||
|
||||
const config = getConfigUtil().getConfig()
|
||||
|
||||
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
|
||||
@ -191,7 +190,6 @@ function onLoad() {
|
||||
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')
|
||||
return
|
||||
}
|
||||
|
||||
ctx.plugin(Log, {
|
||||
enable: config.log!,
|
||||
filename: logFileName
|
||||
|
@ -40,6 +40,8 @@ const callHooks: Array<{
|
||||
}> = []
|
||||
|
||||
export function startHook() {
|
||||
log('start hook')
|
||||
|
||||
const senderExclude = Symbol()
|
||||
|
||||
ipcMain.emit = new Proxy(ipcMain.emit, {
|
||||
@ -50,7 +52,6 @@ export function startHook() {
|
||||
if (logHook) {
|
||||
log('request', args)
|
||||
}
|
||||
|
||||
const event = args[1]
|
||||
if (event.sender && !event.sender[senderExclude]) {
|
||||
event.sender[senderExclude] = true
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ipcMain } from 'electron'
|
||||
import { hookApiCallbacks, registerReceiveHook, removeReceiveHook } from './hook'
|
||||
import { getBuildVersion, log } from '../common/utils'
|
||||
import { log } from '../common/utils'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import {
|
||||
GeneralCallResult,
|
||||
@ -108,13 +108,26 @@ interface InvokeOptions<ReturnType> {
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
let channel: NTChannel
|
||||
|
||||
function getChannel() {
|
||||
if (channel) {
|
||||
return channel
|
||||
}
|
||||
if (ipcMain.eventNames().includes(NTChannel.IPC_UP_2)) {
|
||||
return channel = NTChannel.IPC_UP_2
|
||||
} else {
|
||||
return channel = NTChannel.IPC_UP_3
|
||||
}
|
||||
}
|
||||
|
||||
export function invoke<
|
||||
R extends Awaited<ReturnType<Extract<NTService[S][M], (...args: any) => unknown>>>,
|
||||
S extends keyof NTService = any,
|
||||
M extends keyof NTService[S] & string = any
|
||||
>(method: Extract<unknown, `${S}/${M}`> | string, args: unknown[], options: InvokeOptions<R> = {}) {
|
||||
const className = options.className ?? NTClass.NT_API
|
||||
const channel = options.channel ?? getBuildVersion() >= 28788 ? NTChannel.IPC_UP_3 : NTChannel.IPC_UP_2
|
||||
const channel = options.channel ?? getChannel()
|
||||
const timeout = options.timeout ?? 5000
|
||||
const afterFirstCmd = options.afterFirstCmd ?? true
|
||||
let eventName = className + '-' + channel[channel.length - 1]
|
||||
|
@ -1 +1 @@
|
||||
export const version = '4.1.3'
|
||||
export const version = '4.1.4'
|
||||
|
Loading…
x
Reference in New Issue
Block a user