From b63a53e1827419910b19fc4ea65fa7808ee16ead Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 21 Nov 2020 13:52:20 +0000 Subject: [PATCH] Set default dhcp interface on page load --- app/js/custom.js | 7 +++---- includes/dhcp.php | 5 +++-- templates/dhcp/general.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/js/custom.js b/app/js/custom.js index aba45ff1..de05908d 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -223,7 +223,7 @@ function contentLoaded() { case "hostapd_conf": loadChannel(); case "dhcpd_conf": - loadInterfaceDHCPSelect('wlan0'); + loadInterfaceDHCPSelect(); break; } } @@ -240,9 +240,8 @@ function loadWifiStations(refresh) { } $(".js-reload-wifi-stations").on("click", loadWifiStations(true)); -function loadInterfaceDHCPSelect(default_iface) { - var iface = (default_iface) ? default_iface : $('#cbxdhcpiface').val(); - $('#cbxdhcpiface').val(iface); +function loadInterfaceDHCPSelect() { + var iface = $('#cbxdhcpiface').val(); $.get('ajax/networking/get_netcfg.php?iface='+iface,function(data){ jsonData = JSON.parse(data); $('#dhcp-iface')[0].checked = jsonData.DHCPEnabled; diff --git a/includes/dhcp.php b/includes/dhcp.php index 9f76e298..bd2a4a81 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -44,17 +44,18 @@ function DisplayDHCPConfig() } } } - + getWifiInterface(); $serviceStatus = $dnsmasq_state ? "up" : "down"; exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); exec('cat ' . RASPI_DNSMASQ_LEASES, $leases); + $ap_iface = $_SESSION['ap_interface']; echo renderTemplate( "dhcp", compact( "status", "serviceStatus", "dnsmasq_state", - "conf", + "ap_iface", "dhcpHost", "interfaces", "leases" diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php index 5bcf8c93..60f5b228 100644 --- a/templates/dhcp/general.php +++ b/templates/dhcp/general.php @@ -3,7 +3,7 @@
- +