diff --git a/src/randomization.mjs b/src/randomization.mjs index 139cd43b..fc2e3d22 100644 --- a/src/randomization.mjs +++ b/src/randomization.mjs @@ -1,6 +1,7 @@ import pkg from './routes.mjs'; import { existsSync, readFileSync } from 'fs'; const { cookingInserts, vegetables, charRandom, splashRandom, cacheBustList, text404 } = pkg; +export { insertText, paintSource, tryReadFile }; /* // Try this instead of the .replace method. Might be more performant. @@ -14,13 +15,14 @@ const insertText = (lis, str, newText) => { // This will put other relevant argument types, like a string, into a list. lis = [].concat(lis); + let position; // Loop through each of the placeholder strings. - for (let i = lis.length - 1, position; i >= 0; i--) { + for (let placeholder of lis) { // Find all matches of a placeholder string and insert new text there. - while ((position = str.indexOf(lis[i])) >= 0) + while ((position = str.indexOf(placeholder)) >= 0) str = str.slice(0, position) + (typeof newText == "function" ? newText() : newText) - + str.slice(position + lis[i].length); + + str.slice(position + placeholder.length); } return str; }; @@ -59,12 +61,10 @@ cacheBusting = str => { for (let item of Object.entries(cacheBustList)) str = insertText(item[0], str, item[1]); return str; -}; - - +}, // Applies the final obfuscation changes to an entire file. -export const paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))), +paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))), // Grabs the text content of a file. tryReadFile = file => existsSync(file) ? readFileSync(file, "utf8") : text404; diff --git a/src/server.mjs b/src/server.mjs index a5b273ab..a7cebe1e 100644 --- a/src/server.mjs +++ b/src/server.mjs @@ -1,4 +1,5 @@ import { paintSource, tryReadFile } from './randomization.mjs'; +import loadTemplates from './templates.mjs'; import pkg from './routes.mjs'; import { readFile } from 'fs/promises'; import path from 'path'; @@ -98,13 +99,13 @@ app.use(helmet({ // This takes one of those files and displays it for a site visitor. // Query strings like /?j are converted into paths like /views/hidden.html // back here. Which query string converts to what is defined in routes.mjs. -router.get('/', async (req, res) => res.send(paintSource(tryReadFile( +router.get('/', async (req, res) => res.send(paintSource(loadTemplates(tryReadFile( path.join(__dirname, 'views', // This returns the file path, and has the index page set as the home page. '/?'.indexOf(req.url) ? pages[Object.keys(req.query)[0]] : pages.index ) -)))); +))))); app.use(router); @@ -116,7 +117,7 @@ app.use("/baremux/", express.static(baremuxPath)); app.disable('x-powered-by'); app.use((req, res) => { - res.status(404).send(paintSource(text404)); + res.status(404).send(paintSource(loadTemplates(text404))); }); diff --git a/src/templates.mjs b/src/templates.mjs new file mode 100644 index 00000000..6a1d4fec --- /dev/null +++ b/src/templates.mjs @@ -0,0 +1,16 @@ +import insertText from './randomization.mjs'; +export { loadTemplates as default }; + + +const header = 'H­o­ly U­n­b­lo­c­k­er v5.­7.8 ', + +footer = '

Holy Unblocker LTS

Global Web Proxy Innovation, Done Right.

Services

About

What is Holy Unblocker?

Holy Unblocker, an official flagship Titanium Network site, can bypass web filters or "blockers" regardless of whether it is an extension or network-based.

Being a secure web proxy service, it supports numerous sites while being updated frequently and concentrating on detail with design, mechanics, and features.

How do I unblock websites using Holy Unblocker?

Head to the Web Proxies page and select one of the proxies featured! Afterwards, type out the site you wish to access in the search box ("example.com").

If you wish to explore the games featured on HU, check out the game pages.

Don't know the difference between each web proxy?

Check out the use case for each proxy in the page description. A quick overview:

- Corrosion: Broad support for the majority of sites but slower (YouTube, now.gg, .io sites)
- Womginx: Fast but has forward support for most sites (Discord, Bing and DuckDuckGo)

Are all sites supported? Why are some sites not loading?

As advanced as they are, web proxies are not perfect. This means that some sites may not be supported by any of the proxies listed here due to limitations or security measures.

This also applies to speed; naturally things will be slower or broken under a proxy versus direct access.

`, + +loadTemplates = str => { + str = insertText("", str, header); + str = insertText("", str, footer); + str = insertText("", str, description); + return str; +}; \ No newline at end of file diff --git a/views/401.html b/views/401.html index 081275ae..dd22ffcb 100644 --- a/views/401.html +++ b/views/401.html @@ -34,10 +34,9 @@

The site may have been updated recently and changes have not been made universal yet due to cache.

- + - diff --git a/views/404.html b/views/404.html index 6c59bc6c..579563e2 100644 --- a/views/404.html +++ b/views/404.html @@ -26,10 +26,9 @@

View the FAQ page for help?

- + - diff --git a/views/docs.html b/views/docs.html index 595fb964..a0b5aa55 100644 --- a/views/docs.html +++ b/views/docs.html @@ -17,17 +17,15 @@ - +
- + - - - diff --git a/views/faq.html b/views/faq.html index f7bc30e6..06405a41 100644 --- a/views/faq.html +++ b/views/faq.html @@ -17,17 +17,15 @@ - +
- + - - - - - - diff --git a/views/pages/nav/bookmarklets.html b/views/pages/nav/bookmarklets.html index 59ec08c0..6fab4515 100644 --- a/views/pages/nav/bookmarklets.html +++ b/views/pages/nav/bookmarklets.html @@ -17,7 +17,7 @@ - +
@@ -41,14 +41,12 @@

- CVFD

- + - - diff --git a/views/pages/nav/credits.html b/views/pages/nav/credits.html index 86662f09..c7ab2eb6 100644 --- a/views/pages/nav/credits.html +++ b/views/pages/nav/credits.html @@ -17,7 +17,7 @@ - +
@@ -61,11 +61,9 @@
- + - - diff --git a/views/pages/nav/emulators.html b/views/pages/nav/emulators.html index 58d89bae..7004bf62 100644 --- a/views/pages/nav/emulators.html +++ b/views/pages/nav/emulators.html @@ -17,7 +17,7 @@ - +
@@ -27,14 +27,12 @@
- + - - diff --git a/views/pages/nav/emulibrary.html b/views/pages/nav/emulibrary.html index d6917b42..dcab9204 100644 --- a/views/pages/nav/emulibrary.html +++ b/views/pages/nav/emulibrary.html @@ -17,7 +17,7 @@ - +
@@ -28,14 +28,12 @@
- + - - diff --git a/views/pages/nav/flash.html b/views/pages/nav/flash.html index ca813560..8f0d0290 100644 --- a/views/pages/nav/flash.html +++ b/views/pages/nav/flash.html @@ -17,7 +17,7 @@ - +
@@ -28,14 +28,12 @@
- + - - diff --git a/views/pages/nav/games5.html b/views/pages/nav/games5.html index ee39088e..a6c1ed60 100644 --- a/views/pages/nav/games5.html +++ b/views/pages/nav/games5.html @@ -17,7 +17,7 @@ - +
@@ -28,14 +28,12 @@
- + - - diff --git a/views/pages/nav/gtools.html b/views/pages/nav/gtools.html index 93715314..31701519 100644 --- a/views/pages/nav/gtools.html +++ b/views/pages/nav/gtools.html @@ -17,7 +17,7 @@ - +
@@ -43,12 +43,10 @@
- + - - diff --git a/views/pages/nav/icons.html b/views/pages/nav/icons.html index 4c55a228..9c7cfcd8 100644 --- a/views/pages/nav/icons.html +++ b/views/pages/nav/icons.html @@ -17,7 +17,7 @@ - +
@@ -34,12 +34,10 @@

Copy the URL that the bookmarklet gives you. Then go back to HU and enter in the URL for the Icon URL in Settings. Enjoy!

- + - - diff --git a/views/pages/nav/terms.html b/views/pages/nav/terms.html index 92259a93..29267f66 100644 --- a/views/pages/nav/terms.html +++ b/views/pages/nav/terms.html @@ -35,36 +35,7 @@ - +
@@ -198,11 +169,9 @@
- + - - diff --git a/views/pages/proxnav/corrosion.html b/views/pages/proxnav/corrosion.html index 456880af..a2801252 100644 --- a/views/pages/proxnav/corrosion.html +++ b/views/pages/proxnav/corrosion.html @@ -20,7 +20,7 @@ - +
@@ -51,7 +51,7 @@
- + @@ -59,9 +59,7 @@ - - diff --git a/views/pages/proxnav/preset/discord.html b/views/pages/proxnav/preset/discord.html index aa82273e..131c60aa 100644 --- a/views/pages/proxnav/preset/discord.html +++ b/views/pages/proxnav/preset/discord.html @@ -23,7 +23,7 @@ - +
@@ -63,11 +63,9 @@
- + - - diff --git a/views/pages/proxnav/preset/reddit.html b/views/pages/proxnav/preset/reddit.html index 45fee6b3..58b8e100 100644 --- a/views/pages/proxnav/preset/reddit.html +++ b/views/pages/proxnav/preset/reddit.html @@ -17,7 +17,7 @@ - +
@@ -42,7 +42,7 @@
- + @@ -51,9 +51,7 @@ registerSW(); - - diff --git a/views/pages/proxnav/preset/spotify.html b/views/pages/proxnav/preset/spotify.html index f80e0d5d..c346ce78 100644 --- a/views/pages/proxnav/preset/spotify.html +++ b/views/pages/proxnav/preset/spotify.html @@ -17,7 +17,7 @@ - +
@@ -41,7 +41,7 @@
- + @@ -50,9 +50,7 @@ registerSW(); - - diff --git a/views/pages/proxnav/preset/youtube.html b/views/pages/proxnav/preset/youtube.html index 71854528..4204ca3c 100644 --- a/views/pages/proxnav/preset/youtube.html +++ b/views/pages/proxnav/preset/youtube.html @@ -17,7 +17,7 @@ - +
@@ -41,7 +41,7 @@
- + @@ -50,9 +50,7 @@ registerSW(); - - diff --git a/views/pages/proxnav/rammerhead.html b/views/pages/proxnav/rammerhead.html index 097fee6f..b7be74db 100644 --- a/views/pages/proxnav/rammerhead.html +++ b/views/pages/proxnav/rammerhead.html @@ -16,7 +16,7 @@ - +
@@ -47,18 +47,12 @@
- + - - - - diff --git a/views/pages/proxnav/ultraviolet.html b/views/pages/proxnav/ultraviolet.html index 51916277..ef1a1cf1 100644 --- a/views/pages/proxnav/ultraviolet.html +++ b/views/pages/proxnav/ultraviolet.html @@ -22,7 +22,7 @@ - +
@@ -55,18 +55,13 @@
- + - - - diff --git a/views/pages/proxnav/womginx.html b/views/pages/proxnav/womginx.html index 58878794..f5e86f35 100644 --- a/views/pages/proxnav/womginx.html +++ b/views/pages/proxnav/womginx.html @@ -17,7 +17,7 @@ - +
@@ -43,7 +43,7 @@
- + @@ -51,9 +51,7 @@ - - diff --git a/views/pages/surf.html b/views/pages/surf.html index cc0ea98f..eaab8260 100644 --- a/views/pages/surf.html +++ b/views/pages/surf.html @@ -17,7 +17,7 @@ - +
@@ -56,13 +56,11 @@
- + - -