Tweaked mirror code so mirror urls can contain the current I2P version, added Launchpad as HTTPS mirror
NOTE: this enables mirrors that require a version string to download the current version of files. Older file versions will *not* be downloadable (that would require parsing the requested filename to try and find a version). Hey, it's better than no support at all =)
This commit is contained in:
@@ -16,6 +16,8 @@ except ImportError:
|
|||||||
|
|
||||||
from helpers import Pagination
|
from helpers import Pagination
|
||||||
|
|
||||||
|
CURRENT_I2P_VERSION = '0.9.4'
|
||||||
|
|
||||||
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'pages')
|
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'pages')
|
||||||
STATIC_DIR = os.path.join(os.path.dirname(__file__), 'static')
|
STATIC_DIR = os.path.join(os.path.dirname(__file__), 'static')
|
||||||
|
|
||||||
@@ -406,13 +408,17 @@ def downloads_select(file):
|
|||||||
if (file == 'debian'):
|
if (file == 'debian'):
|
||||||
return render_template('downloads/debian.html')
|
return render_template('downloads/debian.html')
|
||||||
mirrors=read_mirrors()
|
mirrors=read_mirrors()
|
||||||
|
data = {
|
||||||
|
'version': CURRENT_I2P_VERSION,
|
||||||
|
'file': file,
|
||||||
|
}
|
||||||
obj=[]
|
obj=[]
|
||||||
for protocol in mirrors.keys():
|
for protocol in mirrors.keys():
|
||||||
a={}
|
a={}
|
||||||
a['name']=protocol
|
a['name']=protocol
|
||||||
a['mirrors']=mirrors[protocol]
|
a['mirrors']=mirrors[protocol]
|
||||||
for mirror in a['mirrors']:
|
for mirror in a['mirrors']:
|
||||||
mirror['url']=mirror['url'] % file
|
mirror['url']=mirror['url'] % data
|
||||||
obj.append(a)
|
obj.append(a)
|
||||||
return render_template('downloads/select.html', mirrors=obj, file=file)
|
return render_template('downloads/select.html', mirrors=obj, file=file)
|
||||||
|
|
||||||
@@ -423,9 +429,13 @@ def downloads_redirect(protocol, file, mirror):
|
|||||||
if not protocol in mirrors:
|
if not protocol in mirrors:
|
||||||
abort(404)
|
abort(404)
|
||||||
mirrors=mirrors[protocol]
|
mirrors=mirrors[protocol]
|
||||||
|
data = {
|
||||||
|
'version': CURRENT_I2P_VERSION,
|
||||||
|
'file': file,
|
||||||
|
}
|
||||||
if mirror:
|
if mirror:
|
||||||
return redirect(mirrors[mirror]['url'] % file)
|
return redirect(mirrors[mirror]['url'] % data)
|
||||||
return redirect(mirrors[randint(0, len(mirrors) - 1)]['url'] % file)
|
return redirect(mirrors[randint(0, len(mirrors) - 1)]['url'] % data)
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
{"url": "http://i2p.googlecode.com/files/%s", "org": "Google Code", "org_url": "http://code.google.com", "protocol": "http", "country": "us"}
|
{"url": "http://i2p.googlecode.com/files/%(file)s", "org": "Google Code", "org_url": "http://code.google.com", "protocol": "http", "country": "us"}
|
||||||
{"url": "http://golden.mtveurope.org/~yang/i2p_mirror/%s", "org": "VServer.si", "org_url": "http://www.vserver.si", "protocol": "http", "country": "lu"}
|
{"url": "http://golden.mtveurope.org/~yang/i2p_mirror/%(file)s", "org": "VServer.si", "org_url": "http://www.vserver.si", "protocol": "http", "country": "lu"}
|
||||||
{"url": "http://a.mirror.geti2p.net/releases/current/%s", "org": "welterde", "protocol": "http", "country": "de"}
|
{"url": "http://a.mirror.geti2p.net/releases/current/%(file)s", "org": "welterde", "protocol": "http", "country": "de"}
|
||||||
|
{"url": "https://launchpad.net/i2p/trunk/%(version)s/+download/%(file)s", "org": "Launchpad", "org_url": "https://launchpad.net", "protocol": "https", "country": "us"}
|
||||||
|
Reference in New Issue
Block a user