Skip to content

Commit

Permalink
Fix the gravity output to use the ${OVER} sequence
Browse files Browse the repository at this point in the history
Signed-off-by: RD WebDesign <[email protected]>
  • Loading branch information
rdwebdesign committed Oct 7, 2023
1 parent 0f6b917 commit 12ddd2f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions scripts/pi-hole/js/gravity.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,18 @@ function eventsource() {
// Enqueue the next data chunk into our target stream
controller.enqueue(value);
var string = new TextDecoder().decode(value);
// Remove ${OVER} from the string
string = string.replaceAll("\r", "\n");
ta.append(string);

// If a Carriage Return is found ...
if (string.indexOf("\r") === -1) {
ta.append(string);
} else {
// ... remove the last line from the output ...
ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
// ... and append the new text to the end of the output,
// without ${OVER} ("CR + ESC[K") or Carriage Return.
ta.append(string.replaceAll("\r\x1b[K", "").replaceAll("\r", ""));

Check failure on line 59 in scripts/pi-hole/js/gravity.js

View workflow job for this annotation

GitHub Actions / Node

Use uppercase characters for the value of the escape sequence.

Check failure on line 59 in scripts/pi-hole/js/gravity.js

View workflow job for this annotation

GitHub Actions / Node

Use Unicode escapes instead of hexadecimal escapes.
}

if (string.indexOf("Pi-hole blocking is") !== -1) {
alSuccess.show();
}
Expand Down

0 comments on commit 12ddd2f

Please sign in to comment.