Zdalne-systemy-z-kit-uVPN/templates/index.html
2023-04-24 10:22:17 +02:00

46 lines
1.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Panel administracyjny{% endblock %}
{% block style %}
<link rel="stylesheet" href="/style/index.css" />
{% endblock %}
{% block content %}
<div class="container">
<h1 class="my-5 mx-auto">Lista maszyn</h1>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Nazwa maszyny(token)</th>
<th>Obraz</th>
<th>Czas uruchomienia (UTC)</th>
<th>IP uVPN</th>
<th>IP lokalne</th>
<th></th>
</tr>
</thead>
<tbody>
{% for machine in machines %}
<tr>
<td>{{ machine.name }}</td>
<td>{{ machine.image_name }}</td>
<td>{{ machine.start_time }}</td>
<td>{{ machine.ipvpn }}</td>
<td>{{ machine.iplocal }}</td>
<td><button class="btn btn-primary" onclick="ssh('{{ machine.ipvpn }}','{{machine.iplocal}}', '{{ machine.username }}', '{{ machine.password }}')">SSH</button></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
function ssh(ipvpn, iplocal, username, password) {
const currentLocation = window.location;
let ip = ipvpn != null ? ipvpn : iplocal;
const newUrl = currentLocation.protocol + '//' + currentLocation.hostname + ':' + {{ ssh_port }} + "/?hostname="+ip+"&username="+username+"&password="+btoa(password);
window.open(newUrl,"_blank");
}
</script>
{% endblock %}