From 1bad173b3fd8af1b5480336e9debdb7c3c13074f Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Thu, 4 Dec 2025 22:44:16 -0500 Subject: [PATCH] feat: implement core router configuration check method for improved validation --- .../Servers/Proxmox/Livewire/Firewall.php | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) 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)) {