diff --git a/forecast/forecastio.js b/forecast/forecastio.js index 52082820..01713696 100644 --- a/forecast/forecastio.js +++ b/forecast/forecastio.js @@ -26,8 +26,8 @@ module.exports = function(RED) { } if (90 >= lat && 180 >= lon && lat >= -90 && lon >= -180) { - node.lat = lat; - node.lon = lon; + node.lat = lat.trim(); + node.lon = lon.trim(); } else { return callback(RED._("forecastio.error.invalid-lat_lon")); } diff --git a/instagram/instagram.js b/instagram/instagram.js index 5e00f97d..bd8dda21 100644 --- a/instagram/instagram.js +++ b/instagram/instagram.js @@ -79,9 +79,10 @@ module.exports = function(RED) { node.ig.user_media_recent('self', { count : 1, min_id : null, max_id : null}, function(err, medias, pagination, remaining, limit) { if (err) { node.warn(RED._("instagram.warn.userphoto-fetch-fail", {err: err})); + return; } - if(medias.length > 0) { // if the user has uploaded something to Instagram already + if(typeof medias !== 'undefined' && medias.length > 0) { // if the user has uploaded something to Instagram already node.latestSelfContentID = medias[0].id; } @@ -97,9 +98,10 @@ module.exports = function(RED) { node.ig.user_self_liked({ count : 1, max_like_id : null}, function(err, medias, pagination, remaining, limit) { if (err) { node.warn(RED._("instagram.warn.likedphoto-fetch-fail", {err: err})); + return; } - if(medias.length > 0) { // if the user has liked something to Instagram already + if(typeof medias !== 'undefined' && medias.length > 0) { // if the user has liked something to Instagram already node.latestLikedID = medias[0].id; } @@ -120,8 +122,9 @@ module.exports = function(RED) { node.ig.user_media_recent('self', { count : 1, min_id : null, max_id : null}, function(err, medias, pagination, remaining, limit) { if (err) { node.warn(RED._("instagram.warn.userphoto-fetch-fail", {err: err})); + return; } - if(medias.length > 0) { // if the user has uploaded something to Instagram already + if(typeof medias !== 'undefined' && medias.length > 0) { // if the user has uploaded something to Instagram already if(medias[0].type === IMAGE) { if(medias[0].location) { if(medias[0].location.latitude) { @@ -172,8 +175,9 @@ module.exports = function(RED) { node.ig.user_self_liked({ count : 1, max_like_id : null}, function(err, medias, pagination, remaining, limit) { if (err) { node.warn(RED._("instagram.warn.likedphoto-fetch-fail", {err: err})); + return; } - if(medias.length > 0) { // if the user has liked something to Instagram already + if(typeof medias !== 'undefined' && medias.length > 0) { // if the user has liked something to Instagram already if(medias[0].type === IMAGE) { if(medias[0].location) { if(medias[0].location.latitude) { @@ -235,6 +239,7 @@ module.exports = function(RED) { if (err) { node.warn(RED._("instagram.warn.latest-media-fetch-failed", {err: err})); + return; } if(medias) { @@ -401,6 +406,7 @@ module.exports = function(RED) { client_id: credentials.client_id, redirect_uri: credentials.redirect_uri, response_type: "code", + scope: "public_content", state: node_id + ":" + credentials.csrfToken } })); diff --git a/instagram/package.json b/instagram/package.json index 4c5b7d2c..67597b3c 100644 --- a/instagram/package.json +++ b/instagram/package.json @@ -1,10 +1,10 @@ { "name" : "node-red-node-instagram", - "version" : "0.1.0", + "version" : "0.1.1", "description" : "Node-RED nodes that get photos from Instagram", "dependencies" : { "request":"~2.40.0", - "instagram-node":"0.5.1" + "instagram-node":"0.5.8" }, "repository" : { "type":"git", @@ -22,4 +22,4 @@ "email": "zoltan.balogh@uk.ibm.com", "url": "http://nodered.org" } -} +} \ No newline at end of file