Skip to content

Commit a83da34

Browse files
serve all in-crate js files
starting with rust-lang/rust#59776, the search index, aliases, and source file list are getting the resource suffix added to their file names. this means we can't route them from a static path any more. since we always check the static file router first, this will still allow serving `main.js` for rustdoc versions prior to the addition of `--static-root-path`, and also allows rustdoc to add per-crate javascript files without requiring docs.rs to update to handle it. (it also allows us to start hosting things *other* than rustdoc output as docs - e.g. mdbook output - in the future without changing the routing table massively.)
1 parent 46fa554 commit a83da34

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/web/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,15 @@ impl CratesfyiHandler {
170170
router.get("/:crate/:version/",
171171
rustdoc::rustdoc_redirector_handler,
172172
"crate_version_");
173-
router.get("/:crate/:version/search-index.js",
174-
rustdoc::rustdoc_html_server_handler,
175-
"crate_version_search_index_js");
173+
router.get("/:crate/:version/*.js",
174+
rustdoc::rustdoc_redirector_handler,
175+
"crate_version_js");
176176
router.get("/:crate/:version/settings.html",
177177
rustdoc::rustdoc_html_server_handler,
178178
"crate_version_settings_html");
179179
router.get("/:crate/:version/all.html",
180180
rustdoc::rustdoc_html_server_handler,
181181
"crate_version_all_html");
182-
router.get("/:crate/:version/aliases.js",
183-
rustdoc::rustdoc_html_server_handler,
184-
"crate_version_aliases_js");
185-
router.get("/:crate/:version/source-files.js",
186-
rustdoc::rustdoc_html_server_handler,
187-
"crate_version_source_files_js");
188182
router.get("/:crate/:version/:target",
189183
rustdoc::rustdoc_redirector_handler,
190184
"crate_version_target");

0 commit comments

Comments
 (0)