aboutsummaryrefslogtreecommitdiffstats
path: root/settings.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-10-19 13:26:57 -0700
committerJames Taylor <user234683@users.noreply.github.com>2020-10-19 13:26:57 -0700
commitef711dad0590b45a70617ab8717d963fc7df831c (patch)
tree08209859768535f3999803a3a693afe8a84786ae /settings.py
parent75e8930958ea305a26a4652ef88639f7ad5db356 (diff)
downloadyt-local-ef711dad0590b45a70617ab8717d963fc7df831c.tar.lz
yt-local-ef711dad0590b45a70617ab8717d963fc7df831c.tar.xz
yt-local-ef711dad0590b45a70617ab8717d963fc7df831c.zip
settings.py: fix img_prefix not updated when setting changes
caused old prefix to still be used after changing setting see #31
Diffstat (limited to 'settings.py')
-rw-r--r--settings.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/settings.py b/settings.py
index dfab369..6bbb558 100644
--- a/settings.py
+++ b/settings.py
@@ -312,12 +312,6 @@ else:
globals().update(current_settings_dict)
-if proxy_images:
- img_prefix = "/"
-else:
- img_prefix = ""
-
-
if route_tor:
print("Tor routing is ON")
@@ -336,6 +330,19 @@ def add_setting_changed_hook(setting, func):
hooks[setting] = [func]
+def set_img_prefix(old_value=None, value=None):
+ global img_prefix
+ if value is None:
+ value = proxy_images
+ if value:
+ img_prefix = '/'
+ else:
+ img_prefix = ''
+set_img_prefix()
+add_setting_changed_hook('proxy_images', set_img_prefix)
+
+
+
def settings_page():
if request.method == 'GET':
return flask.render_template('settings.html',