From 5c9655abc33be3be8d6a1e24faacfaa9174b5777 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 9 Oct 2021 02:20:27 +0800 Subject: [PATCH] WebAPI: Use specific number to represent non-existing values Closes #15545. --- src/webui/api/torrentscontroller.cpp | 6 +++--- src/webui/www/private/scripts/prop-trackers.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index 14e1c14dc..aadaacdc4 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -176,7 +176,7 @@ namespace const QJsonObject dht { {KEY_TRACKER_URL, "** [DHT] **"}, - {KEY_TRACKER_TIER, ""}, + {KEY_TRACKER_TIER, -1}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, {KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isDHTEnabled() && !isTorrentPrivate) ? working : disabled)}, {KEY_TRACKER_PEERS_COUNT, 0}, @@ -188,7 +188,7 @@ namespace const QJsonObject pex { {KEY_TRACKER_URL, "** [PeX] **"}, - {KEY_TRACKER_TIER, ""}, + {KEY_TRACKER_TIER, -1}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, {KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isPeXEnabled() && !isTorrentPrivate) ? working : disabled)}, {KEY_TRACKER_PEERS_COUNT, 0}, @@ -200,7 +200,7 @@ namespace const QJsonObject lsd { {KEY_TRACKER_URL, "** [LSD] **"}, - {KEY_TRACKER_TIER, ""}, + {KEY_TRACKER_TIER, -1}, {KEY_TRACKER_MSG, (isTorrentPrivate ? privateMsg : "")}, {KEY_TRACKER_STATUS, ((BitTorrent::Session::instance()->isLSDEnabled() && !isTorrentPrivate) ? working : disabled)}, {KEY_TRACKER_PEERS_COUNT, 0}, diff --git a/src/webui/www/private/scripts/prop-trackers.js b/src/webui/www/private/scripts/prop-trackers.js index 985449c04..718d170ba 100644 --- a/src/webui/www/private/scripts/prop-trackers.js +++ b/src/webui/www/private/scripts/prop-trackers.js @@ -97,7 +97,7 @@ window.qBittorrent.PropTrackers = (function() { const row = { rowId: tracker.url, - tier: tracker.tier, + tier: (tracker.tier >= 0) ? tracker.tier : "", url: tracker.url, status: status, peers: tracker.num_peers,