2013-10-03 16:40:15 +02:00

74 lines
3.0 KiB
HTML

{% extends "base.html" %}
{% load bootstrap %}
{% block content %}
<div class="row">
<div class="col-lg-12">
<h3>Your Hosts</h3>
<table class="table">
<tr><th>Host</th><th>Last IP Update</th><th>IPv4 Address</th><th>IPv6 Address</th><th>Comment</th><th>Action</th></tr>
{% for host in hosts %}
<tr>
<td><a href="{% url 'host_view' host.pk %}"><b>{{ host.subdomain }}.{{ host.domain.domain }}</b></a></td>
<td id="last{{ host.pk }}">{{ host.last_api_update|timesince }}</td>
<td>{{ host.getIPv4 }}</td>
<td>{{ host.getIPv6 }}</td>
<td>{{ host.comment }}</td>
<td>
<a href="{% url 'host_view' host.pk %}"><i class="icon icon-pencil"></i> edit</a> |
<a href="{% url 'delete_host' host.pk %}"><i class="icon icon-remove"></i> delete</a> |
<a href="#" onclick="update_host('{{ host.get_fqdn }}',{{ host.pk }})"><i class="icon icon-refresh"></i> update</a>
</td>
</tr>
{% empty %}
<tr>No hosts yet.</tr>
{% endfor %}
</table>
</div>
<script>
update_host = function(host,pk) {
$('#update_result').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myip').val(), hostname: host } )
.done(function( data ) {
$('#last'+pk).text("0 minutes");
}).fail(function( data ) {
$('#last'+pk).text("error updating");
});
}
</script>
</div>
<hr>
<div class="row">
<div class="col-lg-4">
<div class="well well-sm">
<h3>Create a new Host</h3>
<form method="post" action="">
{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">Create</button>
</form>
</div>
</div>
<div class="col-lg-8">
<div class="well well-sm">
<h3>Your current IPs</h3>
<p><b>Your IPv4:</b> <span class="ipv4addr">{{ request.session.ipv4 }}</span></p>
<p><b>Your IPv6:</b> <span class="ipv6addr">{{ request.session.ipv6 }}</span></p>
<p>Note: We try to get your IP addresses through a trick, by hosting two fake images:</p>
<ol>
<li>on a IPv4-only server</li>
<li>on a IPv6-only server</li>
</ol>
<p>
That way we can detect your IPs when your browser tries to load the images and
associate them with your session.
If we detected an IP address, we will update this information accordingly.
</p>
</div>
</div>
</div>
{% endblock %}