This commit is contained in:
libr
2026-03-03 10:12:22 +08:00
commit ae4c58e56d
223 changed files with 42635 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// @ts-ignore
import { libcurl } from "../public/anisette/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:"
const wsUrl = `${wsProto}//${location.host}/wisp/`
libcurl.set_websocket(wsUrl)
await libcurl.load_wasm()
initialized = true
})()
return initPromise
}
export { libcurl }