diff --git a/views/assets/css/styles-1644738239.css b/views/assets/css/styles-1644738239.css index ab67ec1d..6a493aa4 100644 --- a/views/assets/css/styles-1644738239.css +++ b/views/assets/css/styles-1644738239.css @@ -290,7 +290,7 @@ details[open] summary { position: relative; } -.brand-logo-container { +.brand-logo-container, .new { display: flex; align-items: center; /* Align items vertically */ } @@ -497,8 +497,8 @@ details[open] summary { } .navbar-1 { - justify-content: flex-start; /* Align navbar-1 to the left on smaller screens */ - flex: 0 0 100%; /* Force navbar-1 to be on a new row */ + justify-content: flex-end; /* Align navbar-1 to the right on larger screens */ + flex-grow: 1; /* Allow navbar-1 to take up remaining space */ } .navbar-1 > li { @@ -651,10 +651,13 @@ details[open] summary { #header { height: auto; } + .navbar-1 { + justify-content: flex-start; /* Align navbar-1 to the left on smaller screens */ + flex: 0 0 100%; /* Force navbar-1 to be on a new row */ + } .navbar { display: none; margin: 0px; - width: 100%; height: auto; } .navbar > li { @@ -986,7 +989,7 @@ details[open] summary { text-decoration: underline; } -#csel #hideads { +#hideads, #useonion { cursor: pointer; margin-left: 0px; } diff --git a/views/assets/js/common-16451543478.js b/views/assets/js/common-16451543478.js index b9f4264b..5ed63ccb 100644 --- a/views/assets/js/common-16451543478.js +++ b/views/assets/js/common-16451543478.js @@ -359,7 +359,8 @@ const RammerheadEncode = async baseUrl => { * goProx.searx(); */ addEventListener("DOMContentLoaded", () => { - self.goProx = { +// Object.freeze prevents goProx from being edited. + self.goProx = Object.freeze({ // `location.protocol + "//" + getDomain()` more like `location.origin` // setAuthCookie("__cor_auth=1", false); ultraviolet: urlHandler(uvUrl), @@ -395,10 +396,7 @@ addEventListener("DOMContentLoaded", () => { speed: urlHandler(uvUrl("https://captain4lk.itch.io/what-the-road-brings")), heli: urlHandler(uvUrl("https://benjames171.itch.io/helo-storm")) - }; - -// Prevent goProx from being edited. - Object.freeze(goProx); + }); }); (async () => { diff --git a/views/assets/js/csel.js b/views/assets/js/csel.js index d4f59f0a..d3557046 100644 --- a/views/assets/js/csel.js +++ b/views/assets/js/csel.js @@ -54,27 +54,58 @@ pageShowAds = () => { // Remove the stylesheet made by the function above, if it exists. pageHideAds = () => { (document.getElementById("advertising")||new Text()).remove(); -}; +}, + +// These titles and icons are used as autofill templates by settings.html. +// The icon URLs and tab titles may need to be updated over time. +presetIcons = Object.freeze({ + "": " \n ", + "Google": "Google \n https://www.google.com/favicon.ico", + "Bing": "Bing \n https://www.bing.com/sa/simg/favicon-trans-bg-blue-mg-28.ico", + "Google Drive": "Home - Google Drive \n https://ssl.gstatic.com/images/branding/product/2x/drive_2020q4_48dp.png", + "Gmail": "Inbox - Gmail \n https://ssl.gstatic.com/ui/v1/icons/mail/rfr/gmail.ico" +}); // Load a custom page title and favicon if it was previously stored. -readCookie("HBTitle").then(s => (s != undefined) && pageTitle(s)); -readCookie("HBIcon").then(s => (s != undefined) && pageIcon(s)); +readCookie("HBTitle").then(s => {(s != undefined) && pageTitle(s)}); +readCookie("HBIcon").then(s => {(s != undefined) && pageIcon(s)}); + +// Load the UV transport mode that was last used, or use the default. +readCookie("HBTransport").then(s => { + let list = document.getElementById("transport-list"); + if (list != undefined && list.options.length) + list.selectedIndex = + ([...list.options].findIndex(e => e.value === s) + 1 || 1) - 1; +}); // Ads are disabled by default. Load ads if ads were enabled previously. -readCookie("HBHideAds").then(s => (s != "false") ? pageHideAds() : pageShowAds((document.getElementById("hideads") || {}).checked = 0)); +readCookie("HBHideAds").then(s => {(s !== "false") ? pageHideAds() : pageShowAds((document.getElementById("hideads") || {}).checked = 0)}); + +// Tor is disabled by default. Enable Tor if it was enabled previously. +readCookie("HBUseOnion").then(s => {if (s === "true") { + let torCheck = document.getElementById("useonion") || + {dispatchEvent: () => {}}; + torCheck.checked = 1; + torCheck.dispatchEvent(new Event("change")); +}}); + // All code below is used by the Settings UI in the navigation bar. if (document.getElementById("csel")) { + const attachEventListener = (selector, ...args) => ( + document.getElementById(selector) || + document.querySelector(selector) + ).addEventListener(...args); - let closeBtn = document.querySelector(".dropdown-settings .close-settings-btn"); - closeBtn.addEventListener("click", () => {document.activeElement.blur()}); + attachEventListener(".dropdown-settings .close-settings-btn", "click", + () => {document.activeElement.blur()} + ); // Allow users to set a custom title with the UI. - let titleform = document.getElementById("titleform"); - titleform.addEventListener("submit", e => { + attachEventListener("titleform", "submit", e => { e.preventDefault(); - e = titleform.firstElementChild; + e = e.target.firstElementChild; if (e.value) { pageTitle(e.value); setCookie("HBTitle", e.value); @@ -82,13 +113,12 @@ if (document.getElementById("csel")) { } else { alert("Please provide a title."); } - }, false); + }); // Allow users to set a custom favicon with the UI. - let iconform = document.getElementById("iconform"); - iconform.addEventListener("submit", e => { + attachEventListener("iconform", "submit", e => { e.preventDefault(); - e = iconform.firstElementChild; + e = e.target.firstElementChild; if (e.value) { pageIcon(e.value); setCookie("HBIcon", e.value); @@ -96,21 +126,21 @@ if (document.getElementById("csel")) { } else { alert("Please provide an icon URL."); } - }, false); + }); // Allow users to reset the title and favicon to default with the UI. - document.getElementById("cselreset").addEventListener("click", () => { + attachEventListener("cselreset", "click", () => { if (confirm("Reset the title and icon to default?")) { removeCookie("HBTitle"); removeCookie("HBIcon"); pageTitle("Holy Unblocker"); pageIcon("assets/img/icon.png"); } - }, false); + }); // Allow users to make a new about:blank tab and view the site from there. // An iframe of the current page is inserted into the new tab. - document.getElementById("cselab").addEventListener("click", () => { + attachEventListener("cselab", "click", () => { let win = window.open(); let iframe = win.document.createElement("iframe"); iframe.style = "width: 100%; height: 100%; border: none; overflow: hidden; margin: 0; padding: 0; position: fixed; top: 0; left: 0"; @@ -118,8 +148,29 @@ if (document.getElementById("csel")) { win.document.body.appendChild(iframe); }); -// Allow users to enable or disable ads with the UI. - document.getElementById("hideads").addEventListener("change", e => { +// Provides users with a handy set of title and icon autofill options. + attachEventListener("icon-list", "change", e => { + let titleform = document.getElementById("titleform"), + iconform = document.getElementById("iconform"); + [titleform.firstElementChild.value, + iconform.firstElementChild.value] = + (presetIcons[e.target.value] || " \n ").split(" \n "); + }); + +// Allow users to change the UV transport mode, for proxying, with the UI. + attachEventListener("transport-list", "change", e => { + e.target.selectedIndex < 1 + ? removeCookie("HBTransport") + : setCookie("HBTransport", e.target.value); + +// Only the libcurl transport mode supports Tor at the moment. + let torCheck = document.getElementById("useonion"); + if(e.target.value !== "libcurl" && torCheck.checked) + torCheck.click(); + }); + +// Allow users to toggle ads with the UI. + attachEventListener("hideads", "change", e => { if (e.target.checked) { pageHideAds(); setCookie("HBHideAds", "true"); @@ -127,7 +178,28 @@ if (document.getElementById("csel")) { pageShowAds(); setCookie("HBHideAds", "false"); } - }, false); + }); + +// Allow users to toggle onion routing in Ultraviolet with the UI. Only +// the libcurl transport mode supports Tor at the moment, so ensure that +// users are aware that they cannot use Tor with other modes. + attachEventListener("useonion", "change", e => { + let list = document.getElementById("transport-list"); + let options = [...list.options]; + if (e.target.checked) { + list.selectedIndex = + (options.findIndex(e => e.value === "libcurl") + 1 + || 1) - 1; + options.splice(list.selectedIndex, 1); + options.forEach(e => {e.setAttribute("disabled", "true")}); + list.dispatchEvent(new Event("change")); + setCookie("HBUseOnion", "true"); + } else { + options.splice(list.selectedIndex, 1); + options.forEach(e => {e.removeAttribute("disabled")}); + setCookie("HBUseOnion", "false"); + } + }); } diff --git a/views/assets/js/register-sw.js b/views/assets/js/register-sw.js index 145222fd..470c769d 100644 --- a/views/assets/js/register-sw.js +++ b/views/assets/js/register-sw.js @@ -1,10 +1,20 @@ -const stockSW = "/uv/sw.js"; -const swAllowedHostnames = ["localhost", "127.0.0.1"]; -const connection = new BareMux.BareMuxConnection("/baremux/worker.js"); -const wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/"; +const stockSW = "/uv/sw.js", +swAllowedHostnames = ["localhost", "127.0.0.1"], +connection = new BareMux.BareMuxConnection("/baremux/worker.js"), +wispUrl = (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/", -// Proxy configuration -const proxyUrl = "socks5h://localhost:9050"; // Replace with your proxy URL +// Proxy configuration +proxyUrl = "socks5h://localhost:9050", // Replace with your proxy URL +transports = { + epoxy: "/epoxy/index.mjs", + libcurl: "/libcurl/index.mjs", + bare: "/baremux/index.mjs" +}; + +// Set epoxy as the default transport mode. +transports.default = transports.epoxy; +// Prevent the transports object from being edited. +Object.freeze(transports); async function registerSW() { if (!navigator.serviceWorker) { @@ -17,20 +27,40 @@ async function registerSW() { throw new Error("Your browser doesn't support service workers."); } - // Update the transport setup to include the proxy option - await connection.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl /* proxy: proxyUrl */ }]); + + let transportMode = transports.default, + transportOptions = { wisp: wispUrl }; + try { +// If the user has changed the transport mode, use that over the default. + transportMode = transports[await readCookie("HBTransport")] || + transports.default; + +// Only use Tor with the proxy if the user has enabled it in settings. + if (await readCookie("HBUseOnion") === "true") + transportOptions.proxy = proxyUrl; + +// Errors here are likely caused by this script failing to access csel.js. + } catch (e) {console.log(e)} + + await connection.setTransport(transportMode, [transportOptions]); await navigator.serviceWorker.register(stockSW); } +/* + +Commented out upon discovering that a duplicate BareMux connection may be +unnecessary; previously thought to have prevented issues with refreshing. + async function setupTransportOnLoad() { const conn = new BareMux.BareMuxConnection("/baremux/worker.js"); if (await conn.getTransport() !== "/baremux/module.js") { - await conn.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl /* proxy: proxyUrl */ }]); + await conn.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl, proxy: proxyUrl }]); } } // Run transport setup on page load setupTransportOnLoad(); +*/ // Register service worker registerSW(); diff --git a/views/pages/misc/deobf/header.html b/views/pages/misc/deobf/header.html index ed1b7515..205a6ac1 100644 --- a/views/pages/misc/deobf/header.html +++ b/views/pages/misc/deobf/header.html @@ -6,7 +6,7 @@
  • Web Proxies
  • Games
  • YouTube
  • -
  • +
  • Applications
  • diff --git a/views/pages/misc/deobf/settings.html b/views/pages/misc/deobf/settings.html index d15fabd9..8227cd4b 100644 --- a/views/pages/misc/deobf/settings.html +++ b/views/pages/misc/deobf/settings.html @@ -6,27 +6,27 @@

    Browser Tab Config

    Change the universal tab title:

    - +

    Change the universal tab icon:

    - +

    Icon Presets:

    - +

    Default Ultraviolet Transport:

    - -

    Network Options:

    @@ -34,7 +34,7 @@ Hide Ads

    - + Enable Tor


    Holy Unblocker LTS v6.3.x