Skip to content

Commit

Permalink
More tidying of common.js. Emerald I'm still going to eat you alive f…
Browse files Browse the repository at this point in the history
…or this
  • Loading branch information
00Fjongl committed Jul 9, 2024
1 parent 02e3f6d commit 52efec3
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions views/assets/js/common-16451543478.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const UrlHandler = parser => typeof parser === "function"
stealth ? goFrame(url, nolag) : location.href = url;
}
: (stealth, nolag) => {
stealth ? goFrame(url, nolag) : location.href = url;
stealth ? goFrame(parser, nolag) : location.href = parser;
};

// An asynchronous version of the function above, just in case.
Expand All @@ -49,23 +49,21 @@ const setAuthCookie = (s, lax) => {
// Search engine is set to Bing. Intended to work just like the usual
// bar at the top of a browser.
const sx = "bing.com" + "/search?q=";

/*
const omnibox = url =>
(url.indexOf("http")
? "https://" + (url.indexOf(".") < 1 ? sx : "")
: "")
+ url;
*/

// Parse a URL to use with Ultraviolet.
const uvUrl = url => location.origin + __uv$config.prefix + __uv$config.encodeUrl(omnibox(url));

/* RAMMERHEAD CONFIGURATION */

// Another omnibox function. Unsure if the version further above is needed.
// Another omnibox function. Unsure if the version above is needed.
const search = (input, template) => {
try {
// Return the input if it is already a valid URL.
// eg: https://example.com, https://example.com/test?q=param
return new URL(input).toString();
return new URL(input) + "";
} catch (err) {
// Continue if it is invalid.
}
Expand All @@ -75,7 +73,7 @@ const search = (input, template) => {
// eg: example.com, https://example.com/test?q=param
const url = new URL(`http://${input}`);
// Return only if the hostname has a TLD or a subdomain.
if (url.hostname.indexOf(".") != -1) return url.toString();
if (url.hostname.indexOf(".") != -1) return url + "";
} catch (err) {
// Continue if it is invalid.
}
Expand All @@ -84,7 +82,12 @@ const search = (input, template) => {
return template.replace("%s", encodeURIComponent(input));
};

// Parse a URL to use with Rammerhead.
// Parse a URL to use with Ultraviolet.
const uvUrl = url => location.origin + __uv$config.prefix + __uv$config.encodeUrl(search(url, sx + "%s"));

/* RAMMERHEAD CONFIGURATION */

// Parse a URL to use with Rammerhead. Only usable if the server is active.
const RammerheadEncode = async baseUrl => {
// Hellhead
const mod = (n, m) => ((n % m) + m) % m;
Expand Down Expand Up @@ -322,7 +325,7 @@ const goProx = {
// setAuthCookie("__cor_auth=1", false);
ultraviolet: UrlHandler(uvUrl),

rammerhead: asyncUrlHandler(async () => location.origin + (await RammerheadEncode(omnibox(url)))),
rammerhead: asyncUrlHandler(async () => location.origin + (await RammerheadEncode(search(url, sx + "%s")))),

searx: UrlHandler(location.protocol + `//c.${getDomain()}/engine/`),

Expand Down

2 comments on commit 52efec3

@QuiteAFancyEmerald
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LMAO

@3kh0
Copy link

@3kh0 3kh0 commented on 52efec3 Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😳

Please sign in to comment.