forked from rDrama/rDrama
make WPD perma-under-attack
parent
48d630e077
commit
1d278cebe0
|
@ -389,7 +389,7 @@ def reported_comments(v):
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@admin_level_required(PERMS['ADMIN_HOME_VISIBLE'])
|
@admin_level_required(PERMS['ADMIN_HOME_VISIBLE'])
|
||||||
def admin_home(v):
|
def admin_home(v):
|
||||||
if CLOUDFLARE_AVAILABLE:
|
if SITE == 'rdrama.net':
|
||||||
try: under_attack = (requests.get(f"{CLOUDFLARE_API_URL}/zones/{CF_ZONE}/settings/security_level", headers=CF_HEADERS, timeout=CLOUDFLARE_REQUEST_TIMEOUT_SECS).json()['result']['value'] == "under_attack")
|
try: under_attack = (requests.get(f"{CLOUDFLARE_API_URL}/zones/{CF_ZONE}/settings/security_level", headers=CF_HEADERS, timeout=CLOUDFLARE_REQUEST_TIMEOUT_SECS).json()['result']['value'] == "under_attack")
|
||||||
except: return render_template("admin/admin_home.html", v=v)
|
except: return render_template("admin/admin_home.html", v=v)
|
||||||
set_setting('under_attack', under_attack)
|
set_setting('under_attack', under_attack)
|
||||||
|
|
|
@ -56,11 +56,8 @@ def calc_users():
|
||||||
g.loggedin_counter = len(loggedin)
|
g.loggedin_counter = len(loggedin)
|
||||||
g.loggedout_counter = len(loggedout)
|
g.loggedout_counter = len(loggedout)
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv':
|
if SITE == 'rdrama.net':
|
||||||
ddos_threshold = 3500
|
|
||||||
else:
|
|
||||||
ddos_threshold = 1000
|
ddos_threshold = 1000
|
||||||
|
|
||||||
if g.loggedin_counter + g.loggedout_counter > ddos_threshold:
|
if g.loggedin_counter + g.loggedout_counter > ddos_threshold:
|
||||||
if not get_setting('under_attack'):
|
if not get_setting('under_attack'):
|
||||||
set_setting('under_attack', True)
|
set_setting('under_attack', True)
|
||||||
|
|
Loading…
Reference in New Issue