From e9e453a5069ff843142ccd3fffa93798ca476fc5 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Fri, 21 Dec 2012 05:15:42 +0000 Subject: [PATCH] Temporarily enable loading of an externally-hosted CSS file --- i2p2www/__init__.py | 5 +++++ i2p2www/pages/global/layout.html | 2 ++ 2 files changed, 7 insertions(+) diff --git a/i2p2www/__init__.py b/i2p2www/__init__.py index 1a42cc44b..6c4dd504c 100644 --- a/i2p2www/__init__.py +++ b/i2p2www/__init__.py @@ -87,6 +87,11 @@ def detect_theme(): theme = request.cookies['style'] if 'theme' in request.args.keys(): theme = request.args['theme'] + # TEMPORARY: enable external themes + # TODO: Remove this (and the corresponding lines in global/layout.html + if theme[:7] == 'http://': + g.exttheme = theme + theme = 'duck' if not os.path.isfile(safe_join(safe_join(STATIC_DIR, 'styles'), '%s.css' % theme)): theme = 'duck' g.theme = theme diff --git a/i2p2www/pages/global/layout.html b/i2p2www/pages/global/layout.html index 3d375aa31..3f03fbd38 100644 --- a/i2p2www/pages/global/layout.html +++ b/i2p2www/pages/global/layout.html @@ -5,7 +5,9 @@ <meta charset="UTF-8"> <title>{% block title_outer %}{% block title %}{% endblock %} - I2P{% endblock %}</title> <link rel="canonical" href="{{ canonical() }}" /> + {% if g.exttheme %}<link rel="stylesheet" type="text/css" href="{{ g.exttheme }}" title="External theme" />{% else -%} <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/' + g.theme + '.css') }}" title="{{ g.theme }}" /> + {%- endif %} <link rel="shortcut icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}" /> <meta name="robots" content="NOODP" /> {%- block headextra %}{% endblock %} -- GitLab