pushover-notifications
Advanced tools
Comparing version 0.2.3 to 0.2.4
var https = require('https'), | ||
http = require('http'), | ||
url = require('url'), | ||
@@ -114,2 +115,3 @@ qs = require('querystring'), | ||
var o = url.parse(p_url); | ||
var proxy; | ||
o.method = "POST"; | ||
@@ -135,10 +137,27 @@ | ||
var httpOpts = self.httpOptions; | ||
var httpOpts = self.httpOptions || {}; | ||
if (httpOpts) { | ||
Object.keys(httpOpts).forEach(function(key) { | ||
o[key] = httpOpts[key]; | ||
if (key !== 'proxy') { | ||
o[key] = httpOpts[key]; | ||
} | ||
}); | ||
} | ||
var req = https.request(o, function(res) { | ||
if (httpOpts.hasOwnProperty('proxy') && httpOpts.proxy !== "") { | ||
proxy = url.parse(httpOpts.proxy); | ||
o.headers.Host = o.host; | ||
o.host = proxy.hostname; | ||
o.port = proxy.port; | ||
o.protocol = proxy.protocol; | ||
} | ||
var request; | ||
if (httpOpts.proxy && httpOpts.proxy !== "") { | ||
request = http.request; | ||
} else { | ||
request = https.request; | ||
} | ||
req = request(o, function(res) { | ||
if (self.debug) { | ||
@@ -170,5 +189,4 @@ console.log(res.statusCode); | ||
if (self.debug) { | ||
console.log (req_string); | ||
console.log (req_string.replace(self.token, 'XXXXX').replace(self.user, 'XXXXX')); | ||
} | ||
@@ -175,0 +193,0 @@ req.write(req_string); |
@@ -5,3 +5,3 @@ { | ||
"description": "Pushover API for node.js", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"homepage": "http://github.com/qbit/node-pushover", | ||
@@ -17,3 +17,6 @@ "repository": { | ||
"node": "*" | ||
}, | ||
"scripts": { | ||
"test": "node test/test.js" | ||
} | ||
} |
@@ -5,2 +5,5 @@ ![Pushover](https://pushover.net/assets/pushover-header-0f47af8e08d8bef658a999a9e6584fcc.png) | ||
[![Build Status](https://travis-ci.org/qbit/node-pushover.svg?branch=master)](https://travis-ci.org/qbit/node-pushover) | ||
[![Coverity Scan Build Status](https://img.shields.io/coverity/scan/10939.svg)](https://scan.coverity.com/projects/qbit-node-pushover) | ||
## Usage | ||
@@ -14,3 +17,3 @@ | ||
Any API paramaters, as found on https://pushover.net/api, can be passed in the object. For example, `retry` and `expire` can be added to the object being passed to `.send`! Here's an example with many different parameters. | ||
Any API parameters, as found on https://pushover.net/api, can be passed in the object. For example, `retry` and `expire` can be added to the object being passed to `.send`! Here's an example with many different parameters. | ||
```javascript | ||
@@ -37,2 +40,5 @@ var msg = { | ||
token: process.env['PUSHOVER_TOKEN'], | ||
// httpOptions: { | ||
// proxy: process.env['http_proxy'], | ||
//}, | ||
// onerror: function(error) {}, | ||
@@ -39,0 +45,0 @@ // update_sounds: true // update the list of sounds every day - will |
@@ -10,3 +10,3 @@ var push = require( '../lib/pushover.js' ); | ||
var msg = { | ||
message: 'omg node test', | ||
message: 'test from ' + process.argv[1], | ||
title: "Well - this is fantastic", | ||
@@ -13,0 +13,0 @@ user: process.env['PUSHOVER_USER'] |
@@ -14,3 +14,3 @@ var push = require( '../lib/pushover.js' ); | ||
var msg = { | ||
message: 'omg node test', | ||
message: 'test from ' + process.argv[1], | ||
sound: 'magic', | ||
@@ -17,0 +17,0 @@ title: "Well - this is fantastic", |
@@ -11,3 +11,3 @@ var push = require( '../lib/pushover.js' ); | ||
var msg = { | ||
message: 'omg node test', | ||
message: 'test from ' + process.argv[1], | ||
sound: 'magic', | ||
@@ -14,0 +14,0 @@ title: "Well - this is fantastic", |
Network access
Supply chain riskThis module accesses the network.
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
10158
11
244
96
9
2