diff --git a/public/404.html b/public/404.html index ed482e3d2ef6aab4a7d949804150b151f8ac1e6b..b91e8aa879db883f21462175fcbf1452a0aa5200 100644 --- a/public/404.html +++ b/public/404.html @@ -70,15 +70,15 @@ <script> async function addFuzzySearch() { const vanityMap = await (await fetch("/vanitymap.json")).json() - const keys = Object.keys(vanityMap); + const keys = vanityMap['shortlinks'].map((object) => object.sources).flat(1) const fuse = new Fuse(keys, {}) const pathToSearchFor = window.location.pathname.replace("/", "").replace(".html", "").trim(); const results = fuse.search(pathToSearchFor) if (results.length !== 0) { const bestShortlink = results[0].item; - const bestHref = vanityMap[bestShortlink]; + const bestHref = vanityMap['shortlinks'].filter((object) => object.sources.includes(bestShortlink))[0].destination; - document.getElementById("suggestion-text").innerText = bestShortlink; + document.getElementById("suggestion-text").innerText = "/" + bestShortlink; document.getElementById("suggestion-href").href = bestHref; document.getElementById("suggestion-section").classList.remove("is-invisible"); }