Prevented the page's respective .html to show up in the package list

This commit is contained in:
Arzumify 2024-08-03 15:33:14 +01:00
parent 8bf1163a13
commit 781aaafcf1

View file

@ -13,7 +13,7 @@ async function fetchPackages(uri) {
linksNodeList.forEach((link) => { linksNodeList.forEach((link) => {
const linkText = link.innerHTML.trim(); const linkText = link.innerHTML.trim();
const forbiddenLinks = ["Name", "Last modified", "Size", "Description", "Parent Directory"]; const forbiddenLinks = ["Name", "Last modified", "Size", "Description", "Parent Directory"];
if (!forbiddenLinks.includes(linkText)) { if (!forbiddenLinks.includes(linkText) && !linkText.endsWith(".html")) {
const packageLink = document.createElement("a"); const packageLink = document.createElement("a");
const newRedirect = uri + "/" + link.href.split("/").pop(); const newRedirect = uri + "/" + link.href.split("/").pop();
packageLink.href = newRedirect; packageLink.href = newRedirect;
@ -29,4 +29,4 @@ async function fetchPackages(uri) {
console.error('Parsing error:', e); console.error('Parsing error:', e);
statusText.innerHTML = "Failed to fetch packages. Please try again later."; statusText.innerHTML = "Failed to fetch packages. Please try again later.";
} }
} }