Skip to content

Refactor static file handling #1090

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

Merged
merged 4 commits into from
Oct 13, 2020
Merged

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Oct 12, 2020

  • Moved the static files out of templates/ and src/ (both as static files that got included in the build, and as static strings in the source) into the static/ directory

  • Copied the static/ directory into the docker image as static/

  • Removed the staticfile handler serving from $CRATESFYI_PREFIX/public_html/ since those files are now in static/

  • Add metrics tracking DatabaseFileHandler usage

Fixes #55

 * Moved the static files out of templates/ and src/ (both as static
   files that got included in the build, and as static strings in the
   source) into the static/ directory

 * Copied the static/ directory into the docker image as static/

 * Removed the `staticfile` handler serving from
   $CRATESFYI_PREFIX/public_html/ since those files are now in static/
@jyn514 jyn514 added A-backend Area: Webserver backend C-technical-debt Category: This makes the code harder to read and modify, but has no impact on end users S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Oct 13, 2020
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

Looks reasonable, I want to play around with it a little more and make sure it behaves the same. Thanks for working on this!

"/opensearch.xml",
PermanentRedirect("/-/static/opensearch.xml"),
);
routes.static_resource("/sitemap.xml", PermanentRedirect("/-/sitemap.xml"));
Copy link
Member

Choose a reason for hiding this comment

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

The sitemap has to live at the top level:

A sitemap can be posted anywhere on your site, but a sitemap affects only descendants of the parent directory. Therefore, a sitemap posted at the site root can affect all files on the site, which is where we recommend posting your sitemaps.

https://support.google.com/webmasters/answer/183668?hl=en

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, that was one I was wondering about, I'll change this back and put in a comment.

@jyn514 jyn514 mentioned this pull request Oct 13, 2020
@jyn514 jyn514 merged commit 05c3aec into rust-lang:master Oct 13, 2020
@Nemo157 Nemo157 deleted the static-refactor branch October 14, 2020 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend Area: Webserver backend C-technical-debt Category: This makes the code harder to read and modify, but has no impact on end users S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"The requested crate does not exist" message if a version does not exist
3 participants