Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -14,6 +14,7 @@ Usage
/q Do not play a sound when the tooltip is displayed
/w Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
/xp Use IUserNotification interface event when IUserNotification2 is available
/l Display license for notifu
// Kill codes:
2 = Timeout
@@ -32,7 +33,7 @@ var os = require('os');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var hasGrowl = void 0;
var hasGrowl;
module.exports = WindowsBalloon;
@@ -49,7 +50,7 @@ function WindowsBalloon(options) {
util.inherits(WindowsBalloon, EventEmitter);
function noop() {}
WindowsBalloon.prototype.notify = function(options, callback) {
function notifyRaw(options, callback) {
var fallback;
var notifierOptions = this.options;
options = utils.clone(options || {});
@@ -104,7 +105,14 @@ WindowsBalloon.prototype.notify = function(options, callback) {
});
return this;
};
}
Object.defineProperty(WindowsBalloon.prototype, 'notify', {
get: function() {
if (!this._notify) this._notify = notifyRaw.bind(this);
return this._notify;
}
});
var allowedArguments = ['t', 'd', 'p', 'm', 'i', 'e', 'q', 'w', 'xp'];

View File

@@ -13,7 +13,7 @@ var errorMessageNotFound =
module.exports = Growl;
var hasGrowl = void 0;
var hasGrowl;
function Growl(options) {
options = utils.clone(options || {});
@@ -28,7 +28,7 @@ function Growl(options) {
}
util.inherits(Growl, EventEmitter);
Growl.prototype.notify = function(options, callback) {
function notifyRaw(options, callback) {
growly.setHost(this.options.host, this.options.port);
options = utils.clone(options || {});
@@ -71,6 +71,13 @@ Growl.prototype.notify = function(options, callback) {
callback();
});
return this;
};
}
Object.defineProperty(Growl.prototype, 'notify', {
get: function() {
if (!this._notify) this._notify = notifyRaw.bind(this);
return this._notify;
}
});
function noop() {}

View File

@@ -31,7 +31,7 @@ util.inherits(NotificationCenter, EventEmitter);
var activeId = null;
function noop() {}
NotificationCenter.prototype.notify = function(options, callback) {
function notifyRaw(options, callback) {
var fallbackNotifier;
var id = identificator();
options = utils.clone(options || {});
@@ -93,7 +93,14 @@ NotificationCenter.prototype.notify = function(options, callback) {
callback(new Error(errorMessageOsX));
return this;
};
}
Object.defineProperty(NotificationCenter.prototype, 'notify', {
get: function() {
if (!this._notify) this._notify = notifyRaw.bind(this);
return this._notify;
}
});
function identificator() {
return { _ref: 'val' };

View File

@@ -9,7 +9,7 @@ var EventEmitter = require('events').EventEmitter;
var util = require('util');
var notifier = 'notify-send';
var hasNotifier = void 0;
var hasNotifier;
module.exports = NotifySend;
@@ -26,7 +26,7 @@ function NotifySend(options) {
util.inherits(NotifySend, EventEmitter);
function noop() {}
NotifySend.prototype.notify = function(options, callback) {
function notifyRaw(options, callback) {
options = utils.clone(options || {});
callback = callback || noop;
@@ -70,9 +70,16 @@ NotifySend.prototype.notify = function(options, callback) {
}
return this;
};
}
var allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint'];
Object.defineProperty(NotifySend.prototype, 'notify', {
get: function() {
if (!this._notify) this._notify = notifyRaw.bind(this);
return this._notify;
}
});
var allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint', 'app-name'];
function doNotification(options, callback) {
var initial, argsList;

View File

@@ -2,14 +2,19 @@
* Wrapper for the toaster (https://github.com/nels-o/toaster)
*/
var path = require('path');
var notifier = path.resolve(__dirname, '../vendor/snoreToast/SnoreToast.exe');
var notifier = path.resolve(__dirname, '../vendor/snoreToast/snoretoast');
var utils = require('../lib/utils');
var Balloon = require('./balloon');
var os = require('os');
const { v4: uuid } = require('uuid');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var fallback = void 0;
var fallback;
const PIPE_NAME = 'notifierPipe';
const PIPE_PATH_PREFIX = '\\\\.\\pipe\\';
module.exports = WindowsToaster;
@@ -27,16 +32,31 @@ util.inherits(WindowsToaster, EventEmitter);
function noop() {}
var timeoutMessage = 'the toast has timed out';
var successMessage = 'user clicked on the toast';
function hasText(str, txt) {
return str && str.indexOf(txt) !== -1;
function parseResult(data) {
if (!data) {
return {};
}
return data.split(';').reduce((acc, cur) => {
const split = cur.split('=');
if (split && split.length === 2) {
acc[split[0]] = split[1];
}
return acc;
}, {});
}
WindowsToaster.prototype.notify = function(options, callback) {
function getPipeName() {
return `${PIPE_PATH_PREFIX}${PIPE_NAME}-${uuid()}`;
}
function notifyRaw(options, callback) {
options = utils.clone(options || {});
callback = callback || noop;
var is64Bit = os.arch() === 'x64';
var resultBuffer;
const server = {
namedPipe: getPipeName()
};
if (typeof options === 'string') {
options = { title: 'node-notifier', message: options };
@@ -49,26 +69,51 @@ WindowsToaster.prototype.notify = function(options, callback) {
);
}
var actionJackedCallback = utils.actionJackerDecorator(
this,
options,
function cb(err, data) {
// Needs to filter out timeout. Not an actual error.
if (err && hasText(data, timeoutMessage)) {
return callback(null, data);
}
callback(err, data);
},
function mapper(data) {
if (hasText(data, successMessage)) {
return 'click';
}
if (hasText(data, timeoutMessage)) {
return 'timeout';
}
return false;
var snoreToastResultParser = (err, callback) => {
/* Possible exit statuses from SnoreToast, we only want to include err if it's -1 code
Exit Status : Exit Code
Failed : -1
Success : 0
Hidden : 1
Dismissed : 2
TimedOut : 3
ButtonPressed : 4
TextEntered : 5
*/
const result = parseResult(
resultBuffer && resultBuffer.toString('utf16le')
);
// parse action
if (result.action === 'buttonClicked' && result.button) {
result.activationType = result.button;
} else if (result.action) {
result.activationType = result.action;
}
);
if (err && err.code === -1) {
callback(err, result);
}
callback(null, result);
// https://github.com/mikaelbr/node-notifier/issues/334
// Due to an issue with snoretoast not using stdio and pipe
// when notifications are disabled, make sure named pipe server
// is closed before exiting.
server.instance && server.instance.close();
};
var actionJackedCallback = (err) =>
snoreToastResultParser(
err,
utils.actionJackerDecorator(
this,
options,
callback,
(data) => data || false
)
);
options.title = options.title || 'Node Notification:';
if (
@@ -84,17 +129,32 @@ WindowsToaster.prototype.notify = function(options, callback) {
return fallback.notify(options, callback);
}
options = utils.mapToWin8(options);
var argsList = utils.constructArgumentList(options, {
explicitTrue: true,
wrapper: '',
keepNewlines: true,
noEscape: true
// Add pipeName option, to get the output
utils.createNamedPipe(server).then((out) => {
resultBuffer = out;
options.pipeName = server.namedPipe;
options = utils.mapToWin8(options);
var argsList = utils.constructArgumentList(options, {
explicitTrue: true,
wrapper: '',
keepNewlines: true,
noEscape: true
});
var notifierWithArch = notifier + '-x' + (is64Bit ? '64' : '86') + '.exe';
utils.fileCommand(
this.options.customPath || notifierWithArch,
argsList,
actionJackedCallback
);
});
utils.fileCommand(
this.options.customPath || notifier,
argsList,
actionJackedCallback
);
return this;
};
}
Object.defineProperty(WindowsToaster.prototype, 'notify', {
get: function () {
if (!this._notify) this._notify = notifyRaw.bind(this);
return this._notify;
}
});