Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

[wip] Avatars #37

Merged
merged 7 commits into from Aug 26, 2014
Merged

[wip] Avatars #37

merged 7 commits into from Aug 26, 2014

Conversation

seanmonstar
Copy link
Contributor

Still a work in progress.

Status:

  • GET /v1/avatar
  • GET /v1/avatars
  • POST /v1/avatar
  • POST /v1/avatar/upload
  • image processing worker to resize images
    • worker server
    • computer cluster with gm
    • upload to s3
  • put processed images on s3 public bucket
  • domain for s3 public bucket
  • fxa-dev integration
  • docs
    • docs/API.md
    • docs/DESIGN.md
  • tests
    • tests with img.local driver
    • tests with img.aws driver

fixes #29

@seanmonstar seanmonstar added this to the train-20 (Aug 25) milestone Aug 7, 2014
@ckarlof
Copy link
Contributor

ckarlof commented Aug 7, 2014

Cool! Excited to see this.

doc: 'Patterns to match a URL to ensure we only accept certain URLs.',
default: {
'gravatar': '^http://www\\.gravatar\\.com/avatar/[0-9a-f]{32}$',
'fxa': '^http://localhost:1112/a/[0-9a-f]{32}$'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: figure out final pattern for prod

@ckarlof
Copy link
Contributor

ckarlof commented Aug 7, 2014

Can reliers request profile images of different sizes, e.g., ?sz=50? Not a blocker to get this merged, but it would nice to have that early on.

@seanmonstar
Copy link
Contributor Author

@ckarlof I had not thought about variable sizes. Would we store a pre-sized version of certain sizes, or have the proxy from S3 resize on the fly?

providers: {
doc: 'Patterns to match a URL to ensure we only accept certain URLs.',
default: {
'gravatar': '^http://www\\.gravatar\\.com/avatar/[0-9a-f]{32}$',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about https?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just requires adding a s? in there. I didn't realize gravatar served over https.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just found this today:

https://en.gravatar.com/site/implement/images/#secure-images

Secure Requests

If you're displaying Gravatars on a page that is being served over SSL (e.g. the page URL starts with HTTPS), then you'll want to serve your Gravatars via SSL as well, otherwise you'll get annoying security warnings in most browsers. To do this, simply change the URL for your Gravatars so that is starts with:

https://secure.gravatar.com/...

Everything else is the same as above (all the same options work), just make sure that the URL starts out like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grump

fine, i'll change it to http(://www|s://secure)

@seanmonstar
Copy link
Contributor Author

I've updated the checklist of things left to do. @zaach It should work locally with a npm start.

@pdehaan
Copy link
Contributor

pdehaan commented Aug 19, 2014

@rfk to review when ready.

if (config.env !== 'dev') {
logger.warn('static bin should only be for local dev');
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth setting process.title in this script, simply for consistency with the other two scripts in this folder?

var id = img.id();
db.addAvatar(id, uid, payload.url, provider, payload.selected)
.done(function() {
reply(EMPTY).code(201);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the use of 201 here; it should probably be called out explicitly in the docs.

@rfk
Copy link
Contributor

rfk commented Aug 22, 2014

👍

A few nits and thoughts there, but overall this is looking really good. The choice to use a local worker rather than all that SQS infrastructure seems to have paid off nicely in terms of simplicity for the initial version.

Aside from the missing ping method and some API/doc questions, I think we can safely land this on master to help with testing in AWS, and follow up on the other points in separate bugs.

@rfk
Copy link
Contributor

rfk commented Aug 22, 2014

Aside from the missing ping method

My concern being that this will be ignored in dev, but break stuff in prod where it actually checks the heartbeat. Perhaps we should add an explicit test for the heartbeat endpoint.

Key: key
}, function(err, data) {
if (err) {
reject(err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be return reject(err); so it doesn;t fall through?

@zaach
Copy link
Contributor

zaach commented Aug 22, 2014

Also still needs DELETE /avatar/{uid} and for GET/ avatar to return the uid.

@seanmonstar
Copy link
Contributor Author

Yea, I forgot to include a test of __heartbeat__. That shall be added. And the route @zaach wants.

@seanmonstar seanmonstar merged commit aaec215 into master Aug 26, 2014
@seanmonstar seanmonstar deleted the avatar branch October 19, 2015 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile images are going to be a thing
5 participants