forked from Shinonome/dots-hyprland
Fix: Prevent raw HTML rendering in notifications
Notifications were occasionally displaying raw HTML content, including tags, instead of the intended plain text message. This commit introduces a regex to strip all HTML tags from notification content before display, ensuring a proper user experience.
This commit is contained in:
@@ -39,12 +39,12 @@ function guessMessageType(summary) {
|
||||
}
|
||||
|
||||
function processNotificationBody(body, appEntry) {
|
||||
// Only process Chrome/Chromium notifications
|
||||
let processedBody = body;
|
||||
if (appEntry?.toLowerCase().includes('chrome')) {
|
||||
// Remove the first line
|
||||
return body.split('\n\n').slice(1).join('\n\n');
|
||||
processedBody = body.split('\n\n').slice(1).join('\n\n');
|
||||
}
|
||||
return body;
|
||||
processedBody = processedBody.replace(/<[^>]*>/g, '');
|
||||
return processedBody;
|
||||
}
|
||||
|
||||
const getFriendlyNotifTimeString = (timeObject) => {
|
||||
|
||||
Reference in New Issue
Block a user