mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Re-lint a load of nodes
This commit is contained in:
@@ -45,7 +45,8 @@ module.exports = function(RED) {
|
||||
// This will be called anytime there is a new dweet for my-thing
|
||||
if (dweet.content.hasOwnProperty("payload")) {
|
||||
dweet.payload = dweet.content.payload;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dweet.payload = dweet.content;
|
||||
}
|
||||
delete dweet.content;
|
||||
|
@@ -19,7 +19,8 @@ module.exports = function(RED) {
|
||||
|
||||
try {
|
||||
var globalkeys = RED.settings.email || require(process.env.NODE_RED_HOME+"/../emailkeys.js");
|
||||
} catch(err) {
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
|
||||
function EmailNode(n) {
|
||||
@@ -57,7 +58,7 @@ module.exports = function(RED) {
|
||||
var smtpTransport = nodemailer.createTransport({
|
||||
host: node.outserver,
|
||||
port: node.outport,
|
||||
secure: true,
|
||||
secure: node.useSSL,
|
||||
auth: {
|
||||
user: node.userid,
|
||||
pass: node.password
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-email",
|
||||
"version": "0.1.15",
|
||||
"version": "0.1.16",
|
||||
"description": "Node-RED nodes to send and receive simple emails",
|
||||
"dependencies": {
|
||||
"nodemailer": "^1.11.0",
|
||||
|
@@ -15,7 +15,8 @@ module.exports = function(RED) {
|
||||
var parsedUrl = url.parse(this.url);
|
||||
if (!(parsedUrl.host || (parsedUrl.hostname && parsedUrl.port)) && !parsedUrl.isUnix) {
|
||||
this.error(RED._("feedparse.errors.invalidurl"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
var getFeed = function() {
|
||||
var req = request(node.url, {timeout: 10000, pool: false});
|
||||
//req.setMaxListeners(50);
|
||||
|
@@ -33,10 +33,10 @@ module.exports = function(RED) {
|
||||
|
||||
}
|
||||
RED.nodes.registerType("irc-server",IRCServerNode, {
|
||||
credentials: {
|
||||
username: {type:"text"},
|
||||
password: {type:"password"}
|
||||
}
|
||||
credentials: {
|
||||
username: {type:"text"},
|
||||
password: {type:"password"}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@@ -62,7 +62,8 @@ module.exports = function(RED) {
|
||||
pusher.me(function(err, me) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
resolve(me);
|
||||
}
|
||||
});
|
||||
@@ -74,7 +75,8 @@ module.exports = function(RED) {
|
||||
pusher.history({limit:1}, function(err, res) {
|
||||
if (err) {
|
||||
resolve(0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
resolve(res.pushes[0].modified);
|
||||
}
|
||||
@@ -144,7 +146,8 @@ module.exports = function(RED) {
|
||||
closing = true;
|
||||
try {
|
||||
this.stream.close();
|
||||
} catch(err) {
|
||||
}
|
||||
catch(err) {
|
||||
// Ignore error if not connected
|
||||
}
|
||||
});
|
||||
@@ -167,7 +170,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
try {
|
||||
resolve(res.pushes[0].modified);
|
||||
} catch(ex) {
|
||||
}
|
||||
catch(ex) {
|
||||
resolve(last);
|
||||
}
|
||||
});
|
||||
@@ -360,7 +364,8 @@ module.exports = function(RED) {
|
||||
if (me) {
|
||||
deviceid = me.email;
|
||||
self.pushMsg(pushtype, deviceid, title, msg);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
self.error("Unable to push",msg);
|
||||
}
|
||||
});
|
||||
|
@@ -39,10 +39,12 @@ module.exports = function(RED) {
|
||||
if (this.api) {
|
||||
this.twilioClient = twilio(this.api.sid,this.api.token);
|
||||
this.fromNumber = this.api.from;
|
||||
} else if (twiliokey) {
|
||||
}
|
||||
else if (twiliokey) {
|
||||
this.twilioClient = twilio(twiliokey.account, twiliokey.authtoken);
|
||||
this.fromNumber = twiliokey.from;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.error("missing twilio credentials");
|
||||
return;
|
||||
}
|
||||
@@ -66,7 +68,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
//console.log(response);
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Send SMS
|
||||
node.twilioClient.sendMessage( {to: tonum, from: node.fromNumber, body: msg.payload}, function(err, response) {
|
||||
if (err) {
|
||||
@@ -76,7 +79,8 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
}
|
||||
catch (err) {
|
||||
node.error(err);
|
||||
}
|
||||
});
|
||||
|
@@ -32,7 +32,8 @@ module.exports = function(RED) {
|
||||
msg.location.lon = msg.tweet.geo.coordinates[1];
|
||||
msg.location.icon = "twitter";
|
||||
}
|
||||
} else if (msg.tweet.coordinates) { // otherwise attempt go get it from coordinates
|
||||
}
|
||||
else if (msg.tweet.coordinates) { // otherwise attempt go get it from coordinates
|
||||
if (msg.tweet.coordinates.coordinates && msg.tweet.coordinates.coordinates.length === 2) {
|
||||
if (!msg.location) { msg.location = {}; }
|
||||
// WARNING! coordinates[1] is lat, coordinates[0] is lon!!!
|
||||
@@ -94,7 +95,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
if (cb[0]) {
|
||||
node.since_ids[u] = cb[0].id_str;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.since_ids[u] = '0';
|
||||
}
|
||||
node.poll_ids.push(setInterval(function() {
|
||||
@@ -143,7 +145,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
if (cb[0]) {
|
||||
node.since_id = cb[0].id_str;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.since_id = '0';
|
||||
}
|
||||
node.poll_ids.push(setInterval(function() {
|
||||
@@ -203,7 +206,8 @@ module.exports = function(RED) {
|
||||
//console.log("ERRO",rc,tweet);
|
||||
if (rc == 420) {
|
||||
node.status({fill:"red", shape:"ring", text:RED._("twitter.errors.ratelimit")});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.status({fill:"red", shape:"ring", text:" "});
|
||||
node.warn(RED._("twitter.errors.streamerror",{error:tweet.toString(),rc:rc}));
|
||||
}
|
||||
@@ -265,7 +269,8 @@ module.exports = function(RED) {
|
||||
//console.log("ERRO",rc,tweet);
|
||||
if (rc == 420) {
|
||||
node.status({fill:"red", shape:"ring", text:RED._("twitter.errors.ratelimit")});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.status({fill:"red", shape:"ring", text:tweet.toString()});
|
||||
node.warn(RED._("twitter.errors.streamerror",{error:tweet.toString(),rc:rc}));
|
||||
}
|
||||
@@ -409,13 +414,15 @@ module.exports = function(RED) {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
node.status({fill:"red",shape:"ring",text:"twitter.status.failed"});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
var response = JSON.parse(body);
|
||||
if (response.errors) {
|
||||
var errorList = response.errors.map(function(er) { return er.code+": "+er.message }).join(", ");
|
||||
node.error(RED._("twitter.errors.sendfail",{error:errorList}),msg);
|
||||
node.status({fill:"red",shape:"ring",text:"twitter.status.failed"});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
node.status({});
|
||||
}
|
||||
}
|
||||
@@ -424,7 +431,8 @@ module.exports = function(RED) {
|
||||
form.append("status",msg.payload);
|
||||
form.append("media[]",msg.media,{filename:"image"});
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (typeof msg.params === 'undefined') { msg.params = {}; }
|
||||
twit.updateStatus(msg.payload, msg.params, function (err, data) {
|
||||
if (err) {
|
||||
@@ -460,7 +468,8 @@ module.exports = function(RED) {
|
||||
var err = {statusCode: 401, data: "dummy error"};
|
||||
var resp = RED._("twitter.errors.oautherror",{statusCode: err.statusCode, errorData: err.data});
|
||||
res.send(resp)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
credentials.oauth_token = oauth_token;
|
||||
credentials.oauth_token_secret = oauth_token_secret;
|
||||
res.redirect('https://api.twitter.com/oauth/authorize?oauth_token='+oauth_token)
|
||||
@@ -481,7 +490,8 @@ module.exports = function(RED) {
|
||||
if (error) {
|
||||
RED.log.error(error);
|
||||
res.send(RED._("twitter.errors.oauthbroke"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
credentials = {};
|
||||
credentials.access_token = oauth_access_token;
|
||||
credentials.access_token_secret = oauth_access_token_secret;
|
||||
|
@@ -104,7 +104,8 @@ module.exports = function(RED) {
|
||||
skipPresence : true,
|
||||
reconnect : false
|
||||
});
|
||||
} catch(e) {
|
||||
}
|
||||
catch(e) {
|
||||
node.error("Bad xmpp configuration");
|
||||
node.status({fill:"red",shape:"ring",text:"not connected"});
|
||||
}
|
||||
@@ -180,7 +181,8 @@ module.exports = function(RED) {
|
||||
skipPresence : true,
|
||||
reconnect : false
|
||||
});
|
||||
} catch(e) {
|
||||
}
|
||||
catch(e) {
|
||||
node.error("Bad xmpp configuration");
|
||||
node.status({fill:"red",shape:"ring",text:"not connected"});
|
||||
}
|
||||
@@ -201,7 +203,8 @@ module.exports = function(RED) {
|
||||
else if (msg.payload) {
|
||||
if (typeof(msg.payload) === "object") {
|
||||
xmpp.send(to, JSON.stringify(msg.payload), node.join);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
xmpp.send(to, msg.payload.toString(), node.join);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user