feat: frontend support.

This commit is contained in:
2026-02-28 18:44:57 +08:00
parent d75671596c
commit f1054e6476
25 changed files with 3681 additions and 120 deletions

View File

@@ -0,0 +1,20 @@
import { libcurl } from "../public/libcurl_full.mjs";
let initialized = false;
let initPromise: Promise<void> | null = null;
export async function initLibcurl(): Promise<void> {
if (initialized) return;
if (initPromise) return initPromise;
initPromise = (async () => {
const wsProto = location.protocol === "https:" ? "wss:" : "ws:";
let wsUrl = `${wsProto}//${location.host}/wisp/`;
libcurl.set_websocket(wsUrl);
await libcurl.load_wasm("/libcurl.wasm");
initialized = true;
})();
return initPromise;
}
export { libcurl };