From 6fa14d2f6e714a6efdbc6c9c19d08844ef91f846 Mon Sep 17 00:00:00 2001 From: Devdatt Bhatt Date: Mon, 8 Jun 2026 00:27:25 +0000 Subject: [PATCH] ui updtae --- html/network.php | 265 ++++++++++++++++++++++++++--------------------- 1 file changed, 145 insertions(+), 120 deletions(-) diff --git a/html/network.php b/html/network.php index 7110770..badce53 100755 --- a/html/network.php +++ b/html/network.php @@ -23,7 +23,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['action'])) { $interface = $_POST['interface'] ?? ''; $action = $_POST['action']; - + if ($action === 'save') { // Save configuration $config = [ @@ -32,9 +32,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { 'ip' => $_POST['ip'] ?? '', 'netmask' => $_POST['netmask'] ?? '', 'gateway' => $_POST['gateway'] ?? '', - 'dns' => $_POST['dns'] ?? '' + 'dns' => $_POST['dns'] ?? '', + 'multicast' => $_POST['multicast'] ?? 'off' ]; - + $network_config[$interface] = $config; file_put_contents($config_file, json_encode($network_config, JSON_PRETTY_PRINT)); } elseif ($action === 'activate') { @@ -59,26 +60,28 @@ foreach ($output as $line) { // Match interface name if (preg_match('/^\d+:\s+([a-zA-Z0-9]+):/', $line, $matches)) { $current_interface = $matches[1]; - + // Skip interfaces we want to exclude if (strpos($current_interface, 'enx') === 0) { $current_interface = null; continue; } - + if ($current_interface === 'lo') { $current_interface = null; continue; } - + // Check if interface is a bridge or docker interface - if (strpos($current_interface, 'docker') === 0 || + if ( + strpos($current_interface, 'docker') === 0 || strpos($current_interface, 'br-') === 0 || - strpos($current_interface, 'veth') === 0) { + strpos($current_interface, 'veth') === 0 + ) { $current_interface = null; continue; } - + $interface_data[$current_interface] = [ 'name' => $current_interface, 'ip' => '', @@ -87,17 +90,17 @@ foreach ($output as $line) { 'config' => $network_config[$current_interface] ?? null ]; } - + // Extract IP address if ($current_interface && preg_match('/inet\s+(\d+\.\d+\.\d+\.\d+)/', $line, $matches)) { $interface_data[$current_interface]['ip'] = $matches[1]; } - + // Extract MAC address if ($current_interface && preg_match('/link\/ether\s+([a-f0-9:]+)/', $line, $matches)) { $interface_data[$current_interface]['mac'] = $matches[1]; } - + // Check if interface is up if ($current_interface && strpos($line, 'state UP') !== false) { $interface_data[$current_interface]['status'] = 'up'; @@ -108,120 +111,142 @@ foreach ($output as $line) { $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? null; ?> -
-

Network Configuration

- - -
-

Select Interface:

-
- - - - - +
+
+
+

Network Configuration

+ + +
+

Select Interface:

+
+ + + + + +
+
+ + +
+ +
+
+
Interface Settings
+ + + +
+
+

IP Address:

+

MAC Address:

+
+ +
+ +
+ No network interfaces found or selected. +
+ +
- - -
- -
-
-
- - - -
-
-

IP Address:

-

MAC Address:

-
- -
- -
- No network interfaces found or selected. -
- -
\ No newline at end of file