WebUI: Display DHT information in the Status bar only when DHT is enabled

GUI completely hides DHT information when DHT is disabled - now WebUI does the same thing.

Closes #18417.
PR #21339.
This commit is contained in:
skomerko 2024-09-22 08:06:25 +02:00 committed by GitHub
parent 1c43286616
commit 183c7c75b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -927,7 +927,17 @@ window.addEventListener("DOMContentLoaded", () => {
+ window.qBittorrent.Client.mainTitle();
$("freeSpaceOnDisk").textContent = "QBT_TR(Free space: %1)QBT_TR[CONTEXT=HttpServer]".replace("%1", window.qBittorrent.Misc.friendlyUnit(serverState.free_space_on_disk));
$("DHTNodes").textContent = "QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]".replace("%1", serverState.dht_nodes);
const dhtElement = document.getElementById("DHTNodes");
if (window.qBittorrent.Cache.preferences.get().dht) {
dhtElement.textContent = "QBT_TR(DHT: %1 nodes)QBT_TR[CONTEXT=StatusBar]".replace("%1", serverState.dht_nodes);
dhtElement.classList.remove("invisible");
dhtElement.previousElementSibling.classList.remove("invisible");
}
else {
dhtElement.classList.add("invisible");
dhtElement.previousElementSibling.classList.add("invisible");
}
// Statistics dialog
if (document.getElementById("statisticsContent")) {