diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-10-20 15:38:00 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-10-20 15:38:00 -0700 |
commit | 125ddaa8da8dad8f3e8eeb54f79a775b865c58bf (patch) | |
tree | 5f5c19608333bda6a8d1bc15082fad6df4951886 | |
parent | c9d0f685a43d95d653db56a00efe520e3a04d0d2 (diff) | |
download | yt-local-125ddaa8da8dad8f3e8eeb54f79a775b865c58bf.tar.lz yt-local-125ddaa8da8dad8f3e8eeb54f79a775b865c58bf.tar.xz yt-local-125ddaa8da8dad8f3e8eeb54f79a775b865c58bf.zip |
Add setting to change font. Change default to arial
Closes #33
-rw-r--r-- | settings.py | 13 | ||||
-rw-r--r-- | youtube/__init__.py | 17 | ||||
-rw-r--r-- | youtube/templates/base.html | 2 | ||||
-rw-r--r-- | youtube/templates/shared.css (renamed from youtube/static/shared.css) | 2 |
4 files changed, 32 insertions, 2 deletions
diff --git a/settings.py b/settings.py index 6bbb558..852310c 100644 --- a/settings.py +++ b/settings.py @@ -153,6 +153,19 @@ For security reasons, enabling this is not recommended.''', ], }), + ('font', { + 'type': int, + 'default': 1, + 'comment': '', + 'options': [ + (0, 'Browser default'), + (1, 'Arial'), + (2, 'Liberation Serif'), + (3, 'Verdana'), + (4, 'Tahoma'), + ], + }), + ('autocheck_subscriptions', { 'type': bool, 'default': 0, diff --git a/youtube/__init__.py b/youtube/__init__.py index 3c271f1..70ed5b2 100644 --- a/youtube/__init__.py +++ b/youtube/__init__.py @@ -66,3 +66,20 @@ def error_page(e): error_message += ' Exit node IP address: ' + exc_info()[1].ip return flask.render_template('error.html', error_message=error_message), 502 return flask.render_template('error.html', traceback=traceback.format_exc()), 500 + +font_choices = { + 0: 'initial', + 1: 'arial, "liberation sans", sans-serif', + 2: '"liberation serif", "times new roman", calibri, carlito, serif', + 3: 'verdana, sans-serif', + 4: 'tahoma, sans-serif', +} + +@yt_app.route('/shared.css') +def get_css(): + return flask.Response( + flask.render_template('shared.css', + font_family = font_choices[settings.font] + ), + mimetype='text/css', + ) diff --git a/youtube/templates/base.html b/youtube/templates/base.html index 379419c..3d9f1e9 100644 --- a/youtube/templates/base.html +++ b/youtube/templates/base.html @@ -6,7 +6,7 @@ <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; media-src 'self' https://*.googlevideo.com; {{ "img-src 'self' https://*.googleusercontent.com https://*.ggpht.com https://*.ytimg.com;" if not settings.proxy_images else "" }}"> <link href="{{ theme_path }}" type="text/css" rel="stylesheet"> - <link href="/youtube.com/static/shared.css" type="text/css" rel="stylesheet"> + <link href="/youtube.com/shared.css" type="text/css" rel="stylesheet"> <link href="/youtube.com/static/comments.css" type="text/css" rel="stylesheet"> <link href="/youtube.com/static/favicon.ico" type="image/x-icon" rel="icon"> <link title="Youtube local" href="/youtube.com/opensearch.xml" rel="search" type="application/opensearchdescription+xml"> diff --git a/youtube/static/shared.css b/youtube/templates/shared.css index 7dd16e2..141465a 100644 --- a/youtube/static/shared.css +++ b/youtube/templates/shared.css @@ -12,7 +12,7 @@ address{ } html{ - font-family: "liberation serif", "times new roman", calibri, carlito, serif; + font-family: {{ font_family }}; } body{ |