Skip to content

Commit

Permalink
Fixed merged funny stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Aug 7, 2024
2 parents ef39c8c + 1ac43ed commit c21d775
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 88 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"scripts": {
"start": "npm install && npm run build && npm run manual-start",
"restart": "npm stop; npm run manual-start",
"stop": "sh ./read-config.sh '.production' && pm2 stop ecosystem.config.js; pkill node || true",
"stop": "pm2 stop ecosystem.config.js; pkill node || true",
"test": "npm run proxy-validator",
"monit": "pm2 monit",
"manual-start": "sh ./read-config.sh '.production' && ( pm2 start ecosystem.config.js --env production ) || ( node backend.js & pkill -n npm || true )",
"manual-start": "node ./read-config.mjs 'production' && ( pm2 start ecosystem.config.js --env production ) || ( node backend.js & pkill -n npm || true )",
"build": "sh ./build-assets.sh && cd lib/rammerhead && npm install && npm run build",
"start-test-server": "timeout 5 node backend.js; test $? -eq 124 && ( npm run manual-start & ) || exit 1",
"proxy-validator": "node proxyServiceValidator.js"
Expand Down
44 changes: 22 additions & 22 deletions proxyServiceValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ const testGeneratedUrl = async (url, headers) => {
const testServerResponse = async () => {
const endpoints = [
"http://localhost:8080/",
"http://localhost:8080/?pathtonowhere",
"http://localhost:8080/?browse",
"http://localhost:8080/?rh",
"http://localhost:8080/?q",
"http://localhost:8080/?documentation",
"http://localhost:8080/?faq",
"http://localhost:8080/?s",
"http://localhost:8080/?credits",
"http://localhost:8080/?x",
"http://localhost:8080/?terms",
"http://localhost:8080/?g",
"http://localhost:8080/?h",
"http://localhost:8080/?el",
"http://localhost:8080/?f",
"http://localhost:8080/?m",
"http://localhost:8080/?y",
"http://localhost:8080/?apps",
"http://localhost:8080/?fg",
"http://localhost:8080/?eg",
"http://localhost:8080/?vos",
"http://localhost:8080/pathtonowhere",
"http://localhost:8080/browsing",
"http://localhost:8080/rammerhead",
"http://localhost:8080/ultraviolet",
"http://localhost:8080/documentation",
"http://localhost:8080/questions",
"http://localhost:8080/s",
"http://localhost:8080/credits",
"http://localhost:8080/bookmarklets",
"http://localhost:8080/terms",
"http://localhost:8080/games",
"http://localhost:8080/web-games",
"http://localhost:8080/emulators",
"http://localhost:8080/flash-games",
"http://localhost:8080/retro-games",
"http://localhost:8080/youtube",
"http://localhost:8080/apps",
"http://localhost:8080/flash",
"http://localhost:8080/webretro",
"http://localhost:8080/vibe-os",
"http://localhost:8080/assets/js/particlesjs/particles.js",
"http://localhost:8080/assets/js/bareTransport.js",
"http://localhost:8080/assets/js/card.js",
Expand Down Expand Up @@ -106,7 +106,7 @@ const testCommonJSOnPage = async () => {
};

const testRammerhead = async () => {
await page.goto("http://localhost:8080/?rh");
await page.goto("http://localhost:8080/rammerhead");

const testResults = await page.evaluate(async () => {
const results = {};
Expand Down Expand Up @@ -211,7 +211,7 @@ xx xx


const testUltraviolet = async () => {
await page.goto("http://localhost:8080/?q");
await page.goto("http://localhost:8080/ultraviolet");

const testResults = await page.evaluate(async () => {
const results = [{}, {}];
Expand Down
8 changes: 8 additions & 0 deletions read-config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { readFile } from 'node:fs/promises';
let property = JSON.parse(await readFile(new URL("./src/config.json", import.meta.url)));
process.argv.slice(2).forEach(descriptor => {property = property[descriptor]});
if (typeof property === "boolean") process.exitCode = +!property;
else {
console.log(property);
process.exitCode = 0;
}
10 changes: 0 additions & 10 deletions read-config.sh

This file was deleted.

26 changes: 13 additions & 13 deletions src/routes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ const pages = {
index: "index.html",
/* Main */
documentation: "docs.html",
faq: "faq.html",
questions: "faq.html",
s: "pages/frame.html",
browse: "pages/surf.html",
browsing: "pages/surf.html",
credits: "pages/nav/credits.html",
x: "pages/nav/bookmarklets.html",
bookmarklets: "pages/nav/bookmarklets.html",
terms: "pages/nav/terms.html",
/* Games */
g: "pages/nav/gtools.html",
h: "pages/nav/games5.html",
el: "pages/nav/emulators.html",
f: "pages/nav/flash.html",
m: "pages/nav/emulibrary.html",
games: "pages/nav/gtools.html",
"web-games": "pages/nav/games5.html",
emulators: "pages/nav/emulators.html",
"flash-games": "pages/nav/flash.html",
"retro-games": "pages/nav/emulibrary.html",
/* Proxies */
q: "pages/proxnav/ultraviolet.html",
rh: "pages/proxnav/rammerhead.html",
ultraviolet: "pages/proxnav/ultraviolet.html",
rammerhead: "pages/proxnav/rammerhead.html",
/* Proxy Presets */
y: "pages/proxnav/preset/youtube.html",
youtube: "pages/proxnav/preset/youtube.html",
apps: "pages/proxnav/preset/applications.html",
/* Misc */
fg: "archive/gfiles/flash/index.html",
eg: "archive/gfiles/rarch/index.html",
flash: "archive/gfiles/flash/index.html",
webretro: "archive/gfiles/rarch/index.html",
vos: "archive/vibeOS/index.html",
};

Expand Down
31 changes: 24 additions & 7 deletions src/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,20 @@ app.register(fastifyHelmet, {
});

app.register(fastifyStatic, {
root: fileURLToPath(new URL("../views", import.meta.url))
root: fileURLToPath(new URL("../views/pages", import.meta.url)),
decorateReply: false
});

app.register(fastifyStatic, {
root: fileURLToPath(new URL("../views/assets", import.meta.url)),
prefix: "/assets/",
decorateReply: false
});

app.register(fastifyStatic, {
root: fileURLToPath(new URL("../views/archive", import.meta.url)),
prefix: "/arcade/",
decorateReply: false
});

app.register(fastifyStatic, {
Expand Down Expand Up @@ -138,12 +151,11 @@ app.register(fastifyStatic, {

// All website files are stored in the /views directory.
// 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.
app.get("/", (req, reply) => {
// Paths like /browsing are converted into paths like /views/pages/surf.html
// back here. Which path converts to what is defined in routes.mjs.
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]);

Expand All @@ -155,8 +167,8 @@ app.get("/", (req, reply) => {
"views",
// Return the error page if the query is not found in
// routes.mjs. Also set index as the default page.
"/?".indexOf(req.url)
? pages[Object.keys(req.query)[0]] || "error.html"
req.params.file
? pages[req.params.file] || "error.html"
: pages.index
)
)
Expand All @@ -165,6 +177,11 @@ app.get("/", (req, reply) => {
);
});

// Ignore trailing slashes for the above path handling.
app.get("/:file/", (req, reply) => {
reply.redirect("/" + req.params.file);
});


/*
Testing for future restructuring of this config file.
Expand Down
6 changes: 3 additions & 3 deletions views/assets/js/common-16451543478.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getDomain =
// This is used for stealth mode when visiting external sites.
goFrame = url => {
localStorage.setItem("huframesrc", url);
location.href = "?s";
location.href = "/s";
},

// Used to set functions for the goProx object at the bottom.
Expand Down Expand Up @@ -533,7 +533,7 @@ addEventListener("DOMContentLoaded", async () => {
// the corresponding location/index in the dirnames object.
const functionsList = [
() => goFrame(item.path),
() => goFrame("/?eg&core=" + item.core + "&rom=" + item.rom),
() => goFrame("/webretro?core=" + item.core + "&rom=" + item.rom),
item.custom ? () => goProx[item.custom]("stealth") : () => goFrame("/archive/g/" + item.path)
];

Expand All @@ -554,7 +554,7 @@ addEventListener("DOMContentLoaded", async () => {

a.addEventListener("click", e => {
e.preventDefault();
goFrame("/?fg&swf=" + item);
goFrame("/flash?swf=" + item);
});

navList.appendChild(a);
Expand Down
12 changes: 6 additions & 6 deletions views/assets/json/emu-nav.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
[
{
"name": "GBA Emulator",
"path": "/?eg&core=mgba",
"path": "/webretro?core=mgba",
"img": "gba.png",
"description": "Emulate GBA, GB, and GBC games! Click to upload a ROM."
},
{
"name": "NES Emulator",
"path": "/?eg&core=nestopia",
"path": "/webretro?core=nestopia",
"img": "nes.png",
"description": "Emulate NES games! Click to upload a ROM."
},
{
"name": "SNES Emulator",
"path": "/?eg&core=snes9x",
"path": "/webretro?core=snes9x",
"img": "snes.png",
"description": "Emulate SNES games! Click to upload a ROM."
},
{
"name": "Genesis Emulator",
"path": "/?eg&core=genesis_plus_gx",
"path": "/webretro?core=genesis_plus_gx",
"img": "genesis.png",
"description": "Emulate Genesis games! Click to upload a ROM."
},
{
"name": "N64 Emulator (BROKEN)",
"path": "/?eg&core=mupen64plus_next",
"path": "/webretro?core=mupen64plus_next",
"img": "nintendo64.png",
"description": "Emulate N64 games! Click to upload a ROM. (Currently Broken)"
},
{
"name": "VibeOS",
"path": "/?vos",
"path": "/vibe-os",
"img": "vibeos.svg",
"description": "JavaScript based Desktop Environment that runs in your browser."
}
Expand Down
2 changes: 1 addition & 1 deletion views/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1>Site Error!</h1>
<br />
<p>
Invalid URL? View the
<a href="/?faq" class="bluelink">FAQ page</a> for help!
<a href="/questions" class="bluelink">FAQ page</a> for help!
</p>
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@type": "ContactPoint",
"contactType": "Customer Support",
"email": "[email protected]",
"url": "https://holyunblocker.org/?credits"
"url": "https://holyunblocker.org/credits"
},
"keywords": "proxy, web proxy, unblock websites, unblock Chromebook, free web proxy, proxy list, proxy sites, unblock Chromebook, online proxy, proxy server, proxy site, proxy YouTube, bypass Securly, bypass iBoss, bypass Lightspeed filter, Holy Unblocker, Chromebooks, Titanium Network, unblock YouTube, YouTube proxy, unblocked YouTube, YouTube unblocked, anonymous browsing, internet freedom, web censorship, school proxy, work proxy, secure proxy, fast proxy, private proxy, unblock social media, access blocked sites, bypass network restrictions"
}
Expand Down Expand Up @@ -225,7 +225,7 @@
<h1><span>End Internet Censorship.</span></h1>
<h1>Privacy right at your fingertips.</h1>
<a class="homebutton" href="#scrollfix" aria-label="Bypass now">Bypass now?</a>
<a class="homebutton mobile" href="/?browse" aria-label="Browse now">Bypass now?</a>
<a class="homebutton mobile" href="/browsing" aria-label="Browse now">Bypass now?</a>
</div>
<div class="mac-window" aria-label="Command Line Instructions">
<div class="mac-title-bar" role="banner" aria-label="Mac Window Title Bar">
Expand Down Expand Up @@ -294,7 +294,7 @@ <h2 class="hero-content-header">Holy Unblocker is fast and highly advanced.</h2>
<img class="hero" src="/assets/img/icon2.png" alt="icon" />
<h1>Holy Unblocker LTS</h1>
<h2>Free and transparent for use</h2>
<a class="fancybutton glowbutton" href="/?browse">Browse Now</a>
<a class="fancybutton glowbutton" href="/browsing">Browse Now</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -429,7 +429,7 @@ <h1>Intent</h1>
<div class="text-wrap">
<h1>Usage</h1>
<p>
Head to the <a href="?browse">Web Proxies</a> page and select one of
Head to the <a href="/browsing">Web Proxies</a> page and select one of
the proxies featured! Afterwards, type out the site you wish to
access in the search box. Each web proxy has its own level of
effectiveness, speed and security. It is recommended to use
Expand All @@ -447,8 +447,8 @@ <h1>Usage</h1>
<h1>Apps</h1>
<p>
HU LTS features a collection of pre-linked applications,
including YouTube, Spotify, <a href="?el">Webretro</a> (an
online everything emulator), <a href="?f">Ruffle.fs</a> (Adobe
including YouTube, Spotify, <a href="/emulators">Webretro</a> (an
online everything emulator), <a href="/flash-games">Ruffle.fs</a> (Adobe
Flash Emulator), and an expansive library for each respective
app.
</p>
Expand Down Expand Up @@ -536,14 +536,14 @@ <h2 class="hero-content-header">Efficient and Reliable Access</h2>
</div>
<div class="image-container-hero">
<h1>Long Term Support FOSS Project</h1>
<a class="fancybutton glowbutton" href="/?browse">Bypass Now</a>
<a class="fancybutton glowbutton" href="/browsing">Bypass Now</a>
</div>
</div>
</div>
<div class="box-home text-center splashend">
<h1>It's time to browse the internet freely.</h1>
<a class="homebutton" href="#scrollfix">Try HU LTS For Free</a>
<a class="homebutton mobile" href="/?browse">Try HU LTS For Free</a>
<a class="homebutton mobile" href="/browsing">Try HU LTS For Free</a>
</div>
</div>
<div id="footer" class="fullwidth"><!--FOOTER--></div>
Expand Down
2 changes: 1 addition & 1 deletion views/pages/misc/deobf/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h4 id="workspace-configurations">Workspace Configurations</h4>
</ul>
<p>Use the same steps above by running <code>npm install</code> in your repository and adding a <code>.gitignore</code> in your root directory specifying to exclude <code>node_modules</code>.</p>
<h2 id="detailed-faq">Detailed FAQ</h2>
<p>A detailed FAQ with common issues and solutions can be found <a href="https://holyubofficial.net/?faq">here</a> or on any official HU site on the FAQ page.</p>
<p>A detailed FAQ with common issues and solutions can be found <a href="https://holyunblocker.org/questions">here</a> or on any official HU site on the FAQ page.</p>
<details>
<summary>Quick FAQ</summary>

Expand Down
4 changes: 2 additions & 2 deletions views/pages/misc/deobf/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ <h3>About</h3>
title="Holy Unblocker GitHub Repository"
>GitHub</a
></li>
<li><a href="/?terms" title="Privacy Policy and Terms of Service">Privacy and Terms of Service</a></li>
<li><a href="/?credits" title="Credits and Acknowledgements">Credits</a></li>
<li><a href="/terms" title="Privacy Policy and Terms of Service">Privacy and Terms of Service</a></li>
<li><a href="/credits" title="Credits and Acknowledgements">Credits</a></li>
</ul>
</div>
<div class="footerlist">
Expand Down
Loading

0 comments on commit c21d775

Please sign in to comment.