mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Merge branch 'master' of https://github.com/node-red/node-red-nodes
This commit is contained in:
commit
665a8666ab
@ -49,6 +49,10 @@
|
||||
<input type="password" id="node-input-password">
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-row">
|
||||
<label for="node-input-useTLS"><i class="fa fa-lock"></i> <span data-i18n="email.label.useTLS"></label>
|
||||
<input type="checkbox" id="node-input-tls" style="display:inline-block; width:20px; vertical-align:baseline;">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-dname"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
||||
<input type="text" id="node-input-dname" data-i18n="[placeholder]node-red:common.label.name">
|
||||
@ -69,6 +73,7 @@
|
||||
<p>Alternatively you may provide <code>msg.attachments</code> which should contain an array of one or
|
||||
more attachments in <a href="https://www.npmjs.com/package/nodemailer#attachments" target="_new">nodemailer</a> format.</p>
|
||||
<p>If required by your recipient you may also pass in a <code>msg.envelope</code> object, typically containing extra from and to properties.</p>
|
||||
<p>If you have own signed certificates, Nodemailer can complain about that and refuse sending the message. In this case you can try switching off TLS.</p>
|
||||
<p>Note: uses SMTP with SSL to port 465.</p>
|
||||
</script>
|
||||
|
||||
@ -81,6 +86,7 @@
|
||||
server: {value:"smtp.gmail.com",required:true},
|
||||
port: {value:"465",required:true},
|
||||
secure: {value: true},
|
||||
tls: {value: true},
|
||||
name: {value:""},
|
||||
dname: {value:""}
|
||||
},
|
||||
|
@ -30,6 +30,7 @@ module.exports = function(RED) {
|
||||
this.outserver = n.server;
|
||||
this.outport = n.port;
|
||||
this.secure = n.secure;
|
||||
this.tls = true;
|
||||
var flag = false;
|
||||
if (this.credentials && this.credentials.hasOwnProperty("userid")) {
|
||||
this.userid = this.credentials.userid;
|
||||
@ -50,12 +51,16 @@ module.exports = function(RED) {
|
||||
if (flag) {
|
||||
RED.nodes.addCredentials(n.id,{userid:this.userid, password:this.password, global:true});
|
||||
}
|
||||
if (n.tls === false){
|
||||
this.tls = false;
|
||||
}
|
||||
var node = this;
|
||||
|
||||
var smtpOptions = {
|
||||
host: node.outserver,
|
||||
port: node.outport,
|
||||
secure: node.secure
|
||||
secure: node.secure,
|
||||
tls: {rejectUnauthorized: node.tls}
|
||||
}
|
||||
|
||||
if (this.userid && this.password) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
"folder": "Folder",
|
||||
"protocol": "Protocol",
|
||||
"useSSL": "Use SSL?",
|
||||
"useTLS": "Use TLS?",
|
||||
"disposition": "Disposition",
|
||||
"none": "None",
|
||||
"read": "Mark Read",
|
||||
|
@ -374,6 +374,14 @@ module.exports = function(RED) {
|
||||
var res = result.body;
|
||||
if (res.errors) {
|
||||
node.error(res.errors[0].message);
|
||||
if (res.errors[0].code === 44) {
|
||||
// 'since_id parameter is invalid' - reset it for next time
|
||||
delete opts.since_id;
|
||||
}
|
||||
clearInterval(pollId);
|
||||
node.timeout_ids.push(setTimeout(function() {
|
||||
node.poll(interval,url,opts);
|
||||
},interval))
|
||||
return;
|
||||
}
|
||||
if (res.length > 0) {
|
||||
@ -438,7 +446,11 @@ module.exports = function(RED) {
|
||||
node.debug("Twitter DM Poll, rateLimitRemaining="+result.rateLimitRemaining+" rateLimitTimeout="+Math.floor(result.rateLimitTimeout/1000)+"s");
|
||||
var res = result.body;
|
||||
if (res.errors) {
|
||||
throw new Error(res.errors[0].message);
|
||||
node.error(res.errors[0].message);
|
||||
node.timeout_ids.push(setTimeout(function() {
|
||||
node.pollDirectMessages();
|
||||
},interval))
|
||||
return;
|
||||
}
|
||||
var since = "0";
|
||||
var messages = res.events.filter(tweet => tweet.type === 'message_create' && tweet.id > since);
|
||||
@ -459,6 +471,10 @@ module.exports = function(RED) {
|
||||
var res = result.body;
|
||||
if (res.errors) {
|
||||
node.error(res.errors[0].message);
|
||||
clearInterval(pollId);
|
||||
node.timeout_ids.push(setTimeout(function() {
|
||||
node.pollDirectMessages();
|
||||
},interval))
|
||||
return;
|
||||
}
|
||||
var messages = res.events.filter(tweet => tweet.type === 'message_create' && tweet.id > since);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-twitter",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.2",
|
||||
"description": "A Node-RED node to talk to Twitter",
|
||||
"dependencies": {
|
||||
"twitter-ng": "0.6.2",
|
||||
|
Loading…
x
Reference in New Issue
Block a user