mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 11:30:01 -04:00
More commenting and reformatting changes
This commit is contained in:
parent
1411d697b2
commit
46b93c3607
3 changed files with 12 additions and 12 deletions
|
@ -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);
|
||||
|
|
|
@ -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}.`);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue