forked from rDrama/rDrama
master
parent
7f61d1808b
commit
7318f311a5
|
@ -556,28 +556,28 @@ def thumbnail_thread(pid):
|
||||||
|
|
||||||
db = db_session()
|
db = db_session()
|
||||||
|
|
||||||
cpu = cpu_percent()
|
# cpu = cpu_percent()
|
||||||
|
|
||||||
time.sleep(0.1)
|
# time.sleep(0.1)
|
||||||
|
|
||||||
cpu = cpu_percent()
|
# cpu = cpu_percent()
|
||||||
|
|
||||||
if cpu > 70:
|
# if cpu > 70:
|
||||||
print(f'Cpu usage at {cpu}%, Enabling under attack mode!', flush=True)
|
# print(f'Cpu usage at {cpu}%, Enabling under attack mode!', flush=True)
|
||||||
with open('under_attack', 'r') as f: content = f.read()
|
# with open('under_attack', 'r') as f: content = f.read()
|
||||||
|
|
||||||
with open('under_attack', 'w') as f:
|
# with open('under_attack', 'w') as f:
|
||||||
if content == "no":
|
# if content == "no":
|
||||||
f.write("yes")
|
# f.write("yes")
|
||||||
ma = ModAction(
|
# ma = ModAction(
|
||||||
kind="enable_under_attack",
|
# kind="enable_under_attack",
|
||||||
user_id=AUTOJANNY_ID,
|
# user_id=AUTOJANNY_ID,
|
||||||
)
|
# )
|
||||||
db.add(ma)
|
# db.add(ma)
|
||||||
db.commit()
|
# db.commit()
|
||||||
data='{"value":"under_attack"}'
|
# data='{"value":"under_attack"}'
|
||||||
response = requests.patch(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, data=data)
|
# response = requests.patch(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, data=data)
|
||||||
print(response.text, flush=True)
|
# print(response.text, flush=True)
|
||||||
|
|
||||||
def expand_url(post_url, fragment_url):
|
def expand_url(post_url, fragment_url):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue