Report the partner's API key and whether it is actually answering
This commit is contained in:
@@ -498,7 +498,27 @@ function vv_pt_nodes(): array {
|
||||
$apiKeySet = true;
|
||||
$apiKeyPreview = substr($apiData['key'], 0, 8) . '...' . substr($apiData['key'], -4);
|
||||
}
|
||||
} else {
|
||||
// The partner's key is in the partner's own conf, which this host holds in the RAM
|
||||
// cache that conf_sync fills — never on disk here, because sparse checkout means a
|
||||
// host only ever checks out its own host*.conf.
|
||||
//
|
||||
// Two separate facts, deliberately not merged: a key being CONFIGURED is read from
|
||||
// that conf, and the key WORKING is proven by the partner's API having answered this
|
||||
// page's own stats call. A configured key that no longer authenticates would
|
||||
// otherwise render exactly like a healthy one.
|
||||
$pConf = VV_CONF_RAM_CACHE_DIR . '/' . strtolower($nodeIdUpper) . '.conf';
|
||||
if (is_readable($pConf)) {
|
||||
$pKey = vv_arr_scalar((string)@file_get_contents($pConf), $nodeIdUpper . '_UNRAID_API_KEY');
|
||||
if ($pKey !== '') {
|
||||
$apiKeySet = true;
|
||||
$apiKeyPreview = substr($pKey, 0, 8) . '...' . substr($pKey, -4);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Did the partner's API actually answer? Empty for self, where the local API has its own
|
||||
// banner on the Monitor tab.
|
||||
$apiLive = !$isMe && !empty(($remoteStats[$nodeIdUpper] ?? [])['available']);
|
||||
|
||||
// Live metrics: local uses vv_api_data() (cached); remote uses vv_remote_hosts_stats() (30s cache)
|
||||
if ($isMe) {
|
||||
@@ -549,6 +569,7 @@ function vv_pt_nodes(): array {
|
||||
'local_done' => $localDone,
|
||||
'api_key_set' => $apiKeySet,
|
||||
'api_key_preview' => $apiKeyPreview,
|
||||
'api_live' => $apiLive,
|
||||
'metrics' => $metrics,
|
||||
'media_seed' => $isMe ? [] : vv_pt_media_seed($setupDb, $nodeIdUpper),
|
||||
// Every condition that has to hold for this partner to actually be usable, each
|
||||
|
||||
Reference in New Issue
Block a user