mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge pull request #570 from pi-hole/gedetil-development
Add "poweroff" option to Web Interface
This commit is contained in:
@@ -17,6 +17,22 @@ $(function () {
|
||||
$("input[name=\"AddMAC\"]").val(mac);
|
||||
});
|
||||
});
|
||||
$(".confirm-poweroff").confirm({
|
||||
text: "Are you sure you want to send a poweroff command to your Pi-Hole?",
|
||||
title: "Confirmation required",
|
||||
confirm(button) {
|
||||
$("#poweroffform").submit();
|
||||
},
|
||||
cancel(button) {
|
||||
// nothing to do
|
||||
},
|
||||
confirmButton: "Yes, poweroff",
|
||||
cancelButton: "No, go back",
|
||||
post: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
cancelButtonClass: "btn-success",
|
||||
dialogClass: "modal-dialog modal-mg" // Bootstrap classes for mid-size modal
|
||||
});
|
||||
$(".confirm-reboot").confirm({
|
||||
text: "Are you sure you want to send a reboot command to your Pi-Hole?",
|
||||
title: "Confirmation required",
|
||||
|
||||
@@ -420,6 +420,11 @@ function readAdlists()
|
||||
$success .= "The webUI settings have been updated";
|
||||
break;
|
||||
|
||||
case "poweroff":
|
||||
exec("sudo pihole -a poweroff");
|
||||
$success = "The system will poweroff in 5 seconds...";
|
||||
break;
|
||||
|
||||
case "reboot":
|
||||
exec("sudo pihole -a reboot");
|
||||
$success = "The system will reboot in 5 seconds...";
|
||||
|
||||
@@ -842,10 +842,15 @@ readStaticLeasesFile();
|
||||
<h3 class="box-title">System Administration</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<button type="button" class="btn btn-default confirm-poweroff">Power off system</button>
|
||||
<button type="button" class="btn btn-default confirm-reboot">Restart system</button>
|
||||
<button type="button" class="btn btn-default confirm-restartdns">Restart DNS server</button>
|
||||
<button type="button" class="btn btn-default confirm-flushlogs">Flush logs</button>
|
||||
|
||||
<form role="form" method="post" id="poweroffform">
|
||||
<input type="hidden" name="field" value="poweroff">
|
||||
<input type="hidden" name="token" value="<?php echo $token ?>">
|
||||
</form>
|
||||
<form role="form" method="post" id="rebootform">
|
||||
<input type="hidden" name="field" value="reboot">
|
||||
<input type="hidden" name="token" value="<?php echo $token ?>">
|
||||
|
||||
Reference in New Issue
Block a user