diff --git a/deno.json b/deno.json index 62e46b5..1851865 100644 --- a/deno.json +++ b/deno.json @@ -24,9 +24,9 @@ "@twind/core": "https://esm.sh/@twind/core@1.1.3", "@twind/preset-tailwind": "https://esm.sh/@twind/preset-tailwind@1.1.4/", "@twind/preset-autoprefix": "https://esm.sh/@twind/preset-autoprefix@1.0.7/", - "$std/": "https://deno.land/std@0.219.0/", - "mtkruto/": "https://deno.land/x/mtkruto@0.1.301/", - "grammy/": "https://deno.land/x/grammy@v1.21.1/", + "$std/": "https://deno.land/std@0.224.0/", + "mtkruto/": "https://deno.land/x/mtkruto@0.2.3/", + "grammy/": "https://deno.land/x/grammy@v1.23.0/", "dexie": "https://esm.sh/dexie@3.2.6", "dexie-react-hooks": "https://esm.sh/dexie-react-hooks@1.1.7?alias=react:preact/compat", "prism-json": "https://esm.sh/prismjs@1.29.0/components/prism-json?no-check", diff --git a/workers/connectivity_test.ts b/workers/connectivity_test.ts index c16a86d..4fca97f 100644 --- a/workers/connectivity_test.ts +++ b/workers/connectivity_test.ts @@ -28,8 +28,7 @@ async function handleMessage( postMessage("exchanging-encryption-keys"); authKey = await getAuthKey(initialDc); } - /** @type string */ - let authString; + let authString: string; { const writer = new TLWriter(); writer.writeString(initialDc); @@ -40,7 +39,8 @@ async function handleMessage( authString = base64EncodeUrlSafe(rleEncode(writer.buffer)); } postMessage(authKey); - client = new Client(new StorageMemory(authString)); + client = new Client({ storage: new StorageMemory() }); + await client.importAuthString(authString); await client.connect(); } catch (err) { console.error(err); @@ -53,7 +53,7 @@ async function handleMessage( for (let i = 0; i < 10; i++) { const then = now(); try { - await client.api.ping({ ping_id: getRandomId() }); + await client.invoke({ _: "ping", ping_id: getRandomId() }); } catch (err) { if ( i == 0 && !regenerateAuthKey && String(err).includes("was closed") // TODO: Use MTKruto's ConnectionError with instanceof