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; } }