From 191ce0798ff1f25d69d31946fec051c5a42b4b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 11 Aug 2024 00:53:15 +0800 Subject: [PATCH] chore: fix --- src/core/apis/file.ts | 2 +- src/onebot/network/passive-http.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index 9b463250..e955603b 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -37,7 +37,7 @@ export class NTQQFileApi { } async copyFile(filePath: string, destPath: string) { - await this.context.wrapper.util.copyFile(filePath, destPath); + await this.core.util.copyFile(filePath, destPath); } async getFileSize(filePath: string): Promise { diff --git a/src/onebot/network/passive-http.ts b/src/onebot/network/passive-http.ts index 3051cf28..56fa5764 100644 --- a/src/onebot/network/passive-http.ts +++ b/src/onebot/network/passive-http.ts @@ -28,6 +28,7 @@ export class OB11PassiveHttpAdapter implements IOB11NetworkAdapter { this.actionMap.set(action.actionName, action); } registerActionMap(actionMap: Map>) { + this.actionMap = actionMap; } registerHeartBeat() { @@ -53,8 +54,8 @@ export class OB11PassiveHttpAdapter implements IOB11NetworkAdapter { this.server = http.createServer(this.app); this.app.use(express.json()); - - this.app.all('/*', this.handleRequest.bind(this)); + this.app.use(express.urlencoded({ extended: false })); + this.app.use('/', (req, res) => this.handleRequest(req, res)); this.server.listen(this.port, () => { this.coreContext.context.logger.log(`HTTP server listening on port ${this.port}`); @@ -85,5 +86,6 @@ export class OB11PassiveHttpAdapter implements IOB11NetworkAdapter { this.isOpen = false; this.hasBeenClosed = true; this.server?.close(); + this.app = undefined; } }