Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The growly npm package allows for sending system notifications using the Growl notification system, which was originally developed for macOS but has implementations available for other platforms. It interfaces with Growl's GNTP (Growl Notification Transport Protocol) to create and manage notifications.
Basic Notification
This feature allows you to send a basic notification with a message and an optional title.
const growly = require('growly');
growly.notify('Message text', { title: 'Notification Title' });
Notification with Callback
This feature allows you to send a notification that can handle a user's click action through a callback function.
const growly = require('growly');
growly.notify('Click me!', { title: 'Clickable' }, function(err, action) {
console.log('Notification was clicked!');
});
Notification with Custom Icon
This feature allows you to send a notification with a custom icon by specifying the path to the icon image.
const growly = require('growly');
growly.notify('Custom icon!', { title: 'Icon', icon: 'path/to/icon.png' });
Sticky Notification
This feature allows you to send a sticky notification that will remain on the screen until the user interacts with it.
const growly = require('growly');
growly.notify('Sticky message', { title: 'Sticky', sticky: true });
node-notifier is a cross-platform notification library that works on macOS, Linux, and Windows. It is more versatile than growly as it does not rely on Growl and uses native notification systems on each platform.
notifier is another cross-platform notification library similar to node-notifier. It provides a high-level abstraction for system notifications and is not dependent on Growl.
Simple zero-dependency Growl notifications using GNTP.
Install growly using npm
:
npm install growly
And then require it:
var growly = require('growly');
This module uses the Growl Network Transport Protocol (GNTP) which was implemented in Growl since version 1.3, so you must have an appropriate version of Growl installed for Growly to work.
Sending a minimal Growl notification:
var growly = require('growly');
growly.notify('This is as easy as it gets', { title: 'Hello, World!' });
More examples can be found in the example/ directory.
The growly module exposes only three methods: Growly.register()
, Growly.notify()
, and Growly.setHost()
.
Registers a new application with Growl. Registration is completely optional since it will be performed automatically for you with sensible defaults. Useful if you want your application, with its own icon and types of notifications, to show up in Growl's prefence panel.
appname
the name of the application (required.)appicon
url, file path, or Buffer instance for an application icon image.notifications
a list of defined notification types with the following properties:
.label
name used to identify the type of notification being used (required.).dispname
name users will see in Growl's preference panel (defaults to .label
.).enabled
whether or not notifications of this type are enabled (defaults to true.)callback
called when the registration completes; if registration fails, the first argument will be an Error object.An example:
growly.register('My Application', 'path/to/icon.png', [
{ label: 'success', dispname: 'Success' },
{ label: 'warning', dispname: 'Warning', enabled: false }
], function(err) {
console.log(err || 'Registration successful!');
});
Sends a Growl notification. If an application wasn't registered beforehand with growly.register()
, a default application will automatically be registered beforesending the notification.
text
the body of the notification.opts
an object with the following properties:
.title
title of the notification..icon
url, file path, or Buffer instance for the notification's icon..sticky
whether or not to sticky the notification (defaults to false.).label
type of notification to use (defaults to the first registered notification type.).priority
the priority of the notification from lowest (-2) to highest (2)..coalescingId
replace/update the matching previous notification. May be ignored.callback
called when the user has closed/clicked the notification. The callback is passed an Error object err
as the first argument when the notification fails; otherwise, the second argument action
is a string that'll describe which action has been taken by the user (either 'closed' or 'clicked'.)An example:
/* Assuming an application was registered with a notification type labeled 'warning'. */
growly.notify('Stuffs broken!', { label: 'warning' }, function(err, action) {
console.log('Action:', action);
});
Set the host and port that Growl (GNTP) requests will be sent to. Using this method is optional since GNTP defaults to using host 'localhost' and port 23053.
Copyright (C) 2014 Ibrahim Al-Rajhi abrahamalrajhi@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Simple zero-dependency Growl notifications using GNTP.
The npm package growly receives a total of 3,380,701 weekly downloads. As such, growly popularity was classified as popular.
We found that growly demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.