dodanie zabezpieczenia złego ip dla vpn

This commit is contained in:
2023-04-21 10:05:58 +02:00
parent 2ebacf8563
commit 7297474469
3 changed files with 15 additions and 5 deletions

View File

@@ -78,7 +78,7 @@
<td>{{ machine.start_time }}</td>
<td>{{ machine.ipvpn }}</td>
<td>{{ machine.iplocal }}</td>
<td><button class="btn btn-primary" onclick="ssh('{{ machine.ipvpn }}', '{{ machine.username }}', '{{ machine.password }}')">SSH</button></td>
<td><button class="btn btn-primary" onclick="ssh('{{ machine.ipvpn }}','{{machine.iplocal}}', '{{ machine.username }}', '{{ machine.password }}')">SSH</button></td>
</tr>
{% endfor %}
</tbody>
@@ -86,9 +86,10 @@
</div>
<script>
function ssh(ipvpn, username, password) {
function ssh(ipvpn, iplocal username, password) {
const currentLocation = window.location;
const newUrl = currentLocation.protocol + '//' + currentLocation.hostname + ':' + {{ ssh_port }} + "/?hostname="+ipvpn+"&username="+username+"&password="+btoa(password);
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>