more refactor

This commit is contained in:
LiBr
2026-04-10 20:34:14 +08:00
parent 8d31144741
commit 72123cc922
47 changed files with 868 additions and 365 deletions

View File

@@ -1,5 +1,4 @@
// @ts-ignore
import { libcurl } from "../public/anisette/libcurl_full.mjs"
import { loadLibcurl, libcurl } from "./wasm/libcurl"
let initialized = false
let initPromise: Promise<void> | null = null
@@ -13,10 +12,11 @@ export async function initLibcurl(): Promise<void> {
}
initPromise = (async () => {
const loadedLibcurl = await loadLibcurl()
const wsProto = location.protocol === "https:" ? "wss:" : "ws:"
const wsUrl = `${wsProto}//${location.host}/wisp/`
libcurl.set_websocket(wsUrl)
await libcurl.load_wasm()
loadedLibcurl.set_websocket(wsUrl)
await loadedLibcurl.load_wasm()
initialized = true
})()