diff --git a/Plugin/unraid/api/storage.php b/Plugin/unraid/api/storage.php index 4497af8..45248e1 100644 --- a/Plugin/unraid/api/storage.php +++ b/Plugin/unraid/api/storage.php @@ -95,4 +95,37 @@ if ($action === 'detect' && $_SERVER['REQUEST_METHOD'] === 'POST') { exit; } +// ── Unraid API key status ───────────────────────────────────────────────────── +if ($action === 'api_status') { + require_once dirname(__DIR__) . '/include/unraid_api.php'; + $data = vv_api_data(); + $status = vv_api_get_status(); + $vars = vv_conf_vars(); + $myHost = vv_detect_host(); + $keyVar = strtoupper($myHost) . '_UNRAID_API_KEY'; + $key = $vars[$keyVar] ?? ''; + echo json_encode([ + 'ok' => true, + 'key_present' => !empty($key), + 'key_preview' => $key ? substr($key, 0, 8) . '...' . substr($key, -4) : null, + 'api_ok' => !empty($key) && !$status['key_missing'] && $status['available'], + 'key_missing' => $status['key_missing'], + 'fallbacks' => $status['fallbacks'], + ]); + exit; +} + +// ── Renew Unraid API key ────────────────────────────────────────────────────── +if ($action === 'renew_apikey' && $_SERVER['REQUEST_METHOD'] === 'POST') { + $script = SCRIPTS_DIR . '/unRAID_Essentials/unraid_api_key_renew.sh'; + if (!file_exists($script)) { + echo json_encode(['ok' => false, 'error' => 'unraid_api_key_renew.sh not found']); exit; + } + set_time_limit(30); + $output = []; $exit = 0; + exec('bash ' . escapeshellarg($script) . ' 2>&1', $output, $exit); + echo json_encode(['ok' => $exit === 0, 'exit' => $exit, 'output' => implode("\n", $output)]); + exit; +} + echo json_encode(['ok' => false, 'error' => 'Unknown action']); diff --git a/Plugin/unraid/pages/settings.php b/Plugin/unraid/pages/settings.php index e28494a..1ccdbc5 100644 --- a/Plugin/unraid/pages/settings.php +++ b/Plugin/unraid/pages/settings.php @@ -1,8 +1,22 @@
@@ -73,6 +100,78 @@ $_confVal = $_vars[$_confKey] ?? null;

   
+ +
+
Notifications
+ +
+ + +
+ +
+ +
+
+ Discord webhook + +
+
+ + +
+
Leave blank to disable Discord notifications for this host
+
+ +
+ + +
+
+ Unraid API Key + +
+ +
+ + Key: +  ·  Var: + + No key found in .conf — click Renew to register one. + +
+ +
+ The Unraid API key is ephemeral — it clears on OS updates and service restarts. + unraid_api_key_renew.sh + runs at array start to auto-recover, but if the monitor page shows API errors, renew here. +
+ +
+ + + +
+

+  
+