diff --git a/js/notifications.js b/js/notifications.js index f5900592c..2abb9d6c2 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -22,6 +22,15 @@ MESSAGE: 'message', }; + function filter(text) { + return (text || '') + .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, }); diff --git a/preload.js b/preload.js index cd232c8c6..3c2c8d407 100644 --- a/preload.js +++ b/preload.js @@ -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;