diff --git a/files/routes/allroutes.py b/files/routes/allroutes.py index 5cf5caad0..b079c953f 100644 --- a/files/routes/allroutes.py +++ b/files/routes/allroutes.py @@ -61,6 +61,13 @@ def after_request(response): if response.status_code < 400: if hasattr(g, 'v') and g.v: user_id = g.v.id + + if not session.get("GLOBAL") and request.method == "POST": + timestamp = int(time.time()) + if (g.v.last_active + LOGGEDIN_ACTIVE_TIME) < timestamp: + g.v.last_active = timestamp + g.db.add(g.v) + _commit_and_close_db() if request.method == "POST": diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index d3269dbb0..087f0b053 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -107,16 +107,6 @@ def get_logged_in_user(): g.v = v - if v: - # Check against last_active + ACTIVE_TIME to reduce frequency of - # UPDATEs in exchange for a ±ACTIVE_TIME margin of error. - - if not session.get("GLOBAL") and request.method == "POST": - timestamp = int(time.time()) - if (v.last_active + LOGGEDIN_ACTIVE_TIME) < timestamp: - v.last_active = timestamp - g.db.add(v) - if not v and SITE == 'rdrama.net' and request.headers.get("Cf-Ipcountry") == 'EG' and request.method == 'GET' and request.full_path != '/login?nig=a': abort(404)