Skip to content

Commit

Permalink
in new york I milly rock
Browse files Browse the repository at this point in the history
  • Loading branch information
Notplayingallday383 authored Jun 15, 2024
1 parent 771efbf commit dd20dbf
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "terbium",
"version": "1.44-LTS",
"version": "1.45-LTS",
"description": "A Instance of Terbium WebOS!",
"type": "module",
"main": "index.js",
Expand Down
7 changes: 4 additions & 3 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if ('serviceWorker' in navigator) {
await navigator.serviceWorker.register('/sw.js', {
scope: '/sw/',
}).then(() => updateTransports());
}).then(updateTransport);

await navigator.serviceWorker.register('/dynsw.js', {
scope: '/dyn/',
Expand All @@ -36,15 +36,16 @@

async function updateTransports() {
BareMux.registerRemoteListener(navigator.serviceWorker.controller);
let transport = localStorage.getItem('transport') || "EpxMod.EpoxyClient"
if (window.location.origin.includes('.pages.dev')) {
console.log('your static hosting, using TOMP Wisp Server.')
let wispserver = "wss://tomp.app/wisp"
BareMux.SetTransport("CurlMod.LibcurlClient", { wisp: wispserver, wasm: "https://cdn.jsdelivr.net/npm/[email protected]/libcurl.wasm" });
BareMux.SetTransport(transport, { wisp: wispserver });
} else {
console.log('Using Backend Wisp Server, if your static hosting just delete these lines bellow and uncomment out the text bellow')
//let wispserver = "wss://tomp.app/wisp" Uncomment if static hosting
let wispserver = `${window.location.origin.replace(/^https?:\/\//, 'ws://')}/wisp/`
BareMux.SetTransport("CurlMod.LibcurlClient", { wisp: wispserver, wasm: "https://cdn.jsdelivr.net/npm/[email protected]/libcurl.wasm" });
BareMux.SetTransport(transport, { wisp: wispserver });
}
}
</script>
Expand Down
22 changes: 22 additions & 0 deletions static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ const customShadow = document.getElementById("customShadow");
const clearCustomShadow = document.getElementById("clearCustomShadow");
const login = document.getElementById("login");
const usedynamic = document.getElementById("dyn");
const uselibcurl = document.getElementById("libcurl");
const dockPos = document.querySelectorAll(".dockPos");
const dockFull = document.getElementById("dockFull");
const dockOpaque = document.getElementById("dockOpq");
Expand Down Expand Up @@ -499,6 +500,14 @@ if (dynVal === "true") {
usedynamic.checked = false;
}

const lbVal = localStorage.getItem("transport");

if (lbVal === "CurlMod.LibcurlClient" | null) {
uselibcurl.checked = true;
} else {
uselibcurl.checked = false;
}

function addLogoutButton() {
const logoutHolder = document.createElement("div");
logoutHolder.classList.add("sys");
Expand Down Expand Up @@ -568,6 +577,19 @@ usedynamic.addEventListener("click", () => {
}
})

uselibcurl.addEventListener("click", () => {
switch(uselibcurl.checked) {
case true:
localStorage.setItem("transport", "CurlMod.LibcurlClient");
break;
case false:
localStorage.setItem("transport", "EpxMod.EpoxyClient");
break;
default:
break;
}
})

switch(localStorage.getItem("fullscreen")) {
case null:
localStorage.setItem("fullscreen", "no");
Expand Down
5 changes: 4 additions & 1 deletion static/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ <h3>Browser SearXNG Personalization</h3>
<div class="title">
<label>Use Dynamic</label><input class="toggle" id="dyn" checked type="checkbox">
</div>
<div class="title">
<label>Use Libcurl</label><input class="toggle" id="libcurl" checked type="checkbox">
</div>
<h3>Safe Search</h3>
<div class="btns slides">
<div class="dropdown">
Expand All @@ -195,7 +198,7 @@ <h1>About</h1>
<img src="./resources/terbium.png" alt="TB Logo" class="centered-image">
</div>
<h4 class="centered-text">Terbium WebOS</h4>
<h4 class="centered-text">Version: 1.44 LTS</h4>
<h4 class="centered-text">Version: 1.45 LTS</h4>
<h4 class="centered-text">Made By: SNOOT, XSTARS, Raffelisia, Illusions, Riftriot</h4>
<h4 class="centered-text">(C) Copyright 2024 TerbiumOS Group All Rights Reserved</h4>
<h4 class="centered-text">Licensed under the <a href="https://github.com/TerbiumOS/webOS/blob/main/LICENSE" target="_blank">Apache 2.0 License</a></h4>
Expand Down
43 changes: 25 additions & 18 deletions static/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@
* However, if a user changes the location of uv.bundle.js/uv.config.js or sw.js is not relative to them, they will need to modify this script locally.
*/
try {
importScripts('/libcurl/index.js');
importScripts('/baremux/bare.js');
importScripts('/uv/uv.bundle.js');
importScripts('/uv/uv.config.js');
importScripts('/uv/uv.sw.js');

const sw = new UVServiceWorker();

self.addEventListener('fetch', (event) => {
event.respondWith(sw.fetch(event));
});

sw.on('request', (event) => {
importScripts('/uv/uv.bundle.js');
importScripts('/uv/uv.config.js');
importScripts(__uv$config.sw || '/uv/uv.sw.js');
importScripts('/libcurl/index.js');
importScripts('/epoxy/index.js');

const uv = new UVServiceWorker();

self.addEventListener('fetch', event => {
event.respondWith(
(async ()=>{
if (uv.route(event)) {
return await uv.fetch(event);
}
return await fetch(event.request);
})()
);
});

uv.on('request', (event) => {
event.data.headers['user-agent'] =
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 HyperTabs/1.4.0';
});
} catch (e) {
console.error(e);
}
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 HyperTabs/1.4.0';
});
} catch (e) {
console.error(e);
}

0 comments on commit dd20dbf

Please sign in to comment.