From 0a54efefaba43997efd5f73831ff7f77b9e6894b Mon Sep 17 00:00:00 2001 From: n9k Date: Sun, 24 Jul 2022 01:26:18 +0000 Subject: [PATCH 1/3] Bugfix: absent broadcaster with js stuck in refresh loop Fixed by not setting user['verified'] to None for the broadcaster. --- anonstream/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/anonstream/tasks.py b/anonstream/tasks.py index 63c1c55..4902f92 100644 --- a/anonstream/tasks.py +++ b/anonstream/tasks.py @@ -64,8 +64,11 @@ async def t_sunset_users(timestamp, iteration): if iteration == 0: return - # De-access absent users - absent_users = tuple(get_absent_users(timestamp)) + # Revoke access for absent users (except the broadcaster) + absent_users = tuple(filter( + lambda user: not user['broadcaster'], + get_absent_users(timestamp) + )) for user in absent_users: user['verified'] = None # Absent users should have no connected websockets, From c45031277c008f39a2438497fa7b077d34138784 Mon Sep 17 00:00:00 2001 From: n9k Date: Sun, 24 Jul 2022 01:27:55 +0000 Subject: [PATCH 2/3] Minor: remove unused js --- anonstream/static/anonstream.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/anonstream/static/anonstream.js b/anonstream/static/anonstream.js index 21a1807..1625afb 100644 --- a/anonstream/static/anonstream.js +++ b/anonstream/static/anonstream.js @@ -275,30 +275,6 @@ const delete_chat_messages = (seqs) => { } } -const hexdigest = async (string, bytelength) => { - uint8array = new TextEncoder().encode(string); - arraybuffer = await crypto.subtle.digest("sha-256", uint8array); - array = Array.from(new Uint8Array(arraybuffer).slice(0, bytelength)); - hex = array.map(b => b.toString(16).padStart(2, "0")).join(""); - return hex -} -const escape_css_string = (string) => { - /* https://drafts.csswg.org/cssom/#common-serializing-idioms */ - const result = []; - for (const char of string) { - if (char === "\0") { - result.push("\ufffd"); - } else if (char < "\u0020" || char == "\u007f") { - result.push(`\\${char.charCodeAt().toString(16)}`); - } else if (char == '"' || char == "\\") { - result.push(`\\${char}`); - } else { - result.push(char); - } - } - return result.join(""); -} - let users = {}; let stats = null; let stats_received = null; From 3b18ea2a45f353abc35a9fdb2cbfa95ea7de3c62 Mon Sep 17 00:00:00 2001 From: n9k Date: Sun, 24 Jul 2022 01:31:49 +0000 Subject: [PATCH 3/3] Minor: increase default max_comment_lines from 12 to 20 --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index e727d6d..1a205d7 100644 --- a/config.toml +++ b/config.toml @@ -57,7 +57,7 @@ anonymous = "Anonymous" [chat] max_comment_length = 512 -max_comment_lines = 12 +max_comment_lines = 20 max_name_length = 24 min_name_contrast = 3.0 background_color = "#232327"