From a4a05497380257b784a0cd109a1e65b5ab7f0159 Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Tue, 4 Oct 2022 21:37:50 +0200 Subject: [PATCH] add quick spam check to postMsg --- js/posts.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/posts.js b/js/posts.js index 46ac7d0..9290cc5 100644 --- a/js/posts.js +++ b/js/posts.js @@ -61,11 +61,19 @@ socket.addEventListener("open",()=> { var cd = true //inversed "cooldown" +let last_called_postMsg = Date.now() + /* Tell the api to create a new post with the given information previously called "postMessage" */ function postMsg() { + if(last_called_postMsg - Date.now() < 100) { + createModal("slow down there") + debugger; + return; + } + last_called_postMsg = Date.now() let msg = getById("post-text").value let len = msg.length if(len==0){