From a11e3d73a7b945a4831256847fbac520f2961f9c Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Fri, 14 Aug 2026 17:51:04 -0400 Subject: [PATCH] Escape what the arrs report about themselves, and give the tab an assistant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Health messages go straight from each arr's API into innerHTML and quote things nobody here controls — indexer names from Prowlarr, import-list names, release titles. The page used no escaping at all. _sz() was also binary while labelling its output TB, so /tv read 86.9 TB here and 95.6 TB on every other tab; it has one caller and that caller is disk capacity, so it now matches the rest. --- Plugin/unraid/js/varaverk.js | 17 ++++++++--- Plugin/unraid/pages/arrs.php | 57 +++++++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/Plugin/unraid/js/varaverk.js b/Plugin/unraid/js/varaverk.js index 1c5a3ea..ce08409 100644 --- a/Plugin/unraid/js/varaverk.js +++ b/Plugin/unraid/js/varaverk.js @@ -23,12 +23,21 @@ function _fmtBytes(b) { return (b / 1024).toFixed(0) + ' KB'; } -// Bytes → auto-scale TB / GB / MB +// Bytes → auto-scale TB / GB / MB, decimal. +// +// Its only caller is the arr disk bar, which is showing the same storage the Monitor and Watchdog +// tabs show. Those were moved to decimal so a disk reads the same number here as on Unraid's own +// Main page and as printed on the drive; leaving this one binary made /tv 86.9 TB on this tab and +// 95.6 TB on the next, which is worse than either convention chosen consistently. +// +// Capacity is decimal, memory stays binary — 128 GB of RAM genuinely is 125.8 GiB and every tool +// on the box agrees. See _vv_api_bytes_to_gib() in include/unraid_api.php for the same split on +// the PHP side. function _sz(b) { if (!b) return '—'; - if (b >= _TB) return (b / _TB).toFixed(1) + ' TB'; - if (b >= _GB) return (b / _GB).toFixed(1) + ' GB'; - return (b / _MB).toFixed(0) + ' MB'; + if (b >= 1e12) return (b / 1e12).toFixed(1) + ' TB'; + if (b >= 1e9) return (b / 1e9).toFixed(1) + ' GB'; + return (b / 1e6).toFixed(0) + ' MB'; } function _gb(b) { return !b ? '—' : (b / _GB).toFixed(1) + ' GB'; } diff --git a/Plugin/unraid/pages/arrs.php b/Plugin/unraid/pages/arrs.php index 0ae91aa..6e8fa30 100644 --- a/Plugin/unraid/pages/arrs.php +++ b/Plugin/unraid/pages/arrs.php @@ -26,6 +26,7 @@ // api/arrs.php polled every 60s → include/arrs.php // api/confform.php inline conf edits → include/confform.php require_once dirname(__DIR__) . '/include/confui.php'; +require_once dirname(__DIR__) . '/include/ai_chat.php'; ?>