From d512aa83bc3ea942f723b33422956735f242336d Mon Sep 17 00:00:00 2001 From: Niek van der Maas Date: Mon, 6 Mar 2023 16:14:22 +0100 Subject: [PATCH] Allow passing in the API key as a query parameter --- src/App.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/App.svelte b/src/App.svelte index 3cbf1f4..def4c1d 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -10,6 +10,12 @@ $: sortedChats = $chatsStorage.sort((a, b) => b.id - a.id); $: apiKey = $apiKeyStorage; + // Check if the API key is passed in as a "key" query parameter - if so, save it + const urlParams = new URLSearchParams(window.location.search); + if (urlParams.has("key")) { + apiKeyStorage.set(urlParams.get("key")!); + } + let activeChatId: number;