diff --git a/extensions/Servers/Proxmox/Livewire/Firewall.php b/extensions/Servers/Proxmox/Livewire/Firewall.php index 5411cba73..6804586c9 100644 --- a/extensions/Servers/Proxmox/Livewire/Firewall.php +++ b/extensions/Servers/Proxmox/Livewire/Firewall.php @@ -1606,9 +1606,8 @@ class Firewall extends Component string $protocol ): array { try { - // Check if Core Router is configured - $coreRouterEnabled = \Illuminate\Support\Facades\Config::get('corerouter.enabled', false); - if (!$coreRouterEnabled) { + // Check if Core Router is configured using the same logic as Statistics component + if (!$this->coreRouterEnabled()) { return [ 'connections' => [], 'error' => 'Core Router is not configured' @@ -1773,6 +1772,26 @@ class Firewall extends Component } } + protected function coreRouterEnabled(): bool + { + $baseUrl = config('corerouter.base_url'); + $apiKey = config('corerouter.api_key'); + $username = config('corerouter.username'); + $password = config('corerouter.password'); + + // Check if base_url is configured and not empty + $hasBaseUrl = !empty(trim((string) $baseUrl)); + + // Check if API key is configured (not empty after trimming) + $hasKey = !empty(trim((string) $apiKey)); + + // Check if basic auth credentials are both configured + $hasBasic = !empty(trim((string) $username)) && !empty(trim((string) $password)); + + // Configuration is valid if base_url is set and at least one auth method is configured + return $hasBaseUrl && ($hasKey || $hasBasic); + } + protected function extractIpFromField(string $field): string { if (empty($field)) {