forked from MarseyWorld/MarseyWorld
sneed
parent
d84b26fc77
commit
9773930d48
|
@ -76,12 +76,16 @@ def get_logged_in_user():
|
||||||
|
|
||||||
if v: v.poor = session.get('poor')
|
if v: v.poor = session.get('poor')
|
||||||
|
|
||||||
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG' and not (v and v.id == AEVANN_ID):
|
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
|
||||||
with open(f"/eg", "r+", encoding="utf-8") as f:
|
if v and v.id != AEVANN_ID:
|
||||||
ip = request.headers.get('CF-Connecting-IP')
|
with open(f"/eg", "r+", encoding="utf-8") as f:
|
||||||
if f'{v}, {ip}' not in f.read():
|
ip = request.headers.get('CF-Connecting-IP')
|
||||||
t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())))
|
if f'@{v.username}, ' not in f.read():
|
||||||
f.write(f'{f.read()}{v}, {ip}, {t}\n')
|
t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())))
|
||||||
|
f.write(f'{f.read()}@{v.username}, {ip}, {t}\n')
|
||||||
|
elif not v and request.path not in ('/login','/signup'):
|
||||||
|
abort(401)
|
||||||
|
|
||||||
return v
|
return v
|
||||||
|
|
||||||
def check_ban_evade(v):
|
def check_ban_evade(v):
|
||||||
|
@ -124,24 +128,6 @@ def auth_required(f):
|
||||||
wrapper.__name__ = f.__name__
|
wrapper.__name__ = f.__name__
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
def auth_trusted_server(func):
|
|
||||||
@functools.wraps(func)
|
|
||||||
def inner(*args, **kwargs):
|
|
||||||
if not TRUSTED_SERVER_PSK: abort(401)
|
|
||||||
|
|
||||||
auth = request.headers.get("Authorization", None)
|
|
||||||
if not auth: abort(401)
|
|
||||||
|
|
||||||
auth_words = auth.split(' ')
|
|
||||||
if len(auth_words) != 2 or auth_words[0] != 'TrustedServer':
|
|
||||||
abort(401)
|
|
||||||
|
|
||||||
if not auth_words[1] == TRUSTED_SERVER_PSK:
|
|
||||||
abort(403)
|
|
||||||
|
|
||||||
return make_response(func(*args, **kwargs))
|
|
||||||
return inner
|
|
||||||
|
|
||||||
def is_not_permabanned(f):
|
def is_not_permabanned(f):
|
||||||
|
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue