Merge branch 'dev'
このコミットが含まれているのは:
コミット
2a31d433b9
|
@ -107,9 +107,16 @@ def add_chat_message(user, nonce, comment, ignore_empty=False):
|
|||
}
|
||||
MESSAGES_BY_ID[message_id] = message
|
||||
|
||||
# Limit number of stored messages
|
||||
while len(MESSAGES_BY_ID) > CONFIG['MAX_CHAT_MESSAGES']:
|
||||
MESSAGES_BY_ID.popitem(last=False)
|
||||
|
||||
# Deverify user every n messages
|
||||
if CONFIG['CHAT_DEVERIFY_CLOCK'] is not None:
|
||||
user['clock'] = (user['clock'] + 1) % CONFIG['CHAT_DEVERIFY_CLOCK']
|
||||
if user['clock'] == 0:
|
||||
user['verified'] = False
|
||||
|
||||
# Notify event sockets that a chat message was added
|
||||
notify_event_sockets({
|
||||
'type': 'message',
|
||||
|
|
|
@ -119,6 +119,7 @@ def toml_to_flask_section_presence(config):
|
|||
|
||||
def toml_to_flask_section_chat(config):
|
||||
cfg = config['chat']
|
||||
assert cfg['force_captcha_every'] >= 0
|
||||
return {
|
||||
'CHAT_COMMENT_MAX_LENGTH': cfg['max_comment_length'],
|
||||
'CHAT_COMMENT_MAX_LINES': cfg['max_comment_lines'],
|
||||
|
@ -127,6 +128,7 @@ def toml_to_flask_section_chat(config):
|
|||
'CHAT_BACKGROUND_COLOUR': color_to_colour(cfg['background_color']),
|
||||
'CHAT_TRIPCODE_PASSWORD_MAX_LENGTH': cfg['max_tripcode_password_length'],
|
||||
'CHAT_LEGACY_TRIPCODE_ALGORITHM': cfg['legacy_tripcode_algorithm'],
|
||||
'CHAT_DEVERIFY_CLOCK': cfg['force_captcha_every'] or None,
|
||||
}
|
||||
|
||||
def toml_to_flask_section_flood(config):
|
||||
|
|
|
@ -56,6 +56,7 @@ def generate_user(
|
|||
'current': {},
|
||||
},
|
||||
'headers': headers,
|
||||
'clock': 0,
|
||||
}
|
||||
|
||||
def get_default_name(user):
|
||||
|
|
|
@ -174,6 +174,10 @@ def verify(user, digest, answer):
|
|||
return verification_happened
|
||||
|
||||
def deverify(user, timestamp=None):
|
||||
'''
|
||||
Try to deverify a user. The user is deverified iff they have
|
||||
exceeded the message flood threshold.
|
||||
'''
|
||||
if timestamp is None:
|
||||
timestamp = get_timestamp()
|
||||
if user['verified'] and not user['broadcaster']:
|
||||
|
|
|
@ -63,6 +63,7 @@ min_name_contrast = 3.0
|
|||
background_color = "#232327"
|
||||
max_tripcode_password_length = 1024
|
||||
legacy_tripcode_algorithm = false
|
||||
force_captcha_every = 40
|
||||
|
||||
[flood.messages]
|
||||
duration = 20.0
|
||||
|
|
読み込み中…
新しいイシューから参照