Commit 9e037cf2 by Kálmán Viktor Committed by Bach Dániel

dashboard: properly make https/ftp links

parent 90bd13c0
......@@ -3,7 +3,7 @@ from django import template
register = template.Library()
LINKABLE_PORTS = [80, 8080, 443, 8010]
LINKABLE_PORTS = {80: "http", 8080: "http", 443: "https", 21: "ftp"}
@register.simple_tag(name="display_portforward")
......@@ -11,7 +11,8 @@ def display_pf(ports):
is_ipv6 = "ipv6" in ports
data = ports["ipv6" if is_ipv6 else "ipv4"]
if ports['private'] in LINKABLE_PORTS:
if ports['private'] in LINKABLE_PORTS.keys():
href = "%s:%d" % (data['host'], data['port'])
return '<a href="http://%s">%s</a>' % (href, href)
return '<a href="%s://%s">%s</a>' % (
LINKABLE_PORTS.get(ports['private']), href, href)
return "%s:%d" % (data['host'], data['port'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment