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 = 'Holy Unblocker v5.7.8
', + +footer = 'Holy Unblocker LTS © 2024', + +description = `
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.
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.
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)
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.
The site may have been updated recently and changes have not been made universal yet due to cache.
- + - - +- CVFD
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!