Ratelimit fix + replace html content in messages

This commit is contained in:
Akif9748 2022-08-28 17:14:05 +03:00
parent afc55b4dcb
commit b1afa3e9a9
2 changed files with 5 additions and 5 deletions

View file

@ -20,7 +20,7 @@ function renderMessage(message) {
<a href="/users/${message.author.id}"> ${message.author.name}</a>: <a href="/users/${message.author.id}"> ${message.author.name}</a>:
</h2> </h2>
<p>${message.content.replaceAll("\n", "<br>")}</p><br> <p>${message.content.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;").replaceAll("\n", "<br>")}</p><br>
<div id="message-delete-${message.id}"> <div id="message-delete-${message.id}">
${/* if */!message.deleted ? ${/* if */!message.deleted ?
` `

View file

@ -5,12 +5,12 @@ const rateLimit = require('express-rate-limit')
const app = Router(); const app = Router();
app.get("/", (req, res) => res.reply("register", { user: null })); app.get("/", rateLimit({
app.post("/", rateLimit({
windowMs: 24 * 60 * 60_000, max: 1, standardHeaders: true, legacyHeaders: false, windowMs: 24 * 60 * 60_000, max: 1, standardHeaders: true, legacyHeaders: false,
handler: (_r, response, _n, options) => response.error(options.statusCode, "You are begin ratelimited") handler: (_r, response, _n, options) => response.error(options.statusCode, "You are begin ratelimited")
}), async (req, res) => { }), (req, res) => res.reply("register", { user: null }));
app.post("/", async (req, res) => {
req.session.userid = null; req.session.userid = null;