1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

community tunnel, minor bugfixes

This commit is contained in:
Marek Farkaš
2025-11-30 22:49:00 +01:00
parent 7f6957e162
commit 531a0f23e6
10 changed files with 108 additions and 24 deletions

View File

@@ -10,6 +10,9 @@ $(document).ready(function() {
showPanelFromHash();
initNav();
initBanlist();
checkTunnelServers();
setInterval(checkTunnelServers, 10000);
});
/**
@@ -253,3 +256,32 @@ async function loadConsoleLogs() {
});
$("#console-output").length ? $("#console-output").scrollTop($("#console-output")[0].scrollHeight) : null;
}
function checkTunnelServers() {
$.ajax({
url: '/tunnelservers',
method: 'GET',
success: function(servers) {
const $options = $('#tunnel-server ul.options');
const $input = $('#tunnel-serverSelect');
const selectedValue = $input.val(); // currently selected value (label or value?)
servers.forEach(server => {
const $li = $options.find(`li[data-value="${server.value}"]`);
if ($li.length) {
$li.text(server.label);
// If this li is the currently selected one, update input text too
// Note: input.val() holds the label, so match by label is safer
if ($li.text() === selectedValue || server.value === selectedValue) {
$input.val(server.label);
}
}
});
},
error: function() {
console.error('Failed to load server latency data');
}
});
}