add length check to post endpoint

This commit is contained in:
Mystikfluu 2022-06-23 21:11:24 +02:00
parent b5f60d1acf
commit 7e14d7da8d

View File

@ -556,6 +556,12 @@ router.post("/api/post", async function(req,res) {
} else {
reply_id = req.body.reply_id
}
if(req.body.message.length > 1000) {
res.json({"error":"message too long"})
return
}
req.body.message = encodeURIComponent(req.body.message.trim())
req.body.receiver = encodeURIComponent(req.body.receiver||"")
if(req.body.receiver == "")req.body.receiver="everyone"