restore eg.log

master
Aevann 2023-03-10 04:05:00 +02:00
parent 2a03063f82
commit 7550f5ff99
1 changed files with 11 additions and 2 deletions

View File

@ -73,8 +73,17 @@ def get_logged_in_user():
v.last_active = timestamp
g.db.add(v)
if SITE == 'rdrama.net' and request.headers.get("Cf-Ipcountry") == 'EG' and not v:
abort(404)
if SITE == 'rdrama.net' and request.headers.get("Cf-Ipcountry") == 'EG':
if v:
if v.id != AEVANN_ID and not v.username.startswith('Aev'):
with open(f"{LOG_DIRECTORY}/eg.log", "a+", encoding="utf-8") as f:
f.seek(0)
ip = request.headers.get('CF-Connecting-IP')
if f'@{v.username}, ' not in f.read():
t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time()))
log_file(f'@{v.username}, {v.truescore}, {ip}, {t}\n', 'eg.log')
else:
abort(404)
g.is_api_or_xhr = bool((v and v.client) or request.headers.get("xhr"))