Deverify absent users

このコミットが含まれているのは:
n9k 2022-06-29 02:35:24 +00:00
コミット 19b926a3e5
4個のファイルの変更12行の追加5行の削除

ファイルの表示

@ -151,7 +151,7 @@ async def nojs_submit_message(timestamp, user):
else: else:
state_id = None state_id = None
if message_was_added: if message_was_added:
deverify(user) deverify(user, timestamp=timestamp)
url = url_for( url = url_for(
'nojs_chat_form', 'nojs_chat_form',

ファイルの表示

@ -9,7 +9,7 @@ from quart import current_app, websocket
from anonstream.broadcast import broadcast, broadcast_users_update from anonstream.broadcast import broadcast, broadcast_users_update
from anonstream.stream import is_online, get_stream_title, get_stream_uptime_and_viewership from anonstream.stream import is_online, get_stream_title, get_stream_uptime_and_viewership
from anonstream.user import get_sunsettable_users from anonstream.user import get_absent_users, get_sunsettable_users, deverify
from anonstream.wrappers import with_timestamp from anonstream.wrappers import with_timestamp
CONFIG = current_app.config CONFIG = current_app.config
@ -64,6 +64,12 @@ async def t_sunset_users(timestamp, iteration):
if iteration == 0: if iteration == 0:
return return
# Deverify absent users
for user in get_absent_users(timestamp):
deverify(user, timestamp=timestamp)
# Remove as many absent users as possible
# Broadcast a users update, in case any users being # Broadcast a users update, in case any users being
# removed have been mutated or are new. # removed have been mutated or are new.
broadcast_users_update() broadcast_users_update()

ファイルの表示

@ -173,8 +173,9 @@ def verify(user, digest, answer):
return verification_happened return verification_happened
@with_timestamp() def deverify(user, timestamp=None):
def deverify(timestamp, user): if timestamp is None:
timestamp = get_timestamp()
if user['verified'] and not user['broadcaster']: if user['verified'] and not user['broadcaster']:
n_user_messages = 0 n_user_messages = 0
for message in reversed(MESSAGES): for message in reversed(MESSAGES):

ファイルの表示

@ -122,7 +122,7 @@ def handle_inbound_message(timestamp, queue, user, nonce, comment, digest, answe
else: else:
notice = None notice = None
if message_was_added: if message_was_added:
deverify(user) deverify(user, timestamp=timestamp)
return { return {
'type': 'ack', 'type': 'ack',
'nonce': nonce, 'nonce': nonce,