Zdalne-systemy-z-kit-uVPN/templates/index.html

102 lines
2.0 KiB
HTML
Raw Normal View History

2023-04-13 09:54:05 +00:00
<!DOCTYPE html>
<html>
2023-04-13 09:54:05 +00:00
<head>
<title>Panel administracyjny</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
h1 {
font-size: 32px;
font-weight: bold;
color: #333;
margin: 20px 0;
}
table {
border-collapse: collapse;
margin: 20px 0;
width: 100%;
}
table th, table td {
padding: 10px;
text-align: left;
vertical-align: middle;
border: 1px solid #ccc;
}
table th {
background-color: #eee;
font-weight: bold;
}
table tr:hover {
background-color: #f0f0f0;
}
button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 0;
cursor: pointer;
}
button:hover {
background-color: #3e8e41;
}
</style>
2023-04-13 09:54:05 +00:00
</head>
<body>
<h1>Lista maszyn</h1>
2023-04-19 07:43:00 +00:00
<table>
<thead>
<tr>
<th>Nazwa maszyny</th>
<th>Obraz</th>
<th>Czas uruchomienia</th>
<th>IP uVPN</th>
2023-04-19 10:01:53 +00:00
<th>IP lokalne</th>
2023-04-19 07:43:00 +00:00
<th></th>
</tr>
</thead>
<tbody>
{% for machine in machines %}
<tr>
<td>{{ machine.name }}</td>
<td>{{ machine.image_name }}</td>
<td>{{ machine.start_time }}</td>
2023-04-19 10:01:53 +00:00
<td>{{ machine.ipvpn }}</td>
<td>{{ machine.iplocal }}</td>
2023-04-19 07:49:52 +00:00
<td><button onclick="ssh('{{ machine.ip }}', '{{ machine.username }}', '{{ machine.password }}')">SSH</button></td>
2023-04-19 07:43:00 +00:00
</tr>
{% endfor %}
</tbody>
</table>
<script>
function ssh(ipvpn, username, password) {
const currentLocation = window.location;
// budowanie nowego URL
2023-04-19 07:47:30 +00:00
const newUrl = currentLocation.protocol + '//' + currentLocation.hostname + ':' + {{ ssh_port }} + "/?hostname="+ipvpn+"&username="+username+"&password="+btoa(password);
2023-04-19 07:46:53 +00:00
console.log(newUrl);
// przekierowanie na nowy URL
2023-04-19 07:51:32 +00:00
window.open(newUrl,"_blank");
}
</script>
2023-04-13 09:54:05 +00:00
</body>
</html>