mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Apply functionality to dnsmasq log
This commit is contained in:
parent
e57012679e
commit
e422b4908e
4 changed files with 16 additions and 8 deletions
|
@ -3,10 +3,10 @@
|
|||
require_once '../../includes/config.php';
|
||||
require_once '../../includes/functions.php';
|
||||
|
||||
if (isset($_POST['svc'])) {
|
||||
$tmplog = '/tmp/' .$_POST['svc']. '.log';
|
||||
if (isset($_POST['logfile'])) {
|
||||
$logfile = $_POST['logfile'];
|
||||
|
||||
// clear log for requested service
|
||||
exec("sudo truncate -s 0 $tmplog", $return);
|
||||
// truncate requested log file
|
||||
exec("sudo truncate -s 0 $logfile", $return);
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
|
|
@ -123,12 +123,19 @@ $(document).on("click", "#gen_wpa_passphrase", function(e) {
|
|||
});
|
||||
|
||||
$(document).on("click", "#js-clearhostapd-log", function(e) {
|
||||
$.post('ajax/logging/clearlog.php?',{'svc':'hostapd'},function(data){
|
||||
$.post('ajax/logging/clearlog.php?',{'logfile':'/tmp/hostapd.log'},function(data){
|
||||
jsonData = JSON.parse(data);
|
||||
$("#hostapd-log").val("");
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", "#js-cleardnsmasq-log", function(e) {
|
||||
$.post('ajax/logging/clearlog.php?',{'logfile':'/var/log/dnsmasq.log'},function(data){
|
||||
jsonData = JSON.parse(data);
|
||||
$("#dnsmasq-log").val("");
|
||||
});
|
||||
});
|
||||
|
||||
// Enable Bootstrap tooltips
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
|
|
|
@ -63,4 +63,4 @@ www-data ALL=(ALL) NOPASSWD:/bin/cat /etc/wireguard/wg-*.key
|
|||
www-data ALL=(ALL) NOPASSWD:/bin/rm /etc/wireguard/*.conf
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/rm /etc/wireguard/wg-*.key
|
||||
www-data ALL=(ALL) NOPASSWD:/usr/sbin/netplan
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/truncate -s 0 /tmp/*.log
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/truncate -s 0 /tmp/*.log,/bin/truncate -s 0 /var/log/dnsmasq.log
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
</div>
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" id="log-queries" type="checkbox" name="log-queries" value="1" <?php echo $conf['log-queries'] ? ' checked="checked"' : "" ?> aria-describedby="log-dhcp-queries">
|
||||
<label class="custom-control-label" for="log-queries"><?php echo _("Log DNS queries") ?></label>
|
||||
<label class="custom-control-label align-middle" for="log-queries"><?php echo _("Log DNS queries") ?></label>
|
||||
<input type="button" class="btn btn-outline btn-warning btn-sm align-top ml-4" id="js-cleardnsmasq-log" value="<?php echo _("Clear log"); ?>" />
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -18,7 +19,7 @@
|
|||
if ($conf['log-dhcp'] == 1 || $conf['log-queries'] == 1) {
|
||||
exec('sudo /bin/chmod o+r '.RASPI_DHCPCD_LOG);
|
||||
$log = file_get_contents(RASPI_DHCPCD_LOG);
|
||||
echo '<textarea class="logoutput">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
|
||||
echo '<textarea class="logoutput" id="dnsmasq-log">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
|
||||
} else {
|
||||
echo '<textarea class="logoutput my-3"></textarea>';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue