Settings: add Notifications card and Unraid API Key card

This commit is contained in:
Gmer4Lfe
2026-06-03 17:49:22 -04:00
parent 3cdb65cf8e
commit 7d8499686a
2 changed files with 217 additions and 3 deletions
+33
View File
@@ -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']);