dropbear-ssh #5

Merged
wt merged 3 commits from dropbear-ssh into main 2025-01-05 17:12:19 +00:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit bc17587a15 - Show all commits

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ const routes = {
ssh_port_get: () => [host, prefix, 'settings', 'ssh', 'port', 'get'].join('/'),
ssh_port_set: () => [host, prefix, 'settings', 'ssh', 'port', 'set'].join('/'),
ssh_server_get: () => [host, prefix, 'settings', 'ssh', 'server', 'get'].join('/'),
ssh_server_set: () => [host, prefix, 'settings', 'ssh', 'server', 'set'].join('/'),
dns_status: () => [host, prefix, 'settings', 'dns', 'get'].join('/'),
dns_status_set: () => [host, prefix, 'settings', 'dns', 'set'].join('/'),
+18 -1
View File
@@ -45,6 +45,7 @@ set_ssh_settings.addEventListener('click', () => {
if (confirm("Confirm SSH settings?")) {
set_ssh_status()
set_ssh_port()
set_ssh_server()
}
})
@@ -157,4 +158,20 @@ const get_ssh_server = () => {
}).catch((error) => {
notification(`Ошибка на сервере: ${error}`, "error")
})
}
}
const set_ssh_server = () => {
fetch(routes.ssh_server_set(), {
method: 'POST',
body: `{"token":"${localStorage.getItem("token")}","server":"${sshserverinput.options[sshserverinput.selectedIndex].value}"}`
}).then(data => data.json()).then(jsondata => {
for (let i = 0; i < sshserverinput.options.length; i++) {
if (sshserverinput.options[i].value === jsondata.server) {
sshserverinput.selectedIndex = i;
break;
}
}
}).catch((error) => {
notification(`Ошибка на сервере: ${error}`, "error")
})
}