mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Fix tweet with image
This commit is contained in:
parent
aaf93ab587
commit
1c1b53425f
@ -59,12 +59,27 @@
|
||||
},
|
||||
label: function() {
|
||||
if (this.screen_name) {
|
||||
return "@"+this.screen_name
|
||||
return (this.screen_name[0]!=="@"?"@":"")+this.screen_name
|
||||
} else {
|
||||
return "Twitter: "+this.id
|
||||
}
|
||||
},
|
||||
exportable: false
|
||||
exportable: false,
|
||||
oneditsave: function() {
|
||||
var trimFields = [
|
||||
"consumer_key",
|
||||
"consumer_secret",
|
||||
"access_token",
|
||||
"access_token_secret"
|
||||
];
|
||||
// Just in case any whitespace has crept in with the copy-paste of the fields
|
||||
trimFields.forEach(function(field) {
|
||||
var v = $("#node-config-input-"+field).val();
|
||||
v = v.trim();
|
||||
$("#node-config-input-"+field).val(v);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
@ -10,6 +10,9 @@ module.exports = function(RED) {
|
||||
function TwitterCredentialsNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.screen_name = n.screen_name;
|
||||
if (this.screen_name && this.screen_name[0] !== "@") {
|
||||
this.screen_name = "@"+this.screen_name;
|
||||
}
|
||||
}
|
||||
RED.nodes.registerType("twitter-credentials",TwitterCredentialsNode,{
|
||||
credentials: {
|
||||
@ -396,6 +399,18 @@ module.exports = function(RED) {
|
||||
access_token_key: credentials.access_token,
|
||||
access_token_secret: credentials.access_token_secret
|
||||
});
|
||||
|
||||
var oa = new OAuth(
|
||||
"https://api.twitter.com/oauth/request_token",
|
||||
"https://api.twitter.com/oauth/access_token",
|
||||
credentials.consumer_key,
|
||||
credentials.consumer_secret,
|
||||
"1.0",
|
||||
null,
|
||||
"HMAC-SHA1"
|
||||
);
|
||||
|
||||
|
||||
node.on("input", function(msg) {
|
||||
if (msg.hasOwnProperty("payload")) {
|
||||
node.status({fill:"blue",shape:"dot",text:"twitter.status.tweeting"});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-twitter",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "A Node-RED node to talk to Twitter",
|
||||
"dependencies": {
|
||||
"twitter-ng": "0.6.2",
|
||||
|
Loading…
Reference in New Issue
Block a user