From 125ddaa8da8dad8f3e8eeb54f79a775b865c58bf Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 20 Oct 2020 15:38:00 -0700 Subject: Add setting to change font. Change default to arial Closes #33 --- youtube/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'youtube/__init__.py') 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', + ) -- cgit v1.2.3 From c696db3e84d91092182adbeb7eef6126fad6be5d Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 20 Oct 2020 18:24:41 -0700 Subject: comments.js: include error in reply html rather than using an alert --- youtube/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'youtube/__init__.py') diff --git a/youtube/__init__.py b/youtube/__init__.py index 70ed5b2..61039d3 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 @@ -55,6 +56,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 @@ -64,8 +66,8 @@ 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', -- cgit v1.2.3