From 7dde7cbc2b772c4f60d04847e53d19b023c9a540 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Sun, 28 Jan 2024 10:41:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=91=E9=80=81file://=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=E4=BC=9A=E8=AF=AF=E5=88=A0=E9=99=A4=E5=8E=9F?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/HttpServer.ts | 4 +--- src/renderer.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/HttpServer.ts b/src/main/HttpServer.ts index 7e724d6..92ee868 100644 --- a/src/main/HttpServer.ts +++ b/src/main/HttpServer.ts @@ -1,7 +1,6 @@ import {log} from "./utils"; const express = require("express"); -const bodyParser = require('body-parser'); import {sendIPCRecallQQMsg, sendIPCSendQQMsg} from "./IPCSend"; import {OnebotGroupMemberRole, PostDataAction, PostDataSendMsg, SendMessage} from "../common/types"; import {friends, groups, selfInfo} from "./data"; @@ -146,8 +145,7 @@ export function startExpress(port: number) { const app = express(); // 中间件,用于解析POST请求的请求体 app.use(express.urlencoded({extended: true, limit: "500mb"})); - app.use(bodyParser({limit: '500mb'})) - app.use(express.json()); + app.use(express.json({limit: '500mb'})); function parseToOnebot12(action: PostDataAction) { app.post('/' + action, (req: any, res: any) => { diff --git a/src/renderer.ts b/src/renderer.ts index a3c7628..7480df9 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -245,9 +245,9 @@ async function listenSendMessage(postData: PostDataSendMsg) { localFilePath = url.split("file://")[1] } else { localFilePath = await window.llonebot.downloadFile({uri: url, localFilePath: localFilePath}) + sendFiles.push(localFilePath); } message.file = localFilePath - sendFiles.push(localFilePath); } else if (message.type == "reply") { let msgId = message.data?.id || message.msgId let replyMessage = msgHistory.find(msg => msg.raw.msgId == msgId)