From bea24e50b0f4e2d89db09a5c47af07a0f8c4dc42 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 16 Sep 2021 16:26:55 +0400 Subject: [PATCH] No links are allowed. Not even domain names. :) --- homepage/guestbook.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homepage/guestbook.js b/homepage/guestbook.js index 328f30f..bfd755e 100644 --- a/homepage/guestbook.js +++ b/homepage/guestbook.js @@ -64,9 +64,11 @@ exports.addPost = async (post) => { if (post.message === undefined || post.message === "") return reject("empty message"); - + if (post.message.includes("")) - 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";