diff --git a/app.py b/app.py
index 263c26fb..5108529b 100644
--- a/app.py
+++ b/app.py
@@ -14,9 +14,21 @@ MEETINGS_DIR = os.path.join(os.path.dirname(__file__), 'meetings')
app = application = Flask(__name__, template_folder=TEMPLATE_DIR, static_url_path='/_static', static_folder=STATIC_DIR)
app.debug = bool(os.environ.get('APP_DEBUG', 'False'))
+@app.after_request
+def call_after_request_callbacks(response):
+ for callback in getattr(g, 'after_request_callbacks', ()):
+ response = callback(response)
+ return response
+
+def after_this_request(f):
+ if not hasattr(g, 'after_request_callbacks'):
+ g.after_request_callbacks = []
+ g.after_request_callbacks.append(f)
+ return f
+
@app.template_filter('restructuredtext')
-def restructuredtext(env, value):
+def restructuredtext(value):
try:
from docutils.core import publish_parts
except ImportError:
@@ -32,9 +44,24 @@ def pull_lang(endpoint, values):
return
g.lang=values.pop('lang', None)
-#@app.url_value_preprocessor
-#def fix_theme(endpoint, values):
-# pass
+@app.before_request
+def detect_theme():
+ theme = 'light'
+ if 'style' in request.cookies:
+ theme = request.cookies['style']
+ if 'theme' in request.args.keys():
+ theme = request.args['theme']
+ if not os.path.isfile(safe_join('static/styles', '%s.css' % theme)):
+ theme = 'light'
+ g.theme = theme
+ @after_this_request
+ def remember_theme(resp):
+ if g.theme == 'light' and 'style' in request.cookies:
+ resp.delete_cookie('style')
+ elif g.theme != 'light':
+ resp.set_cookie('style', g.theme)
+ return resp
+
@app.route('/')
def main_index():
diff --git a/www.i2p2/pages/meeting208.html b/meetings/208.log
similarity index 83%
rename from www.i2p2/pages/meeting208.html
rename to meetings/208.log
index 18448cd8..0d0f5157 100644
--- a/www.i2p2/pages/meeting208.html
+++ b/meetings/208.log
@@ -1,69 +1,3 @@
-{% extends "_layout.html" %}
-{% block title %}I2P Development Meeting 208{% endblock %}
-{% block content %}
{% block content %}{% endblock %}
diff --git a/www.i2p2/pages/_menu.html b/pages/global/menu.html
similarity index 95%
rename from www.i2p2/pages/_menu.html
rename to pages/global/menu.html
index 046e00a2..86adfcae 100644
--- a/www.i2p2/pages/_menu.html
+++ b/pages/global/menu.html
@@ -1,20 +1,20 @@
-

-

-

-

+

+

+

+
-

-

-

-

+

+

+

+
-

-

+

+
{% if lang == "de" %}
diff --git a/www.i2p2/pages/_urlify b/pages/global/urlify
similarity index 79%
rename from www.i2p2/pages/_urlify
rename to pages/global/urlify
index a9bdbf3d..59ffe02c 100644
--- a/www.i2p2/pages/_urlify
+++ b/pages/global/urlify
@@ -1,4 +1,4 @@
-{% macro urlify url, title, suffix %}
+{% macro urlify(url, title, suffix) %}
{% if static %}
{{title}}
{% else %}
diff --git a/www.i2p2/pages/meetings.html b/pages/meetings/index.html
similarity index 99%
rename from www.i2p2/pages/meetings.html
rename to pages/meetings/index.html
index 9e65b231..b8effc6b 100644
--- a/www.i2p2/pages/meetings.html
+++ b/pages/meetings/index.html
@@ -1,4 +1,4 @@
-{% extends "_layout.html" %}
+{% extends "global/layout.html" %}
{% block title %}Meetings{% endblock %}
{% block content %}
Logs of past I2P meetings
diff --git a/www.i2p2/static/favicon.ico b/static/favicon.ico
similarity index 100%
rename from www.i2p2/static/favicon.ico
rename to static/favicon.ico
diff --git a/www.i2p2/static/images/I2PTunnel-streamr.png b/static/images/I2PTunnel-streamr.png
similarity index 100%
rename from www.i2p2/static/images/I2PTunnel-streamr.png
rename to static/images/I2PTunnel-streamr.png
diff --git a/www.i2p2/static/images/add-key-terminal.png b/static/images/add-key-terminal.png
similarity index 100%
rename from www.i2p2/static/images/add-key-terminal.png
rename to static/images/add-key-terminal.png
diff --git a/www.i2p2/static/images/bandwidth2009.png b/static/images/bandwidth2009.png
similarity index 100%
rename from www.i2p2/static/images/bandwidth2009.png
rename to static/images/bandwidth2009.png
diff --git a/www.i2p2/static/images/cz.png b/static/images/cz.png
similarity index 100%
rename from www.i2p2/static/images/cz.png
rename to static/images/cz.png
diff --git a/www.i2p2/static/images/dark.png b/static/images/dark.png
similarity index 100%
rename from www.i2p2/static/images/dark.png
rename to static/images/dark.png
diff --git a/www.i2p2/static/images/darkbluebg.png b/static/images/darkbluebg.png
similarity index 100%
rename from www.i2p2/static/images/darkbluebg.png
rename to static/images/darkbluebg.png
diff --git a/www.i2p2/static/images/darkbluetile.png b/static/images/darkbluetile.png
similarity index 100%
rename from www.i2p2/static/images/darkbluetile.png
rename to static/images/darkbluetile.png
diff --git a/www.i2p2/static/images/darkerbluetile.png b/static/images/darkerbluetile.png
similarity index 100%
rename from www.i2p2/static/images/darkerbluetile.png
rename to static/images/darkerbluetile.png
diff --git a/www.i2p2/static/images/de.png b/static/images/de.png
similarity index 100%
rename from www.i2p2/static/images/de.png
rename to static/images/de.png
diff --git a/www.i2p2/static/images/download.png b/static/images/download.png
similarity index 100%
rename from www.i2p2/static/images/download.png
rename to static/images/download.png
diff --git a/www.i2p2/static/images/download_dark.png b/static/images/download_dark.png
similarity index 100%
rename from www.i2p2/static/images/download_dark.png
rename to static/images/download_dark.png
diff --git a/www.i2p2/static/images/endToEndEncryption.png b/static/images/endToEndEncryption.png
similarity index 100%
rename from www.i2p2/static/images/endToEndEncryption.png
rename to static/images/endToEndEncryption.png
diff --git a/www.i2p2/static/images/endToEndEncryption_fr.png b/static/images/endToEndEncryption_fr.png
similarity index 100%
rename from www.i2p2/static/images/endToEndEncryption_fr.png
rename to static/images/endToEndEncryption_fr.png
diff --git a/www.i2p2/static/images/endToEndEncryption_zh.png b/static/images/endToEndEncryption_zh.png
similarity index 100%
rename from www.i2p2/static/images/endToEndEncryption_zh.png
rename to static/images/endToEndEncryption_zh.png
diff --git a/www.i2p2/static/images/es.png b/static/images/es.png
similarity index 100%
rename from www.i2p2/static/images/es.png
rename to static/images/es.png
diff --git a/www.i2p2/static/images/eu.png b/static/images/eu.png
similarity index 100%
rename from www.i2p2/static/images/eu.png
rename to static/images/eu.png
diff --git a/www.i2p2/static/images/firefox.options.jpg b/static/images/firefox.options.jpg
similarity index 100%
rename from www.i2p2/static/images/firefox.options.jpg
rename to static/images/firefox.options.jpg
diff --git a/www.i2p2/static/images/firefox.options_fr.png b/static/images/firefox.options_fr.png
similarity index 100%
rename from www.i2p2/static/images/firefox.options_fr.png
rename to static/images/firefox.options_fr.png
diff --git a/www.i2p2/static/images/firefox.proxyports.jpg b/static/images/firefox.proxyports.jpg
similarity index 100%
rename from www.i2p2/static/images/firefox.proxyports.jpg
rename to static/images/firefox.proxyports.jpg
diff --git a/www.i2p2/static/images/firefox.proxyports_fr.png b/static/images/firefox.proxyports_fr.png
similarity index 100%
rename from www.i2p2/static/images/firefox.proxyports_fr.png
rename to static/images/firefox.proxyports_fr.png
diff --git a/www.i2p2/static/images/fr.png b/static/images/fr.png
similarity index 100%
rename from www.i2p2/static/images/fr.png
rename to static/images/fr.png
diff --git a/www.i2p2/static/images/garliccloves.png b/static/images/garliccloves.png
similarity index 100%
rename from www.i2p2/static/images/garliccloves.png
rename to static/images/garliccloves.png
diff --git a/www.i2p2/static/images/help.png b/static/images/help.png
similarity index 100%
rename from www.i2p2/static/images/help.png
rename to static/images/help.png
diff --git a/www.i2p2/static/images/help_dark.png b/static/images/help_dark.png
similarity index 100%
rename from www.i2p2/static/images/help_dark.png
rename to static/images/help_dark.png
diff --git a/www.i2p2/static/images/i2plogo.png b/static/images/i2plogo.png
similarity index 100%
rename from www.i2p2/static/images/i2plogo.png
rename to static/images/i2plogo.png
diff --git a/www.i2p2/static/images/i2ptunnel_peertopeer.png b/static/images/i2ptunnel_peertopeer.png
similarity index 100%
rename from www.i2p2/static/images/i2ptunnel_peertopeer.png
rename to static/images/i2ptunnel_peertopeer.png
diff --git a/www.i2p2/static/images/i2ptunnel_serverclient.png b/static/images/i2ptunnel_serverclient.png
similarity index 100%
rename from www.i2p2/static/images/i2ptunnel_serverclient.png
rename to static/images/i2ptunnel_serverclient.png
diff --git a/www.i2p2/static/images/i2pvstor_zh.png b/static/images/i2pvstor_zh.png
similarity index 100%
rename from www.i2p2/static/images/i2pvstor_zh.png
rename to static/images/i2pvstor_zh.png
diff --git a/www.i2p2/static/images/ie.options.jpg b/static/images/ie.options.jpg
similarity index 100%
rename from www.i2p2/static/images/ie.options.jpg
rename to static/images/ie.options.jpg
diff --git a/www.i2p2/static/images/ie.options_fr.png b/static/images/ie.options_fr.png
similarity index 100%
rename from www.i2p2/static/images/ie.options_fr.png
rename to static/images/ie.options_fr.png
diff --git a/www.i2p2/static/images/ie.proxyports.jpg b/static/images/ie.proxyports.jpg
similarity index 100%
rename from www.i2p2/static/images/ie.proxyports.jpg
rename to static/images/ie.proxyports.jpg
diff --git a/www.i2p2/static/images/ie.proxyports_fr.png b/static/images/ie.proxyports_fr.png
similarity index 100%
rename from www.i2p2/static/images/ie.proxyports_fr.png
rename to static/images/ie.proxyports_fr.png
diff --git a/www.i2p2/static/images/info.png b/static/images/info.png
similarity index 100%
rename from www.i2p2/static/images/info.png
rename to static/images/info.png
diff --git a/www.i2p2/static/images/info_dark.png b/static/images/info_dark.png
similarity index 100%
rename from www.i2p2/static/images/info_dark.png
rename to static/images/info_dark.png
diff --git a/www.i2p2/static/images/it.png b/static/images/it.png
similarity index 100%
rename from www.i2p2/static/images/it.png
rename to static/images/it.png
diff --git a/www.i2p2/static/images/itoopie.png b/static/images/itoopie.png
similarity index 100%
rename from www.i2p2/static/images/itoopie.png
rename to static/images/itoopie.png
diff --git a/www.i2p2/static/images/konqueror.options.jpg b/static/images/konqueror.options.jpg
similarity index 100%
rename from www.i2p2/static/images/konqueror.options.jpg
rename to static/images/konqueror.options.jpg
diff --git a/www.i2p2/static/images/konqueror.options_fr.jpg b/static/images/konqueror.options_fr.jpg
similarity index 100%
rename from www.i2p2/static/images/konqueror.options_fr.jpg
rename to static/images/konqueror.options_fr.jpg
diff --git a/www.i2p2/static/images/konqueror.proxyports.jpg b/static/images/konqueror.proxyports.jpg
similarity index 100%
rename from www.i2p2/static/images/konqueror.proxyports.jpg
rename to static/images/konqueror.proxyports.jpg
diff --git a/www.i2p2/static/images/konqueror.proxyports_fr.jpg b/static/images/konqueror.proxyports_fr.jpg
similarity index 100%
rename from www.i2p2/static/images/konqueror.proxyports_fr.jpg
rename to static/images/konqueror.proxyports_fr.jpg
diff --git a/www.i2p2/static/images/lang_ar.png b/static/images/lang_ar.png
similarity index 100%
rename from www.i2p2/static/images/lang_ar.png
rename to static/images/lang_ar.png
diff --git a/www.i2p2/static/images/light.png b/static/images/light.png
similarity index 100%
rename from www.i2p2/static/images/light.png
rename to static/images/light.png
diff --git a/www.i2p2/static/images/lightbluetile.png b/static/images/lightbluetile.png
similarity index 100%
rename from www.i2p2/static/images/lightbluetile.png
rename to static/images/lightbluetile.png
diff --git a/www.i2p2/static/images/link.png b/static/images/link.png
similarity index 100%
rename from www.i2p2/static/images/link.png
rename to static/images/link.png
diff --git a/www.i2p2/static/images/link_dark.png b/static/images/link_dark.png
similarity index 100%
rename from www.i2p2/static/images/link_dark.png
rename to static/images/link_dark.png
diff --git a/www.i2p2/static/images/logo07c.jpg b/static/images/logo07c.jpg
similarity index 100%
rename from www.i2p2/static/images/logo07c.jpg
rename to static/images/logo07c.jpg
diff --git a/www.i2p2/static/images/net.png b/static/images/net.png
similarity index 100%
rename from www.i2p2/static/images/net.png
rename to static/images/net.png
diff --git a/www.i2p2/static/images/net_fr.png b/static/images/net_fr.png
similarity index 100%
rename from www.i2p2/static/images/net_fr.png
rename to static/images/net_fr.png
diff --git a/www.i2p2/static/images/netdb_get_leaseset.png b/static/images/netdb_get_leaseset.png
similarity index 100%
rename from www.i2p2/static/images/netdb_get_leaseset.png
rename to static/images/netdb_get_leaseset.png
diff --git a/www.i2p2/static/images/netdb_get_leaseset_fr.png b/static/images/netdb_get_leaseset_fr.png
similarity index 100%
rename from www.i2p2/static/images/netdb_get_leaseset_fr.png
rename to static/images/netdb_get_leaseset_fr.png
diff --git a/www.i2p2/static/images/netdb_get_routerinfo_1.png b/static/images/netdb_get_routerinfo_1.png
similarity index 100%
rename from www.i2p2/static/images/netdb_get_routerinfo_1.png
rename to static/images/netdb_get_routerinfo_1.png
diff --git a/www.i2p2/static/images/netdb_get_routerinfo_1_fr.png b/static/images/netdb_get_routerinfo_1_fr.png
similarity index 100%
rename from www.i2p2/static/images/netdb_get_routerinfo_1_fr.png
rename to static/images/netdb_get_routerinfo_1_fr.png
diff --git a/www.i2p2/static/images/netdb_get_routerinfo_2.png b/static/images/netdb_get_routerinfo_2.png
similarity index 100%
rename from www.i2p2/static/images/netdb_get_routerinfo_2.png
rename to static/images/netdb_get_routerinfo_2.png
diff --git a/www.i2p2/static/images/netdb_get_routerinfo_2_fr.png b/static/images/netdb_get_routerinfo_2_fr.png
similarity index 100%
rename from www.i2p2/static/images/netdb_get_routerinfo_2_fr.png
rename to static/images/netdb_get_routerinfo_2_fr.png
diff --git a/www.i2p2/static/images/nl.png b/static/images/nl.png
similarity index 100%
rename from www.i2p2/static/images/nl.png
rename to static/images/nl.png
diff --git a/www.i2p2/static/images/plan.png b/static/images/plan.png
similarity index 100%
rename from www.i2p2/static/images/plan.png
rename to static/images/plan.png
diff --git a/www.i2p2/static/images/protocol_stack.png b/static/images/protocol_stack.png
similarity index 100%
rename from www.i2p2/static/images/protocol_stack.png
rename to static/images/protocol_stack.png
diff --git a/www.i2p2/static/images/protocol_stack_fr.png b/static/images/protocol_stack_fr.png
similarity index 100%
rename from www.i2p2/static/images/protocol_stack_fr.png
rename to static/images/protocol_stack_fr.png
diff --git a/www.i2p2/static/images/ru.png b/static/images/ru.png
similarity index 100%
rename from www.i2p2/static/images/ru.png
rename to static/images/ru.png
diff --git a/www.i2p2/static/images/sqbullet.png b/static/images/sqbullet.png
similarity index 100%
rename from www.i2p2/static/images/sqbullet.png
rename to static/images/sqbullet.png
diff --git a/www.i2p2/static/images/stackoverflow_ad.png b/static/images/stackoverflow_ad.png
similarity index 100%
rename from www.i2p2/static/images/stackoverflow_ad.png
rename to static/images/stackoverflow_ad.png
diff --git a/www.i2p2/static/images/tabletile.png b/static/images/tabletile.png
similarity index 100%
rename from www.i2p2/static/images/tabletile.png
rename to static/images/tabletile.png
diff --git a/www.i2p2/static/images/tabletile_alt.png b/static/images/tabletile_alt.png
similarity index 100%
rename from www.i2p2/static/images/tabletile_alt.png
rename to static/images/tabletile_alt.png
diff --git a/www.i2p2/static/images/tabletitledark.png b/static/images/tabletitledark.png
similarity index 100%
rename from www.i2p2/static/images/tabletitledark.png
rename to static/images/tabletitledark.png
diff --git a/www.i2p2/static/images/tabletitlelight-tall.png b/static/images/tabletitlelight-tall.png
similarity index 100%
rename from www.i2p2/static/images/tabletitlelight-tall.png
rename to static/images/tabletitlelight-tall.png
diff --git a/www.i2p2/static/images/tabletitlelight.png b/static/images/tabletitlelight.png
similarity index 100%
rename from www.i2p2/static/images/tabletitlelight.png
rename to static/images/tabletitlelight.png
diff --git a/www.i2p2/static/images/target.png b/static/images/target.png
similarity index 100%
rename from www.i2p2/static/images/target.png
rename to static/images/target.png
diff --git a/www.i2p2/static/images/tunnelSending.png b/static/images/tunnelSending.png
similarity index 100%
rename from www.i2p2/static/images/tunnelSending.png
rename to static/images/tunnelSending.png
diff --git a/www.i2p2/static/images/tunnels.png b/static/images/tunnels.png
similarity index 100%
rename from www.i2p2/static/images/tunnels.png
rename to static/images/tunnels.png
diff --git a/www.i2p2/static/images/tunnels_fr.png b/static/images/tunnels_fr.png
similarity index 100%
rename from www.i2p2/static/images/tunnels_fr.png
rename to static/images/tunnels_fr.png
diff --git a/www.i2p2/static/images/udp.png b/static/images/udp.png
similarity index 100%
rename from www.i2p2/static/images/udp.png
rename to static/images/udp.png
diff --git a/www.i2p2/static/images/us.png b/static/images/us.png
similarity index 100%
rename from www.i2p2/static/images/us.png
rename to static/images/us.png
diff --git a/www.i2p2/static/images/zh.png b/static/images/zh.png
similarity index 100%
rename from www.i2p2/static/images/zh.png
rename to static/images/zh.png
diff --git a/www.i2p2/static/news/news.xml b/static/news/news.xml
similarity index 100%
rename from www.i2p2/static/news/news.xml
rename to static/news/news.xml
diff --git a/www.i2p2/static/pdf/I2CP_spec.pdf b/static/pdf/I2CP_spec.pdf
similarity index 100%
rename from www.i2p2/static/pdf/I2CP_spec.pdf
rename to static/pdf/I2CP_spec.pdf
diff --git a/www.i2p2/static/pdf/I2NP_spec.pdf b/static/pdf/I2NP_spec.pdf
similarity index 100%
rename from www.i2p2/static/pdf/I2NP_spec.pdf
rename to static/pdf/I2NP_spec.pdf
diff --git a/www.i2p2/static/pdf/I2P-PET-CON-2009.1.pdf b/static/pdf/I2P-PET-CON-2009.1.pdf
similarity index 100%
rename from www.i2p2/static/pdf/I2P-PET-CON-2009.1.pdf
rename to static/pdf/I2P-PET-CON-2009.1.pdf
diff --git a/www.i2p2/static/pdf/datastructures.pdf b/static/pdf/datastructures.pdf
similarity index 100%
rename from www.i2p2/static/pdf/datastructures.pdf
rename to static/pdf/datastructures.pdf
diff --git a/www.i2p2/static/pdf/i2p_philosophy.pdf b/static/pdf/i2p_philosophy.pdf
similarity index 100%
rename from www.i2p2/static/pdf/i2p_philosophy.pdf
rename to static/pdf/i2p_philosophy.pdf
diff --git a/www.i2p2/static/pdf/polling_http_transport.pdf b/static/pdf/polling_http_transport.pdf
similarity index 100%
rename from www.i2p2/static/pdf/polling_http_transport.pdf
rename to static/pdf/polling_http_transport.pdf
diff --git a/www.i2p2/static/styles/dark.css b/static/styles/dark.css
similarity index 100%
rename from www.i2p2/static/styles/dark.css
rename to static/styles/dark.css
diff --git a/www.i2p2/static/styles/light.css b/static/styles/light.css
similarity index 100%
rename from www.i2p2/static/styles/light.css
rename to static/styles/light.css
diff --git a/www.i2p2/static/styles/light_ar.css b/static/styles/light_ar.css
similarity index 100%
rename from www.i2p2/static/styles/light_ar.css
rename to static/styles/light_ar.css
diff --git a/www.i2p2/static/styles/light_zh.css b/static/styles/light_zh.css
similarity index 100%
rename from www.i2p2/static/styles/light_zh.css
rename to static/styles/light_zh.css