diff --git a/debug.php b/debug.php index e148c033..84416cff 100644 --- a/debug.php +++ b/debug.php @@ -6,7 +6,8 @@

Generate debug log

-

Once you click this button a debug log will be generated and automatically uploaded if we detect a working internet connection

+

Upload debug log and provide token once finished

+

Once you click this button a debug log will be generated and can automatically be uploaded if we detect a working internet connection.

diff --git a/scripts/pi-hole/js/debug.js b/scripts/pi-hole/js/debug.js index c529f2f7..6508dfbe 100644 --- a/scripts/pi-hole/js/debug.js +++ b/scripts/pi-hole/js/debug.js @@ -27,15 +27,22 @@ function httpGet(ta,theUrl) function eventsource() { var ta = $("#output"); + var upload = $( "#upload" ); + var checked = ""; + + if(upload.prop("checked")) + { + checked = "upload"; + } // IE does not support EventSource - load whole content at once if (typeof EventSource !== "function") { - httpGet(ta,"/admin/scripts/pi-hole/php/debug.php?IE"); + httpGet(ta,"/admin/scripts/pi-hole/php/debug.php?IE&"+checked); return; } var host = window.location.host; - var source = new EventSource("/admin/scripts/pi-hole/php/debug.php"); + var source = new EventSource("/admin/scripts/pi-hole/php/debug.php?"+checked); // Reset and show field ta.empty(); diff --git a/scripts/pi-hole/php/debug.php b/scripts/pi-hole/php/debug.php index d57fddae..996966a7 100644 --- a/scripts/pi-hole/php/debug.php +++ b/scripts/pi-hole/php/debug.php @@ -12,7 +12,14 @@ function echoEvent($datatext) { echo $datatext; } -$proc = popen("sudo pihole -d -a", "r"); +if(isset($_GET["upload"])) +{ + $proc = popen("sudo pihole -d -a", "r"); +} +else +{ + $proc = popen("sudo pihole -d", "r"); +} while (!feof($proc)) { echoEvent(fread($proc, 4096)); }