From bf24bf53c03fc93e716cd25c922c0dd9567dd82c Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sat, 9 Mar 2024 02:51:29 -0700 Subject: [PATCH] Add libcurl --- public/sw.js | 1 + server.ts | 9 ++++++++- src/pages/Settings/Proxy.tsx | 3 +-- src/util/transports.ts | 22 +++++++--------------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/public/sw.js b/public/sw.js index 15c7ddb..663d20e 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,5 @@ importScripts("/epoxy/index.js"); +importScripts("/libcurl/index.cjs"); importScripts("/uv/uv.bundle.js"); importScripts("/uv/uv.config.js"); importScripts(__uv$config.sw || "/uv/uv.sw.js"); diff --git a/server.ts b/server.ts index 56f9496..044fced 100644 --- a/server.ts +++ b/server.ts @@ -123,7 +123,14 @@ async function MasqFail(req: Request, res: Response) { return; }) */ -app.use(express.static("dist")); +app.use(express.static("dist", { + //force .cjs files to be served as text/javascript (libcurl) + setHeaders: (res, path) => { + if (path.endsWith(".cjs")) { + res.setHeader("Content-Type", "text/javascript"); + } + } +})); app.get("/search=:query", async (req: Request, res: Response) => { const { query } = req.params; diff --git a/src/pages/Settings/Proxy.tsx b/src/pages/Settings/Proxy.tsx index e88d83c..7c48088 100644 --- a/src/pages/Settings/Proxy.tsx +++ b/src/pages/Settings/Proxy.tsx @@ -33,8 +33,7 @@ const Proxy = ({ id, active }) => { (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/"; - //libcurl can be added here when it's stable - const transports = [{ id: "epoxy", label: "Epoxy" }]; + const transports = [{ id: "epoxy", label: "Epoxy" }, { id: "libcurl", label: "Libcurl" }]; return (