From e5c162ddcf2d38ba1ec04784a7ce716e58aa45fd Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 16 Nov 2025 21:32:09 +0100 Subject: [PATCH] Revise fetch hostapd logs w/ hotspot->getHostapdLogs() --- includes/hostapd.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 29c33e35..a074709d 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -135,15 +135,22 @@ function DisplayHostAPDConfig() } } + // fetch hostapd logs if enabled + $logOutput = []; + if (!empty($arrHostapdConf['LogEnable']) && (int)$arrHostapdConf['LogEnable'] === 1) { + $logResult = $hotspot->getHostapdLogs(5000); + if ($logResult['success']) { + $joined = implode("\n", $logResult['logs']); + $limited = getLogLimited('', $joined); + $logOutput = explode("\n", $limited); + } + } + // assign disassoc_low_ack boolean if value is set $arrConfig['disassoc_low_ack_bool'] = isset($arrConfig['disassoc_low_ack']) ? 1 : 0; $hostapdstatus = $system->hostapdStatus(); $serviceStatus = $hostapdstatus[0] == 0 ? "down" : "up"; - // ensure log is writeable - exec('sudo /bin/chmod o+r '.RASPI_HOSTAPD_LOG); - $logdata = getLogLimited(RASPI_HOSTAPD_LOG); - echo renderTemplate( "hostapd", compact( "status", @@ -161,7 +168,7 @@ function DisplayHostAPDConfig() "arrHostapdConf", "operatingSystem", "countryCodes", - "logdata" + "logOutput" ) ); }