hook the firefox profile download page to the mirror system

This commit is contained in:
zab2
2019-01-17 16:51:13 +00:00
parent 3017daf5ee
commit 2f93534840
4 changed files with 38 additions and 9 deletions

View File

@ -23,6 +23,7 @@ except ImportError:
# Constants # Constants
CURRENT_I2P_VERSION = '0.9.37' CURRENT_I2P_VERSION = '0.9.37'
CURRENT_I2P_FIREFOX_PROFILE_VERSION = '0.01a'
CANONICAL_DOMAIN = 'geti2p.net' CANONICAL_DOMAIN = 'geti2p.net'

View File

@ -68,7 +68,12 @@ def downloads_debian():
# Firefox-specific page # Firefox-specific page
def downloads_firefox(): def downloads_firefox():
return render_template('downloads/firefox.html') # TODO: read mirror list or list of available files
if request.headers.get('X-I2P-Desthash') and not request.headers.get('X-Forwarded-Server'):
def_mirror = DEFAULT_I2P_MIRROR
else:
def_mirror = DEFAULT_MIRROR
return render_template('downloads/firefox.html', def_mirror=def_mirror)
# Specific file downloader # Specific file downloader
def downloads_select(version, file): def downloads_select(version, file):

View File

@ -1,18 +1,32 @@
{% extends "global/layout.html" %} {% extends "global/layout.html" %}
{%- from "downloads/macros" import package_outer with context -%}
{% block title %}Firefox Profile{% endblock %} {% block title %}Firefox Profile{% endblock %}
{% block content %} {% block content %}
<h1>{{ _('I2P Firefox Browser Profile') }}</h1> <h1>{{ _('I2P Firefox Browser Profile') }}</h1>
{% trans -%} {% trans -%}
Your browser needs to be configured for use with I2P. To make that easy, we are offering a Firefox browser profile pre-configured to work with I2P. While you can use any browser to access I2P sites, using a dedicated browser profile keeps your I2P browsing activity separate from your clearnet activity. Your browser needs to be configured for use with I2P. To make that easy, we are offering a Firefox browser profile pre-configured to work with I2P. While you can use any browser to access I2P sites, using a dedicated browser profile keeps your I2P browsing activity separate from your clearnet activity.
{%- endtrans %} {%- endtrans %}
<h2 id="windows">{{ _('Windows Installer') }}</h2>
{% trans installer='https://download.i2p2.de/experimental/I2P-Profile-Installer-0.1a.exe' -%}
The <a href="{{ installer }}">windows installer</a> will install the profile and configure I2P to use it. You must already have Firefox and I2P installed.
{%- endtrans %}
<h2 id="other">{{ _('Other OSes') }}</h2> {%- set name = 'Windows' -%}
{% trans -%} {%- set icon = 'images/download/windows.png' -%}
Support for other OSes is coming soon. {%- set filename = 'I2P-Profile-Installer-%s.exe' -%}
{%- endtrans %} {%- set hash = '1234' -%}
{% call package_outer('windows', name, icon) %}
<div class = "file">
<a class = "default" href="{{ url_for('downloads_redirect', version=pver(), net=def_mirror.net, protocol=def_mirror.protocol, domain=def_mirror.domain, file=pver(filename) )}}">
<span class = "name">{{ pver(filename) }}</span><br/>
<span class="mirror">{{ _('Mirror:') }} <img src="{{ url_for('static', filename='images/flags/'+def_mirror.country+'.png') }}" /> {{ def_mirror.org }}</span>
</a>
<a class="mirrors" href="{{ get_url('downloads_select', version=pver(), file=pver(filename)) }}">{{ _('select alternate mirror') }}</a>
</div>
<div class="meta">
<div class="hash">
<code>{{ hash }}</code>
</div>
</div>
<p>{% trans -%}
Download that file and run it.
{%- endtrans %}</p>
{% endcall %}
{% endblock %} {% endblock %}

View File

@ -6,6 +6,7 @@ from urlparse import urlsplit, urlunsplit
from i2p2www import ( from i2p2www import (
CANONICAL_DOMAIN, CANONICAL_DOMAIN,
CURRENT_I2P_VERSION, CURRENT_I2P_VERSION,
CURRENT_I2P_FIREFOX_PROFILE_VERSION,
PROPOSAL_DIR, PROPOSAL_DIR,
RTL_LANGS, RTL_LANGS,
SUPPORTED_LANGS, SUPPORTED_LANGS,
@ -195,6 +196,13 @@ def utility_processor():
return string % CURRENT_I2P_VERSION return string % CURRENT_I2P_VERSION
return CURRENT_I2P_VERSION return CURRENT_I2P_VERSION
def get_current_firefox_profile_version(string=None, ver=None):
if string:
if ver:
return string % ver
return string % CURRENT_I2P_FIREFOX_PROFILE_VERSION
return CURRENT_I2P_FIREFOX_PROFILE_VERSION
return dict(i2pconv=convert_url_to_clearnet, return dict(i2pconv=convert_url_to_clearnet,
i2pclr=convert_url_to_clearnet_inc_https, i2pclr=convert_url_to_clearnet_inc_https,
url_for_other_page=url_for_other_page, url_for_other_page=url_for_other_page,
@ -208,6 +216,7 @@ def utility_processor():
is_rtl=is_rtl_lang, is_rtl=is_rtl_lang,
get_flag=get_flag, get_flag=get_flag,
ver=get_current_version, ver=get_current_version,
pver=get_current_firefox_profile_version,
canonical=get_canonical_link, canonical=get_canonical_link,
supported_langs=SUPPORTED_LANGS, supported_langs=SUPPORTED_LANGS,
lang_names=SUPPORTED_LANG_NAMES) lang_names=SUPPORTED_LANG_NAMES)