diff --git a/public/sw.js b/public/sw.js index e0285d3..64a4322 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,5 +1,7 @@ importScripts("/libcurl/index.js"); -importScripts("/epoxy/index.js"); +if (!navigator.userAgent.includes("Firefox")) { + importScripts("/epoxy/index.js"); +} importScripts("/bare_transport.js") importScripts("/uv/uv.bundle.js"); importScripts("/uv.config.js"); diff --git a/src/components/ts/TransportManager.ts b/src/components/ts/TransportManager.ts index 2552e81..206083e 100644 --- a/src/components/ts/TransportManager.ts +++ b/src/components/ts/TransportManager.ts @@ -25,6 +25,9 @@ export default class TransportManager { if (transport) { this.transport = transport; } + if (navigator.userAgent.includes("Firefox")) { + this.transport = "BareMod.BareClient"; + } if (localStorage.getItem("alu__selectedTransport") != null && !transport) { this.transport = JSON.parse(localStorage.getItem("alu__selectedTransport")!).value; } diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro index d30943a..d1783e5 100644 --- a/src/pages/[lang]/index.astro +++ b/src/pages/[lang]/index.astro @@ -72,10 +72,15 @@ export function getStaticPaths() { } await initTransport(); }); - // Inject Epoxy, Libcurl, and Bare scripts into the DOM - let epoxyScript = document.createElement("script"); - epoxyScript.src = "/epoxy/index.js"; - document.body.appendChild(epoxyScript); + // Inject Epoxy, Libcurl, and Bare scripts into the DOM + // Firefox doesn't support the Epoxy transport, so we don't want to inject it. + if (!(navigator.userAgent.indexOf("Firefox") > 0)) { + let epoxyScript = document.createElement("script"); + epoxyScript.src = "/epoxy/index.js"; + document.body.appendChild(epoxyScript); + } else { + console.log("Firefox detected, not injecting Epoxy transport!"); + } let libcurlScript = document.createElement("script"); libcurlScript.src = "/libcurl/index.js"; document.body.appendChild(libcurlScript);