Socket
Socket
Sign inDemoInstall

node-notifier

Package Overview
Dependencies
10
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.0.1 to 10.0.0

10

CHANGELOG.md
# Changelog
### `v10.0.0`
Breaking changes:
Setting `NSAllowsArbitraryLoads` as false for security reasons within terminal-notifier. Meaning non-https images/loads for terminal-notifier will no longer work. See [#362](https://github.com/mikaelbr/node-notifier/pull/362)
#### Fixes
- fix: options.customPath doesn't work for windows toaster. See [#373](https://github.com/mikaelbr/node-notifier/pull/373)
### `v9.0.1`

@@ -4,0 +14,0 @@

18

index.js

@@ -1,14 +0,14 @@

var os = require('os');
var utils = require('./lib/utils');
const os = require('os');
const utils = require('./lib/utils');
// All notifiers
var NotifySend = require('./notifiers/notifysend');
var NotificationCenter = require('./notifiers/notificationcenter');
var WindowsToaster = require('./notifiers/toaster');
var Growl = require('./notifiers/growl');
var WindowsBalloon = require('./notifiers/balloon');
const NotifySend = require('./notifiers/notifysend');
const NotificationCenter = require('./notifiers/notificationcenter');
const WindowsToaster = require('./notifiers/toaster');
const Growl = require('./notifiers/growl');
const WindowsBalloon = require('./notifiers/balloon');
var options = { withFallback: true };
const options = { withFallback: true };
var osType = utils.isWSL() ? 'WSL' : os.type();
const osType = utils.isWSL() ? 'WSL' : os.type();

@@ -15,0 +15,0 @@ switch (osType) {

@@ -1,4 +0,4 @@

var net = require('net');
const net = require('net');
var hasGrowl = false;
const hasGrowl = false;
module.exports = function(growlConfig, cb) {

@@ -10,5 +10,5 @@ if (typeof cb === 'undefined') {

if (hasGrowl) return cb(null, hasGrowl);
var port = growlConfig.port || 23053;
var host = growlConfig.host || 'localhost';
var socket = net.connect(port, host);
const port = growlConfig.port || 23053;
const host = growlConfig.host || 'localhost';
const socket = net.connect(port, host);
socket.setTimeout(100);

@@ -15,0 +15,0 @@

@@ -1,10 +0,10 @@

var shellwords = require('shellwords');
var cp = require('child_process');
var semver = require('semver');
var isWSL = require('is-wsl');
var path = require('path');
var url = require('url');
var os = require('os');
var fs = require('fs');
var net = require('net');
const shellwords = require('shellwords');
const cp = require('child_process');
const semver = require('semver');
const isWSL = require('is-wsl');
const path = require('path');
const url = require('url');
const os = require('os');
const fs = require('fs');
const net = require('net');

@@ -19,3 +19,3 @@ const BUFFER_SIZE = 1024;

var escapeQuotes = function (str) {
const escapeQuotes = function (str) {
if (typeof str === 'string') {

@@ -28,7 +28,7 @@ return str.replace(/(["$`\\])/g, '\\$1');

var inArray = function (arr, val) {
const inArray = function (arr, val) {
return arr.indexOf(val) !== -1;
};
var notifySendFlags = {
const notifySendFlags = {
u: 'urgency',

@@ -95,3 +95,3 @@ urgency: 'urgency',

try {
var data = JSON.parse(stdout);
const data = JSON.parse(stdout);
cb(!stderr ? null : stderr, data);

@@ -137,3 +137,3 @@ } catch (e) {

var mapAppIcon = function (options) {
const mapAppIcon = function (options) {
if (options.appIcon) {

@@ -147,3 +147,3 @@ options.icon = options.appIcon;

var mapText = function (options) {
const mapText = function (options) {
if (options.text) {

@@ -157,3 +157,3 @@ options.message = options.text;

var mapIconShorthand = function (options) {
const mapIconShorthand = function (options) {
if (options.i) {

@@ -177,3 +177,3 @@ options.icon = options.i;

}
for (var key in options) {
for (const key in options) {
if (key === 'message' || key === 'title') continue;

@@ -266,4 +266,4 @@ if (options.hasOwnProperty(key) && notifySendFlags[key] !== key) {

return function (err, data) {
var resultantData = data;
var metadata = {};
let resultantData = data;
let metadata = {};
// Allow for extra data if resultantData is an object

@@ -289,3 +289,3 @@ if (resultantData && typeof resultantData === 'object') {

var key = mapper(resultantData);
const key = mapper(resultantData);
if (!key) return;

@@ -297,16 +297,16 @@ emitter.emit(key, emitter, options, metadata);

module.exports.constructArgumentList = function (options, extra) {
var args = [];
const args = [];
extra = extra || {};
// Massive ugly setup. Default args
var initial = extra.initial || [];
var keyExtra = extra.keyExtra || '';
var allowedArguments = extra.allowedArguments || [];
var noEscape = extra.noEscape !== undefined;
var checkForAllowed = extra.allowedArguments !== undefined;
var explicitTrue = !!extra.explicitTrue;
var keepNewlines = !!extra.keepNewlines;
var wrapper = extra.wrapper === undefined ? '"' : extra.wrapper;
const initial = extra.initial || [];
const keyExtra = extra.keyExtra || '';
const allowedArguments = extra.allowedArguments || [];
const noEscape = extra.noEscape !== undefined;
const checkForAllowed = extra.allowedArguments !== undefined;
const explicitTrue = !!extra.explicitTrue;
const keepNewlines = !!extra.keepNewlines;
const wrapper = extra.wrapper === undefined ? '"' : extra.wrapper;
var escapeFn = function escapeFn(arg) {
const escapeFn = function escapeFn(arg) {
if (isArray(arg)) {

@@ -328,3 +328,3 @@ return removeNewLines(arg.map(escapeFn).join(','));

});
for (var key in options) {
for (const key in options) {
if (

@@ -344,3 +344,3 @@ options.hasOwnProperty(key) &&

function removeNewLines(str) {
var excapedNewline = process.platform === 'win32' ? '\\r\\n' : '\\n';
const excapedNewline = process.platform === 'win32' ? '\\r\\n' : '\\n';
return str.replace(/\r?\n/g, excapedNewline);

@@ -365,3 +365,3 @@ }

*/
var allowedToasterFlags = [
const allowedToasterFlags = [
't',

@@ -381,4 +381,4 @@ 'm',

];
var toasterSoundPrefix = 'Notification.';
var toasterDefaultSound = 'Notification.Default';
const toasterSoundPrefix = 'Notification.';
const toasterDefaultSound = 'Notification.Default';
module.exports.mapToWin8 = function (options) {

@@ -454,3 +454,3 @@ options = mapAppIcon(options);

for (var key in options) {
for (const key in options) {
// Check if is allowed. If not, delete!

@@ -457,0 +457,0 @@ if (

@@ -25,14 +25,14 @@ /**

*/
var path = require('path');
var notifier = path.resolve(__dirname, '../vendor/notifu/notifu');
var checkGrowl = require('../lib/checkGrowl');
var utils = require('../lib/utils');
var Toaster = require('./toaster');
var Growl = require('./growl');
var os = require('os');
const path = require('path');
const notifier = path.resolve(__dirname, '../vendor/notifu/notifu');
const checkGrowl = require('../lib/checkGrowl');
const utils = require('../lib/utils');
const Toaster = require('./toaster');
const Growl = require('./growl');
const os = require('os');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
const EventEmitter = require('events').EventEmitter;
const util = require('util');
var hasGrowl;
let hasGrowl;

@@ -55,4 +55,4 @@ module.exports = WindowsBalloon;

function notifyRaw(options, callback) {
var fallback;
var notifierOptions = this.options;
let fallback;
const notifierOptions = this.options;
options = utils.clone(options || {});

@@ -65,3 +65,3 @@ callback = callback || noop;

var actionJackedCallback = utils.actionJackerDecorator(
const actionJackedCallback = utils.actionJackerDecorator(
this,

@@ -120,6 +120,6 @@ options,

var allowedArguments = ['t', 'd', 'p', 'm', 'i', 'e', 'q', 'w', 'xp'];
const allowedArguments = ['t', 'd', 'p', 'm', 'i', 'e', 'q', 'w', 'xp'];
function doNotification(options, notifierOptions, callback) {
var is64Bit = os.arch() === 'x64';
const is64Bit = os.arch() === 'x64';
options = options || {};

@@ -129,4 +129,4 @@ options = utils.mapToNotifu(options);

var fullNotifierPath = notifier + (is64Bit ? '64' : '') + '.exe';
var localNotifier = notifierOptions.customPath || fullNotifierPath;
const fullNotifierPath = notifier + (is64Bit ? '64' : '') + '.exe';
const localNotifier = notifierOptions.customPath || fullNotifierPath;

@@ -138,3 +138,3 @@ if (!options.m) {

var argsList = utils.constructArgumentList(options, {
const argsList = utils.constructArgumentList(options, {
wrapper: '',

@@ -148,3 +148,3 @@ noEscape: true,

return utils.fileCommand(localNotifier, argsList, function(error, data) {
var action = fromErrorCodeToAction(error.code);
const action = fromErrorCodeToAction(error.code);
if (action === 'error') return callback(error, data);

@@ -151,0 +151,0 @@

/**
* Wrapper for the growly module
*/
var checkGrowl = require('../lib/checkGrowl');
var utils = require('../lib/utils');
var growly = require('growly');
const checkGrowl = require('../lib/checkGrowl');
const utils = require('../lib/utils');
const growly = require('growly');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
const EventEmitter = require('events').EventEmitter;
const util = require('util');
var errorMessageNotFound =
const errorMessageNotFound =
"Couldn't connect to growl (might be used as a fallback). Make sure it is running";

@@ -16,3 +16,3 @@

var hasGrowl;
let hasGrowl;

@@ -62,3 +62,3 @@ function Growl(options) {

if (hasGrowl || !!options.wait) {
var localCallback = options.wait ? callback : noop;
const localCallback = options.wait ? callback : noop;
growly.notify(options.message, options, localCallback);

@@ -65,0 +65,0 @@ if (!options.wait) callback();

/**
* A Node.js wrapper for terminal-notify (with fallback).
*/
var utils = require('../lib/utils');
var Growl = require('./growl');
var path = require('path');
var notifier = path.join(
const utils = require('../lib/utils');
const Growl = require('./growl');
const path = require('path');
const notifier = path.join(
__dirname,

@@ -12,6 +12,6 @@ '../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier'

var EventEmitter = require('events').EventEmitter;
var util = require('util');
const EventEmitter = require('events').EventEmitter;
const util = require('util');
var errorMessageOsX =
const errorMessageOsX =
'You need Mac OS X 10.8 or above to use NotificationCenter,' +

@@ -32,8 +32,8 @@ ' or use Growl fallback with constructor option {withFallback: true}.';

util.inherits(NotificationCenter, EventEmitter);
var activeId = null;
let activeId = null;
function noop() {}
function notifyRaw(options, callback) {
var fallbackNotifier;
var id = identificator();
let fallbackNotifier;
const id = identificator();
options = utils.clone(options || {});

@@ -54,3 +54,3 @@ activeId = id;

var actionJackedCallback = utils.actionJackerDecorator(
const actionJackedCallback = utils.actionJackerDecorator(
this,

@@ -82,3 +82,3 @@ options,

var argsList = utils.constructArgumentList(options);
const argsList = utils.constructArgumentList(options);
if (utils.isMountainLion()) {

@@ -85,0 +85,0 @@ utils.fileCommandJson(

/**
* Node.js wrapper for "notify-send".
*/
var os = require('os');
var which = require('which');
var utils = require('../lib/utils');
const os = require('os');
const which = require('which');
const utils = require('../lib/utils');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
const EventEmitter = require('events').EventEmitter;
const util = require('util');
var notifier = 'notify-send';
var hasNotifier;
const notifier = 'notify-send';
let hasNotifier;

@@ -82,15 +82,13 @@ module.exports = NotifySend;

var allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint', 'app-name'];
const allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint', 'app-name'];
function doNotification(options, callback) {
var initial, argsList;
options = utils.mapToNotifySend(options);
options.title = options.title || 'Node Notification:';
initial = [options.title, options.message];
const initial = [options.title, options.message];
delete options.title;
delete options.message;
argsList = utils.constructArgumentList(options, {
const argsList = utils.constructArgumentList(options, {
initial: initial,

@@ -97,0 +95,0 @@ keyExtra: '-',

/**
* Wrapper for the toaster (https://github.com/nels-o/toaster)
*/
var path = require('path');
var notifier = path.resolve(__dirname, '../vendor/snoreToast/snoretoast');
var utils = require('../lib/utils');
var Balloon = require('./balloon');
var os = require('os');
const path = require('path');
const notifier = path.resolve(__dirname, '../vendor/snoreToast/snoretoast');
const utils = require('../lib/utils');
const Balloon = require('./balloon');
const os = require('os');
const { v4: uuid } = require('uuid');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
const EventEmitter = require('events').EventEmitter;
const util = require('util');
var fallback;
let fallback;

@@ -50,3 +50,3 @@ const PIPE_NAME = 'notifierPipe';

function getPipeName() {
var pathPrefix = utils.isWSL() ? PIPE_PATH_PREFIX_WSL : PIPE_PATH_PREFIX;
const pathPrefix = utils.isWSL() ? PIPE_PATH_PREFIX_WSL : PIPE_PATH_PREFIX;
return `${pathPrefix}${PIPE_NAME}-${uuid()}`;

@@ -58,4 +58,4 @@ }

callback = callback || noop;
var is64Bit = os.arch() === 'x64';
var resultBuffer;
const is64Bit = os.arch() === 'x64';
let resultBuffer;
const server = {

@@ -76,3 +76,3 @@ namedPipe: getPipeName()

var snoreToastResultParser = (err, callback) => {
const snoreToastResultParser = (err, callback) => {
/* Possible exit statuses from SnoreToast, we only want to include err if it's -1 code

@@ -112,3 +112,3 @@ Exit Status : Exit Code

var actionJackedCallback = (err) =>
const actionJackedCallback = (err) =>
snoreToastResultParser(

@@ -140,4 +140,7 @@ err,

const localNotifier = options.customPath ||
(notifier + '-x' + (is64Bit ? '64' : '86') + '.exe');
options = utils.mapToWin8(options);
var argsList = utils.constructArgumentList(options, {
const argsList = utils.constructArgumentList(options, {
explicitTrue: true,

@@ -149,5 +152,4 @@ wrapper: '',

var notifierWithArch = notifier + '-x' + (is64Bit ? '64' : '86') + '.exe';
utils.fileCommand(
this.options.customPath || notifierWithArch,
localNotifier,
argsList,

@@ -154,0 +156,0 @@ actionJackedCallback

{
"name": "node-notifier",
"version": "9.0.1",
"version": "10.0.0",
"description": "A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)",

@@ -41,13 +41,12 @@ "main": "index.js",

"devDependencies": {
"eslint": "^7.6.0",
"eslint": "^7.26.0",
"eslint-config-semistandard": "^15.0.1",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
"jest": "^26.4.0",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5"
"eslint-plugin-promise": "^4.3.1",
"husky": "^6.0.0",
"jest": "^26.6.3",
"lint-staged": "^11.0.0",
"prettier": "^2.3.0"
},

@@ -57,5 +56,5 @@ "dependencies": {

"is-wsl": "^2.2.0",
"semver": "^7.3.2",
"semver": "^7.3.5",
"shellwords": "^0.1.1",
"uuid": "^8.3.0",
"uuid": "^8.3.2",
"which": "^2.0.2"

@@ -62,0 +61,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc