From 183c7c75b1949ca668d6b3d62d6ab2b8b6aeb42d Mon Sep 17 00:00:00 2001 From: skomerko <168652295+skomerko@users.noreply.github.com> Date: Sun, 22 Sep 2024 08:06:25 +0200 Subject: [PATCH] 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. --- src/webui/www/private/scripts/client.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index e18830daa..4357ded37 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -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")) { -- 2.11.4.GIT