-
Notifications
You must be signed in to change notification settings - Fork 650
Serve locally uploaded crates from a different folder #951
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
Serve locally uploaded crates from a different folder #951
Conversation
src/lib.rs
Outdated
if env != Env::Test { | ||
m.around(dist::Middleware::default()); | ||
m.around(local_uploads::Middleware::default()); |
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.
Wouldn't this break prod ?
It seems that the dist::Middleware
is used to serve the Ember application, styles & other assets. Does it still work after this change ?
Argh yes you're right it doesn't work :(. I'll find another way to get this to work, maybe by adding another bit of middleware specifically for the uploader. |
Bear with me for a few mins, I'm updating a previous PR and I would like to add notes about |
Ok, I've updated the docs too :) |
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.
A few little comment fixes, and I'm having trouble getting this to work-- will elaborate in the next comment.
docs/CONTRIBUTING.md
Outdated
the frontend. If you try to install a crate from your local crates.io and | ||
`cargo` can't find the crate files, that's probably why. | ||
will be stored in `local_uploads/` and served from there when a crate is | ||
downloaded. This directory gets cleared out if you stop and restart the frontend. |
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 thought the point of this change was to make it so that the local uploads wouldn't get cleared out if you stop and restart the frontend? So that should mean this sentence should go away, 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.
Yes it should, I'll make the change :)
src/dist.rs
Outdated
@@ -1,3 +1,5 @@ | |||
//! This module implements middleware to host the compiled emberjs |
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 would say "serve" rather than "host".
src/local_uploads.rs
Outdated
@@ -0,0 +1,41 @@ | |||
//! This module implements middleware to host crates from the |
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.
Same here-- please replace "host" with "serve" :)
Nevermind what I said about it not working, it's totally working now.. I don't know what my issue was. However, since the README rendering has been merged in, and since I merged upstream into this branch for you, could you get README rendering to work as well? The HTML for readmes is getting saved in `/local_uploads/readmes/crate/crate-version.html, but the frontend is requesting http://localhost:4200/local_uploads/readmes/crate/crate-version.html which 404s. |
I've made the requested changes @carols10cents, this should now work locally with readme files too :) |
bors: r+ |
Build failed |
bors: retry |
bors: r+ |
Build failed |
bors: r+ |
Build succeeded |
Fix #934, serve locally uploaded crates from a different location since
dist/
gets recreated each time the front end restarts.