From 9838b010328fef6dc8d3bfcd5b85d1c4f1939e69 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 30 Jul 2022 01:23:33 +0200 Subject: [PATCH] sneed --- files/helpers/wrappers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index b8e1fa291..d36b46a2a 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -76,11 +76,12 @@ def get_logged_in_user(): if v: v.poor = session.get('poor') - if request.headers.get("Cf-Ipcountry") == 'EG': - with open(f"/eg", "a", encoding="utf-8") as f: + if request.headers.get("Cf-Ipcountry") == 'EG' and not (v and v.id == AEVANN_ID): + with open(f"/eg", "a+", encoding="utf-8") as f: ip = request.headers.get('CF-Connecting-IP') - t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time()))) - f.write(f'{v}, {ip}, {t}\n') + if f'{v}, {ip}' not in f.read(): + t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time()))) + f.write(f'{v}, {ip}, {t}\n') return v