Skip to content

Commit

Permalink
Tweak gravity to show the new parse list output
Browse files Browse the repository at this point in the history
Replaces every `\r` returned by `pihole-FTL gravity parseList` with a
known string to allow overwriting the previous line.

Signed-off-by: RD WebDesign <[email protected]>
  • Loading branch information
rdwebdesign committed May 18, 2023
1 parent 800ec66 commit 57600b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/pi-hole/php/gravity.sh.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
function echoEvent($datatext)
{
// Detect ${OVER} and replace it with something we can safely transmit
// This allows every line (including progress and error messages) to be shown on the page

// Replace "\r" (generated by gravity.sh) with "<------"
$datatext = str_replace("\r", '<------', $datatext);

// Replace "\r" generated by "pihole-FTL gravity parseList" command
$datatext = str_replace("\r", '<------', $datatext);

$pos = strpos($datatext, '<------');
// Detect if the ${OVER} line is within this line, e.g.
// "Pending: String to replace${OVER}Done: String has been replaced"
Expand Down

0 comments on commit 57600b0

Please sign in to comment.