diff --git a/run-command.mjs b/run-command.mjs index 7bf10cd3..6de824f5 100644 --- a/run-command.mjs +++ b/run-command.mjs @@ -10,7 +10,7 @@ const config = Object.freeze( JSON.parse(await readFile(new URL("./src/config.json", import.meta.url))) ), ecosystemConfig = Object.freeze( - ecosystem.apps.find(app => app.name === "HolyUB") || apps[0] + ecosystem.apps.find(app => app.name === "HolyUB") || ecosystem.apps[0] ); const serverUrl = (base => { @@ -80,6 +80,7 @@ for (let i = 2; i < process.argv.length; i++) if (response === "Error") throw new Error("Server is unresponsive."); } catch (e) { // Check if this is the error thrown by the fetch request for an unused port. +// Don't print the unused port error, since nothing has actually broken. if (e instanceof TypeError) clearTimeout(timeoutId); else console.error(e); await unlink(shutdown); diff --git a/src/server.mjs b/src/server.mjs index 00e1972a..5de79e4b 100644 --- a/src/server.mjs +++ b/src/server.mjs @@ -22,7 +22,7 @@ const config = Object.freeze( JSON.parse(await readFile(new URL("./config.json", import.meta.url))) ), ecosystemConfig = Object.freeze( - ecosystem.apps.find(app => app.name === "HolyUB") || apps[0] + ecosystem.apps.find(app => app.name === "HolyUB") || ecosystem.apps[0] ), { pages, text404 } = pkg, __dirname = path.resolve(); @@ -201,7 +201,7 @@ app.get("/:file", (req, reply) => { // Testing for future features that need cookies to deliver alternate source files. if (req.raw.rawHeaders.includes("Cookie")) - console.log(req.raw.rawHeaders[req.raw.rawHeaders.indexOf("Cookie") + 1]); + console.log(req.raw.rawHeaders[ req.raw.rawHeaders.indexOf("Cookie") + 1 ]); reply.type("text/html").send( paintSource( @@ -243,7 +243,5 @@ app.setNotFoundHandler((req, reply) => { reply.code(404).type("text/html").send(paintSource(loadTemplates(tryReadFile(path.join(__dirname, "views/error.html"))))); }); -// Configure host to your liking, but remember to tweak the Rammerhead IP -// as well above for any changes. app.listen({ port: serverUrl.port, host: serverUrl.hostname }); -console.log("Holy Unblocker is listening on port " + serverUrl.port + "."); +console.log(`Holy Unblocker is listening on port ${serverUrl.port}.`); diff --git a/views/assets/js/common-16451543478.js b/views/assets/js/common-16451543478.js index 51763024..a46e4859 100644 --- a/views/assets/js/common-16451543478.js +++ b/views/assets/js/common-16451543478.js @@ -463,9 +463,9 @@ addEventListener("DOMContentLoaded", async () => { // This first one is for links, whereas the rest are for navigation menus. const huLinks = await fetch("/assets/json/links.json", {mode: "same-origin"}).then(response => response.json()); - for (let item of Object.entries(huLinks)) + for (let items = Object.entries(huLinks), i = 0; i < items.length; i++) // Replace all placeholder links with the corresponding entry in huLinks. - (document.getElementById(item[0]) || {}).href = item[1]; + (document.getElementById(items[i][0]) || {}).href = items[i][1]; const navLists = { // Pair an element ID with a JSON file name. They are identical for now. @@ -507,10 +507,11 @@ addEventListener("DOMContentLoaded", async () => { } }; - for (let item of data) { + for (let i = 0; i < data.length; i++) { // Load each item as an anchor tag with an image, heading, // description, and click event listener. - let a = document.createElement("a"), + let item = data[i], + a = document.createElement("a"), img = document.createElement("img"), title = document.createElement("h3"), desc = document.createElement("p"); @@ -545,10 +546,10 @@ addEventListener("DOMContentLoaded", async () => { } case "flash-nav": - for (let item of data) { + for (let i = 0; i < data.length; i++) { // Load each item as an anchor tag with a short title and click // event listener. - let a = document.createElement("a"); + const item = data[i], a = document.createElement("a"); a.href = "#"; a.textContent = item.slice(0, -4);