Add in-I2P download mirror

This commit is contained in:
str4d
2015-06-22 22:35:08 +00:00
parent bbc34f8ad1
commit bce4445b59
2 changed files with 14 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
from flask import abort, redirect, render_template
from flask import abort, redirect, render_template, request
try:
import json
except ImportError:
@@ -14,6 +14,13 @@ DEFAULT_MIRROR = {
'country': 'no',
}
DEFAULT_I2P_MIRROR = {
'protocol': 'http',
'domain': 'whnxvjwjhzsske5yevyokhskllvtisv5ueokw6yvh6t7zqrpra2q.b32.i2p',
'org': 'sigterm.no',
'country': 'i2p',
}
###################
# Download handlers
@@ -44,7 +51,11 @@ def read_mirrors():
# List of downloads
def downloads_list():
# TODO: read mirror list or list of available files
return render_template('downloads/list.html', def_mirror=DEFAULT_MIRROR)
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/list.html', def_mirror=def_mirror)
# Debian-specific page
def downloads_debian():

View File

@@ -1,5 +1,6 @@
{"protocol": "https", "domain": "launchpad.net", "path": "/i2p/trunk/%(version)s/+download/%(file)s", "org": "Launchpad", "org_url": "https://launchpad.net", "country": "us"}
{"protocol": "https", "domain": "download.i2p2.de", "path": "/releases/%(version)s/%(file)s", "org": "sigterm.no", "country": "no"}
{"protocol": "http", "domain": "whnxvjwjhzsske5yevyokhskllvtisv5ueokw6yvh6t7zqrpra2q.b32.i2p", "path": "/releases/%(version)s/%(file)s", "org": "sigterm.no", "country": "i2p"}
{"protocol": "http", "domain": "download.i2p2.de", "path": "/releases/%(version)s/%(file)s", "org": "sigterm.no", "country": "no"}
{"protocol": "http", "domain": "download.i2p2.no", "path": "/releases/%(version)s/%(file)s", "org": "sigterm.no", "country": "no"}
{"protocol": "https", "domain": "dl.dropboxusercontent.com", "path": "/u/18621288/I2P/%(version)s/%(file)s", "org": "Dropbox", "country": "us"}