mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-16 21:10:03 -04:00
More commenting and reformatting.
This commit is contained in:
parent
7b45fded6f
commit
552f8ae4e9
1 changed files with 25 additions and 14 deletions
|
@ -25,36 +25,47 @@ const insertText = (lis, str, newText) => {
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
const randomListItem = lis => lis[Math.random() * lis.length | 0];
|
|
||||||
|
|
||||||
const charset = ["­", "​", "­"];
|
|
||||||
const insertCharset = str => insertText(
|
// Below are lots of function definitions used to obfuscate the website.
|
||||||
|
// This makes the website harder to properly categorize, as its source code
|
||||||
|
// changes with each time it is loaded.
|
||||||
|
const randomListItem = lis => () => lis[Math.random() * lis.length | 0],
|
||||||
|
|
||||||
|
charset = ["­", "​", "­"],
|
||||||
|
insertCharset = str => insertText(
|
||||||
charset,
|
charset,
|
||||||
str,
|
str,
|
||||||
() => randomListItem(charRandom)
|
randomListItem(charRandom)
|
||||||
);
|
),
|
||||||
|
|
||||||
const hutaoInsert = str => insertText(
|
hutaoInsert = str => insertText(
|
||||||
"<!--HUTAOWOA-->",
|
"<!--HUTAOWOA-->",
|
||||||
str,
|
str,
|
||||||
() => randomListItem(splashRandom)
|
randomListItem(splashRandom)
|
||||||
);
|
),
|
||||||
|
|
||||||
const insertCooking = str => insertText(
|
cookingText = () => `<span style="display:none" data-fact="${randomListItem(vegetables)()}">${randomListItem(cookingInserts)()}</span>`,
|
||||||
|
insertCooking = str => insertText(
|
||||||
"<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->",
|
"<!-- IMPORTANT-HUTAOCOOKINGINSERT-DONOTDELETE -->",
|
||||||
str,
|
str,
|
||||||
() => `<span style="display:none" data-fact="${randomListItem(vegetables)}">${randomListItem(cookingInserts)}</span>`
|
cookingText
|
||||||
);
|
),
|
||||||
|
|
||||||
const cacheBusting = str => {
|
// This one isn't for obfuscation; it's just for dealing with cache issues.
|
||||||
|
cacheBusting = str => {
|
||||||
for (let item of Object.entries(cacheBustList))
|
for (let item of Object.entries(cacheBustList))
|
||||||
str = insertText(item[0], str, item[1]);
|
str = insertText(item[0], str, item[1]);
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str))));
|
|
||||||
|
|
||||||
export const tryReadFile = file => existsSync(file) ? readFileSync(file, "utf8") : text404;
|
|
||||||
|
// Applies the final obfuscation changes to an entire file.
|
||||||
|
export const paintSource = str => insertCharset(hutaoInsert(insertCooking(cacheBusting(str)))),
|
||||||
|
|
||||||
|
// Grabs the text content of a file.
|
||||||
|
tryReadFile = file => existsSync(file) ? readFileSync(file, "utf8") : text404;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// All of this is now old code.
|
// All of this is now old code.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue