Skip to content

Commit

Permalink
updated libcurl for http/socks5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Jul 19, 2024
1 parent 548ba50 commit 3c4c0e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@mercuryworkshop/bare-as-module3": "^2.2.2",
"@mercuryworkshop/bare-mux": "^2.0.1",
"@mercuryworkshop/epoxy-transport": "^2.1.3",
"@mercuryworkshop/libcurl-transport": "^1.3.6",
"@mercuryworkshop/libcurl-transport": "^1.3.7",
"@titaniumnetwork-dev/ultraviolet": "3.2.1",
"@tomphttp/bare-server-node": "^2.0.3",
"axios": "^1.7.2",
Expand Down
6 changes: 3 additions & 3 deletions views/assets/js/register-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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
const proxyUrl = "socks5h://localhost:9050"; // Replace with your proxy URL

async function registerSW() {
if (!navigator.serviceWorker) {
Expand All @@ -18,14 +18,14 @@ async function registerSW() {
}

// Update the transport setup to include the proxy option
await connection.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl, proxy: proxyUrl }]);
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, proxy: proxyUrl }]);
await conn.setTransport("/libcurl/index.mjs", [{ wisp: wispUrl /* proxy: proxyUrl */ }]);
}
}

Expand Down

0 comments on commit 3c4c0e9

Please sign in to comment.