forked from rDrama/rDrama
1
0
Fork 0

dont iplog when GLOBAL

master
Aevann 2024-02-14 10:32:00 +02:00
parent 05e809cc50
commit 8d88a490cb
1 changed files with 13 additions and 14 deletions

View File

@ -69,20 +69,19 @@ def after_request(response):
g.v.last_active = timestamp
g.db.add(g.v)
if FEATURES['IP_LOGGING']:
if g.v.admin_level < PERMS['EXEMPT_FROM_IP_LOGGING']:
ip = get_IP()
if ip:
existing = g.db.query(IPLog).filter_by(user_id=user_id, ip=ip).one_or_none()
if existing:
existing.last_used = time.time()
g.db.add(existing)
else:
ip_log = IPLog(
user_id=user_id,
ip=ip,
)
g.db.add(ip_log)
if FEATURES['IP_LOGGING'] and not session.get("GLOBAL") and g.v.admin_level < PERMS['EXEMPT_FROM_IP_LOGGING']:
ip = get_IP()
if ip:
existing = g.db.query(IPLog).filter_by(user_id=user_id, ip=ip).one_or_none()
if existing:
existing.last_used = time.time()
g.db.add(existing)
else:
ip_log = IPLog(
user_id=user_id,
ip=ip,
)
g.db.add(ip_log)
_commit_and_close_db()