From 17136a1420f80b65196f2ca8beba5f5adb646261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8C=8C?= Date: Tue, 29 Oct 2024 21:48:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bot.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/bot.js b/lib/bot.js index ff7586dc..ee6da008 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -66,9 +66,11 @@ export default class Yunzai extends EventEmitter { this.makeLog(quiet?"debug":"mark", ["HTTP", req.method, "请求", req.headers, req.query, req.body], `${req.sid} <= ${req.rid}`, true) req.next() }) - .use("/exit", req => { - if (["::1", "::ffff:127.0.0.1"].includes(req.ip) || req.hostname === "localhost") - process.exit(1) + .use("/exit", async req => { + if (!["::1", "::ffff:127.0.0.1"].includes(req.ip) && req.hostname !== "localhost") return + if (process.env.app_type === "pm2") + await this.exec("pnpm stop") + process.exit(1) }) .use("/File", (...args) => this.fileSend(...args))