Add app.ips, bans

This commit is contained in:
Akif9748 2022-09-16 22:46:08 +03:00
parent 214dd16515
commit 0d0ef1d6c1
2 changed files with 5 additions and 2 deletions

View file

@ -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 - upload other photos, model for it
- category system bloat. - category system bloat.
- replace not found errors with no perm - 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 ## Major Version History
- V4: Caching - V4: Caching
- V3: New Theme - V3: New Theme

View file

@ -22,7 +22,10 @@ app.get("/:ip", async (req, res) => {
app.post("/: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."); 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);
}); });