Comparing version 1.5.1 to 1.6.0
1.6.0 / 2012-09-06 | ||
================== | ||
* add notification center support [drudge] | ||
1.5.1 / 2012-04-08 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -8,2 +8,3 @@ // Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed) | ||
var exec = require('child_process').exec | ||
, exists = require('fs').existsSync | ||
, path = require('path') | ||
@@ -13,25 +14,49 @@ , os = require('os') | ||
function which(name) { | ||
var paths = process.env.PATH.split(':'); | ||
var loc; | ||
for (var i = 0, len = paths.length; i < len; ++i) { | ||
loc = path.join(paths[i], name); | ||
if (exists(loc)) return loc; | ||
} | ||
} | ||
switch(os.type()) { | ||
case 'Darwin': | ||
cmd = { | ||
type: "Darwin" | ||
, pkg: "growlnotify" | ||
, msg: '-m' | ||
, sticky: '--sticky' | ||
, priority: { | ||
cmd: '--priority' | ||
, range: [ | ||
-2 | ||
, -1 | ||
, 0 | ||
, 1 | ||
, 2 | ||
, "Very Low" | ||
, "Moderate" | ||
, "Normal" | ||
, "High" | ||
, "Emergency" | ||
] | ||
} | ||
}; | ||
if (which('terminal-notifier')) { | ||
cmd = { | ||
type: "Darwin-NotificationCenter" | ||
, pkg: "terminal-notifier" | ||
, msg: '-message' | ||
, title: '-title' | ||
, subtitle: '-subtitle' | ||
, priority: { | ||
cmd: '-execute' | ||
, range: [] | ||
} | ||
}; | ||
} else { | ||
cmd = { | ||
type: "Darwin-Growl" | ||
, pkg: "growlnotify" | ||
, msg: '-m' | ||
, sticky: '--sticky' | ||
, priority: { | ||
cmd: '--priority' | ||
, range: [ | ||
-2 | ||
, -1 | ||
, 0 | ||
, 1 | ||
, 2 | ||
, "Very Low" | ||
, "Moderate" | ||
, "Normal" | ||
, "High" | ||
, "Emergency" | ||
] | ||
} | ||
}; | ||
} | ||
break; | ||
@@ -132,3 +157,3 @@ case 'Linux': | ||
switch(cmd.type) { | ||
case 'Darwin': | ||
case 'Darwin-Growl': | ||
var flag, ext = path.extname(image).substr(1) | ||
@@ -164,3 +189,3 @@ flag = flag || ext == 'icns' && 'iconpath' | ||
// name | ||
if (options.name && cmd.type === "Darwin") { | ||
if (options.name && cmd.type === "Darwin-Growl") { | ||
args.push('--name', options.name); | ||
@@ -170,7 +195,24 @@ } | ||
switch(cmd.type) { | ||
case 'Darwin': | ||
case 'Darwin-Growl': | ||
args.push(cmd.msg); | ||
args.push('"' + msg + '"'); | ||
if (options.title) args.push(options.title); | ||
if (options.title) args.push('"' + options.title + '"'); | ||
break; | ||
case 'Darwin-NotificationCenter': | ||
args.push(cmd.msg); | ||
args.push('"' + msg + '"'); | ||
if (options.title) { | ||
args.push(cmd.title); | ||
args.push('"' + options.title + '"'); | ||
} | ||
if (options.subtitle) { | ||
args.push(cmd.subtitle); | ||
args.push('"' + options.subtitle + '"'); | ||
} | ||
break; | ||
case 'Darwin-Growl': | ||
args.push(cmd.msg); | ||
args.push('"' + msg + '"'); | ||
if (options.title) args.push('"' + options.title + '"'); | ||
break; | ||
case 'Linux': | ||
@@ -177,0 +219,0 @@ if (options.title) { |
@@ -1,6 +0,7 @@ | ||
{ "name": "growl", | ||
"version": "1.5.1", | ||
{ | ||
"name": "growl", | ||
"version": "1.6.0", | ||
"description": "Growl unobtrusive notifications", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
"main": "./lib/growl.js" | ||
} | ||
} |
# Growl for nodejs | ||
Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl). Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce). You'll need [growlnotify(1)](http://growl.info/extras.php#growlnotify). | ||
Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl). Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce). | ||
## Installation | ||
### Install | ||
### Mac OS X (Darwin): | ||
Install [growlnotify(1)](http://growl.info/extras.php#growlnotify). On OS X 10.8, Notification Center is supported using [terminal-notifier](https://github.com/alloy/terminal-notifier). To install: | ||
$ sudo gem install terminal-notifier | ||
Install [npm](http://npmjs.org/) and run: | ||
@@ -10,0 +16,0 @@ |
@@ -17,1 +17,2 @@ | ||
}) | ||
growl('Show pdf filesystem icon', { title: 'Use show()', image: 'article.pdf' }) |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
10554
227
100
1
3