IIOAOAOOODDJDBHCDCHCJDZHCSFDUYEH

This commit is contained in:
quartinal 2025-01-19 06:59:52 -08:00
parent 521f7f9abb
commit 5f96c40cee
18 changed files with 881 additions and 697 deletions

View File

@ -1,5 +1,6 @@
const { readFileSync, writeFileSync } = require('node:fs');
const fg = require('fast-glob');
const prettyBytes = require('./prettyBytes.cjs');
let brotliWasm;
@ -13,8 +14,8 @@ const { compress } = brotliWasm;
/** @type {string} */
globPattern
) => {
console.warn('Warning: If you provide more than two files as arguments');
console.warn('it will only compress the first file due to performance');
console.warn('Warning: If you provide more than two glob patterns as arguments');
console.warn('it will only compress the first glob pattern due to performance');
console.warn('reasons. You can change this behavior by modifying the');
console.warn('function calling at the end of the script.');
@ -23,7 +24,7 @@ const { compress } = brotliWasm;
quality: 11,
});
console.log(`Compressed ${file} from ${readFileSync(file).length} to ${compressedFile.length} bytes`);
console.log(`Compressed ${file} from ${prettyBytes(readFileSync(file).length)} to ${prettyBytes(compressedFile.length)}`);
writeFileSync(file, compressedFile);
}

View File

@ -1,6 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script type="importmap">
{
"imports": {
"jscrewit": "https://cdn.jsdelivr.net/npm/jscrewit/+esm"
}
}
</script>
<script type="module" src="js/obfuscateScripts.js"></script>
<meta charset="UTF-8">
<title>EaglerCraftX</title>
<meta name="description" content="Eaglercraft Web Clients Site">
@ -14,7 +22,7 @@
<script type="module" src="js/darkmode.js"></script>
<script type="module" src="js/ga4.js"></script>
<script type="module" src="js/main.js"></script>
<script type="module" src="js/popup.js"></script>
<script type="module" src="js/popupPrompt.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser"></script>
<meta property="og:title" content="Eaglercraft Client Collections" />

22
js/obfuscateScripts.js Normal file
View File

@ -0,0 +1,22 @@
import jscrewit from 'jscrewit';
const { scripts } = window.document;
const { encode: obfuscate } = jscrewit;
(async function() {
for (const script of scripts) {
const { src } = script;
if (src) {
try {
const response = await fetch(src);
const textContent = await response.text();
const obfuscated = obfuscate(textContent);
const base64Obfuscated = btoa(obfuscated);
script.setAttribute('src', `data:text/javascript;base64,${base64Obfuscated}`);
console.log('Obfuscated script successfully.');
} catch (error) {
console.error('Failed to obfuscate script:', error);
}
}
}
})();

31
js/popupPrompt.js Normal file
View File

@ -0,0 +1,31 @@
window.onload = () => {
const dontShowDiscordPrompt = Boolean(localStorage.getItem('dontShowDiscordPrompt'));
if (dontShowDiscordPrompt) return;
const message = 'Do you want to join our popular Discord server (y/n/dsa/help)?';
const response = prompt(message);
if (!response) return;
switch (response.toLowerCase()) {
case 'y':
const discordLink = document.querySelector('a.dsc-btn');
if (discordLink) {
const opened = window.open(discordLink.href);
if (opened) opened.focus();
}
break;
case 'n':
alert('That\'s alright. Have a great day!');
break;
case 'dsa':
localStorage.setItem('dontShowDiscordPrompt', 'true');
break;
case 'help':
alert('y: Yes\nn: No\ndsa: Don\'t show again\nhelp: Show this message');
break;
default:
alert('Invalid response. Please try again.');
break;
}
};

View File

@ -8,7 +8,7 @@
},
"devDependencies": {
"@types/jquery": "^3.5.32",
"@types/node": "^22.10.5",
"@types/node": "^22.10.7",
"typescript": "^5.7.3"
},
"scripts": {

122
prettyBytes.cjs Normal file
View File

@ -0,0 +1,122 @@
const BYTE_UNITS = [
'B',
'kB',
'MB',
'GB',
'TB',
'PB',
'EB',
'ZB',
'YB',
];
const BIBYTE_UNITS = [
'B',
'KiB',
'MiB',
'GiB',
'TiB',
'PiB',
'EiB',
'ZiB',
'YiB',
];
const BIT_UNITS = [
'b',
'kbit',
'Mbit',
'Gbit',
'Tbit',
'Pbit',
'Ebit',
'Zbit',
'Ybit',
];
const BIBIT_UNITS = [
'b',
'kibit',
'Mibit',
'Gibit',
'Tibit',
'Pibit',
'Eibit',
'Zibit',
'Yibit',
];
/*
Formats the given number using `Number#toLocaleString`.
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
- If locale is true, the system default locale is used for translation.
- If no value for locale is specified, the number is returned unmodified.
*/
const toLocaleString = (number, locale, options) => {
let result = number;
if (typeof locale === 'string' || Array.isArray(locale)) {
result = number.toLocaleString(locale, options);
} else if (locale === true || options !== undefined) {
result = number.toLocaleString(undefined, options);
}
return result;
};
module.exports = function prettyBytes(number, options) {
if (!Number.isFinite(number)) {
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
}
options = {
bits: false,
binary: false,
space: true,
...options,
};
const UNITS = options.bits
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
const separator = options.space ? ' ' : '';
if (options.signed && number === 0) {
return ` 0${separator}${UNITS[0]}`;
}
const isNegative = number < 0;
const prefix = isNegative ? '-' : (options.signed ? '+' : '');
if (isNegative) {
number = -number;
}
let localeOptions;
if (options.minimumFractionDigits !== undefined) {
localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
}
if (options.maximumFractionDigits !== undefined) {
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
}
if (number < 1) {
const numberString = toLocaleString(number, options.locale, localeOptions);
return prefix + numberString + separator + UNITS[0];
}
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
number /= (options.binary ? 1024 : 1000) ** exponent;
if (!localeOptions) {
number = number.toPrecision(3);
}
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
const unit = UNITS[exponent];
return prefix + numberString + separator + unit;
}