pi hole
All checks were successful
Deploy / deploy-staging (push) Successful in 5s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-27 00:41:37 +02:00
parent e7a1878c72
commit 463b2cf5e1
6 changed files with 40 additions and 22 deletions

View File

@@ -25,6 +25,15 @@ $mm->registerFunction($moduleName, 'instances', function () use ($moduleName): a
$verifyTls = !isset($settings['verify_tls']) || $settings['verify_tls'] === '1' || $settings['verify_tls'] === 1 || $settings['verify_tls'] === true;
$normalizeSecret = static function (array $row): string {
$password = trim((string)($row['password'] ?? ''));
if ($password !== '') {
return $password;
}
return trim((string)($row['token'] ?? ''));
};
$instances = [];
$rawJson = trim((string)($settings['instances_json'] ?? ''));
@@ -44,7 +53,7 @@ $mm->registerFunction($moduleName, 'instances', function () use ($moduleName): a
'id' => $id,
'name' => trim((string)($row['name'] ?? '')) ?: $id,
'url' => rtrim($url, '/'),
'token' => trim((string)($row['token'] ?? '')),
'password' => $normalizeSecret($row),
'api_path' => $apiPath,
'timeout' => $timeout,
'verify_tls' => $verifyTls,
@@ -67,7 +76,7 @@ $mm->registerFunction($moduleName, 'instances', function () use ($moduleName): a
'id' => $key,
'name' => trim((string)($settings[$nameKey] ?? '')) ?: ($key === 'primary' ? 'Primaer' : 'Sekundaer'),
'url' => rtrim($url, '/'),
'token' => trim((string)($settings[$tokenKey] ?? '')),
'password' => trim((string)($settings[$tokenKey] ?? '')),
'api_path' => $apiPath,
'timeout' => $timeout,
'verify_tls' => $verifyTls,