From 69823802f505f11166efbd2bdda0085f48cfa740 Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Wed, 6 Mar 2024 01:14:00 -0700 Subject: [PATCH] Finalize --- index.html | 1 - src/util/transports.ts | 14 +++++++++++++- vite.config.ts | 10 +++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index d8ca197..be30e82 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,6 @@ - diff --git a/src/util/transports.ts b/src/util/transports.ts index e5eddc7..56f7aa5 100644 --- a/src/util/transports.ts +++ b/src/util/transports.ts @@ -15,14 +15,26 @@ function changeTransport(transport: string, wispUrl: string) { SetTransport("EpxMod.EpoxyClient", { wisp: wispUrl }); break; //libcurl when supported can be easily added here + //and stuff like bare-as-module3 COULD also be added default: SetTransport("EpxMod.EpoxyClient", { wisp: wispUrl }); break; } } +function getTransport() { + return localStorage.getItem("transport") || "epoxy"; +} + +function restartTransport() { + changeTransport(getTransport(), localStorage.getItem("wispUrl") || (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/"); +} + +//restart transport every minute +setInterval(restartTransport, 60000); //60000ms = 60s = 1m + const wispUrl = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/"; registerRemoteListener(navigator.serviceWorker.controller!); changeTransport(localStorage.getItem("transport") || "epoxy", localStorage.getItem("wispUrl") || wispUrl); -export { changeTransport }; +export { changeTransport, getTransport }; diff --git a/vite.config.ts b/vite.config.ts index efad3df..3940dd6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -19,11 +19,11 @@ export default defineConfig({ dest: "uv", overwrite: false }, - { - src: `${baremuxPath}/**/*`.replace(/\\/g, "/"), - dest: "mux", - overwrite: false - }, + //{ + // src: `${baremuxPath}/**/*`.replace(/\\/g, "/"), + // dest: "mux", + // overwrite: false + //}, { //include ALL files types src: `${epoxyPath}/**/*`,