mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 04:09:49 +00:00
Escape XML delimiters for notifications on linux
Thanks to @whitequark for pointing out an inconsistency in the way that some Linux desktop environments were displaying markup in notifications.
This commit is contained in:
@@ -22,6 +22,15 @@
|
|||||||
MESSAGE: 'message',
|
MESSAGE: 'message',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function filter(text) {
|
||||||
|
return (text || '')
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>');
|
||||||
|
}
|
||||||
|
|
||||||
Whisper.Notifications = new (Backbone.Collection.extend({
|
Whisper.Notifications = new (Backbone.Collection.extend({
|
||||||
initialize() {
|
initialize() {
|
||||||
this.isEnabled = false;
|
this.isEnabled = false;
|
||||||
@@ -138,7 +147,7 @@
|
|||||||
drawAttention();
|
drawAttention();
|
||||||
|
|
||||||
this.lastNotification = new Notification(title, {
|
this.lastNotification = new Notification(title, {
|
||||||
body: message,
|
body: window.platform === 'linux' ? filter(message) : message,
|
||||||
icon: iconUrl,
|
icon: iconUrl,
|
||||||
silent: !status.shouldPlayNotificationSound,
|
silent: !status.shouldPlayNotificationSound,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ if (config.appInstance) {
|
|||||||
title += ` - ${config.appInstance}`;
|
title += ` - ${config.appInstance}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.platform = process.platform;
|
||||||
window.getTitle = () => title;
|
window.getTitle = () => title;
|
||||||
window.getEnvironment = () => config.environment;
|
window.getEnvironment = () => config.environment;
|
||||||
window.getAppInstance = () => config.appInstance;
|
window.getAppInstance = () => config.appInstance;
|
||||||
|
|||||||
Reference in New Issue
Block a user