No links are allowed. Not even domain names. :)

This commit is contained in:
Alexander Andreev 2021-09-16 16:26:55 +04:00
parent b14a6dbed4
commit bea24e50b0
Signed by: Arav
GPG Key ID: 610DF2574456329F
1 changed files with 4 additions and 2 deletions

View File

@ -64,9 +64,11 @@ exports.addPost = async (post) => {
if (post.message === undefined || post.message === "")
return reject("empty message");
if (post.message.includes("</a>"))
return reject("spam");
return reject("links are not allowed");
if (post.message.match(/(https?)?(:\/\/)?\S+( +)?(\.|\(?dot\)?)( +)?\S+(( +)?\/.+)?/gmi))
return reject("links are not allowed");
if (post.name === undefined || post.name === "")
post.name = "Anonymous";