From 83c7315ece2ad13e76c39fd7980bc82af34f2981 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Wed, 3 Dec 2025 04:29:56 -0500 Subject: [PATCH] feat: enhance Proxmox Firewall log view with detailed IP and port information, including modals for geolocation and protocol descriptions, improving user interaction and data accessibility --- .../Servers/Proxmox/Livewire/Firewall.php | 43 ++ .../Servers/Proxmox/views/firewall.blade.php | 536 +++++++++++++++++- 2 files changed, 574 insertions(+), 5 deletions(-) diff --git a/extensions/Servers/Proxmox/Livewire/Firewall.php b/extensions/Servers/Proxmox/Livewire/Firewall.php index 32a227e1e..4d7d1075e 100644 --- a/extensions/Servers/Proxmox/Livewire/Firewall.php +++ b/extensions/Servers/Proxmox/Livewire/Firewall.php @@ -1152,6 +1152,49 @@ class Firewall extends Component return $result; } + /** + * Fetch IP location data from ip-api.com + */ + public function fetchIPLocation(string $ip): array + { + try { + // Validate IP address + if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { + return [ + 'status' => 'fail', + 'message' => 'Invalid or private IP address' + ]; + } + + // Fetch location data from ip-api.com (HTTP endpoint) + $response = Http::timeout(5)->get("http://ip-api.com/json/{$ip}"); + + if ($response->successful()) { + $data = $response->json(); + + // Check if the API returned success + if (isset($data['status']) && $data['status'] === 'success') { + return $data; + } else { + return [ + 'status' => 'fail', + 'message' => $data['message'] ?? 'Unable to fetch location data' + ]; + } + } + + return [ + 'status' => 'fail', + 'message' => 'Failed to fetch location data (HTTP ' . $response->status() . ')' + ]; + } catch (\Exception $e) { + return [ + 'status' => 'fail', + 'message' => 'Error: ' . $e->getMessage() + ]; + } + } + public function render() { return view('proxmox::firewall')->layoutData([ diff --git a/extensions/Servers/Proxmox/views/firewall.blade.php b/extensions/Servers/Proxmox/views/firewall.blade.php index ac7d5c8f7..0f688e845 100644 --- a/extensions/Servers/Proxmox/views/firewall.blade.php +++ b/extensions/Servers/Proxmox/views/firewall.blade.php @@ -537,18 +537,350 @@ @@ -854,4 +1186,198 @@ @endif +@script + +@endscript +