Added version to download urls (to pass to mirrors requiring it)

This commit is contained in:
str4d
2013-06-04 09:36:42 +00:00
parent eb5d5bddcf
commit 8c89ae48bf
5 changed files with 27 additions and 27 deletions

View File

@@ -37,12 +37,12 @@ def downloads_list():
return render_template('downloads/list.html')
# Specific file downloader
def downloads_select(file):
def downloads_select(version, file):
if (file == 'debian'):
return render_template('downloads/debian.html', file=file)
mirrors=read_mirrors()
data = {
'version': CURRENT_I2P_VERSION,
'version': version,
'file': file,
}
obj=[]
@@ -53,15 +53,15 @@ def downloads_select(file):
for mirror in a['mirrors']:
mirror['url']=mirror['url'] % data
obj.append(a)
return render_template('downloads/select.html', mirrors=obj, file=file)
return render_template('downloads/select.html', mirrors=obj, version=version, file=file)
def downloads_redirect(protocol, file, mirror):
def downloads_redirect(version, protocol, file, mirror):
mirrors=read_mirrors()
if not protocol in mirrors:
abort(404)
mirrors=mirrors[protocol]
data = {
'version': CURRENT_I2P_VERSION,
'version': version,
'file': file,
}
if mirror:

View File

@@ -23,12 +23,12 @@ or type <tt>java -version</tt> at your command prompt.
<div class="package">
<h1>Windows</h1>
<div class="file">
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pinstall_%s_windows.exe', '0.9.5-win1'), mirror=1) }}">i2pinstall_0.9.5-win1_windows.exe</a> (Google Code)
(<a href="{{ get_url('downloads_select', file=ver('i2pinstall_%s_windows.exe', '0.9.5-win1')) }}">{{ _('select alternate link') }}</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pinstall_%s_windows.exe', '0.9.5-win1'), mirror=1) }}">i2pinstall_0.9.5-win1_windows.exe</a> (Google Code)
(<a href="{{ get_url('downloads_select', version=ver(), file=ver('i2pinstall_%s_windows.exe', '0.9.5-win1')) }}">{{ _('select alternate link') }}</a>)
<div class="sig">
(SHA256
<code>d64101793764bf77ac3dfc2352677b3d06eef3b6ecb4fa0cf2cf43fc237302f8</code>
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pinstall_%s_windows.exe.sig', '0.9.5-win1'), mirror=1) }}">sig</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pinstall_%s_windows.exe.sig', '0.9.5-win1'), mirror=1) }}">sig</a>)
</div>
</div>
<div class="details">
@@ -41,12 +41,12 @@ or type <tt>java -version</tt> at your command prompt.
<div class="package">
<h1>Mac OS X</h1>
<div class="file">
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pinstall_%s.jar'), mirror=1) }}">i2pinstall_{{ ver() }}.jar</a> (Google Code)
(<a href="{{ get_url('downloads_select', file=ver('i2pinstall_%s.jar')) }}">{{ _('select alternate link') }}</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pinstall_%s.jar'), mirror=1) }}">i2pinstall_{{ ver() }}.jar</a> (Google Code)
(<a href="{{ get_url('downloads_select', version=ver(), file=ver('i2pinstall_%s.jar')) }}">{{ _('select alternate link') }}</a>)
<div class="sig">
(SHA256
<code>af251596e034b751dc17b73bd35254b94f92d4a3121a6e96479c45c4d846ab30</code>
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pinstall_%s.jar.sig'), mirror=1) }}">sig</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pinstall_%s.jar.sig'), mirror=1) }}">sig</a>)
</div>
</div>
<div class="details">
@@ -69,12 +69,12 @@ or type <tt>java -version</tt> at your command prompt.
<div class="package">
<h1>GNU/Linux / BSD / Solaris</h1>
<div class="file">
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pinstall_%s.jar'), mirror=1) }}">i2pinstall_{{ ver() }}.jar</a> (Google Code)
(<a href="{{ get_url('downloads_select', file=ver('i2pinstall_%s.jar')) }}">{{ _('select alternate link') }}</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pinstall_%s.jar'), mirror=1) }}">i2pinstall_{{ ver() }}.jar</a> (Google Code)
(<a href="{{ get_url('downloads_select', version=ver(), file=ver('i2pinstall_%s.jar')) }}">{{ _('select alternate link') }}</a>)
<div class="sig">
(SHA256
<code>af251596e034b751dc17b73bd35254b94f92d4a3121a6e96479c45c4d846ab30</code>
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pinstall_%s.jar.sig'), mirror=1) }}">sig</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pinstall_%s.jar.sig'), mirror=1) }}">sig</a>)
</div>
</div>
<div class="details">
@@ -97,7 +97,7 @@ or type <tt>java -version</tt> at your command prompt.
<div class="package">
<h1>Debian / Ubuntu</h1>
<div class="details">
<a href="{{ get_url('downloads_select', file='debian') }}">{% trans %}Packages for Debian &amp; Ubuntu are available.{% endtrans %}</a>
<a href="{{ get_url('downloads_select', version=ver(), file='debian') }}">{% trans %}Packages for Debian &amp; Ubuntu are available.{% endtrans %}</a>
</div>
</div>
@@ -131,12 +131,12 @@ or type <tt>java -version</tt> at your command prompt.
<div class="package">
<h1>{{ _('Source package') }}</h1>
<div class="file">
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2psource_%s.tar.bz2'), mirror=1) }}">i2psource_{{ ver() }}.tar.bz2</a> (Google Code)
(<a href="{{ get_url('downloads_select', file=ver('i2psource_%s.tar.bz2')) }}">{{ _('select alternate link') }}</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2psource_%s.tar.bz2'), mirror=1) }}">i2psource_{{ ver() }}.tar.bz2</a> (Google Code)
(<a href="{{ get_url('downloads_select', version=ver(), file=ver('i2psource_%s.tar.bz2')) }}">{{ _('select alternate link') }}</a>)
<div class="sig">
(SHA256
<code>441eac3cb7f25c03e7711c7d516626dc86ba6ad373145ab802d150848262c7c2</code>
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2psource_%s.tar.bz2.sig'), mirror=1) }}">sig</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2psource_%s.tar.bz2.sig'), mirror=1) }}">sig</a>)
</div>
</div>
<div class="details">
@@ -257,12 +257,12 @@ receive the release.
<div class="package">
<h1>{{ _('Manual updates') }}</h1>
<div class="file">
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pupdate_%s.zip'), mirror=1) }}">i2pupdate_{{ ver() }}.zip</a> (Google Code)
(<a href="{{ get_url('downloads_select', file=ver('i2pupdate_%s.zip')) }}">{{ _('select alternate link') }}</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pupdate_%s.zip'), mirror=1) }}">i2pupdate_{{ ver() }}.zip</a> (Google Code)
(<a href="{{ get_url('downloads_select', version=ver(), file=ver('i2pupdate_%s.zip')) }}">{{ _('select alternate link') }}</a>)
<div class="sig">
(SHA256
<code>d20c3f3845c1f4a4cf734dc69cae7de72ff0874cea1382d03d8ac953c50fb139</code>
<a href="{{ url_for('downloads_redirect', protocol='https', file=ver('i2pupdate_%s.zip.sig'), mirror=1) }}">sig</a>)
<a href="{{ url_for('downloads_redirect', version=ver(), protocol='https', file=ver('i2pupdate_%s.zip.sig'), mirror=1) }}">sig</a>)
</div>
</div>
<div class="details">

View File

@@ -7,9 +7,9 @@
<div class="protocol">
<h3>{{ protocol.name | upper }}</h3>
<ul>
<li><a href="{{ url_for('downloads_redirect', protocol=protocol.name, file=file) }}">{{ _('Any mirror') }}</a></li>
<li><a href="{{ url_for('downloads_redirect', version=version, protocol=protocol.name, file=file) }}">{{ _('Any mirror') }}</a></li>
{% for mirror in protocol.mirrors -%}
<li><img src="{{ url_for('static', filename='images/flags/'+mirror.country+'.png') }}" />&nbsp;{% if mirror.org_url %}<a href="{{ mirror.org_url }}">{% endif %}{{ mirror.org }}{% if mirror.org_url %}</a>{% endif %} <a href="{{ url_for('downloads_redirect', protocol=protocol.name, file=file, mirror=loop.index) }}">[{{ _('Download') }}]</a> <a href="{{ url_for('downloads_redirect', protocol=protocol.name, file=file+'.sig', mirror=loop.index) }}">[sig]</a></li>
<li><img src="{{ url_for('static', filename='images/flags/'+mirror.country+'.png') }}" />&nbsp;{% if mirror.org_url %}<a href="{{ mirror.org_url }}">{% endif %}{{ mirror.org }}{% if mirror.org_url %}</a>{% endif %} <a href="{{ url_for('downloads_redirect', version=version, protocol=protocol.name, file=file, mirror=loop.index) }}">[{{ _('Download') }}]</a> <a href="{{ url_for('downloads_redirect', version=version, protocol=protocol.name, file=file+'.sig', mirror=loop.index) }}">[sig]</a></li>
{%- endfor %}
</ul>
</div>

View File

@@ -6,7 +6,7 @@
{%- endif -%}
{%- elif request.endpoint == 'blog_post' -%}{{ url_for('blog_post', lang=lang, slug=slug) }}
{%- elif request.endpoint == 'meetings_show' -%}{{ url_for('meetings_show', lang=lang, id=id) }}
{%- elif request.endpoint == 'downloads_select' -%}{{ url_for('downloads_select', lang=lang, file=file) }}
{%- elif request.endpoint == 'downloads_select' -%}{{ url_for('downloads_select', lang=lang, version=version, file=file) }}
{%- elif request.endpoint -%}{{ url_for(request.endpoint, lang=lang) }}
{%- else -%}{{ url_for('site_show', lang=lang) }}
{%- endif -%}

View File

@@ -55,9 +55,9 @@ url('/<lang:lang>/meetings/<int:id>.rst', 'meetings.views.meetings_show_rst')
url('/<lang:lang>/feed/meetings/atom', 'meetings.views.meetings_atom')
url('/<lang:lang>/download', 'downloads.downloads_list')
url('/<lang:lang>/download/<path:file>', 'downloads.downloads_select')
url('/download/<string:protocol>/any/<path:file>', 'downloads.downloads_redirect', defaults={'mirror': None})
url('/download/<string:protocol>/<int:mirror>/<path:file>', 'downloads.downloads_redirect')
url('/<lang:lang>/download/<string:version>/<path:file>', 'downloads.downloads_select')
url('/download/<string:version>/<string:protocol>/any/<path:file>', 'downloads.downloads_redirect', defaults={'mirror': None})
url('/download/<string:version>/<string:protocol>/<int:mirror>/<path:file>', 'downloads.downloads_redirect')
url('/meeting<int:id>', 'legacy.legacy_meeting')
url('/meeting<int:id>.html', 'legacy.legacy_meeting')