mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-03-17 14:26:18 +00:00
add support for displaying Django hostnames in application details
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import ipaddress
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -55,11 +56,21 @@ def view_application_details(request):
|
|||||||
hosts = application.hosts.all().order_by('hostname')
|
hosts = application.hosts.all().order_by('hostname')
|
||||||
routes = application.routes.all().order_by('order', 'path_prefix')
|
routes = application.routes.all().order_by('order', 'path_prefix')
|
||||||
|
|
||||||
|
is_reserved = application.name == RESERVED_APP_NAME
|
||||||
|
django_hostnames = []
|
||||||
|
if is_reserved:
|
||||||
|
for host in settings.ALLOWED_HOSTS:
|
||||||
|
try:
|
||||||
|
ipaddress.ip_address(host)
|
||||||
|
except ValueError:
|
||||||
|
django_hostnames.append(host)
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'application': application,
|
'application': application,
|
||||||
'hosts': hosts,
|
'hosts': hosts,
|
||||||
'routes': routes,
|
'routes': routes,
|
||||||
'is_reserved': application.name == RESERVED_APP_NAME,
|
'is_reserved': is_reserved,
|
||||||
|
'django_hostnames': django_hostnames,
|
||||||
'page_title': _('Application Details'),
|
'page_title': _('Application Details'),
|
||||||
}
|
}
|
||||||
return render(request, 'app_gateway/application_details.html', context)
|
return render(request, 'app_gateway/application_details.html', context)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if hosts %}
|
{% if hosts or django_hostnames %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover">
|
<table class="table table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -77,6 +77,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{% for hostname in django_hostnames %}
|
||||||
|
<tr class="text-muted">
|
||||||
|
<td>{{ hostname }}</td>
|
||||||
|
<td style="width: 15%"></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
{% for host in hosts %}
|
{% for host in hosts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ host.hostname }}</td>
|
<td>{{ host.hostname }}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user