Skip to content

Commit

Permalink
细节优化
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeRainStarSky committed Oct 29, 2024
1 parent 0c56cf7 commit 17136a1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 17136a1

Please sign in to comment.