mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
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:
@@ -389,9 +389,17 @@ client
|
|||||||
|
|
||||||
return html
|
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.
|
//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)
|
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
|
//search the href for script injection //This is a temporary measure
|
||||||
if( findtext(href,"<script",1,0) )
|
if( findtext(href,"<script",1,0) )
|
||||||
world.log << "Attempted use of scripts within a topic call, by [src]"
|
world.log << "Attempted use of scripts within a topic call, by [src]"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
var/vote = null
|
var/vote = null
|
||||||
var/showvote = null
|
var/showvote = null
|
||||||
|
|
||||||
|
//Anti Link-spam!
|
||||||
|
var/next_allowed_topic_time = 10
|
||||||
// comment out the line below when debugging locally to enable the options & messages menu
|
// comment out the line below when debugging locally to enable the options & messages menu
|
||||||
control_freak = 1
|
control_freak = 1
|
||||||
Reference in New Issue
Block a user