Let the media server card show the whole mesh, not just this host

A partner's Emby URL is http://localhost:8096 — true there, meaningless here —
so nobody queries a partner's media server directly. Each host reports its own
over the SSH call remote_arr_cache_writer.sh already makes, which keeps its API
keys on it and costs no extra connection. Local is the default: opening the tab
to check your own server should not first make you read past a partner's.
A partner with no cache is stated as not collected rather than omitted, because
an empty mesh view and a partner that is down look identical otherwise.
This commit is contained in:
Gmer4Lfe
2026-08-14 19:30:23 -04:00
parent 24710af156
commit 04a0dcb39a
4 changed files with 100 additions and 6 deletions
@@ -152,9 +152,11 @@ for host_var in HOST1 HOST2 HOST3 HOST4 HOST5 HOST6 HOST7 HOST8; do
"php -r \"
require_once '/usr/local/emhttp/plugins/varaverk/include/arrs.php';
require_once '/usr/local/emhttp/plugins/varaverk/include/unraid_api.php';
require_once '/usr/local/emhttp/plugins/varaverk/include/media.php';
echo json_encode([
'arrs' => vv_arrs_local_node(),
'monitor' => vv_local_host_stats(),
'media' => function_exists('vv_media_server_stats') ? vv_media_server_stats() : [],
]);
\"" 2>/dev/null)
@@ -188,6 +190,19 @@ for host_var in HOST1 HOST2 HOST3 HOST4 HOST5 HOST6 HOST7 HOST8; do
file_put_contents('$MONITOR_CACHE', json_encode(\$d['monitor']));
" 2>/dev/null
# Save media server cache. Collected here rather than queried directly because a partner's
# Emby URL is http://localhost:8096 — true on that host and meaningless from this one. The
# same reason the arrs are collected this way: each host answers about itself, and its API
# keys never leave it.
#
# Absent on a partner running an older build, which is why it is written only when present:
# an empty file would read as "no media servers there" rather than "not collected yet".
MEDIA_CACHE="$VV_CACHE_DIR/media_remote_${host_id}.json"
echo "$RESULT" | php -r "
\$d = json_decode(file_get_contents('php://stdin'), true);
if (!empty(\$d['media'])) file_put_contents('$MEDIA_CACHE', json_encode(\$d['media']));
" 2>/dev/null
CACHED_TYPES=$(echo "$RESULT" | php -r "
\$d = json_decode(file_get_contents('php://stdin'), true);
echo implode(', ', array_column(\$d['arrs']['arrs'] ?? [], 'type'));