Sanitize notification text.

Signed-off-by: Armored Dragon <publicmail@armoreddragon.com>
This commit is contained in:
Armored Dragon 2024-07-09 13:37:20 -05:00
parent 647dbf9cea
commit 112bd816ec
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B

View file

@ -21,6 +21,8 @@ var DEFAULT_SIZE = 30;
var DEFAULT_OFFSET = 10;
var FLOOF_NOTIFICATION_CHANNEL = "Floof-Notif";
var MAIN_CHAT_APP_CHANNEL = "Chat";
var ARROW_REGEX = /\</gi;
var offset = DEFAULT_OFFSET;
@ -65,6 +67,7 @@ var notificationCore = {
colour = colour ? colour : {};
colour.text = colour.text ? colour.text : {red: 255, green: 255, blue: 255};
colour.bg = colour.bg ? colour.bg : {red: 10, green: 10, blue: 10};
text = text.replace(ARROW_REGEX, "&lt;");
var lines = text.split("\n");
for (var i = lines.length - 1; i >= 0; i--) {
if (i === 0) {