diff --git a/anonstream/config.py b/anonstream/config.py
index 0fdced9..2ba8bbb 100644
--- a/anonstream/config.py
+++ b/anonstream/config.py
@@ -37,6 +37,7 @@ def toml_to_flask_sections(config):
toml_to_flask_section_chat,
toml_to_flask_section_flood,
toml_to_flask_section_captcha,
+ toml_to_flask_section_nojs,
)
for toml_to_flask_section in TOML_TO_FLASK_SECTIONS:
yield toml_to_flask_section(config)
@@ -110,7 +111,6 @@ def toml_to_flask_section_thresholds(config):
'THRESHOLD_USER_NOTWATCHING': cfg['user_notwatching'],
'THRESHOLD_USER_TENTATIVE': cfg['user_tentative'],
'THRESHOLD_USER_ABSENT': cfg['user_absent'],
- 'THRESHOLD_NOJS_CHAT_TIMEOUT': cfg['nojs_chat_timeout'],
}
def toml_to_flask_section_chat(config):
@@ -147,3 +147,12 @@ def toml_to_flask_section_captcha(config):
'CAPTCHA_BACKGROUND_COLOUR': color_to_colour(cfg['background_color']),
'CAPTCHA_FOREGROUND_COLOUR': color_to_colour(cfg['foreground_color']),
}
+
+def toml_to_flask_section_nojs(config):
+ cfg = config['nojs']
+ return {
+ 'NOJS_REFRESH_MESSAGES': round(cfg['refresh_messages']),
+ 'NOJS_REFRESH_INFO': round(cfg['refresh_info']),
+ 'NOJS_REFRESH_USERS': round(cfg['refresh_users']),
+ 'NOJS_TIMEOUT_CHAT': round(cfg['timeout_chat']),
+ }
diff --git a/anonstream/routes/nojs.py b/anonstream/routes/nojs.py
index 569269e..a40565d 100644
--- a/anonstream/routes/nojs.py
+++ b/anonstream/routes/nojs.py
@@ -35,6 +35,7 @@ async def nojs_info(user):
return await render_template(
'nojs_info.html',
csp=generate_csp(),
+ refresh=CONFIG['NOJS_REFRESH_INFO'],
user=user,
viewership=viewership,
uptime=uptime,
@@ -48,10 +49,11 @@ async def nojs_chat_messages(user):
return await render_template_with_etag(
'nojs_chat_messages.html',
{'csp': generate_csp()},
+ refresh=CONFIG['NOJS_REFRESH_MESSAGES'],
user=user,
users_by_token=USERS_BY_TOKEN,
messages=get_scrollback(current_app.messages),
- timeout=CONFIG['THRESHOLD_NOJS_CHAT_TIMEOUT'],
+ timeout=CONFIG['NOJS_TIMEOUT_CHAT'],
get_default_name=get_default_name,
)
@@ -67,11 +69,12 @@ async def nojs_chat_users(user):
return await render_template_with_etag(
'nojs_chat_users.html',
{'csp': generate_csp()},
+ refresh=CONFIG['NOJS_REFRESH_USERS'],
user=user,
get_default_name=get_default_name,
users_watching=users_by_presence[Presence.WATCHING],
users_notwatching=users_by_presence[Presence.NOTWATCHING],
- timeout=CONFIG['THRESHOLD_NOJS_CHAT_TIMEOUT'],
+ timeout=CONFIG['NOJS_TIMEOUT_CHAT'],
)
@current_app.route('/chat/form.html')
diff --git a/anonstream/templates/nojs_chat_messages.html b/anonstream/templates/nojs_chat_messages.html
index a22cf54..0647188 100644
--- a/anonstream/templates/nojs_chat_messages.html
+++ b/anonstream/templates/nojs_chat_messages.html
@@ -9,8 +9,8 @@
-
-
+
+