From 0d0ef1d6c14e6645b54319689d46e9fffc69e23c Mon Sep 17 00:00:00 2001 From: Akif9748 Date: Fri, 16 Sep 2022 22:46:08 +0300 Subject: [PATCH] Add app.ips, bans --- README.md | 2 +- routes/api/routes/bans.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 218280e..6251b47 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn - upload other photos, model for it - category system bloat. - replace not found errors with no perm -- prewiev for send messages in markdown format. Markdown in user about +- prewiev for send messages in markdown format. Markdown in user about, deprecate clean content ## Major Version History - V4: Caching - V3: New Theme diff --git a/routes/api/routes/bans.js b/routes/api/routes/bans.js index f499c19..82a3368 100644 --- a/routes/api/routes/bans.js +++ b/routes/api/routes/bans.js @@ -22,7 +22,10 @@ app.get("/:ip", async (req, res) => { app.post("/:ip", async (req, res) => { if (await BanModel.exists({ ip: req.params.ip })) return res.error(400, "This ip is already banned."); - res.complate(await BanModel.create({ ip: req.params.ip, reason: req.query.reason || "No reason given", authorID: req.user.id })); + const ban = await BanModel.create({ ip: req.params.ip, reason: req.query.reason || "No reason given", authorID: req.user.id }); + req.app.ips.push(req.params.ip); + res.complate(ban); + });