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
This commit is contained in:
elly1989@rocketmail.com
2012-05-27 04:34:50 +00:00
parent 329c71c306
commit c4d7073fea
2 changed files with 10 additions and 2 deletions

View File

@@ -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,"<script",1,0) )
world.log << "Attempted use of scripts within a topic call, by [src]"