Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Jul 8, 2024
2 parents 5e6179a + f7d7499 commit 1d36f0a
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 88 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ This is an example of DNS records involving Heroku. Self-hosting will require `A
As stated previously, Holy Unblocker is hosted locally with Ultraviolet.

#### Freenom/Domain Steps
For beginners, Freenom is a good provider for obtaining domains for free. However the catch is that you can only use properly "Freenom" domains for free being .cf, .ml, .gq, ga and .tk. However these can be blocked rather easily.
For beginners, Freenom is a good provider for obtaining domains for free. However, Freenom only provides their TLDs (`.cf`, `.ml`, `.gq`, `.ga`, and `.tk`) for free, which can be easily blocked.

- Get some Freenom domains then add them to your Heroku instance (Personal > [App Name] > Settings > Domains)
Add a domain for both `www.example.cf` and `example.cf` with .cf being interchangeable with other Freenom domain names.
Expand Down
25 changes: 12 additions & 13 deletions src/randomization.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ export { insertText, paintSource, tryReadFile };
/*
// Try this instead of the .replace method. Might be more performant.
// Will edit str by replacing all matches of lis with newText.
// Usage: insertText(["<Example1>", "<Example2>"],
// "<Example1> Big Giant Paragraph <Example2> Smol Paragraph",
// Usage: insertText(['<Example1>', '<Example2>'],
// '<Example1> Big Giant Paragraph <Example2> Smol Paragraph',
// stringOrFunctionToGenerateNewText);
*/
const insertText = (lis, str, newText) => {
// The lis argument should be a list of strings containing placeholders.
// 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 placeholder of lis) {

// The lis argument should be a list of strings containing placeholders.
// Ensure lis is formatted as a list, and loop through each of the
// placeholder strings.
for (let placeholder of [].concat(lis)) {
// Find all matches of a placeholder string and insert new text there.
while ((position = str.indexOf(placeholder)) >= 0)
str = str.slice(0, position)
+ (typeof newText == "function" ? newText() : newText)
+ (typeof newText == 'function' ? newText() : newText)
+ str.slice(position + placeholder.length);
}
return str;
Expand All @@ -34,7 +33,7 @@ const insertText = (lis, str, newText) => {
// changes with each time it is loaded.
const randomListItem = lis => () => lis[Math.random() * lis.length | 0],

charset = ["&#173;", "&#8203;", "&shy;", "<wbr>"],
charset = ['&#173;', '&#8203;', '&shy;', '<wbr>'],
getRandomChar = randomListItem(charRandom),
insertCharset = str => insertText(
charset,
Expand All @@ -44,14 +43,14 @@ insertCharset = str => insertText(

getRandomSplash = randomListItem(splashRandom),
hutaoInsert = str => insertText(
"<!--HUTAOWOA-->",
'<!--HUTAOWOA-->',
str,
getRandomSplash
),

getCookingText = () => `<span style="display:none" data-fact="${randomListItem(vegetables)()}">${randomListItem(cookingInserts)()}</span>`,
insertCooking = str => insertText(
"<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->",
'<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->',
str,
getCookingText
),
Expand All @@ -67,7 +66,7 @@ cacheBusting = str => {
paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))),

// Grabs the text content of a file.
tryReadFile = file => existsSync(file) ? readFileSync(file, "utf8") : text404;
tryReadFile = file => existsSync(file) ? readFileSync(file, 'utf8') : text404;

/*
// All of this is now old code.
Expand Down
14 changes: 7 additions & 7 deletions src/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import helmet from 'helmet';
import http from 'http';
import createRammerhead from 'rammerhead/src/server/index.js';
import { createBareServer } from '@tomphttp/bare-server-node';
import wisp from "wisp-server-node";
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
import wisp from 'wisp-server-node';
import { epoxyPath } from '@mercuryworkshop/epoxy-transport';
import { baremuxPath } from '@mercuryworkshop/bare-mux/node';
import { uvPath } from '@titaniumnetwork-dev/ultraviolet';

const config = JSON.parse(await readFile(new URL('./config.json', import.meta.url)));
const { pages, text404 } = pkg;
Expand Down Expand Up @@ -104,9 +104,9 @@ router.get('/', async (req, res) => res.send(paintSource(loadTemplates(tryReadFi

app.use(router);
app.use(express.static(path.join(__dirname, 'views')));
app.use("/uv/", express.static(uvPath));
app.use("/epoxy/", express.static(epoxyPath));
app.use("/baremux/", express.static(baremuxPath));
app.use('/uv/', express.static(uvPath));
app.use('/epoxy/', express.static(epoxyPath));
app.use('/baremux/', express.static(baremuxPath));

app.disable('x-powered-by');

Expand Down
14 changes: 7 additions & 7 deletions src/templates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ terms = tryReadFile(path.normalize(__dirname + '/views/pages/misc/deobf/tos.html
settings = tryReadFile(path.normalize(__dirname + '/views/pages/misc/deobf/settings.html')),

loadTemplates = str => {
str = insertText("<!--HEADER-->", str, header);
str = insertText("<!--FOOTER-->", str, footer);
str = insertText('<!--HEADER-->', str, header);
str = insertText('<!--FOOTER-->', str, footer);

// Never used
// str = insertText("<!--DESC-->", str, description);
// str = insertText('<!--DESC-->', str, description);

// Used only on docs.html
str = insertText("<!--DOCS-->", str, documentation);
str = insertText('<!--DOCS-->', str, documentation);
// Used only on faq.html
str = insertText("<!--FAQ-->", str, faq);
str = insertText('<!--FAQ-->', str, faq);
// Used only on terms.html
str = insertText("<!--TOS-->", str, terms);
str = insertText('<!--TOS-->', str, terms);
// Used only on csel.html
str = insertText("<!--SETTINGS-->", str, settings);
str = insertText('<!--SETTINGS-->', str, settings);
return str;
};
2 changes: 1 addition & 1 deletion views/assets/css/styles-1644738239.css
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ details[open] summary {
height: 100%;
background-color: var(--nord1);
overflow: hidden;
display: block;
display: none;
z-index: 1;
}

Expand Down
15 changes: 10 additions & 5 deletions views/assets/js/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@

const shimmerEffects = document.querySelectorAll(".box-card");


// Attach CSS variables, mouse-x and mouse-y, to elements that will be
// given shimmer effects, by adding or modifying the style attribute.
// CSS calculates and renders the actual shimmer effect from there.
shimmerEffects.forEach(shimmerEffect => {
shimmerEffect.addEventListener("mousemove", handleMouseMove);
shimmerEffect.addEventListener("mouseleave", handleMouseLeave);
});

function handleMouseMove(e) {
// Track the cursor position with respect to the top left of the card.
// The "this" keyword gets the element that invoked the event listener.
const handleMouseMove = e => {
const rect = this.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;

this.style.setProperty("--mouse-x", `${x}px`);
this.style.setProperty("--mouse-y", `${y}px`);
}
};

function handleMouseLeave() {
// Reset the cursor tracking variables when the cursor leaves the card.
const handleMouseLeave = () => {
this.style.setProperty("--mouse-x", `50%`);
this.style.setProperty("--mouse-y", `50%`);
}
};
59 changes: 18 additions & 41 deletions views/assets/js/common-16451543478.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,66 +4,43 @@
/* MAIN Holy Unblocker LTS Common Script
/* ----------------------------------------------- */

function tryGetElement(id) {
return document.getElementById(id) || {};
}
// Used in scripts outside this file.
const tryGetElement = id => document.getElementById(id) || {};

/**
* Get the preferred apex domain name.
* Not exactly apex, as any subdomain other than those listed will be ignored.
**/

function getDomain() {
return location.host.replace(/^(www|edu|cooking|beta)\./, "");
}
const getDomain = () => location.host.replace(/^(www|edu|cooking|beta)\./, "");

/* STEALTH FRAME */
function goFrame(url) {
const goFrame = url => {
localStorage.setItem("huframesrc", url);
window.location.href = "?s";
}
location.href = "?s";
};

function goToUrl(url, stealth, nolag) {
if (stealth) {
goFrame(url, nolag);
} else {
window.location.href = url;
}
}
const goToUrl = (url, stealth, nolag) => {
stealth ? goFrame(url, nolag) : location.href = url;
};

/* COOKIE AUTH DEMO */

function setAuthCookie(s, lax) {
document.cookie =
s +
"; expires=" +
(Date.now() + 259200) +
"; SameSite=" +
(lax ? "Lax" : "None") +
"; domain=." +
getDomain() +
"; path=/; Secure;";
}
const setAuthCookie = (s, lax) => {
document.cookie = s + `; expires=${Date.now() + 259200}; SameSite=${lax ? "Lax" : "None"}; domain=.${getDomain()}; path=/; Secure;`;
};

/* OMNIBOX */

const sx = "bing.com" + "/search?q=";

function omnibox(url) {
if (url.substring(0, 4) == "http") {
return url;
} else if (url.includes("." || "")) {
return "https://" + url;
} else {
return "https://" + sx + url;
}
}
const omnibox = url =>
(url.indexOf("http")
? "https://" + (url.indexOf(".") < 1 ? sx : "")
: "")
+ url;

function uvUrl(url) {
return (
location.origin + __uv$config.prefix + __uv$config.encodeUrl(omnibox(url))
);
}
const uvUrl = url => location.origin + __uv$config.prefix + __uv$config.encodeUrl(omnibox(url));

/* RAMMERHEAD CONFIGURATION */

Expand Down
Loading

0 comments on commit 1d36f0a

Please sign in to comment.