diff --git a/src/usr/local/emhttp/plugins/tailscale/include/get_log.php b/src/usr/local/emhttp/plugins/tailscale/include/get_log.php index 9134fbc..77f92b1 100644 --- a/src/usr/local/emhttp/plugins/tailscale/include/get_log.php +++ b/src/usr/local/emhttp/plugins/tailscale/include/get_log.php @@ -1,19 +1,32 @@ ', htmlspecialchars($log), " not found."; + return; + } -$log = $_POST['log']; -if ( ! in_array($log, $allowed_files)) { - return; + $max = intval($maxLines); + $lines = array_reverse(array_slice(file($log), -$max)); + + foreach ($lines as $line) { + echo '', htmlspecialchars($line), ""; + } } -$max = intval($_POST['max']); -$lines = array_reverse(array_slice(file($log), -$max)); +ini_set('memory_limit', '512M'); // Increase memory limit -foreach ($lines as $line) { - echo '', htmlspecialchars($line), ""; +try { + getLog($_POST['log'], $_POST['max']); +} catch (Throwable $e) { + echo '', htmlspecialchars($e->getMessage()), ""; } ini_restore('memory_limit'); // Restore original memory limit