Download static/reader/search/reader-chapter-search-proxy-url.mjs from VoiceOfML/Search: direct link, hf CLI and curl.
- Browser
- Download file 728 Bytes
-
https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/static/reader/search/reader-chapter-search-proxy-url.mjs
- Command line
-
hf download hf://spaces/VoiceOfML/Search/static/reader/search/reader-chapter-search-proxy-url.mjs
-
curl -L -o reader-chapter-search-proxy-url.mjs https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/static/reader/search/reader-chapter-search-proxy-url.mjs
728 Bytes
| // Chapter search accepts only immutable chapter search indexes. | |
| // Origin is chosen by the site caller. | |
| /** @param {URL} url @param {string} origin @returns {boolean} */ | |
| export function isSearchIndexProxyURL(url, origin) { | |
| if (url.origin !== origin || url.username || url.password || url.hash) return false; | |
| if (url.pathname !== "/api/reader-bucket-resource") return false; | |
| if (url.searchParams.getAll("path").length !== 1) return false; | |
| if (![...url.searchParams.keys()].every(key => key === "path")) return false; | |
| const path=url.searchParams.get("path"); | |
| return typeof path === "string" && | |
| /^chapters\/ebook\/(?:epub|mobi|azw3|fb2|chm)\/[0-9a-f]{64}\/[0-9a-f]{16}\/epub-search-index\.json\.gz$/.test(path); | |
| } | |