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))