API keys: Varaverk_HOST1 registered on all machines, keys in host*.conf, cross-host GraphQL direct access

This commit is contained in:
Gmer4Lfe
2026-06-03 18:39:19 -04:00
parent 7178be73a5
commit a41adfe020
3 changed files with 186 additions and 169 deletions
+20 -12
View File
@@ -152,10 +152,12 @@ $_apiPreview = $_apiKey ? substr($_apiKey, 0, 8) . '...' . substr($_apiKey, -4)
<div id="vv-api-hosts" style="margin-bottom:12px;"></div>
<div style="font-size:11px;color:#444;margin-bottom:12px;line-height:1.6;">
Each host registers a key named <code style="font-size:10px;color:#4a7a4a;background:#080808;padding:1px 4px;border-radius:2px;">Varaverk_HOST1</code>,
<code style="font-size:10px;color:#4a7a4a;background:#080808;padding:1px 4px;border-radius:2px;">Varaverk_HOST2</code>, etc.
Keys are stored in <code style="font-size:10px;color:#4a7a4a;background:#080808;padding:1px 4px;border-radius:2px;">master.conf</code>
so every host can query every other host's GraphQL API directly — no SSH needed for remote monitoring.
Each host registers
<code style="font-size:10px;color:#4a7a4a;background:#080808;padding:1px 4px;border-radius:2px;">Varaverk_HOST1</code>
in <em>every</em> machine's local Unraid registry — own machine plus all partners.
The key values are stored in the private <code style="font-size:10px;color:#4a7a4a;background:#080808;padding:1px 4px;border-radius:2px;">host*.conf</code>
so each host can query every other host's GraphQL API directly — real-time monitoring, no SSH.
During offboard, partner keys are removed from each registry automatically.
</div>
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap;">
@@ -349,16 +351,22 @@ function vvApiCheck() {
badge.className = 'vv-set-badge ' + (allOk ? 'internal' : 'flash');
if (hosts) hosts.innerHTML = d.hosts.map(h => {
const local = h.is_local ? ' <span style="color:#2a3a2a;font-size:9px;">local</span>' : '';
const tag = h.is_local
? `<span style="color:#2a3a2a;font-size:9px;margin-left:4px;">own</span>`
: `<span style="color:#2a2a3a;font-size:9px;margin-left:4px;">${d.my_id}'s key on ${h.host_id}</span>`;
const keyBit = h.key_present
? `<code style="font-size:9px;color:#4a6a4a;">${h.key_preview}</code>`
: `<span style="color:#8b2a2a;font-size:10px;">not set</span>`;
const dot = h.api_ok ? '#4caf50' : '#555';
const name = `Varaverk_${h.host_id}`;
return `<div style="display:flex;align-items:baseline;gap:8px;padding:3px 0;border-bottom:1px solid #111;">
<span style="width:6px;height:6px;border-radius:50%;background:${dot};flex-shrink:0;margin-top:3px;display:inline-block;"></span>
<span style="font-size:11px;color:#666;width:60px;flex-shrink:0;">${h.host_id}${local}</span>
<code style="font-size:9px;color:#2a3a2a;flex-shrink:0;">${name}</code>
: `<span style="color:#8b2a2a;font-size:10px;">not set — click Setup</span>`;
const dot = h.api_ok ? '#4caf50' : (h.key_present ? '#ffb74d' : '#444');
// Key name in that machine's registry: always Varaverk_<MY_ID>
const keyName = `Varaverk_${d.my_id}`;
const registry = h.is_local ? h.host_id : h.host_id;
return `<div style="display:flex;align-items:center;gap:8px;padding:4px 0;border-bottom:1px solid #111;">
<span style="width:6px;height:6px;border-radius:50%;background:${dot};flex-shrink:0;display:inline-block;"></span>
<span style="font-size:11px;color:#666;flex-shrink:0;min-width:50px;">${h.host_id}</span>
<code style="font-size:9px;color:#2a3a2a;flex-shrink:0;">${keyName}</code>
<span style="font-size:9px;color:#2a2a2a;flex-shrink:0;">on ${registry}</span>
${tag}
<span style="flex:1;text-align:right;">${keyBit}</span>
</div>`;
}).join('');