-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instagram node #27
Instagram node #27
Conversation
var scoped_msg = clone(msg); | ||
|
||
|
||
http.get(scoped_url, function(res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knolleary , what do you think about using this http.get and specifying the 'binary' nature of the buffer? It will be deprecated in the future versions of node. However it isn't deprecated yet and is an easy way to buffer into memory.
There's a half-baked "buffer to disk" solution commented out. I'm not sure how I could trigger request to download to memory.
What's the best way forward here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try request that we are already using elsewhere. The request callback has three parameters, the third being the body as a Buffer.
61f1e89
to
b3b99fd
Compare
@knolleary I think the pull request is now in a state where you might want to take a look at it. Comments are welcome! The pull request has the initial requirements in it. Adding functionality such as location based information is to be defined and added later in a separate pull request. Thanks |
@knolleary pull request is in [wip] state again as I realised that currently when selecting the "photos uploaded by user" feature, it fetches all images uploaded by the user, ever. I'll need to fix this before we drop the node. Will let you know when this is fixed. |
b61eec6
to
998ea5e
Compare
11fec91
to
c955b98
Compare
@knolleary The pull request is now ready for review. Since my last comment I:
Thanks! |
cb1953b
to
6dfcead
Compare
RED.nodes.addCredentials(node_id,credentials); | ||
}); | ||
|
||
RED.httpAdmin.get('/instagram-credentials/auth/redirect', function(req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hindessm , I managed to lose your comments when overwriting the pull request's branch with my local one. I made a response on your comment about the redirect url. I deliberately decided to choose a URI that's different from our current convention as I disagree with it. The user is setting up the "redirect URL" in most frameworks. Having redirect in the URL gives confirmation to the user that they're doing the right thing. Having callback here would just confuse the user as they'll start to wonder what that means... Yes, it's a callback from OUR perspective but a redirect from the user's perspective. So I propose to change all of them to redirect. Sorry, it stays as is for the time being!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. However, the fitbit app configuration calls it "Callback URL" though so you shouldn't change that one and I think we want to be consistent. Since oauth calls it the oauth callback I suspect that continuing to use callback for consistency makes most sense.
Luckily I don't think users pay too much attention to the text of the URL they are cutting and pasting and you can write the accurate field name in the configuration hint to make sure they know exactly which field it needs to be pasted into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll change it then! I would still rather use my URI and just simply tag the function, if consistency is key. What do you think about adding a tag to each such callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by 'tag the function'? As has been said, the urls were picked based on what oauth calls them. I don't see a compelling reason for this node to do something different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was offering the option of having something in the path that actually
resembles what the given service calls the OAuth callback. This however
means that the callback URL will be different in some nodes. In order to
match them up, we could add a "callback" tag to all these express functions.
I'm considering that the different name (matching the service's on naming
convention) is for the user's convenience as in the instagram case, it's
called a "rediredt url" and if the user sees "redirect" in the URL, they're
more confident that they're copying the right field into the right place.
Mark says that as long as the instructions are clear, it doesn't matter
what the callback uri is and he'd therefore leave it as callback. I would
do the option I sketched up above.
Thanks
On 3 October 2014 12:05, knolleary notifications@github.com wrote:
In instagram/instagram.js:
res.redirect(Url.format({
protocol: 'https',
hostname: 'api.instagram.com',
pathname: '/oauth/authorize/',
query: {
client_id: credentials.client_id,
redirect_uri: credentials.redirect_uri,
response_type: "code",
state: node_id + ":" + credentials.csrfToken
}
}));
RED.nodes.addCredentials(node_id,credentials);
- });
- RED.httpAdmin.get('/instagram-credentials/auth/redirect', function(req, res) {
What do you mean by 'tag the function'? As has been said, the urls were
picked based on what oauth calls them. I don't see a compelling reason for
this node to do something different.—
Reply to this email directly or view it on GitHub
https://github.com/node-red/node-red-web-nodes/pull/27/files#r18389821.
decd380
to
7900296
Compare
The icon should not be the actual Instagram icon. Needs to conform to our icon requirements: http://nodered.org/docs/creating-nodes/appearance.html |
I did want to use our conventions, however Instagram's terms and conditions Use of Instagram's brand assets (e.g., the Instagram name and logo) is https://help.instagram.com/304689166306603/ which says: Don’t:
On 3 October 2014 14:12, knolleary notifications@github.com wrote:
|
Okay, but that doesn't mean we abandon our visual look. We should use a generic photo/picture icon. |
I think that's exactly what their terms don't allow us. Do you read their Don't On 3 October 2014 14:29, knolleary notifications@github.com wrote:
|
From that same page:
So, please use their glyph icon in white. |
OK! Do you have any problems with the current colour of the node? I used a On 3 October 2014 14:36, knolleary notifications@github.com wrote:
|
I'd suggest something more like #889FB3 - similar in tone, just a bit lighter and in-keeping with our muted palette. |
OK, thanks, I'll change the icon and the colour and push the new branch On 3 October 2014 14:44, knolleary notifications@github.com wrote:
|
b091049
to
f26984b
Compare
@knolleary done |
inputs:0, | ||
outputs:1, | ||
icon: "instagram.png", | ||
align: "right", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input nodes should not have align
set to right
- it defaults to left
, so you can remove this entry.
9e2f517
to
da61040
Compare
Some comments:
|
da61040
to
3ce9838
Compare
@knolleary: regarding your comment "can you and @hbeeken sync-up the appearance of the tip regarding callback url - this and the 4sq node look different. Don't mind which you two pick... just pick one.", we've decided to go with Zoltan's wording as that sounds more general. However, this means that the google calendar node ( @hindessm ) needs updating to the same wording. |
3ce9838
to
f11daf4
Compare
@knolleary I made all the changes you required above. I re-worded the node description and photos are now consistently called "photos". I also added a new paragraph to the node's description (last paragraph) to mention that the node currently only works with photos and not with videos. |
The help text talks about setting msg.filename, which I don't believe is still in the code, so needs removing. I don't think the query node is entirely clear about what it returns - what query does it actually do? (rhetorical question... don't need an answer here... the help needs updating to make it clear) |
f11daf4
to
d4cd22c
Compare
@knolleary I made the changes to the help txt as suggested by you. Thanks! I also updated the icon to be closer to the homepage's guidelines in terms of its dimension. |
d4cd22c
to
9ec9b85
Compare
@knolleary All changes suggested by @hindessm are now done. |
var ig = require('instagram-node').instagram(); | ||
|
||
// needed for normal operation | ||
var clone = require('clone'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need to depend on clone
? I don't see it used anywhere.
785499e
to
813226f
Compare
ig.use({ access_token: credentials.access_token }); | ||
ig.user('self', function(err, result, remaining, limit) { // warning, this is not the same as the other result or res! | ||
if (err) { | ||
this.warn('Instagram node has failed to fetch the username : '+err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knolleary, marked my node as WIP again as it looks like this.warn is a bad choice for the auth process as it's this
is undefined at this point! Noticed this when writing nock tests!
I think a more appropriate error message would be maybe to send a warning to res.send()
. I'll fix this.
7cff243
to
7e99d30
Compare
33a4c8a
to
c55eea2
Compare
This is my attempt on the Instagram node. Current example is showing the query node. Comments are welcome. I'll squash commits once we get this work into a pullable state. Thanks
The pull request is now ready @knolleary .