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:
parent
5336c5fd90
commit
7cfd3870d5
2 changed files with 11 additions and 1 deletions
|
@ -22,6 +22,15 @@
|
|||
MESSAGE: 'message',
|
||||
};
|
||||
|
||||
function filter(text) {
|
||||
return (text || '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
}
|
||||
|
||||
Whisper.Notifications = new (Backbone.Collection.extend({
|
||||
initialize() {
|
||||
this.isEnabled = false;
|
||||
|
@ -138,7 +147,7 @@
|
|||
drawAttention();
|
||||
|
||||
this.lastNotification = new Notification(title, {
|
||||
body: message,
|
||||
body: window.platform === 'linux' ? filter(message) : message,
|
||||
icon: iconUrl,
|
||||
silent: !status.shouldPlayNotificationSound,
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@ if (config.appInstance) {
|
|||
title += ` - ${config.appInstance}`;
|
||||
}
|
||||
|
||||
window.platform = process.platform;
|
||||
window.getTitle = () => title;
|
||||
window.getEnvironment = () => config.environment;
|
||||
window.getAppInstance = () => config.appInstance;
|
||||
|
|
Loading…
Add table
Reference in a new issue