Skip to content
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

refactor: photo endpoints, mutex fixes, makefile updates #363

Merged
merged 5 commits into from
Apr 17, 2018
Merged

Conversation

b5
Copy link
Member

@b5 b5 commented Apr 17, 2018

refator(api): use /profile/photo & /profile/poster as vanity enapoints

Similar to the situation we ran into shipping the webapp, readonly mode can and should prevent access to anything under the /ipfs/ endpoint, which sadly includes profile photos & poster images. To get around this we'll use the same trick of hiding photos behind vanity urls.

In an effort to avoid API bloat, I've added these as elements of the previously under-used /profile/photo & /profile/poster GET endpoints. Both now accept query params for id (which is the profile ID) or peerneme. this is going to need some refinement & docs, but it'll work for now.

I've also removed .png image formats for posters & profiles so that these endpoints have an easy story for providing Content-Type headers.

Examples:

# this will return the peer's profile photo as jpg data:
GET http://localhost:2503/profile/photo?peername=b5

# ditto for the peer's poster, this time fetched with a profile id:
GET http://localhost:2503/profile/poster?id=QmeqJRCTeXnLvr523UTgVzi6UhMV5jcGn4xz3Wf3ycknEm

We should update the frontend to use these instead of the raw ipfs hashes, that way it'll work in both readonly and writable modes.

Other Fixes

  • I've also added a few odds & ends to this PR. With any luck these added mutex locks might address Keep getting odd log messages #357, which I believe is being caused by a race condition at write time.
  • Also added some makefile magic to make developing qri easier.

b5 added 5 commits April 16, 2018 16:52
Similar to the situation we ran into shipping the webapp, readonly mode
can and should prevent access to anything under the /ipfs/ endpoint,
which sadly includes profile photos & poster images. To get around this
we'll use the same trick of hiding photos behind vanity urls.

In an effort to avoid API bloat, I've added these as elements of
the previously under-used /profile/photo & /profile/poster GET endpoints.
Both now accept query params for id (which is the profile ID) or peerneme.
this is going to need some refinement & docs, but it'll work for now.
this was causing problems in tests, hopefully it'll clean 'em up.

closes #354
added a quick makefile action to checkout qri repos & update,
and documentation to help fix issues encountered rebuilding qri
after updates.
also bumped circleci to use go 1.10.1, and removed unused deps

closes #313, closes #237
removing a race condition uncovers ANOTHER RACE CONDITION. On the upside
this might be the cause of corrupt profile store file writes, here's hoping.
@b5 b5 added refactor A code change that neither fixes a bug nor adds a feature fix A bug fix labels Apr 17, 2018
@b5 b5 self-assigned this Apr 17, 2018
@b5 b5 requested a review from ramfox April 17, 2018 15:14
@ghost ghost added the in progress label Apr 17, 2018
Copy link
Member

@ramfox ramfox left a comment

Choose a reason for hiding this comment

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

☁️ 🌞 🌈

Also yay on the decision to change profile.profile to profile.photo

@b5 b5 merged commit 81a4020 into master Apr 17, 2018
@ghost ghost removed the in progress label Apr 17, 2018
@b5 b5 deleted the photo_endpoints branch April 17, 2018 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A bug fix refactor A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants