pi hole
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user