Fix API key detection — name is 'Varaverk <hostname>', not 'Varaverk'
This commit is contained in:
@@ -248,7 +248,9 @@ function vv_pt_nodes(): array {
|
|||||||
$apiKeySet = false;
|
$apiKeySet = false;
|
||||||
$apiKeyPreview = '';
|
$apiKeyPreview = '';
|
||||||
if ($isMe) {
|
if ($isMe) {
|
||||||
$apiOut = shell_exec('/usr/local/sbin/unraid-api apikey --name "Varaverk" --json </dev/null 2>/dev/null');
|
$hn = trim((string)shell_exec("hostname -s 2>/dev/null | sed 's/^[Uu][Nn][Rr][Aa][Ii][Dd]-//'")) ?: 'Varaverk';
|
||||||
|
$keyName = 'Varaverk ' . $hn;
|
||||||
|
$apiOut = shell_exec('/usr/local/sbin/unraid-api apikey --name ' . escapeshellarg($keyName) . ' --json </dev/null 2>/dev/null');
|
||||||
$apiData = json_decode(trim($apiOut ?? ''), true);
|
$apiData = json_decode(trim($apiOut ?? ''), true);
|
||||||
if (is_array($apiData) && !empty($apiData['key'])) {
|
if (is_array($apiData) && !empty($apiData['key'])) {
|
||||||
$apiKeySet = true;
|
$apiKeySet = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user