diff --git a/views/assets/js/card.js b/views/assets/js/card.js index 14e115e6..e10140ac 100644 --- a/views/assets/js/card.js +++ b/views/assets/js/card.js @@ -1,3 +1,9 @@ +/* ----------------------------------------------- +/* Authors: QuiteAFancyEmerald +/* GNU Affero General Public License v3.0: https://www.gnu.org/licenses/agpl-3.0.en.html +/* Card Shimmer Mouse Follow Script +/* ----------------------------------------------- */ + const shimmerEffects = document.querySelectorAll(".box-card"); diff --git a/views/assets/js/common-16451543478.js b/views/assets/js/common-16451543478.js index f66efe61..ee946df7 100644 --- a/views/assets/js/common-16451543478.js +++ b/views/assets/js/common-16451543478.js @@ -1,49 +1,268 @@ /* ----------------------------------------------- -/* Authors: QuiteAFancyEmerald and OlyB -/* MIT license: http://opensource.org/licenses/MIT -/* Common functions +/* Authors: QuiteAFancyEmerald, Yoct, and OlyB +/* GNU Affero General Public License v3.0: https://www.gnu.org/licenses/agpl-3.0.en.html +/* MAIN Holy Unblocker LTS Common Script /* ----------------------------------------------- */ function tryGetElement(id) { - return document.getElementById(id) || {}; + return 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)\./, ""); + return location.host.replace(/^(www|edu|cooking|beta)\./, ""); } -// nolag = no external js (arc widget, an-lytics, etc.) -function goFrame(url, nolag) { - localStorage.setItem("huframesrc", url); - window.location.href = nolag ? "?s&nolag" : "?s"; +/* STEALTH FRAME */ +function goFrame(url) { + localStorage.setItem("huframesrc", url); + window.location.href = "?s"; } function goToUrl(url, stealth, nolag) { - if (stealth) { - goFrame(url, nolag); - } else { - window.location.href = url; - } + if (stealth) { + goFrame(url, nolag); + } else { + window.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;"; + document.cookie = + s + + "; expires=" + + (Date.now() + 259200) + + "; SameSite=" + + (lax ? "Lax" : "None") + + "; domain=." + + getDomain() + + "; path=/; Secure;"; } -const sx = 'bing.com' + '/search?q='; +/* 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; + if (url.substring(0, 4) == "http") { + return url; + } else if (url.includes("." || "")) { + return "https://" + url; + } else { + return "https://" + sx + url; + } +} + +function uvUrl(url) { + return ( + location.origin + __uv$config.prefix + __uv$config.encodeUrl(omnibox(url)) + ); +} + +/* RAMMERHEAD CONFIGURATION */ + +function search(input, template) { + try { + // input is a valid URL: + // eg: https://example.com, https://example.com/test?q=param + return new URL(input).toString(); + } catch (err) { + // input was not a valid URL + } + + try { + // input is a valid URL when http:// is added to the start: + // eg: example.com, https://example.com/test?q=param + const url = new URL(`http://${input}`); + // only if the hostname has a TLD/subdomain + if (url.hostname.includes(".")) return url.toString(); + } catch (err) { + // input was not valid URL + } + + return template.replace("%s", encodeURIComponent(input)); +} + +async function RammerheadEncode(baseUrl) { + // Hellhead + const mod = (n, m) => ((n % m) + m) % m; + const baseDictionary = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~-"; + const shuffledIndicator = "_rhs"; + const generateDictionary = function () { + let str = ""; + const split = baseDictionary.split(""); + while (split.length > 0) { + str += split.splice(Math.floor(Math.random() * split.length), 1)[0]; } + return str; + }; + + class StrShuffler { + constructor(dictionary = generateDictionary()) { + this.dictionary = dictionary; + } + shuffle(str) { + if (str.startsWith(shuffledIndicator)) { + return str; + } + let shuffledStr = ""; + for (let i = 0; i < str.length; i++) { + const char = str.charAt(i); + const idx = baseDictionary.indexOf(char); + if (char === "%" && str.length - i >= 3) { + shuffledStr += char; + shuffledStr += str.charAt(++i); + shuffledStr += str.charAt(++i); + } else if (idx === -1) { + shuffledStr += char; + } else { + shuffledStr += this.dictionary.charAt( + mod(idx + i, baseDictionary.length) + ); + } + } + return shuffledIndicator + shuffledStr; + } + unshuffle(str) { + if (!str.startsWith(shuffledIndicator)) { + return str; + } + + str = str.slice(shuffledIndicator.length); + + let unshuffledStr = ""; + for (let i = 0; i < str.length; i++) { + const char = str.charAt(i); + const idx = this.dictionary.indexOf(char); + if (char === "%" && str.length - i >= 3) { + unshuffledStr += char; + unshuffledStr += str.charAt(++i); + unshuffledStr += str.charAt(++i); + } else if (idx === -1) { + unshuffledStr += char; + } else { + unshuffledStr += baseDictionary.charAt( + mod(idx - i, baseDictionary.length) + ); + } + } + return unshuffledStr; + } + } + function get(url, callback, shush = false) { + var request = new XMLHttpRequest(); + request.open("GET", url, true); + request.send(); + + request.onerror = function () { + if (!shush) console.log("Cannot communicate with the server"); + }; + request.onload = function () { + if (request.status === 200) { + callback(request.responseText); + } else { + if (!shush) + console.log( + 'unexpected server response to not match "200". Server says "' + + request.responseText + + '"' + ); + } + }; + } + var api = { + newsession(callback) { + get("/newsession", callback); + }, + sessionexists(id, callback) { + get("/sessionexists?id=" + encodeURIComponent(id), function (res) { + if (res === "exists") return callback(true); + if (res === "not found") return callback(false); + console.log("unexpected response from server. received" + res); + }); + }, + shuffleDict(id, callback) { + console.log("Shuffling", id); + get("/api/shuffleDict?id=" + encodeURIComponent(id), function (res) { + callback(JSON.parse(res)); + }); + }, + }; + var localStorageKey = "rammerhead_sessionids"; + var localStorageKeyDefault = "rammerhead_default_sessionid"; + var sessionIdsStore = { + get() { + var rawData = localStorage.getItem(localStorageKey); + if (!rawData) return []; + try { + var data = JSON.parse(rawData); + if (!Array.isArray(data)) throw "getout"; + return data; + } catch (e) { + return []; + } + }, + set(data) { + if (!data || !Array.isArray(data)) throw new TypeError("must be array"); + localStorage.setItem(localStorageKey, JSON.stringify(data)); + }, + getDefault() { + var sessionId = localStorage.getItem(localStorageKeyDefault); + if (sessionId) { + var data = sessionIdsStore.get(); + data.filter(function (e) { + return e.id === sessionId; + }); + if (data.length) return data[0]; + } + return null; + }, + setDefault(id) { + localStorage.setItem(localStorageKeyDefault, id); + }, + }; + function addSession(id) { + var data = sessionIdsStore.get(); + data.unshift({ id: id, createdOn: new Date().toLocaleString() }); + sessionIdsStore.set(data); + } + function getSessionId() { + return new Promise((resolve) => { + var id = localStorage.getItem("session-string"); + api.sessionexists(id, function (value) { + if (!value) { + console.log("Session validation failed"); + api.newsession(function (id) { + addSession(id); + localStorage.setItem("session-string", id); + console.log(id); + console.log("^ new id"); + resolve(id); + }); + } else { + resolve(id); + } + }); + }); + } + var ProxyHref; + + return getSessionId().then((id) => { + return new Promise((resolve, reject) => { + api.shuffleDict(id, function (shuffleDict) { + var shuffler = new StrShuffler(shuffleDict); + ProxyHref = "/" + id + "/" + shuffler.shuffle(baseUrl); + resolve(ProxyHref); + }); + }); + }); } /* To use: @@ -51,263 +270,72 @@ function omnibox(url) { * * Examples: * goProx.corrosion("https://google.com") - * goProx.womginx("discord.com", true) + * goProx.womginx("discord.com", true) */ -function search(input, template) { - try { - // input is a valid URL: - // eg: https://example.com, https://example.com/test?q=param - return new URL(input).toString(); - } catch (err) { - // input was not a valid URL - } - - try { - // input is a valid URL when http:// is added to the start: - // eg: example.com, https://example.com/test?q=param - const url = new URL(`http://${input}`); - // only if the hostname has a TLD/subdomain - if (url.hostname.includes(".")) return url.toString(); - } catch (err) { - // input was not valid URL - } - - return template.replace("%s", encodeURIComponent(input)); -} - -async function RammerheadEncode(baseUrl) { - // Hellhead - const mod = (n, m) => ((n % m) + m) % m; - const baseDictionary = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~-"; - const shuffledIndicator = "_rhs"; - const generateDictionary = function () { - let str = ""; - const split = baseDictionary.split(""); - while (split.length > 0) { - str += split.splice(Math.floor(Math.random() * split.length), 1)[0]; - } - return str; - }; - - class StrShuffler { - constructor(dictionary = generateDictionary()) { - this.dictionary = dictionary; - } - shuffle(str) { - if (str.startsWith(shuffledIndicator)) { - return str; - } - let shuffledStr = ""; - for (let i = 0; i < str.length; i++) { - const char = str.charAt(i); - const idx = baseDictionary.indexOf(char); - if (char === "%" && str.length - i >= 3) { - shuffledStr += char; - shuffledStr += str.charAt(++i); - shuffledStr += str.charAt(++i); - } else if (idx === -1) { - shuffledStr += char; - } else { - shuffledStr += this.dictionary.charAt( - mod(idx + i, baseDictionary.length) - ); - } - } - return shuffledIndicator + shuffledStr; - } - unshuffle(str) { - if (!str.startsWith(shuffledIndicator)) { - return str; - } - - str = str.slice(shuffledIndicator.length); - - let unshuffledStr = ""; - for (let i = 0; i < str.length; i++) { - const char = str.charAt(i); - const idx = this.dictionary.indexOf(char); - if (char === "%" && str.length - i >= 3) { - unshuffledStr += char; - unshuffledStr += str.charAt(++i); - unshuffledStr += str.charAt(++i); - } else if (idx === -1) { - unshuffledStr += char; - } else { - unshuffledStr += baseDictionary.charAt( - mod(idx - i, baseDictionary.length) - ); - } - } - return unshuffledStr; - } - } - function get(url, callback, shush = false) { - var request = new XMLHttpRequest(); - request.open("GET", url, true); - request.send(); - - request.onerror = function () { - if (!shush) console.log("Cannot communicate with the server"); - }; - request.onload = function () { - if (request.status === 200) { - callback(request.responseText); - } else { - if (!shush) - console.log( - 'unexpected server response to not match "200". Server says "' + - request.responseText + - '"' - ); - } - }; - } - var api = { - newsession(callback) { - get("/newsession", callback); - }, - sessionexists(id, callback) { - get("/sessionexists?id=" + encodeURIComponent(id), function (res) { - if (res === "exists") return callback(true); - if (res === "not found") return callback(false); - console.log("unexpected response from server. received" + res); - }); - }, - shuffleDict(id, callback) { - console.log("Shuffling", id); - get("/api/shuffleDict?id=" + encodeURIComponent(id), function (res) { - callback(JSON.parse(res)); - }); - } - }; - var localStorageKey = "rammerhead_sessionids"; - var localStorageKeyDefault = "rammerhead_default_sessionid"; - var sessionIdsStore = { - get() { - var rawData = localStorage.getItem(localStorageKey); - if (!rawData) return []; - try { - var data = JSON.parse(rawData); - if (!Array.isArray(data)) throw "getout"; - return data; - } catch (e) { - return []; - } - }, - set(data) { - if (!data || !Array.isArray(data)) throw new TypeError("must be array"); - localStorage.setItem(localStorageKey, JSON.stringify(data)); - }, - getDefault() { - var sessionId = localStorage.getItem(localStorageKeyDefault); - if (sessionId) { - var data = sessionIdsStore.get(); - data.filter(function (e) { - return e.id === sessionId; - }); - if (data.length) return data[0]; - } - return null; - }, - setDefault(id) { - localStorage.setItem(localStorageKeyDefault, id); - } - }; - function addSession(id) { - var data = sessionIdsStore.get(); - data.unshift({ id: id, createdOn: new Date().toLocaleString() }); - sessionIdsStore.set(data); - } - function getSessionId() { - return new Promise((resolve) => { - var id = localStorage.getItem("session-string"); - api.sessionexists(id, function (value) { - if (!value) { - console.log("Session validation failed"); - api.newsession(function (id) { - addSession(id); - localStorage.setItem("session-string", id); - console.log(id); - console.log("^ new id"); - resolve(id); - }); - } else { - resolve(id); - } - }); - }); - } - var ProxyHref; - - return getSessionId().then((id) => { - return new Promise((resolve, reject) => { - api.shuffleDict(id, function (shuffleDict) { - var shuffler = new StrShuffler(shuffleDict); - ProxyHref = "/" + id + "/" + shuffler.shuffle(baseUrl); - resolve(ProxyHref); - }); - }); - }); -} - -function uvUrl(url) { - return location.origin + __uv$config.prefix + __uv$config.encodeUrl(omnibox(url)); -}; - window.goProx = { - // `location.protocol + "//" + getDomain()` more like `location.origin` - ultraviolet: function (url, stealth) { - //setAuthCookie("__cor_auth=1", false); - goToUrl(uvUrl(url), stealth); - }, - rammerhead: async function (url, stealth) { - goToUrl(location.origin + await RammerheadEncode(omnibox(url)), stealth); - }, - searx: function (stealth) { - goToUrl(location.protocol + "//c." + getDomain() + "/engine/", stealth); - }, - libreddit: function (stealth) { - goToUrl(location.protocol + "//c." + getDomain(), stealth); - }, - rnav: function (stealth) { - goToUrl(location.protocol + "//client." + getDomain(), stealth); - }, - osu: function (stealth) { - goToUrl(location.origin + '/archive/osu', stealth); - }, - mcnow: function (stealth) { - goToUrl(uvUrl('https://now.gg/play/a/10010/b'), stealth); - }, - glife: function (stealth) { - goToUrl(uvUrl('https://now.gg/apps/lunime/5767/gacha-life.html'), stealth); - }, - roblox: function (stealth) { - goToUrl(uvUrl('https://now.gg/apps/roblox-corporation/5349/roblox.html'), stealth); - }, - amongus: function (stealth) { - goToUrl(uvUrl('https://now.gg/apps/innersloth-llc/4047/among-us.html'), stealth); - }, - pubg: function (stealth) { - goToUrl(uvUrl('https://now.gg/apps/proxima-beta/2609/pubg-mobile-resistance.html'), stealth); - }, - train: function (stealth) { - goToUrl(uvUrl('https://hby.itch.io/last-train-home'), stealth); - }, - village: function (stealth) { - goToUrl(uvUrl('https://kwoodhouse.itch.io/village-arsonist'), stealth); - }, - prison: function (stealth) { - goToUrl(uvUrl('https://vimlark.itch.io/pick-up-prison'), stealth); - }, - rpg: function (stealth) { - goToUrl(uvUrl('https://alarts.itch.io/die-in-the-dungeon'), stealth); - }, - speed: function (stealth) { - goToUrl(uvUrl('https://captain4lk.itch.io/what-the-road-brings'), stealth); - }, - heli: function (stealth) { - goToUrl(uvUrl('https://benjames171.itch.io/helo-storm'), stealth); - } -}; \ No newline at end of file + // `location.protocol + "//" + getDomain()` more like `location.origin` + ultraviolet: function (url, stealth) { + //setAuthCookie("__cor_auth=1", false); + goToUrl(uvUrl(url), stealth); + }, + rammerhead: async function (url, stealth) { + goToUrl(location.origin + (await RammerheadEncode(omnibox(url))), stealth); + }, + searx: function (stealth) { + goToUrl(location.protocol + "//c." + getDomain() + "/engine/", stealth); + }, + libreddit: function (stealth) { + goToUrl(location.protocol + "//c." + getDomain(), stealth); + }, + rnav: function (stealth) { + goToUrl(location.protocol + "//c." + getDomain(), stealth); + }, + osu: function (stealth) { + goToUrl(location.origin + "/archive/osu", stealth); + }, + mcnow: function (stealth) { + goToUrl(uvUrl("https://now.gg/play/a/10010/b"), stealth); + }, + glife: function (stealth) { + goToUrl(uvUrl("https://now.gg/apps/lunime/5767/gacha-life.html"), stealth); + }, + roblox: function (stealth) { + goToUrl( + uvUrl("https://now.gg/apps/roblox-corporation/5349/roblox.html"), + stealth + ); + }, + amongus: function (stealth) { + goToUrl( + uvUrl("https://now.gg/apps/innersloth-llc/4047/among-us.html"), + stealth + ); + }, + pubg: function (stealth) { + goToUrl( + uvUrl( + "https://now.gg/apps/proxima-beta/2609/pubg-mobile-resistance.html" + ), + stealth + ); + }, + train: function (stealth) { + goToUrl(uvUrl("https://hby.itch.io/last-train-home"), stealth); + }, + village: function (stealth) { + goToUrl(uvUrl("https://kwoodhouse.itch.io/village-arsonist"), stealth); + }, + prison: function (stealth) { + goToUrl(uvUrl("https://vimlark.itch.io/pick-up-prison"), stealth); + }, + rpg: function (stealth) { + goToUrl(uvUrl("https://alarts.itch.io/die-in-the-dungeon"), stealth); + }, + speed: function (stealth) { + goToUrl(uvUrl("https://captain4lk.itch.io/what-the-road-brings"), stealth); + }, + heli: function (stealth) { + goToUrl(uvUrl("https://benjames171.itch.io/helo-storm"), stealth); + }, +}; diff --git a/views/assets/js/csel.js b/views/assets/js/csel.js index 38998167..1aa3458f 100644 --- a/views/assets/js/csel.js +++ b/views/assets/js/csel.js @@ -1,6 +1,6 @@ /* ----------------------------------------------- /* Authors: OlyB -/* MIT license: http://opensource.org/licenses/MIT +/* GNU Affero General Public License v3.0: https://www.gnu.org/licenses/agpl-3.0.en.html /* Settings Menu /* ----------------------------------------------- */ diff --git a/views/assets/js/links-1644738239.js b/views/assets/js/links-1644738239.js index 8b59e244..ba7ba22f 100644 --- a/views/assets/js/links-1644738239.js +++ b/views/assets/js/links-1644738239.js @@ -1,6 +1,6 @@ /* ----------------------------------------------- /* Authors: YÖCTDÖNALD'S, QuiteAFancyEmerald, and OlyB with help from MikeLime -/* MIT license: http://opensource.org/licenses/MIT +/* GNU Affero General Public License v3.0: https://www.gnu.org/licenses/agpl-3.0.en.html /* Hidden Links /* ----------------------------------------------- */ diff --git a/views/assets/js/prset.js b/views/assets/js/prset.js index 585bdced..751c90c8 100644 --- a/views/assets/js/prset.js +++ b/views/assets/js/prset.js @@ -1,6 +1,6 @@ /* ----------------------------------------------- /* Authors: OlyB -/* MIT license: http://opensource.org/licenses/MIT +/* GNU Affero General Public License v3.0: https://www.gnu.org/licenses/agpl-3.0.en.html /* prSet script /* ----------------------------------------------- */ diff --git a/views/pages/frame.html b/views/pages/frame.html index 2986e4b6..1644ebf3 100644 --- a/views/pages/frame.html +++ b/views/pages/frame.html @@ -32,15 +32,6 @@ } document.getElementById("frame").src = localStorage.getItem("huframesrc"); - - // make arc widget if nolag isn't specified - /*if (!queries.hasOwnProperty("nolag")) { - var arcw = document.createElement("script"); - arcw.setAttribute("async", ""); - arcw.src = "https://arc.io/widget.min.js#2BzvQ1em"; - document.head.appendChild(arcw); - } - */