Skip to content

Commit

Permalink
Renamed some paths; replaced query string navigation system with path…
Browse files Browse the repository at this point in the history
…s, for SEO reasons.
  • Loading branch information
00Fjongl committed Aug 7, 2024
1 parent e0496f4 commit f52a4f9
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 58 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"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 )",
Expand Down
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
16 changes: 8 additions & 8 deletions views/pages/misc/deobf/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

<ul class="navbar-1" role="list" aria-label="Primary navigation">
<li class="pulse" style="margin-left: 0;" role="listitem">
<a href="/?browse" title="Web Proxies - Access various web proxies to bypass restrictions">Web Proxies</a>
<a href="/browsing" title="Web Proxies - Access various web proxies to bypass restrictions">Web Proxies</a>
</li>
<li class="pulse" role="listitem">
<a href="/?g" title="Games - Explore a range of games available through our service">Games</a>
<a href="/games" title="Games - Explore a range of games available through our service">Games</a>
</li>
<li class="pulse" role="listitem">
<a href="/?y" title="YouTube - Access YouTube content through our proxy service">YouTube</a>
<a href="/youtube" title="YouTube - Access YouTube content through our proxy service">YouTube</a>
</li>
<li class="pulse new" role="listitem">
<a href="/?apps" title="Applications - Browse a selection of useful applications">Applications</a>
<a href="/apps" title="Applications - Browse a selection of useful applications">Applications</a>
</li>
</ul>

Expand All @@ -31,19 +31,19 @@
<div class="dropdown-child" tabindex="0" role="menu" aria-label="More options submenu">
<ul class="subnavbar" role="menu">
<li role="menuitem">
<a href="/?x" title="Bookmarklets - Useful tools and shortcuts for your browser">Bookmarklets</a>
<a href="/bookmarklets" title="Bookmarklets - Useful tools and shortcuts for your browser">Bookmarklets</a>
</li>
<li role="menuitem">
<a href="/?documentation" title="Documentation - Detailed information and guides">Docs</a>
</li>
<li role="menuitem">
<a href="/?faq" title="FAQ - Frequently asked questions and answers">FAQ</a>
<a href="/questions" title="FAQ - Frequently asked questions and answers">FAQ</a>
</li>
<li role="menuitem">
<a href="/?credits" title="Credits - Acknowledgements and contributions">Credits</a>
<a href="/credits" title="Credits - Acknowledgements and contributions">Credits</a>
</li>
<li role="menuitem">
<a href="/?terms" title="Terms of Service - Rules and policies of use">TOS</a>
<a href="/terms" title="Terms of Service - Rules and policies of use">TOS</a>
</li>
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions views/pages/nav/gtools.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ <h3>Information:</h3>
<p>Most of the games here should hopefully be updated.</p>
</div>
<div class="responsive-fix">
<a class="fancybutton glowbutton" href="/?el">Emulators</a>
<a class="fancybutton glowbutton" href="/?m">EmuLibrary</a>
<a class="fancybutton glowbutton" href="/?h">Web Games</a>
<a class="fancybutton glowbutton" href="/?f">Flash Games</a>
<a class="fancybutton glowbutton" href="/emulators">Emulators</a>
<a class="fancybutton glowbutton" href="/retro-games">EmuLibrary</a>
<a class="fancybutton glowbutton" href="/web-games">Web Games</a>
<a class="fancybutton glowbutton" href="/flash-games">Flash Games</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/pages/proxnav/preset/youtube.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h1 class="bigtitle">Youtube Proxy</h1>
</p>
<h3>Having Issues?</h3>
<p class="font3 accented">
Read the <a href="/?faq">FAQ page</a> for more information.
Read the <a href="/questions">FAQ page</a> for more information.
<br />Sometimes the proxies are under high load so things may be slow,
sorry. In that case simply wait for the page to load.
</p>
Expand Down
6 changes: 3 additions & 3 deletions views/pages/surf.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<h1 class="bigtitle">Web Proxies</h1>
<p>Choose which proxy you would like to use.</p>
<div class="buttonrow">
<a class="fancybutton glowbutton" href="/?q">Ultraviolet</a>
<a class="fancybutton glowbutton" href="/?rh">Rammerhead</a>
<a class="fancybutton glowbutton" href="/ultraviolet">Ultraviolet</a>
<a class="fancybutton glowbutton" href="/rammerhead">Rammerhead</a>
</div>
<p>
Stealth mode hides your browser history while Classic mode is the
Expand All @@ -85,7 +85,7 @@ <h3>More Information:</h3>
</div>
<p>
If you get any errors please check the
<a href="/?faq">FAQ</a> page!<br />Join the TN discord for updated
<a href="/questions">FAQ</a> page!<br />Join the TN discord for updated
Holy Unblocker site links and better services.
</p>
<a id="tnlink" class="bluelink">https://discord.gg/unblock</a>
Expand Down

0 comments on commit f52a4f9

Please sign in to comment.