From c4d7073fea90ed15364afb34220db19c67f77a17 Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Sun, 27 May 2012 04:34:50 +0000 Subject: [PATCH] A very simple anti link-spam thingy. I've tried to set it as high as possible without it being uncomfortable. But if text-links seem unresponsive just lower TOPIC_SPAM_DELAY. It's currently set to half a second. That means that a client can only click one link every half-second rather than upwards of 10 a second. So about a 80% reduction. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3682 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/datumvars.dm | 8 ++++++++ code/defines/client.dm | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index c162bf66724..2718fcf55ef 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -389,9 +389,17 @@ client return html +#define TOPIC_SPAM_DELAY 5 //5 tick delay is a little under half a second //All BYOND links pass through client/Topic() FIRST and are then directed to [hsrc]/Topic() by the ..() call at the end. client/Topic(href, href_list, hsrc) + if(next_allowed_topic_time > world.time) + //we have previously sent a Topic() call withing the last [TOPIC_SPAM_DELAY] ticks. + //drop the Topic call to preventc crashing/lagging the server via link-spamming +// src << "\red Error: SPAM" + return + next_allowed_topic_time = world.time + TOPIC_SPAM_DELAY + //search the href for script injection //This is a temporary measure if( findtext(href,"