forked from rDrama/rDrama
decouple v.last_active from the calc_users
parent
39aa59a37a
commit
6465982580
|
@ -15,11 +15,6 @@ def calc_users(v):
|
||||||
if v:
|
if v:
|
||||||
if session["session_id"] in loggedout: del loggedout[session["session_id"]]
|
if session["session_id"] in loggedout: del loggedout[session["session_id"]]
|
||||||
loggedin[v.id] = timestamp
|
loggedin[v.id] = timestamp
|
||||||
# Check against last_active + ACTIVE_TIME to reduce frequency of
|
|
||||||
# UPDATEs in exchange for a ±ACTIVE_TIME margin of error.
|
|
||||||
if (v.last_active + LOGGEDIN_ACTIVE_TIME) < timestamp:
|
|
||||||
v.last_active = timestamp
|
|
||||||
g.db.add(v)
|
|
||||||
else:
|
else:
|
||||||
ua = str(user_agents.parse(g.agent))
|
ua = str(user_agents.parse(g.agent))
|
||||||
if 'spider' not in ua.lower() and 'bot' not in ua.lower():
|
if 'spider' not in ua.lower() and 'bot' not in ua.lower():
|
||||||
|
@ -75,7 +70,14 @@ def get_logged_in_user():
|
||||||
|
|
||||||
g.v = v
|
g.v = v
|
||||||
|
|
||||||
if v: v.poor = session.get('poor')
|
if v:
|
||||||
|
v.poor = session.get('poor')
|
||||||
|
# Check against last_active + ACTIVE_TIME to reduce frequency of
|
||||||
|
# UPDATEs in exchange for a ±ACTIVE_TIME margin of error.
|
||||||
|
timestamp = int(time.time())
|
||||||
|
if (v.last_active + LOGGEDIN_ACTIVE_TIME) < timestamp:
|
||||||
|
v.last_active = timestamp
|
||||||
|
g.db.add(v)
|
||||||
|
|
||||||
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
|
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
|
||||||
if v and not v.username.startswith('Aev'):
|
if v and not v.username.startswith('Aev'):
|
||||||
|
|
|
@ -255,7 +255,7 @@ def comment(v):
|
||||||
if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']:
|
if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']:
|
||||||
abort(403, "You can't reply to users who have blocked you or users that you have blocked.")
|
abort(403, "You can't reply to users who have blocked you or users that you have blocked.")
|
||||||
|
|
||||||
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID))
|
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID)
|
||||||
|
|
||||||
execute_antispam_comment_check(body, v)
|
execute_antispam_comment_check(body, v)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue