From 9d5d90442bee0fafa0a6fc78009bf1e150b0d8c6 Mon Sep 17 00:00:00 2001 From: QuiteAFancyEmerald <46467239+QuiteAFancyEmerald@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:51:51 -0700 Subject: [PATCH] TODO: SOCK5 support --- views/assets/js/register-sw.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/views/assets/js/register-sw.js b/views/assets/js/register-sw.js index 4da80283..44ae88fb 100644 --- a/views/assets/js/register-sw.js +++ b/views/assets/js/register-sw.js @@ -3,6 +3,9 @@ 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/"; +// Proxy configuration +const proxyUrl = "socks5://localhost:9050"; // Replace with your proxy URL + async function registerSW() { if (!navigator.serviceWorker) { if ( @@ -14,14 +17,15 @@ async function registerSW() { throw new Error("Your browser doesn't support service workers."); } - await connection.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl }]); + // Update the transport setup to include the proxy option + await connection.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl, proxy: proxyUrl }]); await navigator.serviceWorker.register(stockSW); } async function setupTransportOnLoad() { const conn = new BareMux.BareMuxConnection("/baremux/worker.js"); if (await conn.getTransport() !== "/baremux/module.js") { - await conn.setTransport("/baremux/module.js", [{ wisp: wispUrl }]); + await conn.setTransport("/baremux/module.js", [{ wisp: wispUrl, proxy: proxyUrl }]); } }