service: Show port forwarding info when available

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2019-05-10 20:58:56 -04:00 committed by Sunil Mohan Adapa
parent 3cc16fc23e
commit bf63ebaa96
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
8 changed files with 28 additions and 0 deletions

View File

@ -36,6 +36,7 @@ class EjabberdServiceView(ServiceView):
diagnostics_module_name = 'ejabberd'
form_class = EjabberdForm
manual_page = ejabberd.manual_page
port_forwarding_info = ejabberd.port_forwarding_info
def get_initial(self):
initdict = super().get_initial()

View File

@ -78,6 +78,7 @@ class InfinotedServiceView(ServiceView):
diagnostics_module_name = "infinoted"
description = description
clients = clients
port_forwarding_info = port_forwarding_info
def setup(helper, old_version=None):

View File

@ -39,6 +39,7 @@ class MinetestServiceView(ServiceView): # pylint: disable=too-many-ancestors
form_class = MinetestForm
clients = minetest.clients
manual_page = minetest.manual_page
port_forwarding_info = minetest.port_forwarding_info
def get_initial(self):
"""Return the values to fill in the form."""

View File

@ -83,6 +83,7 @@ class MumbleServiceView(ServiceView):
description = description
clients = clients
manual_page = manual_page
port_forwarding_info = port_forwarding_info
def setup(helper, old_version=None):

View File

@ -61,6 +61,7 @@ def index(request):
'title': openvpn.name,
'description': openvpn.description,
'manual_page': openvpn.manual_page,
'port_forwarding_info': openvpn.port_forwarding_info,
'status': status,
'form': form
})

View File

@ -89,6 +89,7 @@ class QuasselServiceView(ServiceView):
description = description
clients = clients
manual_page = manual_page
port_forwarding_info = port_forwarding_info
def setup(helper, old_version=None):

View File

@ -75,6 +75,26 @@
{% include "internal-zone.html" %}
{% if port_forwarding_info %}
<h3>{% trans "Port Forwarding" %}</h3>
<p>
{% with service_name=service.name %}
{% blocktrans trimmed %}
If your FreedomBox is behind a router, you will need to set up port
forwarding on your router. You should forward the following ports for
{{ service_name }}:
{% endblocktrans %}
{% endwith %}
</p>
<ul>
{% for port in port_forwarding_info %}
<li>{{ port.0 }} {{ port.1 }}</li>
{% endfor %}
</ul>
{% endif %}
{% block configuration %}
<h3>{% trans "Configuration" %}</h3>

View File

@ -122,6 +122,7 @@ class ServiceView(FormView):
service_id = None
template_name = 'service.html'
manual_page = ""
port_forwarding_info = None
@property
def success_url(self):
@ -177,6 +178,7 @@ class ServiceView(FormView):
context['description'] = self.description
context['show_status_block'] = self.show_status_block
context['manual_page'] = self.manual_page
context['port_forwarding_info'] = self.port_forwarding_info
return context