aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/__init__.py
diff options
context:
space:
mode:
authorJames Taylor <28744867+user234683@users.noreply.github.com>2020-10-21 18:53:12 -0700
committerGitHub <noreply@github.com>2020-10-21 18:53:12 -0700
commitaa52c7a42e9573105dfadb07981c7f5f1447ca9d (patch)
tree6bff6ae507db03e435bb04e3969ef08093f3f8d8 /youtube/__init__.py
parent3b5df36b0310b751fc25f8c0b7167c659c8259de (diff)
parentf01ef36a37c9112eca3f85d49622c41d68000a69 (diff)
downloadyt-local-aa52c7a42e9573105dfadb07981c7f5f1447ca9d.tar.lz
yt-local-aa52c7a42e9573105dfadb07981c7f5f1447ca9d.tar.xz
yt-local-aa52c7a42e9573105dfadb07981c7f5f1447ca9d.zip
Merge branch 'master' into add_sponsorblock
Diffstat (limited to 'youtube/__init__.py')
-rw-r--r--youtube/__init__.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/youtube/__init__.py b/youtube/__init__.py
index 92e1878..6d79e44 100644
--- a/youtube/__init__.py
+++ b/youtube/__init__.py
@@ -1,5 +1,6 @@
from youtube import util
import flask
+from flask import request
import settings
import traceback
import re
@@ -59,6 +60,7 @@ def timestamps(text):
@yt_app.errorhandler(500)
def error_page(e):
+ slim = request.args.get('slim', False) # whether it was an ajax request
if (exc_info()[0] == util.FetchError
and exc_info()[1].code == '429'
and settings.route_tor
@@ -68,5 +70,22 @@ def error_page(e):
' using the New Identity button in the Tor Browser.')
if exc_info()[1].ip:
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
+ return flask.render_template('error.html', error_message=error_message, slim=slim), 502
+ return flask.render_template('error.html', traceback=traceback.format_exc(), slim=slim), 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',
+ )