diff options
| author | Adam Soltys <[email protected]> | 2026-02-11 20:10:43 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 20:10:43 -0800 |
| commit | 56a04684c1fb77ea7b21afc6b0d2e1c4773906f6 (patch) | |
| tree | d6bc2557c56b93177bb14aa376847c6e123a4862 /src | |
| parent | 13466248004327e9a026cb89f94926f9b060d1c1 (diff) | |
| download | coinos-ui-56a04684c1fb77ea7b21afc6b0d2e1c4773906f6.tar.gz coinos-ui-56a04684c1fb77ea7b21afc6b0d2e1c4773906f6.zip | |
format
Diffstat (limited to 'src')
150 files changed, 664 insertions, 2265 deletions
diff --git a/src/app.css b/src/app.css index 62997d50..168ea02a 100644 --- a/src/app.css +++ b/src/app.css @@ -38,8 +38,7 @@ @font-face { font-family: "PublicSans"; - src: url("/fonts/Public_Sans/static/PublicSans-Regular.ttf") - format("truetype"); + src: url("/fonts/Public_Sans/static/PublicSans-Regular.ttf") format("truetype"); } :root { diff --git a/src/app.html b/src/app.html index 32cbd31e..e3206d6f 100644 --- a/src/app.html +++ b/src/app.html @@ -7,10 +7,7 @@ name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> - <meta - name="description" - content="The easiest way to get started with bitcoin" - /> + <meta name="description" content="The easiest way to get started with bitcoin" /> <meta name="keywords" content="open source bitcoin lightning web wallet" /> <meta name="theme-color" content="#fff" /> <meta name="mobile-web-app-capable" content="yes" /> diff --git a/src/components/404.svelte b/src/components/404.svelte index d5fdfa38..5a7ba663 100644 --- a/src/components/404.svelte +++ b/src/components/404.svelte @@ -5,12 +5,10 @@ <div class="flex justify-center items-center mt-20"> <div class="space-y-5 text-center"> <a href="/"> - <iconify-icon noobserver icon="coinos:logo" width="224" class="mx-auto" - ></iconify-icon> + <iconify-icon noobserver icon="coinos:logo" width="224" class="mx-auto"></iconify-icon> </a> - <iconify-icon noobserver icon="ph:question-bold" class="mx-auto w-56" - ></iconify-icon> + <iconify-icon noobserver icon="ph:question-bold" class="mx-auto w-56"></iconify-icon> <h1 class="font-bold text-5xl">{$t("404.404")}</h1> <p>{$t("404.pageNotFound")}</p> diff --git a/src/components/About.svelte b/src/components/About.svelte index 0c8be717..dbcf7854 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -33,10 +33,7 @@ <div class="flex w-full"> <div class="md:flex 2xl:items-start md:max-w-2xl mx-auto"> <div class="w-[220px] mx-auto"> - <Image - image={member.name} - style="rounded-full mx-auto w-40 h-40 mb-5 object-cover" - /> + <Image image={member.name} style="rounded-full mx-auto w-40 h-40 mb-5 object-cover" /> <div class="space-y-2"> <span class="text-2xl text-center font-semibold block" @@ -69,9 +66,7 @@ <h3 class="text-5xl font-medium mb-5 text-center"> {$t("about.locations.header")} </h3> - <p - class="text-secondary text-xl w-full md:w-10/12 lg:w-2/3 2xl:w-[800px] mx-auto mb-10" - > + <p class="text-secondary text-xl w-full md:w-10/12 lg:w-2/3 2xl:w-[800px] mx-auto mb-10"> {@html $t("about.locations.description")} </p> diff --git a/src/components/Account.svelte b/src/components/Account.svelte index c88c1118..88b944b3 100644 --- a/src/components/Account.svelte +++ b/src/components/Account.svelte @@ -9,21 +9,10 @@ import { t } from "$lib/translations"; import { versions } from "$lib/utils"; import { arkkey } from "$lib/ark"; - import { - getRememberedWalletPassword, - forgetWalletPassword, - } from "$lib/passwordCache"; + import { getRememberedWalletPassword, forgetWalletPassword } from "$lib/passwordCache"; let { user, rate, account }: any = $props(); - let { - name, - seed, - fingerprint, - balance, - id, - type: accountType, - arkAddress, - } = $derived(account); + let { name, seed, fingerprint, balance, id, type: accountType, arkAddress } = $derived(account); let arkBalance = $state(0); let arkLoading = $state(false); @@ -45,12 +34,11 @@ $arkkey = hex.encode(decrypt(seed, cached) as Uint8Array); } else if (user.seed) { // Master seed: derive m/86'/0'/0'/0/0 - const [{ HDKey }, { entropyToMnemonic, mnemonicToSeed }, { wordlist }] = - await Promise.all([ - import("@scure/bip32"), - import("@scure/bip39"), - import("@scure/bip39/wordlists/english.js"), - ]); + const [{ HDKey }, { entropyToMnemonic, mnemonicToSeed }, { wordlist }] = await Promise.all([ + import("@scure/bip32"), + import("@scure/bip39"), + import("@scure/bip39/wordlists/english.js"), + ]); let entropy = await decrypt(user.seed, cached); let mnemonic = entropyToMnemonic(entropy, wordlist); let s = await mnemonicToSeed(mnemonic, cached); @@ -91,12 +79,11 @@ if (seed) { $arkkey = hex.encode(decrypt(seed, password!) as Uint8Array); } else if (user.seed) { - const [{ HDKey }, { entropyToMnemonic, mnemonicToSeed }, { wordlist }] = - await Promise.all([ - import("@scure/bip32"), - import("@scure/bip39"), - import("@scure/bip39/wordlists/english.js"), - ]); + const [{ HDKey }, { entropyToMnemonic, mnemonicToSeed }, { wordlist }] = await Promise.all([ + import("@scure/bip32"), + import("@scure/bip39"), + import("@scure/bip39/wordlists/english.js"), + ]); let entropy = await decrypt(user.seed, password!); let mnemonic = entropyToMnemonic(entropy, wordlist); let s = await mnemonicToSeed(mnemonic, password!); @@ -153,14 +140,9 @@ onclick={goSettings} > {#if isArk} - <img - src="/images/ark.png" - class="w-8 h-8 rounded-full object-cover" - alt="Ark" - /> + <img src="/images/ark.png" class="w-8 h-8 rounded-full object-cover" alt="Ark" /> {:else if seed || (user.seed && fingerprint)} - <iconify-icon noobserver icon="cryptocurrency-color:btc" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="cryptocurrency-color:btc" width="32"></iconify-icon> {:else} <img src="/images/icon.png" class="w-8 h-8" /> {/if} @@ -169,20 +151,9 @@ </div> <div class="flex w-full text-xl gap-2"> - <a - href={"/invoice"} - class="contents" - onclick={(e) => setAccount(e, "/invoice")} - > - <button - class="btn !w-auto flex-1 !bg-base-300" - data-testid="account-receive" - > - <iconify-icon - noobserver - icon="ph:hand-coins-bold" - width="32" - flip="horizontal" + <a href={"/invoice"} class="contents" onclick={(e) => setAccount(e, "/invoice")}> + <button class="btn !w-auto flex-1 !bg-base-300" data-testid="account-receive"> + <iconify-icon noobserver icon="ph:hand-coins-bold" width="32" flip="horizontal" ></iconify-icon> <div class="my-auto hidden sm:block"> {$t("user.dashboard.receive")} @@ -192,8 +163,7 @@ <a href={`/send`} class="contents" onclick={(e) => setAccount(e, "/send")}> <button type="button" class="btn !w-auto flex-1 !bg-base-300"> - <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32"></iconify-icon> <div class="my-auto hidden sm:block">{$t("user.dashboard.send")}</div> </button> </a> diff --git a/src/components/Amount.svelte b/src/components/Amount.svelte index 8cfb9942..f368e96c 100644 --- a/src/components/Amount.svelte +++ b/src/components/Amount.svelte @@ -34,8 +34,7 @@ aria-label="Toggle currency display" > {#if !canShowFiat} - <iconify-icon noobserver {icon} class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver {icon} class="text-yellow-300"></iconify-icon> {/if} {#if canShowFiat} {f(toFiat(amount, rate), currency, locale)} diff --git a/src/components/AmountField.svelte b/src/components/AmountField.svelte index 21c36631..b5c4261e 100644 --- a/src/components/AmountField.svelte +++ b/src/components/AmountField.svelte @@ -38,13 +38,10 @@ <button type="button" class="flex w-full" onclick={startSetting}> <div class="p-4 border rounded-2xl rounded-r-none border-r-0 bg-base-200"> - <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> </div> - <div - class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left" - > + <div class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left"> {amount || none} </div> <input type="hidden" {name} bind:value={amount} /> @@ -52,24 +49,14 @@ </div> {#if setting} - <div - class="fixed bg-base-100/90 inset-0 overflow-y-auto h-full w-full z-50 max-w-lg mx-auto" - > + <div class="fixed bg-base-100/90 inset-0 overflow-y-auto h-full w-full z-50 max-w-lg mx-auto"> <div class="relative p-5 border shadow-lg rounded-md bg-base-100 space-y-5"> <h1 class="text-center text-2xl font-semibold"> {label} </h1> - <Numpad - bind:amount - {currency} - {rate} - bind:submit={done} - bind:element={numpad} - /> + <Numpad bind:amount {currency} {rate} bind:submit={done} bind:element={numpad} /> - <button bind:this={done} type="button" onclick={set} class="btn" - >Ok</button - > + <button bind:this={done} type="button" onclick={set} class="btn">Ok</button> </div> </div> {/if} diff --git a/src/components/AppForm.svelte b/src/components/AppForm.svelte index 2f65372c..2fedca47 100644 --- a/src/components/AppForm.svelte +++ b/src/components/AppForm.svelte @@ -16,17 +16,7 @@ PUBLIC_COINOS_RELAY as relayUrl, } from "$env/static/public"; - let { - rate, - user, - name, - max_fee, - max_amount, - budget_renewal, - pubkey, - secret, - notify, - } = $props(); + let { rate, user, name, max_fee, max_amount, budget_renewal, pubkey, secret, notify } = $props(); let { currency } = $derived(user); onMount(() => { @@ -95,9 +85,7 @@ /> <div> - <label for="name" class="font-bold mb-1 block" - >{$t("accounts.renewal")}</label - > + <label for="name" class="font-bold mb-1 block">{$t("accounts.renewal")}</label> <select name="budget_renewal" bind:value={budget_renewal}> <option value="never" selected>{$t("accounts.never")}</option> <option value="daily">{$t("accounts.daily")}</option> @@ -108,9 +96,7 @@ </div> <div> - <label for="notify" class="font-bold mb-1 block" - >{$t("accounts.notifications")}</label - > + <label for="notify" class="font-bold mb-1 block">{$t("accounts.notifications")}</label> <select name="notify" bind:value={notify}> <option value={false} selected>{$t("accounts.off")}</option> <option value={true}>{$t("accounts.on")}</option> @@ -118,16 +104,9 @@ </div> <div> - <label for="pubkey" class="font-bold mb-1 block" - >{$t("accounts.pubkey")}</label - > + <label for="pubkey" class="font-bold mb-1 block">{$t("accounts.pubkey")}</label> <div class="flex gap-1 items-center"> - <textarea - rows={3} - name="pubkey" - bind:value={pubkey} - class="grow" - readonly={secret} + <textarea rows={3} name="pubkey" bind:value={pubkey} class="grow" readonly={secret} ></textarea> <button type="button" @@ -142,29 +121,15 @@ {#if !pubkey || secret} <div> - <label for="secret" class="font-bold mb-1 block" - >{$t("accounts.secret")}</label - > + <label for="secret" class="font-bold mb-1 block">{$t("accounts.secret")}</label> <div class="flex gap-1 items-center"> - <textarea rows={3} name="secret" bind:value={secret} class="grow" - ></textarea> + <textarea rows={3} name="secret" bind:value={secret} class="grow"></textarea> <div class="space-y-2 w-24"> - <button - type="button" - onclick={generate} - class="btn" - aria-label="Generate secret" - > - <iconify-icon noobserver icon="ph:dice-three-bold" width="32" - ></iconify-icon> + <button type="button" onclick={generate} class="btn" aria-label="Generate secret"> + <iconify-icon noobserver icon="ph:dice-three-bold" width="32"></iconify-icon> </button> - <button - type="button" - onclick={() => copy(secret)} - class="btn" - aria-label="Copy secret" - > + <button type="button" onclick={() => copy(secret)} class="btn" aria-label="Copy secret"> <iconify-icon icon="ph:copy-bold" width="32"></iconify-icon> </button> </div> @@ -173,8 +138,7 @@ {/if} <div class="space-y-2"> - <button type="submit" class="btn btn-accent">{$t("payments.submit")}</button - > + <button type="submit" class="btn btn-accent">{$t("payments.submit")}</button> {#if pubkey} <button type="button" class="btn" onclick={del}> <iconify-icon icon="ph:trash-bold" width="32"></iconify-icon> diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index f45f4d0c..daeedcdb 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -56,9 +56,7 @@ ]); let opacity = $derived((href) => - $page.url.pathname === href - ? "opacity-100" - : "opacity-90 hover:opacity-none", + $page.url.pathname === href ? "opacity-100" : "opacity-90 hover:opacity-none", ); </script> @@ -74,8 +72,7 @@ {#each links as { href, icon, label }} <a {href} data-sveltekit-preload-code="eager" aria-label={label}> <button class="btn-menu {opacity(href)}" aria-label={label}> - <iconify-icon noobserver {icon} width={(w ?? 0) > 640 ? 32 : 24} - ></iconify-icon> + <iconify-icon noobserver {icon} width={(w ?? 0) > 640 ? 32 : 24}></iconify-icon> </button> </a> {/each} diff --git a/src/components/Avatar.svelte b/src/components/Avatar.svelte index c9bacf65..c56b7486 100644 --- a/src/components/Avatar.svelte +++ b/src/components/Avatar.svelte @@ -9,29 +9,16 @@ class?: string; } - let { - user, - size = 32, - disabled = false, - class: className = "", - }: Props = $props(); + let { user, size = 32, disabled = false, class: className = "" }: Props = $props(); let s = $derived(size.toString()); - let link = $derived( - user ? (user.anon ? `/${user.pubkey}` : `/${user.username}`) : undefined, - ); + let link = $derived(user ? (user.anon ? `/${user.pubkey}` : `/${user.username}`) : undefined); let base = "/api/public"; - let profile = $derived( - user?.profile ? `${base}/${user.profile}.webp` : user?.picture, - ); - let fallback = $derived( - `${base}/punks/` + punk(user?.pubkey || user?.id || "aa"), - ); + let profile = $derived(user?.profile ? `${base}/${user.profile}.webp` : user?.picture); + let fallback = $derived(`${base}/punks/` + punk(user?.pubkey || user?.id || "aa")); let tmp = $derived( - ($avatar as any)?.id && - ($avatar as any).id === user?.id && - ($avatar as any).src, + ($avatar as any)?.id && ($avatar as any).id === user?.id && ($avatar as any).src, ); let src = $derived(tmp || profile || fallback); </script> diff --git a/src/components/Balance.svelte b/src/components/Balance.svelte index 41b55c7a..440c260d 100644 --- a/src/components/Balance.svelte +++ b/src/components/Balance.svelte @@ -27,13 +27,8 @@ <div> {#if user.haspin && !$pin} - <button - onclick={toggleShow} - class="flex gap-2 text-xl" - data-testid="balance-show" - > - <iconify-icon noobserver icon="ph:eye-slash-bold" width="32" - ></iconify-icon> + <button onclick={toggleShow} class="flex gap-2 text-xl" data-testid="balance-show"> + <iconify-icon noobserver icon="ph:eye-slash-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.showBalance")}</div> </button> {:else if !isNaN(rate)} @@ -47,14 +42,7 @@ /> {#if locked && id === user.id} <div class="text-red-600"> - <Amount - amount={locked} - {rate} - {currency} - {locale} - align="left" - locked={true} - /> + <Amount amount={locked} {rate} {currency} {locale} align="left" locked={true} /> </div> {/if} </div> diff --git a/src/components/Code.svelte b/src/components/Code.svelte index 4f182ff2..48c132b0 100644 --- a/src/components/Code.svelte +++ b/src/components/Code.svelte @@ -5,12 +5,7 @@ </script> {#snippet cp(something)} - <button - type="button" - class="ml-auto" - onclick={() => copy(something)} - aria-label="Copy value" - > + <button type="button" class="ml-auto" onclick={() => copy(something)} aria-label="Copy value"> <iconify-icon noobserver icon="ph:copy-bold" width="42"></iconify-icon> </button> {/snippet} diff --git a/src/components/DarkToggle.svelte b/src/components/DarkToggle.svelte index ebeaf762..78506c88 100644 --- a/src/components/DarkToggle.svelte +++ b/src/components/DarkToggle.svelte @@ -7,10 +7,7 @@ }; </script> -<button - class="flex justify-center items-center hover:opacity-80 gap-2 font-bold" - onclick={dark} -> +<button class="flex justify-center items-center hover:opacity-80 gap-2 font-bold" onclick={dark}> <iconify-icon noobserver icon={$theme === "dark" ? "ph:sun-bold" : "ph:moon-stars-bold"} diff --git a/src/components/Event.svelte b/src/components/Event.svelte index 3ecf00fc..03b93695 100644 --- a/src/components/Event.svelte +++ b/src/components/Event.svelte @@ -43,11 +43,7 @@ </div> {#if author.lud16} <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> {author.lud16} </div> {/if} @@ -75,8 +71,7 @@ {:else if type === "link"} <Media {value} {minimal} /> {:else if type.match(/^nostr:np(rofile|ub)$/)} - <a href={`/${value.pubkey}`} class="font-bold">@{names[value.pubkey]}</a - > + <a href={`/${value.pubkey}`} class="font-bold">@{names[value.pubkey]}</a> {/if} {/each} </div> @@ -99,11 +94,7 @@ <div class="justify-center flex"> <button type="button" onclick={zap} class="btn btn-accent items-center"> <div class="flex gap-1 items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - width={32} + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" width={32} ></iconify-icon> <div>Zap</div> </div> diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index 92930300..5bf7b461 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -18,9 +18,7 @@ ]; </script> -<footer - class="space-y-10 md:space-y-0 text-xl block md:flex justify-around pb-8 px-4" -> +<footer class="space-y-10 md:space-y-0 text-xl block md:flex justify-around pb-8 px-4"> <div class="space-y-5"> <div class="text-center w-full"> <a href="/" aria-label="Home"> @@ -36,9 +34,7 @@ </a> </div> </div> - <div - class="w-full flex flex-wrap sm:flex-nowrap gap-2 justify-center items-center" - > + <div class="w-full flex flex-wrap sm:flex-nowrap gap-2 justify-center items-center"> <DarkToggle /> <LocaleSelector /> </div> @@ -49,11 +45,8 @@ <ul class="mt-5 text-secondary space-y-3 font-medium"> {#each followLinks as link} <li> - <a - href={link.url} - target="_blank" - rel="noreferrer" - class="hover:opacity-80">{$t("footer." + link.titleID)}</a + <a href={link.url} target="_blank" rel="noreferrer" class="hover:opacity-80" + >{$t("footer." + link.titleID)}</a > </li> {/each} @@ -65,18 +58,12 @@ <ul class="mt-5 text-secondary space-y-3"> {#each companyLinks as link} <li> - <a href={link.url} class="hover:opacity-80" - >{$t("footer." + link.titleID)}</a - > + <a href={link.url} class="hover:opacity-80">{$t("footer." + link.titleID)}</a> </li> {/each} </ul> </div> - <iconify-icon - noobserver - icon="coinos:shield" - class="flex justify-center" - width="96" + <iconify-icon noobserver icon="coinos:shield" class="flex justify-center" width="96" ></iconify-icon> </footer> diff --git a/src/components/HowItWorksCard.svelte b/src/components/HowItWorksCard.svelte index 1012af46..33a39e08 100644 --- a/src/components/HowItWorksCard.svelte +++ b/src/components/HowItWorksCard.svelte @@ -4,8 +4,7 @@ </script> <div class="space-y-5"> - <iconify-icon noobserver icon={image} class="mx-auto" width="128" - ></iconify-icon> + <iconify-icon noobserver icon={image} class="mx-auto" width="128"></iconify-icon> <p class="text-2xl font-medium">{$t("howItWorks." + stepID + ".header")}</p> <p class="text-secondary text-xl font-medium w-full md:w-2/3 mx-auto"> {$t("howItWorks." + stepID + ".description")} diff --git a/src/components/InvoiceActions.svelte b/src/components/InvoiceActions.svelte index 7cc62698..c6ae7249 100644 --- a/src/components/InvoiceActions.svelte +++ b/src/components/InvoiceActions.svelte @@ -48,23 +48,20 @@ <div class="flex flex-wrap gap-2 justify-around text-secondary w-full"> {#if user?.id === invoice?.user?.id} <button class="btn grow !w-auto" onclick={toggleAmount}> - <iconify-icon noobserver icon="ph:pencil-simple-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:pencil-simple-bold" width="32"></iconify-icon> <div class="my-auto">{t("payments.setAmount")}</div> </button> {:else} <a href={link} class="block"> <button class="btn grow !w-auto"> - <iconify-icon noobserver icon="ph:arrow-square-out-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:arrow-square-out-bold" width="32"></iconify-icon> <div class="my-auto">{t("payments.openLink")}</div> </button> </a> {/if} <button class="btn grow !w-auto" onclick={toggleMemo}> - <iconify-icon noobserver icon="ph:chat-centered-text-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:chat-centered-text-bold" width="32"></iconify-icon> <div class="my-auto"> {t("invoice.setMemo")} </div> @@ -80,8 +77,7 @@ </button> <button class="btn grow !w-auto" onclick={() => goto("/receive")}> - <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32"></iconify-icon> <div class="my-auto text-lg">{t("user.send.paste")}</div> </button> @@ -95,11 +91,9 @@ <div class="w-full flex justify-center gap-2 flex-wrap"> <button class="btn" onclick={() => (showQr = !showQr)}> {#if showQr} - <iconify-icon noobserver icon="ph:text-align-center-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:text-align-center-bold" width="32"></iconify-icon> {:else} - <iconify-icon noobserver icon="ph:qr-code-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:qr-code-bold" width="32"></iconify-icon> {/if} <div class="my-auto"> {showQr ? t("payments.showText") : t("payments.showQr")} @@ -120,14 +114,9 @@ setType(types.lightning); }} > - <div - class="bg-black rounded-full w-8 h-8 items-center justify-center flex" - > + <div class="bg-black rounded-full w-8 h-8 items-center justify-center flex"> <div class="m-auto"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-2xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-2xl" ></iconify-icon> </div> </div> diff --git a/src/components/InvoiceData.svelte b/src/components/InvoiceData.svelte index 51f7b396..142755f0 100644 --- a/src/components/InvoiceData.svelte +++ b/src/components/InvoiceData.svelte @@ -39,12 +39,7 @@ {#if invoice.type === types.liquid} <div class="flex justify-center p-4 shadow items-center gap-2"> - <iconify-icon - noobserver - icon="ph:warning-bold" - width="48" - class="text-warning" - ></iconify-icon> + <iconify-icon noobserver icon="ph:warning-bold" width="48" class="text-warning"></iconify-icon> <div> <div class="my-auto text-xl text-center text-secondary"> {t("payments.onlyLbtc")} diff --git a/src/components/InvoiceTypes.svelte b/src/components/InvoiceTypes.svelte index 9aa1330a..cfde1285 100644 --- a/src/components/InvoiceTypes.svelte +++ b/src/components/InvoiceTypes.svelte @@ -22,8 +22,7 @@ class="btn flex-nowrap !w-auto grow" class:bg-base-300={type === types.bitcoin && address_type === "bech32"} class:text-secondary={type === types.bitcoin && address_type === "bech32"} - class:hidden={activeOnly && - (type !== types.bitcoin || address_type !== "bech32")} + class:hidden={activeOnly && (type !== types.bitcoin || address_type !== "bech32")} onclick={() => (activeOnly ? toggleType() : setType(types.bitcoin))} > <img src="/images/bitcoin.svg" class="w-8" alt="Bitcoin" /> @@ -34,10 +33,8 @@ class="btn flex-nowrap !w-auto grow" class:bg-base-300={type === types.bitcoin && address_type === "bech32m"} class:text-secondary={type === types.bitcoin && address_type === "bech32m"} - class:hidden={activeOnly && - (type !== types.bitcoin || address_type !== "bech32m")} - onclick={() => - activeOnly ? toggleType() : setType(types.bitcoin, "bech32m")} + class:hidden={activeOnly && (type !== types.bitcoin || address_type !== "bech32m")} + onclick={() => (activeOnly ? toggleType() : setType(types.bitcoin, "bech32m"))} > <img src="/images/bitcoin.svg" class="w-8" alt="Bitcoin" /> <div class="my-auto text-lg">Taproot</div> @@ -47,10 +44,8 @@ class="btn flex-nowrap !w-auto grow" class:bg-base-300={type === types.bitcoin && address_type === "legacy"} class:text-secondary={type === types.bitcoin && address_type === "legacy"} - class:hidden={activeOnly && - (type !== types.bitcoin || address_type !== "legacy")} - onclick={() => - activeOnly ? toggleType() : setType(types.bitcoin, "legacy")} + class:hidden={activeOnly && (type !== types.bitcoin || address_type !== "legacy")} + onclick={() => (activeOnly ? toggleType() : setType(types.bitcoin, "legacy"))} > <img src="/images/bitcoin.svg" class="w-8" alt="Bitcoin" /> <div class="my-auto text-lg">Legacy</div> @@ -62,10 +57,8 @@ <div class="flex flex-wrap gap-2"> <button class="btn flex-nowrap !w-auto grow" - class:bg-base-300={type === types.lightning && - $page.url.pathname.includes("/receive")} - class:text-secondary={type === types.lightning && - $page.url.pathname.includes("/receive")} + class:bg-base-300={type === types.lightning && $page.url.pathname.includes("/receive")} + class:text-secondary={type === types.lightning && $page.url.pathname.includes("/receive")} class:hidden={activeOnly && (type !== types.lightning || !$page.url.pathname.includes("/receive"))} onclick={() => { @@ -77,14 +70,9 @@ } }} > - <div - class="bg-black rounded-full w-8 h-8 items-center justify-center flex" - > + <div class="bg-black rounded-full w-8 h-8 items-center justify-center flex"> <div class="m-auto"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-2xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-2xl" ></iconify-icon> </div> </div> @@ -97,14 +85,9 @@ class:hidden={activeOnly && type !== types.bolt12} onclick={() => (activeOnly ? toggleType() : setType(types.bolt12))} > - <div - class="bg-black rounded-full w-8 h-8 items-center justify-center flex" - > + <div class="bg-black rounded-full w-8 h-8 items-center justify-center flex"> <div class="m-auto"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-2xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-2xl" ></iconify-icon> </div> </div> @@ -113,10 +96,8 @@ <button class="btn flex-nowrap !w-auto grow" - class:bg-base-300={type === types.lightning && - !$page.url.pathname.includes("/receive")} - class:text-secondary={type === types.lightning && - !$page.url.pathname.includes("/receive")} + class:bg-base-300={type === types.lightning && !$page.url.pathname.includes("/receive")} + class:text-secondary={type === types.lightning && !$page.url.pathname.includes("/receive")} class:hidden={activeOnly && (type !== types.lightning || $page.url.pathname.includes("/receive"))} onclick={() => { @@ -128,14 +109,9 @@ } }} > - <div - class="bg-black rounded-full w-8 h-8 items-center justify-center flex" - > + <div class="bg-black rounded-full w-8 h-8 items-center justify-center flex"> <div class="m-auto"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-2xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-2xl" ></iconify-icon> </div> </div> diff --git a/src/components/ItemForm.svelte b/src/components/ItemForm.svelte index 7215a239..a64cb7ee 100644 --- a/src/components/ItemForm.svelte +++ b/src/components/ItemForm.svelte @@ -17,10 +17,7 @@ let src: string | undefined = $state(); let tooLarge: Record<string, boolean> = {}; - let handleFile = async ( - { target }: { target: EventTarget | null }, - type: string, - ) => { + let handleFile = async ({ target }: { target: EventTarget | null }, type: string) => { tooLarge[type] = false; file = (target as HTMLInputElement).files![0]; if (!file) return; @@ -42,9 +39,7 @@ if (src) { try { - let { hash } = JSON.parse( - (await upload(file, "item", progress)) as string, - ); + let { hash } = JSON.parse((await upload(file, "item", progress)) as string); data.set("image", hash); @@ -91,11 +86,7 @@ <div> <label for="price" class="font-bold mb-1 block">{$t("items.price")}</label> <div class="flex"> - <input - name="price" - bind:value={item.price} - class="border-r-none rounded-r-none" - /> + <input name="price" bind:value={item.price} class="border-r-none rounded-r-none" /> <div class="text-gray-600 rounded-r-2xl p-4 my-auto rounded-l-none rounded border bg-gray-100" > diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index f1b6a2b4..9d8b92cf 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -22,10 +22,7 @@ }; </script> -<header - class="w-full lg:w-5/6 p-4 mx-auto fixed sticky z-10 top-0 bg-base-100" - bind:this={header} -> +<header class="w-full lg:w-5/6 p-4 mx-auto fixed sticky z-10 top-0 bg-base-100" bind:this={header}> <nav class="block lg:flex justify-between items-center"> <div class="flex justify-start lg:justify-center items-center lg:space-x-5"> <a href="/" onclick={() => scroll(header)} aria-label="Home"> @@ -39,35 +36,21 @@ <button class="hover:opacity-80" onclick={() => scroll(howItWorks)} >{$t("howItWorks.header")}</button > - <button class="hover:opacity-80" onclick={() => scroll(faq)} - >{$t("faq.header")}</button - > - <button class="hover:opacity-80" onclick={() => scroll(about)} - >{$t("about.header")}</button - > + <button class="hover:opacity-80" onclick={() => scroll(faq)}>{$t("faq.header")}</button> + <button class="hover:opacity-80" onclick={() => scroll(about)}>{$t("about.header")}</button> {/if} {#if user} - <button - class="btn !w-auto !rounded-full" - onclick={() => goto(`/${user.username}`)} + <button class="btn !w-auto !rounded-full" onclick={() => goto(`/${user.username}`)} >{$t("nav.home")} </button> - <button - class="btn !w-auto !rounded-full" - onclick={() => goto("/logout")} - > + <button class="btn !w-auto !rounded-full" onclick={() => goto("/logout")}> {$t("nav.signOut")} </button> {:else} - <button - class="btn btn-accent !w-auto !rounded-full" - onclick={() => goto("/register")} + <button class="btn btn-accent !w-auto !rounded-full" onclick={() => goto("/register")} >{$t("nav.register")} </button> - <button - class="btn !w-auto !rounded-full" - onclick={() => goto("/login")} - > + <button class="btn !w-auto !rounded-full" onclick={() => goto("/login")}> {$t("nav.signIn")} </button> {/if} @@ -78,10 +61,7 @@ class="block lg:hidden absolute top-[34.5px] right-10 z" onclick={() => (showMobileMenu = !showMobileMenu)} > - <iconify-icon - noobserver - icon={!showMobileMenu ? "ph:list-bold" : "ph:x-bold"} - width="32" + <iconify-icon noobserver icon={!showMobileMenu ? "ph:list-bold" : "ph:x-bold"} width="32" ></iconify-icon> </button> @@ -96,9 +76,7 @@ <button onclick={() => mobileMenuButtonClick(howItWorks)} class="block" >{$t("howItWorks.header")}</button > - <button onclick={() => mobileMenuButtonClick(faq)} class="block" - >{$t("faq.header")}</button - > + <button onclick={() => mobileMenuButtonClick(faq)} class="block">{$t("faq.header")}</button> <button onclick={() => mobileMenuButtonClick(about)} class="block" >{$t("about.header")}</button > diff --git a/src/components/LandingInfoCard.svelte b/src/components/LandingInfoCard.svelte index cb16c5dd..8b85518c 100644 --- a/src/components/LandingInfoCard.svelte +++ b/src/components/LandingInfoCard.svelte @@ -1,13 +1,7 @@ <script lang="ts"> import Image from "./Image.svelte"; - let { - image, - title, - description = undefined, - order = undefined, - children, - } = $props(); + let { image, title, description = undefined, order = undefined, children } = $props(); </script> <div class="block lg:flex justify-center lg:space-x-20 items-center"> @@ -17,14 +11,10 @@ 'reverse' && 'order-last'}" /> <div class="w-full lg:w-1/2 max-w-3xl space-y-10 mx-auto lg:mx-0"> - <h3 - class="text-5xl font-medium text-left w-full mx-auto lg:mx-0 md:w-[500px]" - > + <h3 class="text-5xl font-medium text-left w-full mx-auto lg:mx-0 md:w-[500px]"> {title} </h3> - <p - class="text-secondary text-xl font-medium w-full md:w-[500px] mx-auto lg:mx-0" - > + <p class="text-secondary text-xl font-medium w-full md:w-[500px] mx-auto lg:mx-0"> {#if description} {description} {:else} diff --git a/src/components/Lnurlp.svelte b/src/components/Lnurlp.svelte index c735c5a8..360c05db 100644 --- a/src/components/Lnurlp.svelte +++ b/src/components/Lnurlp.svelte @@ -9,8 +9,7 @@ let { data, form, send = $bindable(), comment = $bindable() } = $props(); let { currency } = data.user; - let { minSendable, maxSendable, commentAllowed, callback, metadata, rate } = - data; + let { minSendable, maxSendable, commentAllowed, callback, metadata, rate } = data; let amount = $state(Math.round(minSendable / 1000)), loading = $state(); diff --git a/src/components/Lnurlw.svelte b/src/components/Lnurlw.svelte index 006fda8b..9b374fcd 100644 --- a/src/components/Lnurlw.svelte +++ b/src/components/Lnurlw.svelte @@ -11,14 +11,7 @@ let { data, form } = $props(); let { currency, username } = data.user; - let { - defaultDescription, - minWithdrawable, - maxWithdrawable, - k1, - callback, - rate, - } = data; + let { defaultDescription, minWithdrawable, maxWithdrawable, k1, callback, rate } = data; let amount = $state(Math.round(minWithdrawable / 1000)); let amountFiat = $derived(parseFloat(((amount * rate) / sats).toFixed(2))); @@ -56,9 +49,7 @@ <div>{f(amountFiat, currency)}</div> {:else} <div> - <span class="text-secondary font-normal text-xl" - >⚡️{`${s(amount)}`}</span - > + <span class="text-secondary font-normal text-xl">⚡️{`${s(amount)}`}</span> </div> {/if} </div> @@ -66,12 +57,7 @@ <Numpad bind:amount {currency} {rate} /> {/if} - <form - use:enhance={handler(toggle)} - action="?/withdraw" - method="POST" - class="space-y-5" - > + <form use:enhance={handler(toggle)} action="?/withdraw" method="POST" class="space-y-5"> <input name="amount" value={amount} type="hidden" /> <input name="username" value={username} type="hidden" /> <input name="currency" value={currency} type="hidden" /> @@ -89,22 +75,14 @@ disabled={submitting} onkeydown={setMax} >{#if $fiat} - Max {f( - (Math.floor(maxWithdrawable / 1000) * rate) / sats, - currency, - )} + Max {f((Math.floor(maxWithdrawable / 1000) * rate) / sats, currency)} {:else} Max ⚡️{s(Math.floor(maxWithdrawable / 1000))} {/if}</button > {/if} - <button - use:focus - bind:this={submit} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button use:focus bind:this={submit} type="submit" class="btn btn-accent !w-auto grow"> {#if submitting} <Spinner /> {:else} diff --git a/src/components/LoadingSplash.svelte b/src/components/LoadingSplash.svelte index e629a494..8ed0429f 100644 --- a/src/components/LoadingSplash.svelte +++ b/src/components/LoadingSplash.svelte @@ -1,8 +1,4 @@ <div class="flex justify-center items-center"> - <iconify-icon - noobserver - icon="coinos:logo" - width="224" - class="mt-[calc(50vh-72px)]" + <iconify-icon noobserver icon="coinos:logo" width="224" class="mt-[calc(50vh-72px)]" ></iconify-icon> </div> diff --git a/src/components/LocationsMap.svelte b/src/components/LocationsMap.svelte index 3ec50e38..23da473e 100644 --- a/src/components/LocationsMap.svelte +++ b/src/components/LocationsMap.svelte @@ -181,11 +181,8 @@ maplibrePromise = new Promise((resolve, reject) => { const existing = document.querySelector("script[data-maplibre]"); if (existing) { - if ((window as any).maplibregl) - return resolve((window as any).maplibregl); - existing.addEventListener("load", () => - resolve((window as any).maplibregl), - ); + if ((window as any).maplibregl) return resolve((window as any).maplibregl); + existing.addEventListener("load", () => resolve((window as any).maplibregl)); existing.addEventListener("error", reject); return; } @@ -285,27 +282,20 @@ onDestroy(() => map && map.remove()); let list = $derived( search - ? markers.filter((m) => - m.tags.name.toLowerCase().includes(search.toLowerCase()), - ) + ? markers.filter((m) => m.tags.name.toLowerCase().includes(search.toLowerCase())) : inview, ); </script> <div class="w-screen h-dvh flex" id="map" bind:this={mapWrapper}> - <div - id="map-container" - class="mx-auto h-full w-full z-0" - bind:this={mapContainer} - ></div> + <div id="map-container" class="mx-auto h-full w-full z-0" bind:this={mapContainer}></div> <div class="absolute flex top-2 left-2 gap-2"> <button aria-label="Back" class="rounded-full border-2 border-black bg-base-100/80 w-16 h-16 flex items-center justify-center" onclick={back} > - <iconify-icon noobserver icon="ph:arrow-left-bold" width="24" - ></iconify-icon> + <iconify-icon noobserver icon="ph:arrow-left-bold" width="24"></iconify-icon> </button> </div> <div class="relative"> @@ -318,12 +308,10 @@ <div class="flex gap-1 absolute right-6 top-3"> {#if search} <button type="button" onclick={clearSearch} aria-label="Clear"> - <iconify-icon noobserver icon="ph:x-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:x-bold" width="32"></iconify-icon> </button> {:else} - <iconify-icon noobserver icon="ph:search-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:search-bold" width="32"></iconify-icon> {/if} </div> </div> @@ -354,11 +342,9 @@ aria-label={timeout ? "Resume map" : "Pause map"} > {#if timeout} - <iconify-icon noobserver icon="ph:pause-bold" width="24" - ></iconify-icon> + <iconify-icon noobserver icon="ph:pause-bold" width="24"></iconify-icon> {:else} - <iconify-icon noobserver icon="ph:play-bold" width="24" - ></iconify-icon> + <iconify-icon noobserver icon="ph:play-bold" width="24"></iconify-icon> {/if} </button> </div> diff --git a/src/components/Media.svelte b/src/components/Media.svelte index 9c2c21f8..6471d190 100644 --- a/src/components/Media.svelte +++ b/src/components/Media.svelte @@ -1,8 +1,6 @@ <script lang="ts"> - export const isImage = (url: string) => - url?.match(/^.*\.(jpg|jpeg|png|webp|gif|avif|svg)/gi); - export const isVideo = (url: string) => - url?.match(/^.*\.(mov|mkv|mp4|avi|m4v|webm)/gi); + export const isImage = (url: string) => url?.match(/^.*\.(jpg|jpeg|png|webp|gif|avif|svg)/gi); + export const isVideo = (url: string) => url?.match(/^.*\.(mov|mkv|mp4|avi|m4v|webm)/gi); export const isAudio = (url: string) => url?.match(/^.*\.(ogg|mp3|wav)/gi); // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/components/Menu.svelte b/src/components/Menu.svelte index 9b49a263..1c09bd54 100644 --- a/src/components/Menu.svelte +++ b/src/components/Menu.svelte @@ -27,13 +27,8 @@ <div> <OutClick onOutClick={hideMenu}> - <button - class="btn-menu {opacity('/support')}" - onclick={toggleMenu} - aria-label="Open menu" - > - <iconify-icon noobserver icon="ph:list-bold" width={w > 640 ? 32 : 24} - ></iconify-icon> + <button class="btn-menu {opacity('/support')}" onclick={toggleMenu} aria-label="Open menu"> + <iconify-icon noobserver icon="ph:list-bold" width={w > 640 ? 32 : 24}></iconify-icon> </button> <div @@ -66,8 +61,7 @@ </ul> <hr class="my-4" /> <a href="/?stay=true" aria-label="Coinos home" - ><iconify-icon noobserver icon="coinos:logo" width="160" - ></iconify-icon></a + ><iconify-icon noobserver icon="coinos:logo" width="160"></iconify-icon></a > </div> </OutClick> diff --git a/src/components/Nostr.svelte b/src/components/Nostr.svelte index 74e85faf..529dd6e7 100644 --- a/src/components/Nostr.svelte +++ b/src/components/Nostr.svelte @@ -32,8 +32,7 @@ let connectUrl: string | undefined = $state(); let nostrConnect = async () => { const { Relay } = await import("nostr-tools/relay"); - const { nip04, generateSecretKey, getPublicKey } = - await import("nostr-tools"); + const { nip04, generateSecretKey, getPublicKey } = await import("nostr-tools"); const { getConversationKey, decrypt } = await import("nostr-tools/nip44"); let connectionSecret = crypto.randomUUID(); @@ -49,9 +48,7 @@ try { let result; try { - ({ result } = JSON.parse( - await nip04.decrypt(sk, pk, event.content), - )); + ({ result } = JSON.parse(await nip04.decrypt(sk, pk, event.content))); } catch (e) { let ck = await getConversationKey(sk, pk); ({ result } = JSON.parse(await decrypt(event.content, ck))); @@ -119,9 +116,7 @@ {#if $eventToSign && !$signer?.ready} <div class="fixed inset-0 bg-base-100/90 overflow-y-auto h-full w-full z-50"> - <div - class="relative mx-auto mt-10 p-5 border w-96 shadow-lg rounded-md bg-base-100 space-y-5" - > + <div class="relative mx-auto mt-10 p-5 border w-96 shadow-lg rounded-md bg-base-100 space-y-5"> <h1 class="text-center text-2xl font-semibold">Nostr sign</h1> {#if ($eventToSign as any).sig && !hadSigner} @@ -140,16 +135,11 @@ </div> </a> <a href={connectUrl} class="btn"> - <iconify-icon - noobserver - icon="ph:arrow-square-out-bold" - width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:arrow-square-out-bold" width="32"></iconify-icon> {$t("payments.openLink")}</a > <button class="btn" onclick={() => copy(connectUrl!)}> - <iconify-icon noobserver icon="ph:copy-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:copy-bold" width="32"></iconify-icon> {$t("payments.copy")}</button > </div> @@ -157,8 +147,7 @@ {#if $signer?.method === "nsec"} <input bind:value={nsec} placeholder="nsec..." /> <button type="button" class="btn btn-accent" onclick={nsecSign}> - <iconify-icon icon="ph:paper-plane-right-bold" width="32" - ></iconify-icon> + <iconify-icon icon="ph:paper-plane-right-bold" width="32"></iconify-icon> <div class="my-auto">Submit</div> </button> {/if} @@ -166,10 +155,7 @@ {#if !$signer} {#if extensionAvailable} <button type="button" class="btn" onclick={extensionSign}> - <iconify-icon - icon="lucide-lab:bee" - width="32" - class="text-yellow-400" + <iconify-icon icon="lucide-lab:bee" width="32" class="text-yellow-400" ></iconify-icon> <div class="my-auto">Browser extension</div> </button> diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 57e8dd24..4f04fbaa 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -29,8 +29,7 @@ function getCurrencyInfo(locale: any = "en-US", currency: string) { const l = typeof locale === "function" ? locale() : locale || "en-US"; const region = l.length >= 2 ? l.slice(-2) : ""; - const currencyDisplay = - region && currency.startsWith(region) ? "narrowSymbol" : "symbol"; + const currencyDisplay = region && currency.startsWith(region) ? "narrowSymbol" : "symbol"; const formatter = new Intl.NumberFormat(l, { style: "currency", currency, @@ -75,11 +74,8 @@ const updateByMode = () => { if (fiat) { - const numericFiat = - parseFloat((fiatDigits || "0").replace(/\D/g, "")) / 100; - amountFiat = isFinite(numericFiat) - ? numericFiat.toFixed(2) - : ("0.00" as any); + const numericFiat = parseFloat((fiatDigits || "0").replace(/\D/g, "")) / 100; + amountFiat = isFinite(numericFiat) ? numericFiat.toFixed(2) : ("0.00" as any); amount = numericFiat ? Math.round((numericFiat * sats) / rate) : 0; } else { // integer-only sats, already normalized @@ -201,8 +197,7 @@ if (!html) html = fiat ? formatFiatFromDigits("0", decimalChar) : "0"; }; - const keydown = (e) => - e.key === "Enter" && (e.preventDefault() || submit?.click?.()); + const keydown = (e) => e.key === "Enter" && (e.preventDefault() || submit?.click?.()); // CHANGED: make swap set html for the new mode immediately and keep DOM in sync const swap = () => { @@ -213,9 +208,7 @@ element && (element.innerHTML = html); } else { // going -> fiat - const cents = Math.round( - (parseFloat(String(amountFiat) || "0") || 0) * 100, - ); + const cents = Math.round((parseFloat(String(amountFiat) || "0") || 0) * 100); fiatDigits = Math.max(0, cents).toString(); fiat = true; html = formatFiatFromDigits(fiatDigits, decimalChar); @@ -241,27 +234,12 @@ }; const arrow = "<"; - const numPad = [ - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "00", - "0", - arrow, - ]; + const numPad = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "00", "0", arrow]; onMount(() => { fiat = $fiatStore; if (fiat) { - const cents = Math.round( - (parseFloat(String(amountFiat) || "0") || 0) * 100, - ); + const cents = Math.round((parseFloat(String(amountFiat) || "0") || 0) * 100); fiatDigits = Math.max(0, cents).toString(); html = formatFiatFromDigits(fiatDigits, decimalChar); // keep html in sync on mount } else { @@ -275,17 +253,12 @@ <div class="flex justify-center items-center"> <div class="space-y-5 w-full"> <div class="text-center"> - <div - class="text-5xl md:text-6xl font-semibold tracking-widest flex justify-center" - > + <div class="text-5xl md:text-6xl font-semibold tracking-widest flex justify-center"> <div class="my-auto" class:text-5xl={!fiat}> {#if fiat} {#if position === "before"}{symbol}{/if} {:else} - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" ></iconify-icon> {/if} </div> @@ -330,11 +303,7 @@ }} > {#if fiat} - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> {s(amount, locale)} {:else} {f(amountFiat, currency, locale)} diff --git a/src/components/Password.svelte b/src/components/Password.svelte index 2c2319f6..3a7d71fe 100644 --- a/src/components/Password.svelte +++ b/src/components/Password.svelte @@ -24,24 +24,17 @@ </script> <div class="fixed inset-0 bg-base-100/90 overflow-y-auto h-full w-full z-50"> - <div - class="relative top-1/3 mx-auto p-5 border w-96 shadow-lg rounded-md bg-base-100 space-y-5" - > + <div class="relative top-1/3 mx-auto p-5 border w-96 shadow-lg rounded-md bg-base-100 space-y-5"> <h1 class="text-center text-2xl font-semibold"> {$t("user.settings.pleaseEnterYourPassword")} </h1> <form onsubmit={submit} class="space-y-2"> <PasswordInput bind:value={password} {focus} /> <div class="w-full flex gap-2"> - <button - type="button" - class="btn !w-auto grow" - onclick={cancel} - onkeydown={cancel}>{$t("payments.cancel")}</button - > - <button type="submit" class="btn btn-accent !w-auto grow" - >{$t("payments.submit")}</button + <button type="button" class="btn !w-auto grow" onclick={cancel} onkeydown={cancel} + >{$t("payments.cancel")}</button > + <button type="submit" class="btn btn-accent !w-auto grow">{$t("payments.submit")}</button> </div> </form> </div> diff --git a/src/components/PasswordInput.svelte b/src/components/PasswordInput.svelte index 3f784290..8d16aad6 100644 --- a/src/components/PasswordInput.svelte +++ b/src/components/PasswordInput.svelte @@ -15,21 +15,11 @@ let icon = $derived(show ? "ph:eye-bold" : "ph:eye-slash-bold"); </script> -<label - for="password" - class="input flex items-center justify-center gap-2 w-full" -> +<label for="password" class="input flex items-center justify-center gap-2 w-full"> {#if show} <input {name} type="text" bind:value class="clean" {placeholder} /> {:else} - <input - {name} - type="password" - bind:value - class="clean" - use:focus - {placeholder} - /> + <input {name} type="password" bind:value class="clean" use:focus {placeholder} /> {/if} <button type="button" aria-label="Toggle" onclick={toggle} class="contents"> <iconify-icon noobserver {icon} width="32"></iconify-icon> diff --git a/src/components/Payments.svelte b/src/components/Payments.svelte index 046356ca..ddbee1e0 100644 --- a/src/components/Payments.svelte +++ b/src/components/Payments.svelte @@ -18,8 +18,7 @@ class:border-b-0={i === payments.length - 1} class:text-error={amount < 0} onclick={() => goto(`/payment/${p.id}`)} - onkeydown={(e) => - (e.key === "Enter" || e.key === " ") && goto(`/payment/${p.id}`)} + onkeydown={(e) => (e.key === "Enter" || e.key === " ") && goto(`/payment/${p.id}`)} role="button" tabindex="0" > @@ -31,11 +30,7 @@ {f(Math.abs(amount) * (p.rate / sats), p.currency, locale)} </div> {:else} - <iconify-icon - noobserver - icon="ph:lightning-fill" - width="24" - class="text-yellow-300" + <iconify-icon noobserver icon="ph:lightning-fill" width="24" class="text-yellow-300" ></iconify-icon> <div>{s(Math.abs(amount), locale)}</div> {/if} @@ -49,9 +44,7 @@ {/if} </div> - <div - class="flex my-auto col-span-6 truncate text-ellipsis overflow-hidden mx-auto" - > + <div class="flex my-auto col-span-6 truncate text-ellipsis overflow-hidden mx-auto"> {#if p.type === types.fund} {#if fund} <div class="flex"> @@ -65,10 +58,7 @@ {:else} <a href={`/fund/${p.memo}`}> <div class="text-secondary flex"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-3xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-3xl" ></iconify-icon> <div class="my-auto">{$t("payments.fund")}</div> @@ -87,16 +77,12 @@ {:else} <div class="text-secondary flex items-center gap-1"> {#if p.type === types.lightning || p.type === types.bolt12} - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-3xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-3xl" ></iconify-icon> {:else if p.type === types.ecash} <img src="/images/cash.png" class="w-12" alt="Ecash" /> {:else if p.type === types.bitcoin} - <iconify-icon noobserver icon="logos:bitcoin" class="text-3xl" - ></iconify-icon> + <iconify-icon noobserver icon="logos:bitcoin" class="text-3xl"></iconify-icon> {:else if p.type === types.liquid} <div class="my-auto"> <img @@ -106,11 +92,7 @@ /> </div> {:else if p.type === types.ark} - <img - src="/images/ark.png" - class="w-10 h-10 rounded-full object-cover" - alt="Ark" - /> + <img src="/images/ark.png" class="w-10 h-10 rounded-full object-cover" alt="Ark" /> {/if} <div class="my-auto"> diff --git a/src/components/Pin.svelte b/src/components/Pin.svelte index 9c5d8664..72bbf78d 100644 --- a/src/components/Pin.svelte +++ b/src/components/Pin.svelte @@ -55,16 +55,12 @@ aria-labelledby="title" tabindex="-1" > - <div - class="mx-auto p-5 border shadow-lg rounded-md bg-base-100 space-y-5 max-w-lg" - > + <div class="mx-auto p-5 border shadow-lg rounded-md bg-base-100 space-y-5 max-w-lg"> <h1 id="title" class="text-center text-2xl font-semibold">{title}</h1> <Pinpad bind:v={p} {cancel} /> <div> - <label for="locktime" class="font-bold" - >{$t("user.settings.rememberFor")}</label - > + <label for="locktime" class="font-bold">{$t("user.settings.rememberFor")}</label> <select name="locktime" bind:value={locktime}> <option value={30}>30 {$t("user.settings.seconds")}</option> <option value={5 * 60}>5 {$t("user.settings.minutes")}</option> diff --git a/src/components/Pinpad.svelte b/src/components/Pinpad.svelte index 15dbc53e..3e9c490b 100644 --- a/src/components/Pinpad.svelte +++ b/src/components/Pinpad.svelte @@ -24,11 +24,7 @@ let validate = (e) => { let k = e.key || e.code; if (k === "Escape") cancel(); - if ( - e.key.length <= 1 && - !(e.metaKey || e.ctrlKey || e.altKey) && - !(k >= "0" && k <= "9") - ) { + if (e.key.length <= 1 && !(e.metaKey || e.ctrlKey || e.altKey) && !(k >= "0" && k <= "9")) { if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } @@ -43,9 +39,7 @@ }; </script> -<label - class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2" -> +<label class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2"> {#if hide} <input onkeydown={validate} @@ -73,10 +67,7 @@ onclick={toggle} aria-label={hide ? "Show PIN" : "Hide PIN"} > - <iconify-icon - noobserver - icon={hide ? "ph:eye-slash-bold" : "ph:eye-bold"} - width="32" + <iconify-icon noobserver icon={hide ? "ph:eye-slash-bold" : "ph:eye-bold"} width="32" ></iconify-icon></button > </label> @@ -88,9 +79,7 @@ <Left /> </button> {:else} - <button type="button" class="btn" onclick={(e) => handleInput(e, value)} - >{value}</button - > + <button type="button" class="btn" onclick={(e) => handleInput(e, value)}>{value}</button> {/if} {/each} </div> diff --git a/src/components/Popup.svelte b/src/components/Popup.svelte index e696c5cc..58b37eae 100644 --- a/src/components/Popup.svelte +++ b/src/components/Popup.svelte @@ -4,11 +4,7 @@ let { tags } = $props(); let addr = (tags) => { - let { - "addr:housenumber": house, - "addr:street": street, - "addr:city": city, - } = tags; + let { "addr:housenumber": house, "addr:street": street, "addr:city": city } = tags; if (house) return `${house} ${street}`; return ""; }; diff --git a/src/components/Qr.svelte b/src/components/Qr.svelte index 37b1708c..c2014348 100644 --- a/src/components/Qr.svelte +++ b/src/components/Qr.svelte @@ -22,8 +22,7 @@ class="w-72 sm:w-80 mx-auto cursor-pointer" bind:this={qr} onclick={() => screenfull?.toggle?.(qr)} - onkeydown={(e) => - (e.key === "Enter" || e.key === " ") && screenfull?.toggle?.(qr)} + onkeydown={(e) => (e.key === "Enter" || e.key === " ") && screenfull?.toggle?.(qr)} role="button" tabindex="0" aria-label="Toggle fullscreen QR" diff --git a/src/components/SetAmount.svelte b/src/components/SetAmount.svelte index ce58e146..c339aa7d 100644 --- a/src/components/SetAmount.svelte +++ b/src/components/SetAmount.svelte @@ -21,33 +21,14 @@ {#if settingAmount} <div class="fixed inset-0 bg-base-100/90 overflow-y-auto h-full w-full z-50"> - <div - class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-5" - > + <div class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-5"> <form onsubmit={setAmount} class="space-y-5"> - <Numpad - bind:amount={newAmount} - bind:fiat - {currency} - {rate} - {submit} - {locale} - /> + <Numpad bind:amount={newAmount} bind:fiat {currency} {rate} {submit} {locale} /> <div class="w-full flex flex-wrap gap-2"> - <button - bind:this={submit} - type="submit" - onclick={setAmount} - class="btn btn-accent" - > + <button bind:this={submit} type="submit" onclick={setAmount} class="btn btn-accent"> <div class="my-auto">{t("payments.ok")}</div> </button> - <button - type="button" - class="btn" - onclick={toggleAmount} - onkeydown={toggleAmount} - > + <button type="button" class="btn" onclick={toggleAmount} onkeydown={toggleAmount}> <div class="my-auto">{t("payments.cancel")}</div> </button> </div> diff --git a/src/components/SetMemo.svelte b/src/components/SetMemo.svelte index 54921f56..e9f2524b 100644 --- a/src/components/SetMemo.svelte +++ b/src/components/SetMemo.svelte @@ -1,38 +1,19 @@ <script lang="ts"> import { focus } from "$lib/utils"; - let { - submit = $bindable(), - settingMemo, - setMemo, - memo = $bindable(), - toggleMemo, - t, - } = $props(); + let { submit = $bindable(), settingMemo, setMemo, memo = $bindable(), toggleMemo, t } = $props(); </script> {#if settingMemo} <div class="fixed inset-0 bg-base-100/90 overflow-y-auto h-full w-full z-50"> - <div - class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-5" - > + <div class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-5"> <form onsubmit={setMemo} class="space-y-5"> <input use:focus placeholder={t("invoice.memo")} bind:value={memo} /> <div class="w-full flex flex-wrap gap-2"> - <button - bind:this={submit} - type="submit" - onclick={setMemo} - class="btn btn-accent" - > + <button bind:this={submit} type="submit" onclick={setMemo} class="btn btn-accent"> <div class="my-auto">{t("payments.ok")}</div> </button> - <button - type="button" - class="btn" - onclick={toggleMemo} - onkeydown={toggleMemo} - > + <button type="button" class="btn" onclick={toggleMemo} onkeydown={toggleMemo}> <div class="my-auto">{t("payments.cancel")}</div> </button> </div> diff --git a/src/components/SetType.svelte b/src/components/SetType.svelte index d06ca345..5794700d 100644 --- a/src/components/SetType.svelte +++ b/src/components/SetType.svelte @@ -18,18 +18,8 @@ {#if settingType} <div class="fixed inset-0 bg-base-100/90 overflow-y-auto h-full w-full z-50"> - <div - class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-2" - > - <InvoiceTypes - bind:newAmount - {setAmount} - {invoice} - {user} - {setType} - {toggleType} - {t} - /> + <div class="relative mx-auto p-12 max-w-xl shadow-lg rounded-md bg-base-100 space-y-2"> + <InvoiceTypes bind:newAmount {setAmount} {invoice} {user} {setType} {toggleType} {t} /> </div> </div> {/if} diff --git a/src/components/Slider.svelte b/src/components/Slider.svelte index 846d32a6..946878ee 100644 --- a/src/components/Slider.svelte +++ b/src/components/Slider.svelte @@ -9,12 +9,4 @@ let { value = $bindable(), handle, min = 0, max = 100 }: Props = $props(); </script> -<input - id="slider" - type="range" - {min} - {max} - bind:value - class="range w-full" - oninput={handle} -/> +<input id="slider" type="range" {min} {max} bind:value class="range w-full" oninput={handle} /> diff --git a/src/components/Spinner.svelte b/src/components/Spinner.svelte index e9c3348f..f08cb3f3 100644 --- a/src/components/Spinner.svelte +++ b/src/components/Spinner.svelte @@ -4,14 +4,7 @@ fill="none" viewBox="0 0 24 24" > - <circle - class="opacity-25" - cx="12" - cy="12" - r="10" - stroke="currentColor" - stroke-width="4" - /> + <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" /> <path class="opacity-75" fill="currentColor" diff --git a/src/components/Success.svelte b/src/components/Success.svelte index ae54b6c1..bd3214ce 100644 --- a/src/components/Success.svelte +++ b/src/components/Success.svelte @@ -2,14 +2,7 @@ import { browser } from "$app/environment"; import { scale } from "svelte/transition"; import Amount from "$comp/Amount.svelte"; - const { - amount, - tip = undefined, - rate, - currency, - locale, - title = "", - }: any = $props(); + const { amount, tip = undefined, rate, currency, locale, title = "" }: any = $props(); let ConfettiComp: any = $state(null); let loaded = $state(false); diff --git a/src/components/Toggle.svelte b/src/components/Toggle.svelte index 3f725d08..8aee2829 100644 --- a/src/components/Toggle.svelte +++ b/src/components/Toggle.svelte @@ -3,13 +3,7 @@ </script> <label for={id} class="inline-flex relative items-center mr-5 cursor-pointer"> - <input - type="checkbox" - bind:checked={value} - {id} - name={id} - class="sr-only peer" - /> + <input type="checkbox" bind:checked={value} {id} name={id} class="sr-only peer" /> <div class="w-11 h-6 bg-gray-200 rounded-full peer dark:bg-gray-700 peer-focus:ring-4 peer-focus:ring-gray-300 dark:peer-focus:ring-gray-800 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-green-500" ></div> diff --git a/src/components/WalletPass.svelte b/src/components/WalletPass.svelte index 9e0b6cd2..cc9e2bbd 100644 --- a/src/components/WalletPass.svelte +++ b/src/components/WalletPass.svelte @@ -24,9 +24,7 @@ </script> <div class="fixed inset-0 bg-gray-600/50 overflow-y-auto h-full w-full z-20"> - <div - class="relative top-1/3 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white space-y-5" - > + <div class="relative top-1/3 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white space-y-5"> <h1 class="text-center text-2xl font-semibold"> {$t("payments.enterWalletPass")} </h1> @@ -66,15 +64,12 @@ </button> </div> <div class="mb-5 space-y-2"> - <label for="rememberFor" class="text-sm text-gray-500"> - Remember for - </label> + <label for="rememberFor" class="text-sm text-gray-500"> Remember for </label> <select id="rememberFor" class="w-full" value={rememberForMs} - onchange={(e) => - (rememberForMs = Number((e.target as HTMLSelectElement).value))} + onchange={(e) => (rememberForMs = Number((e.target as HTMLSelectElement).value))} > {#each rememberForOptions as option} <option value={option.ms}>{option.label}</option> diff --git a/src/lib/ark.ts b/src/lib/ark.ts index 51e378c3..61668c3a 100644 --- a/src/lib/ark.ts +++ b/src/lib/ark.ts @@ -95,14 +95,11 @@ export const syncTransactions = async (aid: string) => { return post("/post/ark/sync", { transactions, aid }); }; -export const vtxoKey = (v: { txid: string; vout: number }) => - `${v.txid}:${v.vout}`; +export const vtxoKey = (v: { txid: string; vout: number }) => `${v.txid}:${v.vout}`; export const getProcessedVtxos = (): Set<string> => { try { - return new Set( - JSON.parse(localStorage.getItem("processedArkVtxos") || "[]"), - ); + return new Set(JSON.parse(localStorage.getItem("processedArkVtxos") || "[]")); } catch { return new Set(); } diff --git a/src/lib/bip21.ts b/src/lib/bip21.ts index 842782a5..674fa714 100644 --- a/src/lib/bip21.ts +++ b/src/lib/bip21.ts @@ -12,10 +12,7 @@ export function decode(uri, allowedSchemes = ["bitcoin", "liquidnetwork"]) { // Extract address and query string const queryStart = uri.indexOf("?"); - const address = uri.slice( - split + 1, - queryStart === -1 ? undefined : queryStart, - ); + const address = uri.slice(split + 1, queryStart === -1 ? undefined : queryStart); const query = queryStart === -1 ? "" : uri.slice(queryStart + 1); const options = Object.fromEntries(new URLSearchParams(query)); @@ -28,11 +25,7 @@ export function decode(uri, allowedSchemes = ["bitcoin", "liquidnetwork"]) { return { scheme: urnScheme, address, options }; } -export function encode( - address, - options = { amount: "" }, - urnScheme = "bitcoin", -) { +export function encode(address, options = { amount: "" }, urnScheme = "bitcoin") { if (!address || typeof address !== "string") { throw new TypeError("Invalid address"); } diff --git a/src/lib/invoice.ts b/src/lib/invoice.ts index 015f2837..25741639 100644 --- a/src/lib/invoice.ts +++ b/src/lib/invoice.ts @@ -30,8 +30,7 @@ export default async ({ cookies, request }) => { invoice = await post("/invoice", { invoice, user }, auth(cookies)); const { id } = invoice; - if (invoice.prompt && invoice.tip === null) - redirect(307, `/invoice/${id}/tip`); + if (invoice.prompt && invoice.tip === null) redirect(307, `/invoice/${id}/tip`); if (invoice.memoPrompt && !invoice.memo) { redirect(307, `/invoice/${id}/memo`); diff --git a/src/lib/nip07.ts b/src/lib/nip07.ts index 4b32512f..c26226d9 100644 --- a/src/lib/nip07.ts +++ b/src/lib/nip07.ts @@ -15,16 +15,9 @@ export const signEvent = async (event: any, user: any): Promise<any> => { }; // Encrypts an event in NIP-44 using NIP-07 if available, otherwise getPrivateKey() -export const encrypt = async ( - json: any, - user: any, - receiverPK: string, -): Promise<string> => { +export const encrypt = async (json: any, user: any, receiverPK: string): Promise<string> => { if ((await (window as any).nostr.getPublicKey()) === user.pubkey) { - return (window as any).nostr.nip44.encrypt( - receiverPK, - JSON.stringify(json), - ); + return (window as any).nostr.nip44.encrypt(receiverPK, JSON.stringify(json)); } else { const senderSK = await getPrivateKey(user); const senderSKString = bytesToHex(senderSK); @@ -34,15 +27,9 @@ export const encrypt = async ( }; // Decrypts an event in NIP-44 using NIP-07 if available, otherwise getPrivateKey() -export const decrypt = async ( - encrypted: string, - user: any, - receiverPK: string, -): Promise<any> => { +export const decrypt = async (encrypted: string, user: any, receiverPK: string): Promise<any> => { if ((await (window as any).nostr.getPublicKey()) === user.pubkey) { - return JSON.parse( - await (window as any).nostr.nip44.decrypt(receiverPK, encrypted), - ); + return JSON.parse(await (window as any).nostr.nip44.decrypt(receiverPK, encrypted)); } else { const senderSK = await getPrivateKey(user); const senderSKString = bytesToHex(senderSK); diff --git a/src/lib/nip17.ts b/src/lib/nip17.ts index 32a18bd8..49312783 100644 --- a/src/lib/nip17.ts +++ b/src/lib/nip17.ts @@ -1,11 +1,6 @@ import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js"; -import { - finalizeEvent, - getEventHash, - generateSecretKey, - getPublicKey, -} from "nostr-tools/pure"; +import { finalizeEvent, getEventHash, generateSecretKey, getPublicKey } from "nostr-tools/pure"; import { SimplePool } from "nostr-tools/pool"; import { Relay } from "nostr-tools/relay"; import { unwrapEvent } from "nostr-tools/nip17"; @@ -17,8 +12,7 @@ import { eventToSign, signer } from "$lib/store"; import { get } from "svelte/store"; const TWO_DAYS = 2 * 24 * 60 * 60; -const randomTimestamp = () => - Math.floor(Date.now() / 1000 - Math.random() * TWO_DAYS); +const randomTimestamp = () => Math.floor(Date.now() / 1000 - Math.random() * TWO_DAYS); const pool = new SimplePool(); let relayListCache = new Map(); @@ -43,11 +37,7 @@ const ensureSigner = async (userPubkey: string): Promise<Uint8Array | null> => { // Check if signer already has a valid sk (64 hex chars = 32 bytes) const currentSigner: any = get(signer); - if ( - currentSigner?.ready && - currentSigner?.params?.sk && - currentSigner.params.sk.length === 64 - ) { + if (currentSigner?.ready && currentSigner?.params?.sk && currentSigner.params.sk.length === 64) { return hexToBytes(currentSigner.params.sk); } @@ -112,12 +102,7 @@ export const createNIP17MessageSK = ( expiryDays: number | null = null, ) => { const rumour = createRumour(text, getPublicKey(senderSK), receiverPK); - const sealed = sealRumourSK( - rumour, - senderSK, - wrapPK || receiverPK, - expiryDays, - ); + const sealed = sealRumourSK(rumour, senderSK, wrapPK || receiverPK, expiryDays); return giftWrap(sealed, wrapPK || receiverPK, expiryDays); }; @@ -136,11 +121,7 @@ export const createNIP17MessageNIP07 = async ( expiryDays: number | null = null, ) => { const rumour = createRumour(text, senderPK, receiverPK); - const sealed = await sealRumourNip07( - rumour, - wrapPK || receiverPK, - expiryDays, - ); + const sealed = await sealRumourNip07(rumour, wrapPK || receiverPK, expiryDays); return giftWrap(sealed, wrapPK || receiverPK, expiryDays); }; @@ -207,16 +188,9 @@ const sealRumourNip07 = async ( return (window as any).nostr.signEvent(sealEvent); }; -const giftWrap = ( - event: any, - receiverPK: string, - expiryDays: number | null = null, -) => { +const giftWrap = (event: any, receiverPK: string, expiryDays: number | null = null) => { const secretKey = generateSecretKey(); - const conversationKey = u.getConversationKey( - bytesToHex(secretKey), - receiverPK, - ); + const conversationKey = u.getConversationKey(bytesToHex(secretKey), receiverPK); const encryptedEvent = encrypt(JSON.stringify(event), conversationKey); const created = randomTimestamp(); @@ -236,15 +210,9 @@ const giftWrap = ( }; const decryptNIP17MessageNIP07 = async (wrapped: any): Promise<any> => { - const sealedText = await (window as any).nostr.nip44.decrypt( - wrapped.pubkey, - wrapped.content, - ); + const sealedText = await (window as any).nostr.nip44.decrypt(wrapped.pubkey, wrapped.content); const sealed = JSON.parse(sealedText); - const rumourText = await (window as any).nostr.nip44.decrypt( - sealed.pubkey, - sealed.content, - ); + const rumourText = await (window as any).nostr.nip44.decrypt(sealed.pubkey, sealed.content); return JSON.parse(rumourText); }; @@ -373,9 +341,7 @@ const publishToPreferred = async ( throw new Error("No relays available to publish to"); } - const promises = preferredRelays.map((url) => - publishWithAuth(url, event, currentSk), - ); + const promises = preferredRelays.map((url) => publishWithAuth(url, event, currentSk)); try { return await (Promise as any).any(promises); } catch (e) { @@ -387,12 +353,7 @@ const publishToPreferred = async ( // Sends a NIP-17 message from `user` to `recipient`. // If expiryDays is set, messages will expire after that many days. -export const send = async ( - message: string, - user: any, - recipient: any, - expiryDays?: number, -) => { +export const send = async (message: string, user: any, recipient: any, expiryDays?: number) => { let event1, event2; const sk = await ensureSigner(user.pubkey); @@ -416,20 +377,8 @@ export const send = async ( expiryDays, ); } else { - event1 = createNIP17MessageSK( - message, - sk, - recipient.pubkey, - recipient.pubkey, - expiryDays, - ); - event2 = createNIP17MessageSK( - message, - sk, - recipient.pubkey, - user.pubkey, - expiryDays, - ); + event1 = createNIP17MessageSK(message, sk, recipient.pubkey, recipient.pubkey, expiryDays); + event2 = createNIP17MessageSK(message, sk, recipient.pubkey, user.pubkey, expiryDays); } const p1 = publishToPreferred(event1, recipient.pubkey, expiryDays != null); diff --git a/src/lib/nip44.ts b/src/lib/nip44.ts index e05fc685..f1f872b5 100644 --- a/src/lib/nip44.ts +++ b/src/lib/nip44.ts @@ -5,10 +5,7 @@ import { chacha20 } from "@noble/ciphers/chacha.js"; import { equalBytes } from "@noble/ciphers/utils.js"; import { secp256k1 } from "@noble/curves/secp256k1.js"; -import { - extract as hkdf_extract, - expand as hkdf_expand, -} from "@noble/hashes/hkdf.js"; +import { extract as hkdf_extract, expand as hkdf_expand } from "@noble/hashes/hkdf.js"; import { hmac } from "@noble/hashes/hmac.js"; import { sha256 } from "@noble/hashes/sha2.js"; import { concatBytes, randomBytes, utf8ToBytes } from "@noble/hashes/utils.js"; @@ -27,9 +24,7 @@ export const u = { }, getConversationKey(privkeyA: string, pubkeyB: string): Uint8Array { - const sharedX = secp256k1 - .getSharedSecret(privkeyA, "02" + pubkeyB) - .subarray(1, 33); + const sharedX = secp256k1.getSharedSecret(privkeyA, "02" + pubkeyB).subarray(1, 33); return hkdf_extract(sha256, sharedX, "nip44-v2"); }, @@ -45,8 +40,7 @@ export const u = { }, calcPaddedLen(len: number): number { - if (!Number.isSafeInteger(len) || len < 1) - throw new Error("expected positive integer"); + if (!Number.isSafeInteger(len) || len < 1) throw new Error("expected positive integer"); if (len <= 32) return 32; const nextPower = 1 << (Math.floor(Math.log2(len - 1)) + 1); const chunk = nextPower <= 256 ? 32 : nextPower / 8; @@ -54,14 +48,8 @@ export const u = { }, writeU16BE(num: number) { - if ( - !Number.isSafeInteger(num) || - num < u.minPlaintextSize || - num > u.maxPlaintextSize - ) - throw new Error( - "invalid plaintext size: must be between 1 and 65535 bytes", - ); + if (!Number.isSafeInteger(num) || num < u.minPlaintextSize || num > u.maxPlaintextSize) + throw new Error("invalid plaintext size: must be between 1 and 65535 bytes"); const arr = new Uint8Array(2); new DataView(arr.buffer).setUint16(0, num, false); return arr; @@ -89,8 +77,7 @@ export const u = { }, hmacAad(key: Uint8Array, message: Uint8Array, aad: Uint8Array) { - if (aad.length !== 32) - throw new Error("AAD associated data must be 32 bytes"); + if (aad.length !== 32) throw new Error("AAD associated data must be 32 bytes"); const combined = concatBytes(aad, message); return hmac(sha256, key, combined); }, @@ -102,11 +89,9 @@ export const u = { // raw payload: 99 (65+32+2) to 65603 (65+0xffff+2) // compressed payload (base64): 132b to 87472b decodePayload(payload: string) { - if (typeof payload !== "string") - throw new Error("payload must be a valid string"); + if (typeof payload !== "string") throw new Error("payload must be a valid string"); const plen = payload.length; - if (plen < 132 || plen > 87472) - throw new Error("invalid payload length: " + plen); + if (plen < 132 || plen > 87472) throw new Error("invalid payload length: " + plen); if (payload[0] === "#") throw new Error("unknown encryption version"); let data: Uint8Array; try { @@ -115,8 +100,7 @@ export const u = { throw new Error("invalid base64: " + (error as any).message); } const dlen = data.length; - if (dlen < 99 || dlen > 65603) - throw new Error("invalid data length: " + dlen); + if (dlen < 99 || dlen > 65603) throw new Error("invalid data length: " + dlen); const vers = data[0]; if (vers !== 2) throw new Error("unknown encryption version " + vers); return { @@ -132,24 +116,16 @@ export function encrypt( conversationKey: Uint8Array, nonce = randomBytes(32), ): string { - const { chacha_key, chacha_nonce, hmac_key } = u.getMessageKeys( - conversationKey, - nonce, - ); + const { chacha_key, chacha_nonce, hmac_key } = u.getMessageKeys(conversationKey, nonce); const padded = u.pad(plaintext); const ciphertext = chacha20(chacha_key, chacha_nonce, padded); const mac = u.hmacAad(hmac_key, ciphertext, nonce); - return base64.encode( - concatBytes(new Uint8Array([2]), nonce, ciphertext, mac), - ); + return base64.encode(concatBytes(new Uint8Array([2]), nonce, ciphertext, mac)); } export function decrypt(payload: string, conversationKey: Uint8Array): string { const { nonce, ciphertext, mac } = u.decodePayload(payload); - const { chacha_key, chacha_nonce, hmac_key } = u.getMessageKeys( - conversationKey, - nonce, - ); + const { chacha_key, chacha_nonce, hmac_key } = u.getMessageKeys(conversationKey, nonce); const calculatedMac = u.hmacAad(hmac_key, ciphertext, nonce); if (!equalBytes(calculatedMac, mac)) throw new Error("invalid MAC"); const padded = chacha20(chacha_key, chacha_nonce, ciphertext); diff --git a/src/lib/nip51.ts b/src/lib/nip51.ts index 7560dd3d..05de1947 100644 --- a/src/lib/nip51.ts +++ b/src/lib/nip51.ts @@ -57,17 +57,11 @@ const getMuteLists = async (user: any): Promise<any> => { return { shown: listEvents[0].tags, hidden: - listEvents[0].content == "" - ? [] - : await decrypt(listEvents[0].content, user, user.pubkey), + listEvents[0].content == "" ? [] : await decrypt(listEvents[0].content, user, user.pubkey), }; }; -const publishMuteList = async ( - user: any, - shown: string[], - hidden: string[], -) => { +const publishMuteList = async (user: any, shown: string[], hidden: string[]) => { const event = await signEvent( { kind: 10000, diff --git a/src/lib/nostr.ts b/src/lib/nostr.ts index 50df6408..2a8975ec 100644 --- a/src/lib/nostr.ts +++ b/src/lib/nostr.ts @@ -46,11 +46,7 @@ export const decrypt = async ({ event, user }: { event: any; user: any }) => { if (pubkey === user.pubkey) pubkey = event.tags[0][1]; const { nip04 } = await loadNostrTools(); - const message = await nip04.decrypt( - await getPrivateKey(user), - pubkey, - content, - ); + const message = await nip04.decrypt(await getPrivateKey(user), pubkey, content); cache[id] = Buffer.from(message).toString("utf8"); decrypted.set(cache); @@ -151,10 +147,7 @@ const getPassword = async (): Promise<string> => { export const nostrConnectRelay = "wss://relay.nsec.app"; -const signingMethods: Record< - string, - (event: any, params: any) => Promise<any> -> = { +const signingMethods: Record<string, (event: any, params: any) => Promise<any>> = { async connect(event: any, { sk, pk, pubkey }: any) { const id = crypto.randomUUID(); const signEvent = { @@ -191,8 +184,7 @@ const signingMethods: Record< const { nip04 } = await loadNostrTools(); response = JSON.parse(await nip04.decrypt(sk, pk, event.content)); } catch { - const { getConversationKey, decrypt: nip44decrypt } = - await loadNip44(); + const { getConversationKey, decrypt: nip44decrypt } = await loadNip44(); const ck = await getConversationKey(sk, pk); response = JSON.parse(await nip44decrypt(event.content, ck)); } diff --git a/src/lib/parse.ts b/src/lib/parse.ts index 38c32a54..2af661a3 100644 --- a/src/lib/parse.ts +++ b/src/lib/parse.ts @@ -3,11 +3,8 @@ import { decode } from "$lib/bip21"; import { auth, get, isLiquid, post, sats } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; -let validatePromise: - | Promise<typeof import("bitcoin-address-validation")> - | undefined; -const loadValidate = () => - (validatePromise ||= import("bitcoin-address-validation")); +let validatePromise: Promise<typeof import("bitcoin-address-validation")> | undefined; +const loadValidate = () => (validatePromise ||= import("bitcoin-address-validation")); export default async (s, host, cookies) => { if (!s) return; @@ -16,8 +13,7 @@ export default async (s, host, cookies) => { let invoice; let user; - if (t.startsWith("ark") || t.startsWith("tark")) - redirect(307, `/send/ark/${t}`); + if (t.startsWith("ark") || t.startsWith("tark")) redirect(307, `/send/ark/${t}`); if (t.startsWith("http")) redirect(307, t); if (t.startsWith(host)) redirect(307, `http://${t}`); @@ -44,10 +40,7 @@ export default async (s, host, cookies) => { if (["nprofile", "npub"].some((p) => t.startsWith(p))) redirect(307, `/${t}`); // bitcoin - if ( - t.toLowerCase().startsWith("bitcoin:") || - t.toLowerCase().startsWith("liquidnetwork:") - ) { + if (t.toLowerCase().startsWith("bitcoin:") || t.toLowerCase().startsWith("liquidnetwork:")) { ({ address: t, options: { amount }, @@ -62,8 +55,7 @@ export default async (s, host, cookies) => { } // lightning - if (t.toLowerCase().startsWith("lightning:")) - t = t.toLowerCase().replace("lightning:", ""); + if (t.toLowerCase().startsWith("lightning:")) t = t.toLowerCase().replace("lightning:", ""); if (t.toLowerCase().startsWith("lnurl")) redirect(307, `/ln/${t}`); if (t.includes(":")) t = t.split(":")[1]; diff --git a/src/lib/passwordCache.ts b/src/lib/passwordCache.ts index a67113e3..5a2a4796 100644 --- a/src/lib/passwordCache.ts +++ b/src/lib/passwordCache.ts @@ -34,14 +34,9 @@ const loadStoredPassword = () => { return password; }; -export const walletPassword = writable<string | undefined>( - loadStoredPassword(), -); +export const walletPassword = writable<string | undefined>(loadStoredPassword()); -export const rememberWalletPassword = ( - password: string, - durationMs: number, -) => { +export const rememberWalletPassword = (password: string, durationMs: number) => { if (!browser) return; if (!durationMs) { clearStoredPassword(); diff --git a/src/lib/random.ts b/src/lib/random.ts index 605471ac..4c8dbda3 100644 --- a/src/lib/random.ts +++ b/src/lib/random.ts @@ -1,9 +1,4 @@ -import { - NumberDictionary, - animals, - colors, - uniqueNamesGenerator, -} from "unique-names-generator"; +import { NumberDictionary, animals, colors, uniqueNamesGenerator } from "unique-names-generator"; export const randomName = () => uniqueNamesGenerator({ diff --git a/src/lib/store.ts b/src/lib/store.ts index e14d107f..3d688535 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -3,9 +3,7 @@ import { writable } from "svelte/store"; export const persistSession = (key, defaultValue = undefined) => { const s = writable( - browser && - sessionStorage.getItem(key) && - sessionStorage.getItem(key) !== "undefined" + browser && sessionStorage.getItem(key) && sessionStorage.getItem(key) !== "undefined" ? JSON.parse(sessionStorage.getItem(key) || "") : defaultValue, ); @@ -19,9 +17,7 @@ export const persistSession = (key, defaultValue = undefined) => { export const persistLocal = (key, defaultValue: any = undefined) => { const s = writable( - browser && - localStorage.getItem(key) && - localStorage.getItem(key) !== "undefined" + browser && localStorage.getItem(key) && localStorage.getItem(key) !== "undefined" ? JSON.parse(localStorage.getItem(key) || "") : defaultValue, ); @@ -46,9 +42,7 @@ export const persistLocal = (key, defaultValue: any = undefined) => { export const persistLocalValue = (key, defaultValue: any = undefined) => { const s = writable( - browser && - localStorage.getItem(key) && - localStorage.getItem(key) !== "undefined" + browser && localStorage.getItem(key) && localStorage.getItem(key) !== "undefined" ? JSON.parse(localStorage.getItem(key) || "") : defaultValue, ); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index ebec6caa..c1514d6b 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -31,8 +31,7 @@ const ipHeaders = (): Record<string, string> => { return ip ? { "cf-connecting-ip": ip } : {}; }; -export const punk = (k: string) => - `${Math.floor((parseInt(k.slice(-2), 16) / 256) * 64) + 1}.webp`; +export const punk = (k: string) => `${Math.floor((parseInt(k.slice(-2), 16) / 256) * 64) + 1}.webp`; export const g = (url: string, fetch: any, headers: object) => fetch(base + url, { headers: { ...ipHeaders(), ...headers } }) @@ -234,17 +233,14 @@ export const isInvalidTokenError = (e: unknown) => { ); }; -export const btc = (fiat: number, rate: number): number => - Math.round((fiat * sats) / rate); +export const btc = (fiat: number, rate: number): number => Math.round((fiat * sats) / rate); -export const toFiat = (amount: number, rate: number): number => - (amount * rate) / sats; +export const toFiat = (amount: number, rate: number): number => (amount * rate) / sats; export const fd = async (req: Request): Promise<any> => { const obj: Record<string, any> = Object.fromEntries(await req.formData()); for (const k in obj) - (obj[k] === "undefined" && (obj[k] = undefined)) || - (obj[k] === "false" && (obj[k] = false)); + (obj[k] === "undefined" && (obj[k] = undefined)) || (obj[k] === "false" && (obj[k] = false)); return obj; }; @@ -338,8 +334,7 @@ export const f = ( const l = typeof locale === "function" ? locale() : locale || "en-US"; const cur = currency || "USD"; const region = l.length >= 2 ? l.slice(-2) : ""; - const currencyDisplay = - region && cur.startsWith(region) ? "narrowSymbol" : "symbol"; + const currencyDisplay = region && cur.startsWith(region) ? "narrowSymbol" : "symbol"; return new Intl.NumberFormat(l, { style: "currency", currency: cur, @@ -356,11 +351,7 @@ export const s = (s: number, locale = "en-US"): string => { export const sat = (s: number): string => `${si(Math.abs(s)).toString()}`; -export const si = ( - n: number, - minimumFractionDigits = 1, - maximumFractionDigits = 2, -) => { +export const si = (n: number, minimumFractionDigits = 1, maximumFractionDigits = 2) => { const units = ["", "K", "M", "G", "T", "P", "E", "Z"]; let s = n; @@ -380,8 +371,7 @@ export const si = ( export const sats = 100000000; -export const back = (): any => - browser && (history.length ? history.go(-1) : goto("/")); +export const back = (): any => browser && (history.length ? history.go(-1) : goto("/")); export const focus = (el: HTMLElement): any => browser && screen.width > 1280 && setTimeout(() => el.focus(), 1); @@ -389,8 +379,7 @@ export const focus = (el: HTMLElement): any => export const select = (el: HTMLInputElement): any => browser && screen.width > 1280 && setTimeout(() => el.select(), 1); -export const sleep = (n: number): Promise<void> => - new Promise((r) => setTimeout(r, n)); +export const sleep = (n: number): Promise<void> => new Promise((r) => setTimeout(r, n)); export const wait = async ( f: () => boolean | Promise<boolean>, @@ -417,8 +406,7 @@ export const types = { bolt12: "bolt12", }; -export const ease = (t: number): number => - t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t; +export const ease = (t: number): number => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t); export function shuffleArray<T>(array: T[]): void { for (let i = array.length - 1; i > 0; i--) { @@ -428,9 +416,7 @@ export function shuffleArray<T>(array: T[]): void { } export const closest = (a: number[], n: number): number => - a.reduce((prev, curr) => - Math.abs(curr - n) < Math.abs(prev - n) ? curr : prev, - ); + a.reduce((prev, curr) => (Math.abs(curr - n) < Math.abs(prev - n) ? curr : prev)); export const isLiquid = (text: string): boolean => text.startsWith("Az") || @@ -439,8 +425,7 @@ export const isLiquid = (text: string): boolean => text.startsWith("VT") || text.startsWith("XR") || text.startsWith("XC") || - ((text.startsWith("H") || text.startsWith("G") || text.startsWith("Q")) && - text.length === 34) || + ((text.startsWith("H") || text.startsWith("G") || text.startsWith("Q")) && text.length === 34) || (text.startsWith("ert1q") && text.length === 43) || (text.startsWith("ex1q") && text.length === 42) || text.startsWith("el1qq") || diff --git a/src/routes/(app)/+layout.server.ts b/src/routes/(app)/+layout.server.ts index 3b29df70..11114ebd 100644 --- a/src/routes/(app)/+layout.server.ts +++ b/src/routes/(app)/+layout.server.ts @@ -50,11 +50,7 @@ export async function load({ cookies, request, url, params }) { redirect(307, "/migrate"); } - if ( - user && - ["/login", "/register"].includes(pathname) && - request.method === "GET" - ) { + if (user && ["/login", "/register"].includes(pathname) && request.method === "GET") { redirect(307, `/${user.username}`); } diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 346cc93e..6ac9bed5 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -24,12 +24,7 @@ import Password from "$comp/Password.svelte"; import { s, f, toFiat, success, getCookie, warning } from "$lib/utils"; import { t, locale, loading } from "$lib/translations"; - import { - goto, - invalidate, - afterNavigate, - preloadData, - } from "$app/navigation"; + import { goto, invalidate, afterNavigate, preloadData } from "$app/navigation"; let { data, children } = $props(); @@ -63,9 +58,7 @@ if (result?.received > 0) { if ($fiat && $rateStore && user?.currency) { - success( - `Received ${f(toFiat(result.received, $rateStore), user.currency)}!`, - ); + success(`Received ${f(toFiat(result.received, $rateStore), user.currency)}!`); } else { success(`Received ⚡️${s(result.received)}!`); } diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 1bb9447f..6e6a318f 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -37,18 +37,14 @@ let stripped = $derived(n.replace(/\s/g, "")); let username = $derived(n.length > 60 ? n.substr(0, 6) : display || stripped); let lnaddr = $derived( - subject?.anon - ? subject.lud16 || undefined - : `${stripped}@${$page.url.host}`, + subject?.anon ? subject.lud16 || undefined : `${stripped}@${$page.url.host}`, ); let profile = $derived(`${$page.url.host}/${subject.anon ? npub : stripped}`); let lnurl = $derived( encode( "lnurl", toWords( - new TextEncoder().encode( - `https://${PUBLIC_DOMAIN}/p/${subject.anon ? npub : stripped}`, - ), + new TextEncoder().encode(`https://${PUBLIC_DOMAIN}/p/${subject.anon ? npub : stripped}`), ), 20000, ), @@ -57,33 +53,19 @@ <div class="container mx-auto w-full px-4 flex flex-wrap lg:flex-nowrap"> <div class="hidden lg:block lg:w-[280px] xl:w-[360px]"></div> - <div - class="w-full lg:w-[280px] xl:w-[360px] lg:absolute space-y-2 left-20 mx-auto" - > - <div - class="flex text-3xl font-bold text-center mx-auto justify-center gap-1 items-center" - > + <div class="w-full lg:w-[280px] xl:w-[360px] lg:absolute space-y-2 left-20 mx-auto"> + <div class="flex text-3xl font-bold text-center mx-auto justify-center gap-1 items-center"> <button class="flex gap-1 items-center" onclick={toggleDetails}> <div class="break-words">{display || username}</div> <iconify-icon noobserver icon="ph:list-bold" width="32"></iconify-icon> </button> {#if subject.id === user?.id} - <a - href="/settings/profile" - class="btn contents" - aria-label="Edit profile" - > - <iconify-icon noobserver icon="ph:pencil-bold" width="32" - ></iconify-icon> + <a href="/settings/profile" class="btn contents" aria-label="Edit profile"> + <iconify-icon noobserver icon="ph:pencil-bold" width="32"></iconify-icon> </a> {:else} - <a - href="/dm?username={subject.username}" - class="btn contents" - aria-label="Direct Message" - > - <iconify-icon noobserver icon="ph:chat-bold" width="32" - ></iconify-icon> + <a href="/dm?username={subject.username}" class="btn contents" aria-label="Direct Message"> + <iconify-icon noobserver icon="ph:chat-bold" width="32"></iconify-icon> </a> {/if} <!-- <a href={`/${subject.pubkey}/notes`}> --> @@ -128,16 +110,14 @@ aria-label="Copy lightning address" onclick={() => copy(lnaddr)} > - ><iconify-icon noobserver icon="ph:copy-bold" width="32" - ></iconify-icon></button + ><iconify-icon noobserver icon="ph:copy-bold" width="32"></iconify-icon></button > <a href={`/qr/${encodeURIComponent(lnaddr)}`} class="my-auto" aria-label="Show lightning address QR" > - <iconify-icon noobserver icon="ph:qr-code-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:qr-code-bold" width="32"></iconify-icon> </a> </div> </div> @@ -156,18 +136,14 @@ aria-label="Copy profile URL" onclick={() => copy(profile)} > - ><iconify-icon noobserver icon="ph:copy-bold" width="32" - ></iconify-icon></button + ><iconify-icon noobserver icon="ph:copy-bold" width="32"></iconify-icon></button > <a - href={`/qr/${encodeURIComponent( - `${$page.url.protocol}//${profile}`, - )}`} + href={`/qr/${encodeURIComponent(`${$page.url.protocol}//${profile}`)}`} class="my-auto" aria-label="Show profile URL QR" > - <iconify-icon noobserver icon="ph:qr-code-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:qr-code-bold" width="32"></iconify-icon> </a> </div> </div> @@ -185,16 +161,14 @@ aria-label="Copy LNURL" onclick={() => copy(`lightning:${lnurl}`)} > - ><iconify-icon noobserver icon="ph:copy-bold" width="32" - ></iconify-icon></button + ><iconify-icon noobserver icon="ph:copy-bold" width="32"></iconify-icon></button > <a href={`/${n}/accepted/${encodeURIComponent(`lightning:${lnurl}`)}`} class="my-auto" aria-label="Show LNURL QR" > - <iconify-icon noobserver icon="ph:qr-code-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:qr-code-bold" width="32"></iconify-icon> </a> </div> </div> @@ -259,8 +233,7 @@ aria-label="Reset password" > <div class="mx-auto flex"> - <iconify-icon noobserver icon="ph:clock" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:clock" width="32"></iconify-icon> </div> </button> </form> @@ -269,9 +242,7 @@ </div> <div class="w-full"> - <div - class="mx-auto space-y-5 lg:max-w-xl xl:max-w-2xl lg:pl-10 mt-5 lg:mt-0" - > + <div class="mx-auto space-y-5 lg:max-w-xl xl:max-w-2xl lg:pl-10 mt-5 lg:mt-0"> {@render children?.()} </div> </div> @@ -293,20 +264,12 @@ {#if satsPerCurrency >= 1} <div>{f(1, currency, locale)} =</div> <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> {s(satsPerCurrency)} </div> {:else} <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> 1 </div> <div>= {f(1 / satsPerCurrency, currency, locale)}</div> diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index fb4d6dd9..78816e36 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -73,8 +73,7 @@ aria-label={$t("accounts.addAccount")} title={$t("accounts.addAccount")} > - <iconify-icon noobserver icon="ph:plus-bold" width="28" - ></iconify-icon> + <iconify-icon noobserver icon="ph:plus-bold" width="28"></iconify-icon> </button> </a> </div> @@ -88,8 +87,7 @@ {#if $installPrompt} <button class="btn btn-accent lg:hidden" onclick={install}> - <iconify-icon noobserver icon="ph:floppy-disk-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:floppy-disk-bold" width="32"></iconify-icon> {$t("user.install")} </button> {/if} @@ -106,14 +104,8 @@ : `/pay/${subject.username}`} class="contents" > - <button - class="btn btn-accent !text-2xl items-center !w-full sm:!max-w-[400px] mx-auto" - > - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <button class="btn btn-accent !text-2xl items-center !w-full sm:!max-w-[400px] mx-auto"> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> <div> {$t("user.pay")} {subject.username} diff --git a/src/routes/(app)/[username]/(profile)/+page.ts b/src/routes/(app)/[username]/(profile)/+page.ts index 0a6c78b2..e6a3ffeb 100644 --- a/src/routes/(app)/[username]/(profile)/+page.ts +++ b/src/routes/(app)/[username]/(profile)/+page.ts @@ -5,6 +5,5 @@ import { get } from "svelte/store"; export const ssr = false; export async function load() { const sk = cookies.get("sk"); - if (sk && !get(signer)) - signer.set({ method: "nsec", params: { sk }, ready: true }); + if (sk && !get(signer)) signer.set({ method: "nsec", params: { sk }, ready: true }); } diff --git a/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte b/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte index ff4524e1..a9cc3e19 100644 --- a/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/notes/new/+page.svelte @@ -32,10 +32,7 @@ <div class="container px-4 max-w-xl mx-auto space-y-5"> <form method="POST" class="space-y-2 text-xl" onsubmit={submit}> - <textarea use:focus bind:value={content} placeholder={$t("notes.contents")} - ></textarea> - <button type="submit" class="btn btn-accent"> - {$t("payments.submit")}</button - > + <textarea use:focus bind:value={content} placeholder={$t("notes.contents")}></textarea> + <button type="submit" class="btn btn-accent"> {$t("payments.submit")}</button> </form> </div> diff --git a/src/routes/(app)/[username]/+layout.server.ts b/src/routes/(app)/[username]/+layout.server.ts index ab755410..5e921541 100644 --- a/src/routes/(app)/[username]/+layout.server.ts +++ b/src/routes/(app)/[username]/+layout.server.ts @@ -1,12 +1,7 @@ import { get } from "$lib/utils"; import { error } from "@sveltejs/kit"; -export const load = async ({ - cookies, - depends, - params: { username }, - parent, -}) => { +export const load = async ({ cookies, depends, params: { username }, parent }) => { depends("app:user"); try { diff --git a/src/routes/(app)/[username]/accepted/[text]/+page.svelte b/src/routes/(app)/[username]/accepted/[text]/+page.svelte index 339f6c9c..3e16177c 100644 --- a/src/routes/(app)/[username]/accepted/[text]/+page.svelte +++ b/src/routes/(app)/[username]/accepted/[text]/+page.svelte @@ -14,35 +14,23 @@ let lnurl = $derived( `https://${PUBLIC_DOMAIN}/ln/${encode( "lnurl", - toWords( - new TextEncoder().encode(`https://${PUBLIC_DOMAIN}/p/${username}`), - ), + toWords(new TextEncoder().encode(`https://${PUBLIC_DOMAIN}/p/${username}`)), 20000, )}`, ); </script> <div class="px-2"> - <div - class="border-8 border-black p-8 max-w-[580px] mx-auto mt-20 space-y-2 rounded-3xl relative" - > + <div class="border-8 border-black p-8 max-w-[580px] mx-auto mt-20 space-y-2 rounded-3xl relative"> <div class="flex gap-2 mx-auto justify-center"> <!-- <img src="/images/bitcoin.png" class="w-16 h-16 my-auto" /> --> - <img - src="/images/bitcoin-logo.png" - class="my-auto w-[400px]" - alt="Bitcoin" - /> + <img src="/images/bitcoin-logo.png" class="my-auto w-[400px]" alt="Bitcoin" /> <!-- <h3 class="text-5xl font-bold text-center my-auto"> --> <!-- bitcoin --> <!-- </h3> --> </div> {#if nfc} - <img - src="/images/tap.png" - class="w-24 absolute top-52 left-4 rotate-[-10deg]" - alt="Tap" - /> + <img src="/images/tap.png" class="w-24 absolute top-52 left-4 rotate-[-10deg]" alt="Tap" /> <img src="/images/arrow.png" class="w-24 scale-x-[-1] rotate-[120deg] absolute top-52 left-32 w-20 h-52" diff --git a/src/routes/(app)/[username]/accepted/create/+page.svelte b/src/routes/(app)/[username]/accepted/create/+page.svelte index 189a734d..3a17bcc0 100644 --- a/src/routes/(app)/[username]/accepted/create/+page.svelte +++ b/src/routes/(app)/[username]/accepted/create/+page.svelte @@ -8,8 +8,7 @@ text = $state(), pasted = $state(); - let keypress = (e) => - e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false); + let keypress = (e) => (e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false)); let paste = async () => { text = await navigator.clipboard.readText(); @@ -24,9 +23,7 @@ </script> <div class="container px-4 max-w-lg mx-auto space-y-5 mt-20"> - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - Create QR - </h1> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Create QR</h1> <form onsubmit={preventDefault(submit)} class="space-y-2 text-xl"> <div class="mb-2"> @@ -48,11 +45,7 @@ class="flex border rounded-2xl px-6 py-5 font-bold hover:opacity-80 w-full bg-primary justify-center gap-2" onclick={paste} > - <iconify-icon - noobserver - icon="ph:clipboard-text-bold" - width="32" - class="my-auto" + <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32" class="my-auto" ></iconify-icon> <div class="my-auto">{$t("user.send.paste")}</div> </button> @@ -62,11 +55,7 @@ type="submit" class="flex bg-black text-white border rounded-2xl px-6 py-5 w-full font-bold gap-2 justify-center" > - <iconify-icon - noobserver - icon="ph:paper-plane-right-bold" - width="32" - class="my-auto invert" + <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32" class="my-auto invert" ></iconify-icon> <div class="my-auto">{$t("user.dashboard.go")}</div> </button> diff --git a/src/routes/(app)/[username]/receive/+page.svelte b/src/routes/(app)/[username]/receive/+page.svelte index 6921d443..14489c13 100644 --- a/src/routes/(app)/[username]/receive/+page.svelte +++ b/src/routes/(app)/[username]/receive/+page.svelte @@ -1,18 +1,6 @@ <script lang="ts"> import { run } from "svelte/legacy"; - import { - btc, - loc, - post, - copy, - fail, - f, - get, - types, - sat, - s, - sats, - } from "$lib/utils"; + import { btc, loc, post, copy, fail, f, get, types, sat, s, sats } from "$lib/utils"; import { tick, onMount, onDestroy } from "svelte"; import { browser } from "$app/environment"; import { last, showQr, amountPrompt } from "$lib/store"; @@ -117,12 +105,8 @@ let settingMemo = $state(); let toggleMemo = () => (settingMemo = !settingMemo); - let link = $derived( - [types.bitcoin, types.liquid].includes(type) ? text : `lightning:${text}`, - ); - let txt = $derived( - [types.bitcoin, types.liquid].includes(type) ? hash : text, - ); + let link = $derived([types.bitcoin, types.liquid].includes(type) ? text : `lightning:${text}`); + let txt = $derived([types.bitcoin, types.liquid].includes(type) ? hash : text); onMount(() => { if ($amountPrompt && !amount) toggleAmount(); diff --git a/src/routes/(app)/account/[id]/+page.svelte b/src/routes/(app)/account/[id]/+page.svelte index 6b48bac2..43ebe508 100644 --- a/src/routes/(app)/account/[id]/+page.svelte +++ b/src/routes/(app)/account/[id]/+page.svelte @@ -8,10 +8,7 @@ import { t } from "$lib/translations"; import { entropyToMnemonic, mnemonicToSeed } from "@scure/bip39"; import { wordlist } from "@scure/bip39/wordlists/english.js"; - import { - getRememberedWalletPassword, - forgetWalletPassword, - } from "$lib/passwordCache"; + import { getRememberedWalletPassword, forgetWalletPassword } from "$lib/passwordCache"; let { data } = $props(); let { account, user } = data; @@ -94,22 +91,19 @@ <Mnemonic {mnemonic} /> <button onclick={() => copy(mnemonic)} type="button" class="btn"> - <iconify-icon noobserver icon="ph:copy-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:copy-bold" width="32"></iconify-icon> <div class="my-auto">{$t("accounts.copy")}</div></button > {:else if seed} <button onclick={requestMnemonic} type="button" class="btn"> - <iconify-icon noobserver icon="ph:eye-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:eye-bold" width="32"></iconify-icon> <div class="my-auto">{$t("accounts.revealMnemonic")}</div></button > {/if} {#if seed} <button onclick={del} type="button" class="btn"> - <iconify-icon noobserver icon="ph:trash-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:trash-bold" width="32"></iconify-icon> <div class="my-auto">{$t("accounts.deleteAccount")}</div></button > {/if} diff --git a/src/routes/(app)/account/ark/+page.svelte b/src/routes/(app)/account/ark/+page.svelte index 42329ef8..c21da0d5 100644 --- a/src/routes/(app)/account/ark/+page.svelte +++ b/src/routes/(app)/account/ark/+page.svelte @@ -165,14 +165,11 @@ {#if hasMasterSeed} <form onsubmit={preventDefault(submit)} class="space-y-5"> <p class="text-secondary"> - Your Ark wallet will be derived from your master seed. Enter your - wallet password to continue. + Your Ark wallet will be derived from your master seed. Enter your wallet password to + continue. </p> - <label - for="password" - class="input flex items-center justify-center gap-2 w-full" - > + <label for="password" class="input flex items-center justify-center gap-2 w-full"> {#if revealPassword} <input name="password" @@ -211,15 +208,12 @@ </label> <div class="space-y-2"> - <label for="rememberFor" class="text-sm text-secondary"> - Remember for - </label> + <label for="rememberFor" class="text-sm text-secondary"> Remember for </label> <select id="rememberFor" class="w-full" value={rememberForMs} - onchange={(e) => - (rememberForMs = Number((e.target as HTMLSelectElement).value))} + onchange={(e) => (rememberForMs = Number((e.target as HTMLSelectElement).value))} > {#each rememberForOptions as option} <option value={option.ms}>{option.label}</option> @@ -231,11 +225,7 @@ <a href={`/${user.username}`} class="contents"> <button type="button" class="btn !w-auto grow"> Back </button> </a> - <button - disabled={submitting} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button disabled={submitting} type="submit" class="btn btn-accent !w-auto grow"> {#if submitting} <Spinner /> {:else} @@ -247,8 +237,7 @@ {:else if !confirmed} <div class="space-y-4"> <p class="text-secondary"> - Your Ark wallet is secured by a private key. Please copy it down - somewhere safe. + Your Ark wallet is secured by a private key. Please copy it down somewhere safe. </p> {#if showNsec} @@ -264,24 +253,14 @@ </div> <div class="flex gap-2"> - <button - type="button" - class="btn btn-accent flex-grow" - onclick={confirmBackup} - > - <iconify-icon noobserver icon="ph:check-bold" width="24" - ></iconify-icon> + <button type="button" class="btn btn-accent flex-grow" onclick={confirmBackup}> + <iconify-icon noobserver icon="ph:check-bold" width="24"></iconify-icon> I've backed it up </button> </div> {:else} - <button - type="button" - class="btn btn-warning w-full" - onclick={revealNsec} - > - <iconify-icon noobserver icon="ph:eye-bold" width="24" - ></iconify-icon> + <button type="button" class="btn btn-warning w-full" onclick={revealNsec}> + <iconify-icon noobserver icon="ph:eye-bold" width="24"></iconify-icon> Reveal backup key </button> {/if} @@ -289,14 +268,10 @@ {:else} <form onsubmit={preventDefault(submit)} class="space-y-5"> <p class="text-secondary"> - Set a password to encrypt your key. You'll need this password to send - funds. + Set a password to encrypt your key. You'll need this password to send funds. </p> - <label - for="password" - class="input flex items-center justify-center gap-2 w-full" - > + <label for="password" class="input flex items-center justify-center gap-2 w-full"> {#if revealPassword} <input name="password" @@ -334,10 +309,7 @@ </button> </label> - <label - for="confirm" - class="input flex items-center justify-center gap-2 w-full" - > + <label for="confirm" class="input flex items-center justify-center gap-2 w-full"> {#if revealConfirm} <input name="confirm" @@ -373,15 +345,12 @@ </label> <div class="space-y-2"> - <label for="rememberFor" class="text-sm text-secondary"> - Remember for - </label> + <label for="rememberFor" class="text-sm text-secondary"> Remember for </label> <select id="rememberFor" class="w-full" value={rememberForMs} - onchange={(e) => - (rememberForMs = Number((e.target as HTMLSelectElement).value))} + onchange={(e) => (rememberForMs = Number((e.target as HTMLSelectElement).value))} > {#each rememberForOptions as option} <option value={option.ms}>{option.label}</option> @@ -390,18 +359,10 @@ </div> <div class="flex gap-2"> - <button - type="button" - class="btn !w-auto grow" - onclick={() => (confirmed = false)} - > + <button type="button" class="btn !w-auto grow" onclick={() => (confirmed = false)}> Back </button> - <button - disabled={submitting} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button disabled={submitting} type="submit" class="btn btn-accent !w-auto grow"> {#if submitting} <Spinner /> {:else} diff --git a/src/routes/(app)/account/bitcoin/+page.svelte b/src/routes/(app)/account/bitcoin/+page.svelte index 87dc32e2..ca90c758 100644 --- a/src/routes/(app)/account/bitcoin/+page.svelte +++ b/src/routes/(app)/account/bitcoin/+page.svelte @@ -11,8 +11,7 @@ <a href="/account/seed" class="block"> <div class="card card-side shadow shadow-base-300 p-8 hover:bg-base-200"> <figure class="w-20 flex items-center justify-center"> - <iconify-icon noobserver icon="ph:file-plus-bold" width="64" - ></iconify-icon> + <iconify-icon noobserver icon="ph:file-plus-bold" width="64"></iconify-icon> </figure> <div> <div class="text-xl">{$t("accounts.create")}</div> @@ -23,8 +22,7 @@ <a href="/account/import" class="block"> <div class="card card-side shadow shadow-base-300 p-8 hover:bg-base-200"> <figure class="w-20 flex items-center justify-center"> - <iconify-icon noobserver icon="ph:folder-open-bold" width="64" - ></iconify-icon> + <iconify-icon noobserver icon="ph:folder-open-bold" width="64"></iconify-icon> </figure> <div> <div class="text-xl">{$t("accounts.import")}</div> diff --git a/src/routes/(app)/account/import/+page.svelte b/src/routes/(app)/account/import/+page.svelte index 551cbb2d..09e1edb1 100644 --- a/src/routes/(app)/account/import/+page.svelte +++ b/src/routes/(app)/account/import/+page.svelte @@ -53,11 +53,7 @@ {$t("accounts.back")} </button> </a> - <button - bind:this={el} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button bind:this={el} type="submit" class="btn btn-accent !w-auto grow"> <div class="my-auto">{$t("accounts.next")}</div> </button> </div> diff --git a/src/routes/(app)/account/new/+page.svelte b/src/routes/(app)/account/new/+page.svelte index 4100e001..c4045db8 100644 --- a/src/routes/(app)/account/new/+page.svelte +++ b/src/routes/(app)/account/new/+page.svelte @@ -7,9 +7,7 @@ <div class="container w-full mx-auto text-lg px-4 max-w-xl space-y-5"> <a href="/account/bitcoin" class="block"> - <div - class="card card-side shadow shadow-base-300 p-8 hover:bg-base-200 gap-4 items-center" - > + <div class="card card-side shadow shadow-base-300 p-8 hover:bg-base-200 gap-4 items-center"> <iconify-icon noobserver icon="logos:bitcoin" width={48}></iconify-icon> <div> <div class="text-xl">Bitcoin (On-chain)</div> @@ -20,14 +18,8 @@ </div> </a> <a href="/account/ark" class="block"> - <div - class="card card-side shadow shadow-base-300 p-8 hover:bg-base-200 gap-4 items-center" - > - <img - src="/images/ark.png" - class="w-12 h-12 rounded-full object-cover" - alt="Ark" - /> + <div class="card card-side shadow shadow-base-300 p-8 hover:bg-base-200 gap-4 items-center"> + <img src="/images/ark.png" class="w-12 h-12 rounded-full object-cover" alt="Ark" /> <div> <div class="text-xl">Ark (Off-chain)</div> <div class="text-secondary"> diff --git a/src/routes/(app)/account/pass/+page.svelte b/src/routes/(app)/account/pass/+page.svelte index 2f62c38c..fd58921f 100644 --- a/src/routes/(app)/account/pass/+page.svelte +++ b/src/routes/(app)/account/pass/+page.svelte @@ -5,11 +5,7 @@ import { t } from "$lib/translations"; import { mnemonic } from "$lib/store"; import Spinner from "$comp/Spinner.svelte"; - import { - mnemonicToSeed, - mnemonicToEntropy, - entropyToMnemonic, - } from "@scure/bip39"; + import { mnemonicToSeed, mnemonicToEntropy, entropyToMnemonic } from "@scure/bip39"; import { wordlist } from "@scure/bip39/wordlists/english.js"; import { focus, versions, fail, post } from "$lib/utils"; import { goto } from "$app/navigation"; @@ -46,10 +42,7 @@ try { const { encrypt } = await import("nostr-tools/nip49"); - let seed = await encrypt( - mnemonicToEntropy($mnemonic as string, wordlist), - password, - ); + let seed = await encrypt(mnemonicToEntropy($mnemonic as string, wordlist), password); // Save master seed on user await post("/post/user", { seed }); @@ -98,16 +91,11 @@ onsubmit={preventDefault(submit)} class="container w-full mx-auto text-lg px-4 max-w-xl space-y-5" > - <p - class="text-secondary p-4 bg-warning/80 rounded-2xl border-warning border-2" - > + <p class="text-secondary p-4 bg-warning/80 rounded-2xl border-warning border-2"> {$t("accounts.passwordWarning")} </p> - <label - for="password" - class="input flex items-center justify-center gap-2 w-full" - > + <label for="password" class="input flex items-center justify-center gap-2 w-full"> {#if revealPassword} <input name="password" @@ -144,10 +132,7 @@ </button> </label> - <label - for="confirm" - class="input flex items-center justify-center gap-2 w-full" - > + <label for="confirm" class="input flex items-center justify-center gap-2 w-full"> {#if revealConfirm} <input name="confirm" @@ -183,15 +168,12 @@ </label> <div class="space-y-2"> - <label for="rememberFor" class="text-sm text-secondary"> - Remember for - </label> + <label for="rememberFor" class="text-sm text-secondary"> Remember for </label> <select id="rememberFor" class="w-full" value={rememberForMs} - onchange={(e) => - (rememberForMs = Number((e.target as HTMLSelectElement).value))} + onchange={(e) => (rememberForMs = Number((e.target as HTMLSelectElement).value))} > {#each rememberForOptions as option} <option value={option.ms}>{option.label}</option> @@ -205,11 +187,7 @@ {$t("accounts.back")} </button> </a> - <button - disabled={submitting} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button disabled={submitting} type="submit" class="btn btn-accent !w-auto grow"> {#if submitting} <Spinner /> {:else} diff --git a/src/routes/(app)/account/setup/+page.svelte b/src/routes/(app)/account/setup/+page.svelte index 9d747578..faab0938 100644 --- a/src/routes/(app)/account/setup/+page.svelte +++ b/src/routes/(app)/account/setup/+page.svelte @@ -19,16 +19,11 @@ </a> <a href="/account/new" class="block"> <div class="shadow p-8 rounded-xl flex gap-4 hover:bg-primary"> - <img - src="/images/keys.png" - class="w-20 my-auto" - alt="Savings account" - /> + <img src="/images/keys.png" class="w-20 my-auto" alt="Savings account" /> <div> <div class="text-xl">Savings</div> <div class="text-secondary"> - You hold the keys to the account and are responsible for - safeguarding them. + You hold the keys to the account and are responsible for safeguarding them. </div> </div> </div> diff --git a/src/routes/(app)/admin/+page.server.ts b/src/routes/(app)/admin/+page.server.ts index 7bb7d1f3..216e2606 100644 --- a/src/routes/(app)/admin/+page.server.ts +++ b/src/routes/(app)/admin/+page.server.ts @@ -5,8 +5,6 @@ export async function load({ cookies, parent }) { const { user } = await parent(); if (!user) redirect(307, "/login"); - const users = (await get("/users", auth(cookies))).sort( - (a, b) => b.balance - a.balance, - ); + const users = (await get("/users", auth(cookies))).sort((a, b) => b.balance - a.balance); return { users }; } diff --git a/src/routes/(app)/apps/new/+page.server.ts b/src/routes/(app)/apps/new/+page.server.ts index a78b9093..c221cef9 100644 --- a/src/routes/(app)/apps/new/+page.server.ts +++ b/src/routes/(app)/apps/new/+page.server.ts @@ -5,11 +5,7 @@ import { fail, redirect } from "@sveltejs/kit"; export const load = async ({ parent, url }) => { const { user } = await parent(); - if (!user) - redirect( - 307, - `/login?redirect=${encodeURIComponent(url.pathname + url.search)}`, - ); + if (!user) redirect(307, `/login?redirect=${encodeURIComponent(url.pathname + url.search)}`); let max_amount = url.searchParams.get("max_amount"); max_amount = max_amount ? Math.round(Number(max_amount) / 1000) : undefined; diff --git a/src/routes/(app)/dm/+page.svelte b/src/routes/(app)/dm/+page.svelte index 173871c1..5a908664 100644 --- a/src/routes/(app)/dm/+page.svelte +++ b/src/routes/(app)/dm/+page.svelte @@ -38,8 +38,7 @@ } const nostrUserInfo = (await getNostrUserInfo(pubkey)) || {}; - const valid = - "nip05" in nostrUserInfo && (await isValid(pubkey, nostrUserInfo.nip05)); + const valid = "nip05" in nostrUserInfo && (await isValid(pubkey, nostrUserInfo.nip05)); const username = await usernameFromPubkey(pubkey); return { coinosUsername: username, @@ -223,8 +222,7 @@ allRumours = await libnip17.getMessageRumours(user); const rumours = allRumours.filter( (r) => - (r.pubkey === user.pubkey && - pTagKeys(r).includes(selectedChat.pubkey)) || + (r.pubkey === user.pubkey && pTagKeys(r).includes(selectedChat.pubkey)) || (r.pubkey === selectedChat.pubkey && pTagKeys(r).includes(user.pubkey)), ); messageRumours = dateMap(rumours); @@ -296,19 +294,13 @@ </script> <div class="super-container"> - <div - class={"sidebar " + ($theme === "light" ? "light-sidebar" : "dark-sidebar")} - > + <div class={"sidebar " + ($theme === "light" ? "light-sidebar" : "dark-sidebar")}> <h2 class="text-xl chat-header"> {creatingNewChat ? $t("dm.newChatHeader") : $t("dm.chatHeader")} <button class={"chat-btn push-right " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn") + - (creatingNewChat - ? $theme === "light" - ? " light-selected" - : " dark-selected" - : "")} + (creatingNewChat ? ($theme === "light" ? " light-selected" : " dark-selected") : "")} on:click={() => { creatingNewChat = !creatingNewChat; selectedChat = null; @@ -336,29 +328,23 @@ : "")} on:click={() => selectChat(c)} > - <span - class={"text-xl" + - (muted && muted.has(c.pubkey) ? " secondary" : "")} + <span class={"text-xl" + (muted && muted.has(c.pubkey) ? " secondary" : "")} >{name(c)}</span > - <span class={(idValid(c) ? "" : "invalid ") + "secondary text-xs"} - >{id(c)}</span - > + <span class={(idValid(c) ? "" : "invalid ") + "secondary text-xs"}>{id(c)}</span> </button> {/if} {/each} {:else if searchQuery !== ""} <button - class={"chat-btn tall-btn " + - ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} + class={"chat-btn tall-btn " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} on:click={() => selectChatUsername(searchQuery)} > <span class="text-xl">{$t("dm.findByUsername")}</span> </button> {#if searchQuery.includes(".")} <button - class={"chat-btn tall-btn " + - ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} + class={"chat-btn tall-btn " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} on:click={() => selectChatNip05(searchQuery)} > <span class="text-xl">{$t("dm.findByNIP05")}</span> @@ -366,8 +352,7 @@ {/if} {#if searchQuery.length === 64 || searchQuery.slice(0, 4) === "npub"} <button - class={"chat-btn tall-btn " + - ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} + class={"chat-btn tall-btn " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} on:click={() => selectChatPubkey(searchQuery)} > <span class="text-xl">{$t("dm.findByPubkey")}</span> @@ -378,33 +363,26 @@ <div class="main container space-y-2 mx-auto space-y-5 lg:max-w-xl xl:max-w-2xl lg:pl-10 mt-5 lg:mt-0" > - <h1 - class="text-5xl font-medium text-left w-full mx-auto lg:mx-0 md:w-[500px]" - > + <h1 class="text-5xl font-medium text-left w-full mx-auto lg:mx-0 md:w-[500px]"> {$t("dm.header")} </h1> {#if selectedChat} <h1> {#if selectedChat.coinosUsername} - <a class="text-3xl" href="/{selectedChat.coinosUsername}" - >{name(selectedChat)}</a - > + <a class="text-3xl" href="/{selectedChat.coinosUsername}">{name(selectedChat)}</a> {:else} <span class="text-3xl">{name(selectedChat)}</span> {/if} <span - class={"secondary timestamp text-small" + - (idValid(selectedChat) ? "" : " invalid")} + class={"secondary timestamp text-small" + (idValid(selectedChat) ? "" : " invalid")} title={npubEncode(selectedChat.pubkey)}>{id(selectedChat)}</span > <button class={"small-btn push-right " + ($theme === "light" ? "light-chat-btn" : "dark-chat-btn")} on:click={() => toggleMute(selectedChat.pubkey)} - >{$t( - muted && muted.has(selectedChat.pubkey) ? "dm.unmute" : "dm.mute", - )}</button + >{$t(muted && muted.has(selectedChat.pubkey) ? "dm.unmute" : "dm.mute")}</button > </h1> @@ -418,13 +396,10 @@ {#each messageRumours.get(day) as rumour} {#if rumour.pubkey === user.pubkey && pTagKeys(rumour).includes(selectedChat.pubkey)} <li - class={(rumour.expiration && - expirationClose(rumour.expiration) + class={(rumour.expiration && expirationClose(rumour.expiration) ? "secondary " : "") + - ($theme === "light" - ? "light-message " - : "dark-message ") + + ($theme === "light" ? "light-message " : "dark-message ") + "message by-user"} > {rumour.content} @@ -434,13 +409,10 @@ </li> {:else if rumour.pubkey === selectedChat.pubkey && pTagKeys(rumour).includes(user.pubkey)} <li - class={(rumour.expiration && - expirationClose(rumour.expiration) + class={(rumour.expiration && expirationClose(rumour.expiration) ? "secondary " : "") + - ($theme === "light" - ? "light-message " - : "dark-message ") + + ($theme === "light" ? "light-message " : "dark-message ") + "message by-other"} > {rumour.content} @@ -488,12 +460,7 @@ <p class="secondary">{$t("dm.fadedWarning")}</p> {#if canSend && !canSendExpiring} <p class="warning"> - <em - >{$t("dm.cantSendExpiring").replace( - "[R]", - name(selectedChat), - )}</em - > + <em>{$t("dm.cantSendExpiring").replace("[R]", name(selectedChat))}</em> </p> {/if} {/if} @@ -506,9 +473,7 @@ <p class="warning"> <em >{$t("dm.noRelaysSet")} - <a class="link" href="/settings/nostr#dm-relays" - >{$t("dm.nostrSettingsLink")}</a - ></em + <a class="link" href="/settings/nostr#dm-relays">{$t("dm.nostrSettingsLink")}</a></em > </p> {/if} diff --git a/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte b/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte index bf00964b..a4cfd805 100644 --- a/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte +++ b/src/routes/(app)/ecash/[id]/[...version]/+layout.svelte @@ -24,9 +24,7 @@ <div>{f(amountFiat, currency)}</div> {:else} <div> - <span class="text-secondary font-normal text-xl" - >⚡️{`${s(amount)}`}</span - > + <span class="text-secondary font-normal text-xl">⚡️{`${s(amount)}`}</span> </div> {/if} </div> @@ -46,9 +44,7 @@ </div> {:else} <div> - <span class="text-secondary font-normal text-xl" - >⚡️{`${s(spent)}`}</span - > + <span class="text-secondary font-normal text-xl">⚡️{`${s(spent)}`}</span> <span class=" text-red-600">{$t("payments.spent")}</span> </div> {/if} diff --git a/src/routes/(app)/ecash/[id]/[...version]/+page.server.ts b/src/routes/(app)/ecash/[id]/[...version]/+page.server.ts index 08efb998..9a20b85c 100644 --- a/src/routes/(app)/ecash/[id]/[...version]/+page.server.ts +++ b/src/routes/(app)/ecash/[id]/[...version]/+page.server.ts @@ -10,8 +10,7 @@ export async function load({ parent }) { export const actions = { default: async ({ cookies, request, url }) => { - if (!cookies.get("username")) - redirect(307, `/register?redirect=${url.pathname}`); + if (!cookies.get("username")) redirect(307, `/register?redirect=${url.pathname}`); const { token } = await fd(request); let claimed; diff --git a/src/routes/(app)/ecash/[id]/[...version]/+page.svelte b/src/routes/(app)/ecash/[id]/[...version]/+page.svelte index 3cfa502d..0702dcb0 100644 --- a/src/routes/(app)/ecash/[id]/[...version]/+page.svelte +++ b/src/routes/(app)/ecash/[id]/[...version]/+page.svelte @@ -51,11 +51,7 @@ {#if external} <a href={`/ecash/${id}/swap`} class="contents"> <button type="submit" class="btn"> - <iconify-icon - noobserver - icon="ph:hand-coins-bold" - width="32" - flip="horizontal" + <iconify-icon noobserver icon="ph:hand-coins-bold" width="32" flip="horizontal" ></iconify-icon> <div class="my-auto">{$t("payments.swap")}</div> </button> @@ -64,11 +60,7 @@ <form method="POST" use:enhance class="w-full"> <input type="hidden" name="token" bind:value={token} /> <button type="submit" class="btn"> - <iconify-icon - noobserver - icon="ph:hand-coins-bold" - width="32" - flip="horizontal" + <iconify-icon noobserver icon="ph:hand-coins-bold" width="32" flip="horizontal" ></iconify-icon> <div class="my-auto">{$t("payments.redeem")}</div> </button> @@ -76,10 +68,7 @@ {/if} {/if} - <button - class="btn break-all !h-auto py-5 font-normal leading-normal" - onclick={() => copy(token)} - > + <button class="btn break-all !h-auto py-5 font-normal leading-normal" onclick={() => copy(token)}> {token} </button> </div> diff --git a/src/routes/(app)/ecash/[id]/[...version]/swap/+page.svelte b/src/routes/(app)/ecash/[id]/[...version]/swap/+page.svelte index f05a7297..77f631af 100644 --- a/src/routes/(app)/ecash/[id]/[...version]/swap/+page.svelte +++ b/src/routes/(app)/ecash/[id]/[...version]/swap/+page.svelte @@ -2,6 +2,4 @@ let { data } = $props(); </script> -<div class="text-center"> - Support for swapping in cash from other mints is coming soon -</div> +<div class="text-center">Support for swapping in cash from other mints is coming soon</div> diff --git a/src/routes/(app)/firehose/+page.svelte b/src/routes/(app)/firehose/+page.svelte index 2fdaa4d0..a11d15d1 100644 --- a/src/routes/(app)/firehose/+page.svelte +++ b/src/routes/(app)/firehose/+page.svelte @@ -35,9 +35,7 @@ </script> <div class="container px-4 max-w-xl mx-auto space-y-5"> - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - Events - </h1> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Events</h1> <div onpointerenter={pause} onpointerleave={unpause}> {#each events as event} diff --git a/src/routes/(app)/fund/[id]/+page.svelte b/src/routes/(app)/fund/[id]/+page.svelte index 34e0d503..8d83038b 100644 --- a/src/routes/(app)/fund/[id]/+page.svelte +++ b/src/routes/(app)/fund/[id]/+page.svelte @@ -36,16 +36,10 @@ <div class="container px-4 max-w-4xl mx-auto mt-10 space-y-5"> <div class="flex justify-center items-center"> - <div - class="md:shadow-xl rounded-3xl md:px-10 pt-5 pb-10 space-y-5 w-full md:mx-5" - > + <div class="md:shadow-xl rounded-3xl md:px-10 pt-5 pb-10 space-y-5 w-full md:mx-5"> {#if show} <div class="max-w-[360px] mx-auto"> - <img - src={`/qr/${href}/raw`} - class="z-10 border-4 border-white w-" - alt="URL" - /> + <img src={`/qr/${href}/raw`} class="z-10 border-4 border-white w-" alt="URL" /> </div> {/if} <div class="flex justify-center gap-4"> @@ -72,10 +66,7 @@ </div> {#if (user && !managers.length) || managers.some((m) => m.id === user?.id)} - <a - href={`/fund/${id}/access`} - class="btn !w-auto ml-auto text-secondary grow" - > + <a href={`/fund/${id}/access`} class="btn !w-auto ml-auto text-secondary grow"> <iconify-icon icon="ph:gear-bold" width={32}></iconify-icon> {$t("funds.manage")} </a> @@ -85,8 +76,7 @@ <div class="grow"> <a href={`/send/fund/${id}`}> <button class="btn"> - <iconify-icon noobserver icon="ph:plus-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:plus-bold" width="32"></iconify-icon> {$t("payments.addFunds")} </button> </a> @@ -95,11 +85,7 @@ <div class="grow"> <a href={`/fund/${id}/withdraw`}> <button class="btn"> - <iconify-icon - noobserver - icon="ph:hand-coins-bold" - width="32" - flip="horizontal" + <iconify-icon noobserver icon="ph:hand-coins-bold" width="32" flip="horizontal" ></iconify-icon> {$t("payments.takeFunds")} </button> @@ -109,13 +95,11 @@ </div> <div class="flex gap-2" data-sveltekit-prefetch="off"> <a href={`/qr/${href}`} class="btn !w-auto grow"> - <iconify-icon noobserver icon="ph:link-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:link-bold" width="32"></iconify-icon> <div class="my-auto">{$t("payments.shareLink")}</div> </a> <a href={`${$page.url.pathname}/gift`} class="btn !w-auto grow"> - <iconify-icon noobserver icon="ph:gift-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:gift-bold" width="32"></iconify-icon> <div class="my-auto">{$t("payments.giftLink")}</div> </a> <!-- <a href={`/qr/${lnurlw}`} class="btn !w-auto grow"> --> diff --git a/src/routes/(app)/fund/[id]/access/+page.svelte b/src/routes/(app)/fund/[id]/access/+page.svelte index 24ded54e..9920fa5b 100644 --- a/src/routes/(app)/fund/[id]/access/+page.svelte +++ b/src/routes/(app)/fund/[id]/access/+page.svelte @@ -23,12 +23,8 @@ <div class="container px-4 max-w-4xl mx-auto mt-10 space-y-5"> <div class="flex justify-center items-center"> - <div - class="md:shadow-xl rounded-3xl md:px-10 pt-5 pb-10 space-y-5 w-full md:mx-5" - > - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - Fund managers - </h1> + <div class="md:shadow-xl rounded-3xl md:px-10 pt-5 pb-10 space-y-5 w-full md:mx-5"> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Fund managers</h1> {#each m as c} <a href={`/${c.username}`} class="contents"> @@ -51,12 +47,7 @@ <form method="post" use:enhance class="space-y-2"> <input type="hidden" name="id" value={id} /> - <input - use:focus - name="username" - bind:value={username} - placeholder={$t("funds.username")} - /> + <input use:focus name="username" bind:value={username} placeholder={$t("funds.username")} /> <button type="submit" class="btn"> <iconify-icon icon="ph:plus-bold" width="32"></iconify-icon> {$t("funds.addManager")} diff --git a/src/routes/(app)/fund/[id]/gift/+page.svelte b/src/routes/(app)/fund/[id]/gift/+page.svelte index 9bef9c64..ff05575d 100644 --- a/src/routes/(app)/fund/[id]/gift/+page.svelte +++ b/src/routes/(app)/fund/[id]/gift/+page.svelte @@ -32,11 +32,7 @@ <div class="my-auto break-all min-w-0 !w-auto max-w-full">{text}</div> </button> - <a - href={`/qr/${encodeURIComponent(text)}`} - class="btn !w-auto" - aria-label="Show gift QR" - > + <a href={`/qr/${encodeURIComponent(text)}`} class="btn !w-auto" aria-label="Show gift QR"> <iconify-icon icon="ph:qr-code-bold" width={32}></iconify-icon> </a> </div> diff --git a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.svelte b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.svelte index 451fc128..b67a024b 100644 --- a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.svelte +++ b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.svelte @@ -15,13 +15,7 @@ </script> <div class="container px-4 text-center mx-auto"> - <Success - {amount} - {rate} - {currency} - {locale} - title={$t("payments.received")} - /> + <Success {amount} {rate} {currency} {locale} title={$t("payments.received")} /> </div> <a href={`/${user.username}`} aria-label="Continue"> diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.svelte b/src/routes/(app)/fund/[id]/withdraw/+page.svelte index 9b53824d..b8ccd5af 100644 --- a/src/routes/(app)/fund/[id]/withdraw/+page.svelte +++ b/src/routes/(app)/fund/[id]/withdraw/+page.svelte @@ -62,12 +62,7 @@ {/if}</button > - <button - use:focus - bind:this={submit} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button use:focus bind:this={submit} type="submit" class="btn btn-accent !w-auto grow"> {#if submitting} <Spinner /> {:else} diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts index d6ee4246..a0d7d676 100644 --- a/src/routes/(app)/invoice/[id]/+layout.server.ts +++ b/src/routes/(app)/invoice/[id]/+layout.server.ts @@ -31,8 +31,7 @@ export async function load({ cookies, depends, params, url, parent }) { !(url.pathname.includes("tip") || url.pathname.includes("memo")) && !options ) { - if (invoice.prompt && invoice.tip === null) - redirect(307, `/invoice/${id}/tip`); + if (invoice.prompt && invoice.tip === null) redirect(307, `/invoice/${id}/tip`); else { redirect(307, `/send/invoice/${id}`); } diff --git a/src/routes/(app)/invoice/[id]/+page.svelte b/src/routes/(app)/invoice/[id]/+page.svelte index bf62a062..2810b39c 100644 --- a/src/routes/(app)/invoice/[id]/+page.svelte +++ b/src/routes/(app)/invoice/[id]/+page.svelte @@ -2,20 +2,7 @@ import { getWallet } from "$lib/ark"; import { enhance } from "$app/forms"; import { send } from "$lib/socket"; - import { - btc, - loc, - post, - copy, - f, - fail, - success, - get, - types, - sat, - s, - sats, - } from "$lib/utils"; + import { btc, loc, post, copy, f, fail, success, get, types, sat, s, sats } from "$lib/utils"; import { tick, onMount, onDestroy } from "svelte"; import { browser } from "$app/environment"; import { last, showQr, amountPrompt } from "$lib/store"; @@ -149,13 +136,9 @@ let fiat = $state(true); let amountFiat = $derived(parseFloat(((amount * rate) / sats).toFixed(2))); let tipAmount = $derived(((tip * rate) / sats).toFixed(2)); - let link = $derived( - [types.bitcoin, types.liquid].includes(type) ? text : `lightning:${text}`, - ); + let link = $derived([types.bitcoin, types.liquid].includes(type) ? text : `lightning:${text}`); - let txt = $derived( - [types.bitcoin, types.liquid].includes(type) ? hash : text, - ); + let txt = $derived([types.bitcoin, types.liquid].includes(type) ? hash : text); </script> <div class="invoice container mx-auto max-w-xl px-4 space-y-2"> diff --git a/src/routes/(app)/invoice/[id]/paid/+page.svelte b/src/routes/(app)/invoice/[id]/paid/+page.svelte index 30679ac3..1a09653f 100644 --- a/src/routes/(app)/invoice/[id]/paid/+page.svelte +++ b/src/routes/(app)/invoice/[id]/paid/+page.svelte @@ -5,9 +5,7 @@ import { loc } from "$lib/utils"; let { data } = $props(); - let { amount, currency, rate, received, pending, tip, user, id } = $derived( - data.invoice, - ); + let { amount, currency, rate, received, pending, tip, user, id } = $derived(data.invoice); let locale = $derived(loc(user)); // toast.pop(0); @@ -15,12 +13,7 @@ <div class="container px-4 text-center mx-auto"> {#if pending} - <iconify-icon - noobserver - icon="ph:clock-bold" - class="text-warning" - width="160" - ></iconify-icon> + <iconify-icon noobserver icon="ph:clock-bold" class="text-warning" width="160"></iconify-icon> <h1 class="text-3xl md:text-4xl font-bold mb-6">Payment detected</h1> diff --git a/src/routes/(app)/invoice/[id]/tip/+page.server.ts b/src/routes/(app)/invoice/[id]/tip/+page.server.ts index 16cc22fa..91ccebca 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.server.ts +++ b/src/routes/(app)/invoice/[id]/tip/+page.server.ts @@ -44,11 +44,7 @@ export const actions = { tip: form.tip ?? null, }; - const { id } = await post( - `/invoice/${form.id}`, - { invoice }, - auth(cookies), - ); + const { id } = await post(`/invoice/${form.id}`, { invoice }, auth(cookies)); redirect(307, `/invoice/${id}`); }, diff --git a/src/routes/(app)/invoice/[id]/tip/+page.svelte b/src/routes/(app)/invoice/[id]/tip/+page.svelte index 1183093e..32ba78a2 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.svelte +++ b/src/routes/(app)/invoice/[id]/tip/+page.svelte @@ -107,18 +107,13 @@ <div> <span class="mr-1"> {f(amountFiat, currency, locale)} - <span class="font-semibold" - >+{f(tipAmount, currency, locale)}</span - > + <span class="font-semibold">+{f(tipAmount, currency, locale)}</span> </span> </div> {:else} <div class="ml-auto text-lg flex gap-2"> <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" ></iconify-icon> <div>{s(amount, locale)}</div> </div> @@ -134,12 +129,8 @@ <div class="space-y-2"> {#if tip} - <button type="button" class="btn" onclick={() => submit.click()} - >Next</button - > - <button type="button" class="btn" onclick={() => (tipPercent = 0)} - >Reset</button - > + <button type="button" class="btn" onclick={() => submit.click()}>Next</button> + <button type="button" class="btn" onclick={() => (tipPercent = 0)}>Reset</button> {:else} {#each tipAmounts as amount, i} {#if i === 0} @@ -163,10 +154,7 @@ </div> <div class="space-y-2"> - <button - type="button" - class="btn" - onclick={() => (showCustomAmount = true)} + <button type="button" class="btn" onclick={() => (showCustomAmount = true)} >{$t("payments.custom")}</button > <a href={`/invoice/${id}`} class="btn">{$t("payments.cancel")}</a> @@ -186,9 +174,7 @@ placeholder={$t("payments.amount")} use:focus /> - <button type="submit" class="btn" disabled={!customTipAmount} - >Apply</button - > + <button type="submit" class="btn" disabled={!customTipAmount}>Apply</button> </form> {/if} </div> diff --git a/src/routes/(app)/invoices/+page.svelte b/src/routes/(app)/invoices/+page.svelte index 35a81a3e..418dfaf3 100644 --- a/src/routes/(app)/invoices/+page.svelte +++ b/src/routes/(app)/invoices/+page.svelte @@ -7,9 +7,7 @@ <div class="container w-full mx-auto text-lg px-2 space-y-2"> <div class="mx-auto flex justify-center w-full gap-1"> - <div - class="grid md:grid-cols-12 w-full text-center text-lg break-all gap-x-2" - > + <div class="grid md:grid-cols-12 w-full text-center text-lg break-all gap-x-2"> {#each invoices as i} <div class="md:col-span-2 whitespace-nowrap mt-8 md:mt-0">{i.type}</div> {#if show[i.id]} diff --git a/src/routes/(app)/ln/[lnurl]/+page.server.ts b/src/routes/(app)/ln/[lnurl]/+page.server.ts index ae784401..912ed07c 100644 --- a/src/routes/(app)/ln/[lnurl]/+page.server.ts +++ b/src/routes/(app)/ln/[lnurl]/+page.server.ts @@ -62,15 +62,12 @@ export const actions = { pay: async ({ fetch, request }) => { let error; - let { callback, amount, minSendable, maxSendable, comment } = - await fd(request); + let { callback, amount, minSendable, maxSendable, comment } = await fd(request); minSendable = Math.round(minSendable / 1000); maxSendable = Math.round(maxSendable / 1000); - if (amount < minSendable) - error = `Amount must be at least ${minSendable} sats`; - if (amount > maxSendable) - error = `Amount must be at most ${maxSendable} sats`; + if (amount < minSendable) error = `Amount must be at least ${minSendable} sats`; + if (amount > maxSendable) error = `Amount must be at most ${maxSendable} sats`; if (error) return fail(400, { error }); let url = `${callback}?amount=${amount * 1000}`; @@ -86,33 +83,20 @@ export const actions = { withdraw: async ({ cookies, fetch, request }) => { let error; - let { - callback, - amount, - username, - currency, - minWithdrawable, - maxWithdrawable, - k1, - } = await fd(request); + let { callback, amount, username, currency, minWithdrawable, maxWithdrawable, k1 } = + await fd(request); minWithdrawable = Math.round(minWithdrawable / 1000); maxWithdrawable = Math.round(maxWithdrawable / 1000); - if (amount < minWithdrawable) - error = `Amount must be at least ${minWithdrawable} sats`; - if (amount > maxWithdrawable) - error = `Amount must be at most ${maxWithdrawable} sats`; + if (amount < minWithdrawable) error = `Amount must be at least ${minWithdrawable} sats`; + if (amount > maxWithdrawable) error = `Amount must be at most ${maxWithdrawable} sats`; if (error) return fail(400, { error }); const invoice = { amount, type: "lightning" }; const user = { username, currency }; - const { text: pr } = await post( - "/invoice", - { invoice, user }, - auth(cookies), - ); + const { text: pr } = await post("/invoice", { invoice, user }, auth(cookies)); const url = new URL(callback); url.searchParams.append("k1", k1); diff --git a/src/routes/(app)/ln/withdrawal/sent/+page.svelte b/src/routes/(app)/ln/withdrawal/sent/+page.svelte index fa888fc1..3f0b8711 100644 --- a/src/routes/(app)/ln/withdrawal/sent/+page.svelte +++ b/src/routes/(app)/ln/withdrawal/sent/+page.svelte @@ -9,14 +9,8 @@ </script> <div class="text-center mt-20 md:mt-0"> - <div - class="flex w-full max-w-[200px] mx-auto py-20" - in:scale={{ start: 0.5 }} - > - <iconify-icon - noobserver - icon="ph:check-bold" - class="mx-auto w-full text-[#7ACC8F]" + <div class="flex w-full max-w-[200px] mx-auto py-20" in:scale={{ start: 0.5 }}> + <iconify-icon noobserver icon="ph:check-bold" class="mx-auto w-full text-[#7ACC8F]" ></iconify-icon> </div> <h1 class="text-3xl md:text-4xl font-bold mb-6">Request Sent!</h1> diff --git a/src/routes/(app)/messages/+page.server.ts b/src/routes/(app)/messages/+page.server.ts index ec83bede..20ba5f39 100644 --- a/src/routes/(app)/messages/+page.server.ts +++ b/src/routes/(app)/messages/+page.server.ts @@ -22,9 +22,7 @@ export async function load({ params, parent }) { const { pubkey } = user; try { messages = await get(`/${pubkey}/${since}/messages`); - messages = messages.sort( - (a: Message, b: Message) => b.created_at - a.created_at, - ); + messages = messages.sort((a: Message, b: Message) => b.created_at - a.created_at); } catch (e) { console.log("failed to fetch nostr messages", e); } diff --git a/src/routes/(app)/messages/+page.svelte b/src/routes/(app)/messages/+page.svelte index 3e97398f..2aaede8b 100644 --- a/src/routes/(app)/messages/+page.svelte +++ b/src/routes/(app)/messages/+page.svelte @@ -9,10 +9,8 @@ let { data } = $props(); - let { messages, notes, invoices, sent, received, subject, user }: any = - $state(data); - let refresh = (d: any) => - ({ messages, notes, invoices, sent, received, subject, user } = d); + let { messages, notes, invoices, sent, received, subject, user }: any = $state(data); + let refresh = (d: any) => ({ messages, notes, invoices, sent, received, subject, user } = d); let keys = new Set(); let latest: any[] = $state([]); @@ -20,10 +18,7 @@ e.subscribe(async (event: any) => { if (!(browser && event && ready)) return; - if ( - event.recipient?.id === user.id && - !~latest.findIndex((m: any) => m.id === event.id) - ) { + if (event.recipient?.id === user.id && !~latest.findIndex((m: any) => m.id === event.id)) { event.content = await decrypt({ event, user }); let i = latest.findIndex((m: any) => m.pubkey === event.pubkey); @@ -46,10 +41,7 @@ if (!(event.author && event.recipient)) continue; - let k = - event.author.id === user.id - ? event.recipient?.pubkey - : event.author.pubkey; + let k = event.author.id === user.id ? event.recipient?.pubkey : event.author.pubkey; if (!keys.has(k)) { keys.add(k); diff --git a/src/routes/(app)/messages/[recipient]/+page.server.ts b/src/routes/(app)/messages/[recipient]/+page.server.ts index 85deabbb..d9a9c54f 100644 --- a/src/routes/(app)/messages/[recipient]/+page.server.ts +++ b/src/routes/(app)/messages/[recipient]/+page.server.ts @@ -12,10 +12,7 @@ export async function load({ params, parent }) { messages = await get(`/${user.pubkey}/${since}/messages`); messages = messages - .filter( - (m: Message) => - m.recipient?.id === recipient.id || m.author?.id === recipient.id, - ) + .filter((m: Message) => m.recipient?.id === recipient.id || m.author?.id === recipient.id) .sort((a, b) => a.created_at - b.created_at); } catch (e) { console.log("failed to fetch nostr messages", e); diff --git a/src/routes/(app)/messages/[recipient]/+page.svelte b/src/routes/(app)/messages/[recipient]/+page.svelte index 654ddcca..f828bde2 100644 --- a/src/routes/(app)/messages/[recipient]/+page.svelte +++ b/src/routes/(app)/messages/[recipient]/+page.svelte @@ -28,9 +28,7 @@ duration, css: (t) => { const eased = easing(t); - return `opacity: ${eased * o}; transform: scale(${ - eased * s * is + baseScale - })`; + return `opacity: ${eased * o}; transform: scale(${eased * s * is + baseScale})`; }, }; } @@ -41,9 +39,7 @@ let initialize = async (p: any) => { await Promise.all( - messages.map( - async (event) => (event.message = await decrypt({ event, user })), - ), + messages.map(async (event) => (event.message = await decrypt({ event, user }))), ); messages = messages; @@ -117,14 +113,8 @@ </script> <div class="container max-w-xl mx-auto px-4 space-y-5"> - <button - type="button" - class="hover:opacity-80" - data-sveltekit-preload-data="false" - onclick={back} - > - <iconify-icon noobserver icon="ph:arrow-left-bold" width="40" - ></iconify-icon> + <button type="button" class="hover:opacity-80" data-sveltekit-preload-data="false" onclick={back}> + <iconify-icon noobserver icon="ph:arrow-left-bold" width="40"></iconify-icon> </button> <div @@ -145,11 +135,7 @@ baseScale: 0.5, }} > - <div - class="rounded-2xl px-4 py-2 max-w-[300px] mb-1 text-lg" - class:ours - class:theirs - > + <div class="rounded-2xl px-4 py-2 max-w-[300px] mb-1 text-lg" class:ours class:theirs> {message} </div> <div class="mt-auto"> @@ -184,8 +170,7 @@ tabindex="0" ></div> <button type="submit" class="my-auto shrink-0"> - <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32"></iconify-icon> </button> </form> </div> diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte index 9807313a..6cae555c 100644 --- a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte +++ b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte @@ -54,23 +54,14 @@ <div class="container px-4 mt-20 max-w-xl mx-auto space-y-2"> <Numpad bind:amount bind:fiat {currency} {locale} {rate} submit={next} /> - <form - method="POST" - use:enhance - class="flex gap-2 justify-center" - bind:this={formElement} - > + <form method="POST" use:enhance class="flex gap-2 justify-center" bind:this={formElement}> <input name="amount" bind:value={amount} type="hidden" /> <input name="rate" value={rate} type="hidden" /> <input name="username" value={subject.username} type="hidden" /> <input name="prompt" value={subject.prompt} type="hidden" /> {#if user?.balance} - <button - type="button" - class="btn !w-auto grow" - onclick={setMax} - onkeydown={setMax} + <button type="button" class="btn !w-auto grow" onclick={setMax} onkeydown={setMax} >{#if $fiatStore} Max {f((user.balance * rate) / sats, currency, locale)} {:else} diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 436a7ab6..b8a4223d 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -2,18 +2,7 @@ import { browser } from "$app/environment"; import { onMount, tick } from "svelte"; import { t, loading } from "$lib/translations"; - import { - copy, - f, - s, - loc, - toFiat, - post, - sats, - fail, - success, - types, - } from "$lib/utils"; + import { copy, f, s, loc, toFiat, post, sats, fail, success, types } from "$lib/utils"; import { fiat } from "$lib/store"; const toggleFiat = (e) => { @@ -77,9 +66,7 @@ if (type === types.fund) a = 0 - a; direction = a > 0 ? $t("payments.from") : $t("payments.to"); - if (direction) - direction = - direction[0].toUpperCase() + direction.substr(1, direction.length); + if (direction) direction = direction[0].toUpperCase() + direction.substr(1, direction.length); }); </script> @@ -98,11 +85,7 @@ </div> {:else} <div class="flex items-center gap-1"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> {s(amount, userLocale)} </div> {/if} @@ -152,11 +135,7 @@ </div> <div class="text-secondary flex"> <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> {s((1 * sats) / rate)} = {f(1, currency, userLocale, 0, 0)} </div> @@ -179,15 +158,17 @@ </a> {:else if type === types.fund} <a href={`/fund/${memo}`} class="btn btn-accent"> - <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" - ></iconify-icon>{$t("payments.viewFund")} + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon>{$t( + "payments.viewFund", + )} </a> {:else if memo?.includes("9734")} {@const eid = JSON.parse(memo).tags.find((t) => t[0] === "e")[1]} <a href={`/e/${eid}`} class="btn btn-accent"> <img src="/images/nostr.png" class="w-8" alt="Nostr" /> - <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" - ></iconify-icon>{$t("payments.zappedEvent")} + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon>{$t( + "payments.zappedEvent", + )} </a> {:else if memo} <div> @@ -220,10 +201,7 @@ rel="noreferrer">{txid}</a > </div> - <button - class="flex font-bold hover:opacity-80 mb-auto my-auto" - onclick={() => copy(txid)} - > + <button class="flex font-bold hover:opacity-80 mb-auto my-auto" onclick={() => copy(txid)}> </button> </div> </div> @@ -234,10 +212,7 @@ <span class="text-lg text-secondary">Path</span> <div class="flex"> <div>{path}</div> - <button - class="flex font-bold hover:opacity-80 mb-auto my-auto" - onclick={() => copy(path)} - > + <button class="flex font-bold hover:opacity-80 mb-auto my-auto" onclick={() => copy(path)}> </button> </div> </div> diff --git a/src/routes/(app)/payment/[id]/plain/+page.svelte b/src/routes/(app)/payment/[id]/plain/+page.svelte index 46197260..87ad2207 100644 --- a/src/routes/(app)/payment/[id]/plain/+page.svelte +++ b/src/routes/(app)/payment/[id]/plain/+page.svelte @@ -3,17 +3,7 @@ import { onMount } from "svelte"; import { browser } from "$app/environment"; import { t } from "$lib/translations"; - import { - back, - copy, - f, - s, - toFiat, - post, - sats, - success, - types, - } from "$lib/utils"; + import { back, copy, f, s, toFiat, post, sats, success, types } from "$lib/utils"; import { fiat } from "$lib/store"; import Avatar from "$comp/Avatar.svelte"; import { format } from "date-fns"; diff --git a/src/routes/(app)/payments/[...page]/+page.server.ts b/src/routes/(app)/payments/[...page]/+page.server.ts index bf280937..9a81993a 100644 --- a/src/routes/(app)/payments/[...page]/+page.server.ts +++ b/src/routes/(app)/payments/[...page]/+page.server.ts @@ -25,10 +25,7 @@ export async function load({ cookies, depends, params }) { if (start) q.set("start", str(start * 1000)); if (end) q.set("end", str(end * 1000)); - const { count, payments, incoming, outgoing } = await get( - `/payments?${str(q)}`, - auth(cookies), - ); + const { count, payments, incoming, outgoing } = await get(`/payments?${str(q)}`, auth(cookies)); const pages = Array.from({ length: Math.ceil(count / limit) }); diff --git a/src/routes/(app)/payments/[...page]/+page.svelte b/src/routes/(app)/payments/[...page]/+page.svelte index 7d73a0b1..f6cbcba8 100644 --- a/src/routes/(app)/payments/[...page]/+page.svelte +++ b/src/routes/(app)/payments/[...page]/+page.svelte @@ -11,16 +11,7 @@ import { goto, invalidate } from "$app/navigation"; let { data } = $props(); - let { - start, - end, - user, - payments, - incoming, - outgoing, - pages, - page: p, - } = $derived(data); + let { start, end, user, payments, incoming, outgoing, pages, page: p } = $derived(data); let locale = $derived(loc(user)); @@ -55,9 +46,7 @@ ]); let selection = $derived( - presets.findIndex( - (p) => Math.abs(differenceInDays(new Date(start * 1000), p.start)) < 1, - ), + presets.findIndex((p) => Math.abs(differenceInDays(new Date(start * 1000), p.start)) < 1), ); $effect(() => { @@ -88,9 +77,7 @@ platform_fee: p.ourfee, amount_fiat: f((p.amount * p.rate) / sats, p.currency), fee_fiat: p.fee ? f((p.fee * p.rate) / sats, p.currency) : null, - platform_fee_fiat: p.ourfee - ? f((p.ourfee * p.rate) / sats, p.currency) - : null, + platform_fee_fiat: p.ourfee ? f((p.ourfee * p.rate) / sats, p.currency) : null, tip_fiat: p.tip ? f((p.tip * p.rate) / sats, p.currency) : null, total_fiat: f( ((p.amount + ((p.amount > 0 ? p.tip : -p.tip) || 0)) * p.rate) / sats, @@ -120,9 +107,7 @@ let csv = keys.map((k) => `"${k}"`).join(",") + "\n" + - payments - .map((r) => keys.map((k) => `"${r[k] || ""}"`).join(",")) - .join("\n"); + payments.map((r) => keys.map((k) => `"${r[k] || ""}"`).join(",")).join("\n"); let filename = "payments.csv"; let blob = new Blob([csv], { type: "text/csv;charset=utf-8;" }); @@ -148,10 +133,7 @@ if (i === 0 || i === pages.length - 1) return true; - let start = Math.max( - 1, - currentPage - Math.floor((maxVisiblePages - 4) / 2), - ); + let start = Math.max(1, currentPage - Math.floor((maxVisiblePages - 4) / 2)); let end = start + maxVisiblePages - 5; if (end >= pages.length - 1) { @@ -162,8 +144,7 @@ return i >= start && i <= end; }; - let isEllipsis = (i) => - (i === 1 && !showPage(i)) || (i === pages.length - 2 && !showPage(i)); + let isEllipsis = (i) => (i === 1 && !showPage(i)) || (i === pages.length - 2 && !showPage(i)); </script> <div class="space-y-5"> @@ -189,19 +170,12 @@ {#each pages as _, i} {#if showPage(i)} <a href={`${path}/${i + 1}`}> - <div - class="join-item btn !btn-sm" - class:btn-active={parseInt(p) === i + 1} - > + <div class="join-item btn !btn-sm" class:btn-active={parseInt(p) === i + 1}> {i + 1} </div> </a> {:else if isEllipsis(i)} - <div - class="join-item btn !w-auto !btn-sm btn-disabled !bg-base-200" - > - ... - </div> + <div class="join-item btn !w-auto !btn-sm btn-disabled !bg-base-200">...</div> {/if} {/each} {/if} @@ -218,9 +192,7 @@ <span class="text-base text-secondary"> {#if tipsIn > 0 || tipsOut > 0}{$t("payments.tips")}{/if} </span> - <span class="text-base text-secondary text-right" - >{$t("payments.total")}</span - > + <span class="text-base text-secondary text-right">{$t("payments.total")}</span> {@const totalIn = incoming[c]?.fiat || 0} {@const tipsIn = incoming[c]?.fiatTips || 0} @@ -231,25 +203,17 @@ {@const subtotalOut = totalOut - tipsOut} {#if totalIn > 0} - <span class="text-left text-base text-secondary" - >{$t("payments.income")}</span - > + <span class="text-left text-base text-secondary">{$t("payments.income")}</span> <!-- <span><b>{subtotalIn ? f(subtotalIn, c) : "-"}</b></span> --> <span><b>{tipsIn > 0 ? f(tipsIn, c, locale) : ""}</b></span> - <span class="text-right" - ><b>{totalIn > 0 ? f(totalIn, c, locale) : "-"}</b></span - > + <span class="text-right"><b>{totalIn > 0 ? f(totalIn, c, locale) : "-"}</b></span> {/if} {#if totalOut > 0} - <span class="text-left text-base text-secondary" - >{$t("payments.expenditure")}</span - > + <span class="text-left text-base text-secondary">{$t("payments.expenditure")}</span> <!-- <span><b>{subtotalOut ? f(subtotalOut, c) : "-"}</b></span> --> <span><b>{tipsOut > 0 ? f(tipsOut, c, locale) : "-"}</b></span> - <span class="text-right" - ><b>{totalOut > 0 ? f(totalOut, c, locale) : "-"}</b></span - > + <span class="text-right"><b>{totalOut > 0 ? f(totalOut, c, locale) : "-"}</b></span> {/if} {/each} </div> @@ -258,8 +222,7 @@ {#if payments.length} <div class="flex justify-center"> <button class="btn !w-auto" onclick={csv}> - <iconify-icon noobserver icon="ph:floppy-disk-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:floppy-disk-bold" width="32"></iconify-icon> <div class="my-auto">{$t("payments.export")}</div> </button> </div> diff --git a/src/routes/(app)/pos/+page.svelte b/src/routes/(app)/pos/+page.svelte index 056a9254..0b29608d 100644 --- a/src/routes/(app)/pos/+page.svelte +++ b/src/routes/(app)/pos/+page.svelte @@ -63,9 +63,7 @@ chip = await esploader.main(); connected = true; - portInfo = (await device.getInfo?.()) - ? JSON.stringify(await device.getInfo()) - : "Connected"; + portInfo = (await device.getInfo?.()) ? JSON.stringify(await device.getInfo()) : "Connected"; } catch (e) { console.log(e); connected = false; @@ -148,9 +146,7 @@ </script> <div class="container px-4 max-w-lg mx-auto space-y-5 mt-20"> - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - ESP32-C3 Flasher - </h1> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">ESP32-C3 Flasher</h1> {#if !connected} <div class="text-center"> @@ -162,15 +158,11 @@ {#if connected} <!-- Tabs --> <div class="flex gap-2 justify-center"> - <button - class="btn" - class:btn-neutral={tab === "config"} - onclick={() => (tab = "config")}>Flash config</button + <button class="btn" class:btn-neutral={tab === "config"} onclick={() => (tab = "config")} + >Flash config</button > - <button - class="btn" - class:btn-neutral={tab === "firmware"} - onclick={() => (tab = "firmware")}>Flash firmware</button + <button class="btn" class:btn-neutral={tab === "firmware"} onclick={() => (tab = "firmware")} + >Flash firmware</button > </div> @@ -181,15 +173,12 @@ <div class="text-center text-2xl">Config written ✔</div> {:else} <div>Generated config file (<b>{bytes.length} bytes</b>)</div> - <label class="label mt-2" for="littlefs-address" - >LittleFS address (hex)</label - > + <label class="label mt-2" for="littlefs-address">LittleFS address (hex)</label> <input id="littlefs-address" class="input" bind:value={littlefsAddress} - onchange={(e) => - (littlefsAddress = Number((e.target as HTMLInputElement).value))} + onchange={(e) => (littlefsAddress = Number((e.target as HTMLInputElement).value))} /> <div class="mt-3"> <button class="btn" onclick={flashConfig}>Flash config</button> @@ -202,21 +191,14 @@ <form method="POST" use:enhance class="space-y-2"> <input name="ssid" placeholder="Wifi SSID" class="input" /> <input name="key" placeholder="Wifi password" class="input" /> - <input - name="token" - bind:value={token} - placeholder="Coinos API token" - class="input" - /> + <input name="token" bind:value={token} placeholder="Coinos API token" class="input" /> <button type="submit" class="btn">Generate Config</button> </form> {/if} {:else} <!-- NEW FIRMWARE FLOW --> <div class="space-y-3"> - <label class="label" for="firmware-file" - >Select .ino.bin (firmware)</label - > + <label class="label" for="firmware-file">Select .ino.bin (firmware)</label> <input id="firmware-file" type="file" @@ -225,15 +207,12 @@ onchange={onPickFw} /> - <label class="label" for="firmware-address" - >Firmware address (hex, default 0x10000)</label - > + <label class="label" for="firmware-address">Firmware address (hex, default 0x10000)</label> <input id="firmware-address" class="input" bind:value={fwAddress} - onchange={(e) => - (fwAddress = Number((e.target as HTMLInputElement).value))} + onchange={(e) => (fwAddress = Number((e.target as HTMLInputElement).value))} /> <label class="flex items-center gap-2 mt-2"> @@ -242,9 +221,7 @@ </label> <div class="mt-3"> - <button class="btn" disabled={!fwBytes} onclick={flashFirmware} - >Flash firmware</button - > + <button class="btn" disabled={!fwBytes} onclick={flashFirmware}>Flash firmware</button> </div> {#if fwProgress > 0 && !fwDone} diff --git a/src/routes/(app)/printer/+page.svelte b/src/routes/(app)/printer/+page.svelte index 28a3dfb1..108af3b5 100644 --- a/src/routes/(app)/printer/+page.svelte +++ b/src/routes/(app)/printer/+page.svelte @@ -69,9 +69,7 @@ </script> <div class="container px-4 max-w-lg mx-auto space-y-5 mt-20"> - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - Printer - </h1> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Printer</h1> {#if esploader} {#if data} @@ -85,16 +83,8 @@ <form method="POST" use:enhance class="space-y-2"> <input name="ssid" bind:value={ssid} placeholder="wifi ssid" /> <input name="key" bind:value={key} placeholder="wifi pass" /> - <input - name="username" - bind:value={username} - placeholder="coinos username" - /> - <input - name="password" - bind:value={password} - placeholder="coinos password" - /> + <input name="username" bind:value={username} placeholder="coinos username" /> + <input name="password" bind:value={password} placeholder="coinos password" /> <button type="submit" class="btn">Generate Config</button> </form> {/if} diff --git a/src/routes/(app)/qr/[text]/[icon]/+server.ts b/src/routes/(app)/qr/[text]/[icon]/+server.ts index 4a1bb78e..85311a8f 100644 --- a/src/routes/(app)/qr/[text]/[icon]/+server.ts +++ b/src/routes/(app)/qr/[text]/[icon]/+server.ts @@ -15,13 +15,7 @@ export async function GET({ params }) { const logo = await loadImage(`static/images/${icon}`); const logoSize = size * 0.3; - ctx.drawImage( - logo, - (size - logoSize) / 2, - (size - logoSize) / 2, - logoSize, - logoSize, - ); + ctx.drawImage(logo, (size - logoSize) / 2, (size - logoSize) / 2, logoSize, logoSize); const buffer = canvas.toBuffer("image/png"); return new Response(buffer, { diff --git a/src/routes/(app)/qr/create/+page.svelte b/src/routes/(app)/qr/create/+page.svelte index 189a734d..3a17bcc0 100644 --- a/src/routes/(app)/qr/create/+page.svelte +++ b/src/routes/(app)/qr/create/+page.svelte @@ -8,8 +8,7 @@ text = $state(), pasted = $state(); - let keypress = (e) => - e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false); + let keypress = (e) => (e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false)); let paste = async () => { text = await navigator.clipboard.readText(); @@ -24,9 +23,7 @@ </script> <div class="container px-4 max-w-lg mx-auto space-y-5 mt-20"> - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - Create QR - </h1> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Create QR</h1> <form onsubmit={preventDefault(submit)} class="space-y-2 text-xl"> <div class="mb-2"> @@ -48,11 +45,7 @@ class="flex border rounded-2xl px-6 py-5 font-bold hover:opacity-80 w-full bg-primary justify-center gap-2" onclick={paste} > - <iconify-icon - noobserver - icon="ph:clipboard-text-bold" - width="32" - class="my-auto" + <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32" class="my-auto" ></iconify-icon> <div class="my-auto">{$t("user.send.paste")}</div> </button> @@ -62,11 +55,7 @@ type="submit" class="flex bg-black text-white border rounded-2xl px-6 py-5 w-full font-bold gap-2 justify-center" > - <iconify-icon - noobserver - icon="ph:paper-plane-right-bold" - width="32" - class="my-auto invert" + <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32" class="my-auto invert" ></iconify-icon> <div class="my-auto">{$t("user.dashboard.go")}</div> </button> diff --git a/src/routes/(app)/receive/[...token]/+page.svelte b/src/routes/(app)/receive/[...token]/+page.svelte index 1f4c81fc..bea32277 100644 --- a/src/routes/(app)/receive/[...token]/+page.svelte +++ b/src/routes/(app)/receive/[...token]/+page.svelte @@ -43,9 +43,7 @@ {#if form?.error} <div class="mb-5"> <div class="text-red-600"> - {form.error === "default" - ? $t("error.unrecognizedInput") - : form.error} + {form.error === "default" ? $t("error.unrecognizedInput") : form.error} </div> </div> {/if} @@ -66,15 +64,13 @@ <div class="flex gap-2"> <a href="/scan" class="contents"> <button type="button" class="btn !w-auto flex-grow"> - <iconify-icon noobserver icon="ph:camera-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:camera-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.send.scan")}</div> </button> </a> <button type="button" class="btn !w-auto flex-grow" onclick={paste}> - <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.send.paste")}</div> </button> </div> diff --git a/src/routes/(app)/reset/[code]/+page.svelte b/src/routes/(app)/reset/[code]/+page.svelte index 93fdf8f9..deade18a 100644 --- a/src/routes/(app)/reset/[code]/+page.svelte +++ b/src/routes/(app)/reset/[code]/+page.svelte @@ -19,8 +19,7 @@ onMount(() => { if (!isTor && recaptchaSiteKey) { let s = document.createElement("script"); - s.src = - "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; + s.src = "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; document.head.appendChild(s); } }); @@ -28,13 +27,9 @@ const getRecaptchaToken = () => new Promise((resolve, reject) => { if (isTor) return resolve(""); - if (!browser || !grecaptcha) - return reject(new Error("captcha unavailable")); + if (!browser || !grecaptcha) return reject(new Error("captcha unavailable")); grecaptcha.ready(() => { - grecaptcha - .execute(recaptchaSiteKey, { action: "reset" }) - .then(resolve) - .catch(reject); + grecaptcha.execute(recaptchaSiteKey, { action: "reset" }).then(resolve).catch(reject); }); }); @@ -59,9 +54,7 @@ } const scriptSelector = - "script[src='https://www.google.com/recaptcha/api.js?render=" + - recaptchaSiteKey + - "']"; + "script[src='https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey + "']"; const script = document.querySelector(scriptSelector); if (script) { script.remove(); @@ -77,9 +70,7 @@ </div> <div class="flex justify-center items-center"> - <div - class="shadow-xl rounded-3xl p-10 pb-12 space-y-5 w-full mx-5 md:mx-0 md:w-[400px]" - > + <div class="shadow-xl rounded-3xl p-10 pb-12 space-y-5 w-full mx-5 md:mx-0 md:w-[400px]"> <h1 class="text-2xl font-bold text-center">{$t("login.reset")}</h1> {#if form?.error} @@ -90,15 +81,11 @@ <form class="space-y-5" method="POST" onsubmit={handleSubmit}> <input type="hidden" name="recaptcha" value={recaptchaToken} /> - <PasswordInput - bind:value={$password} - placeholder={$t("login.password")} - /> + <PasswordInput bind:value={$password} placeholder={$t("login.password")} /> <div class="text-secondary"> - A new seed phrase will be generated for your account. You'll need to - import your old seed phrase if you want to use the same nostr profile - and savings account as before. + A new seed phrase will be generated for your account. You'll need to import your old seed + phrase if you want to use the same nostr profile and savings account as before. </div> <button diff --git a/src/routes/(app)/scan/+page.svelte b/src/routes/(app)/scan/+page.svelte index 90e0e79c..5fd49a43 100644 --- a/src/routes/(app)/scan/+page.svelte +++ b/src/routes/(app)/scan/+page.svelte @@ -32,8 +32,7 @@ highlightCodeOutline: true, qrEngine: BarcodeDetector, }; - let cb = ({ data }) => - scanner.stop() || goto(`/send/${encodeURIComponent(data)}`); + let cb = ({ data }) => scanner.stop() || goto(`/send/${encodeURIComponent(data)}`); scanner = new QrScanner(vid, cb, options); await tick(); scanner.start(); @@ -47,9 +46,7 @@ <div class="flex w-full mb-4 p-4"> <div class="mx-auto rounded-3xl"> - <video - bind:this={vid} - class="border-4 rounded-3xl border-black max-h-[calc(100vh*0.7)]" + <video bind:this={vid} class="border-4 rounded-3xl border-black max-h-[calc(100vh*0.7)]" ></video> </div> </div> diff --git a/src/routes/(app)/send/+layout.server.ts b/src/routes/(app)/send/+layout.server.ts index 38ed57cf..4917ea20 100644 --- a/src/routes/(app)/send/+layout.server.ts +++ b/src/routes/(app)/send/+layout.server.ts @@ -1,6 +1,5 @@ import { redirect } from "@sveltejs/kit"; export async function load({ cookies, url }) { - if (!cookies.get("token")) - redirect(307, `/register?redirect=${url.pathname}`); + if (!cookies.get("token")) redirect(307, `/register?redirect=${url.pathname}`); } diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index 58db231a..28332f6b 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -27,8 +27,7 @@ pasted = $state(), w: number | undefined = $state(); - let keypress = (e) => - e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false); + let keypress = (e) => (e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false)); let paste = async () => { text = await navigator.clipboard.readText(); @@ -80,9 +79,7 @@ {#if form?.error} <div class="mb-5"> <div class="text-red-600"> - {form.error === "default" - ? $t("error.unrecognizedInput") - : form.error} + {form.error === "default" ? $t("error.unrecognizedInput") : form.error} </div> </div> {/if} @@ -90,15 +87,13 @@ <div class="flex gap-2"> <a href="/scan" class="contents"> <button type="button" class="btn !w-auto flex-grow"> - <iconify-icon noobserver icon="ph:camera-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:camera-bold" width="32"></iconify-icon> {$t("user.send.scan")} </button> </a> <button type="button" class="btn !w-auto flex-grow" onclick={paste}> - <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:clipboard-text-bold" width="32"></iconify-icon> {$t("user.send.paste")} </button> </div> @@ -115,17 +110,13 @@ ></textarea> <button bind:this={el} type="submit" class="btn btn-accent"> - <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:paper-plane-right-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.send.next")}</div> </button> <a href="/send/fund" class="block"> <button type="button" class="btn"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 text-2xl" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 text-2xl" ></iconify-icon> <div class="my-auto">{$t("payments.createFund")}</div> </button> @@ -151,9 +142,7 @@ onclick={(e) => pin(e, c)} aria-label={c.pinned ? "Unpin contact" : "Pin contact"} > - <iconify-icon - icon={c.pinned ? "ph:push-pin-fill" : "ph:push-pin-bold"} - width={32} + <iconify-icon icon={c.pinned ? "ph:push-pin-fill" : "ph:push-pin-bold"} width={32} ></iconify-icon> </button> <button @@ -162,9 +151,7 @@ onclick={(e) => trust(e, c)} aria-label={c.trusted ? "Untrust contact" : "Trust contact"} > - <iconify-icon - icon={c.trusted ? "ph:star-fill" : "ph:star-bold"} - width={32} + <iconify-icon icon={c.trusted ? "ph:star-fill" : "ph:star-bold"} width={32} ></iconify-icon> </button> </div> @@ -176,8 +163,6 @@ {/if} {#if !loaded && contacts.length > 0} - <button onclick={loadMore} type="button" class="btn" - >{$t("user.loadMore")}</button - > + <button onclick={loadMore} type="button" class="btn">{$t("user.loadMore")}</button> {/if} </div> diff --git a/src/routes/(app)/send/ark/[address]/+layout.server.ts b/src/routes/(app)/send/ark/[address]/+layout.server.ts index bb167d2d..6381463a 100644 --- a/src/routes/(app)/send/ark/[address]/+layout.server.ts +++ b/src/routes/(app)/send/ark/[address]/+layout.server.ts @@ -18,8 +18,7 @@ export async function load({ cookies, params, parent }) { const recipient = await get(`/users/${invoice.uid}`); let r = `/pay/${recipient.username}`; if (amount) r += `/${amount}`; - if (recipient?.id !== user.id && recipient.id === invoice.aid) - redirect(307, r); + if (recipient?.id !== user.id && recipient.id === invoice.aid) redirect(307, r); } return { balance }; diff --git a/src/routes/(app)/send/ark/[address]/+page.svelte b/src/routes/(app)/send/ark/[address]/+page.svelte index 0bf9e0de..23f3a7fb 100644 --- a/src/routes/(app)/send/ark/[address]/+page.svelte +++ b/src/routes/(app)/send/ark/[address]/+page.svelte @@ -34,21 +34,10 @@ <div class="text-xl text-secondary break-all">{address}</div> - <Numpad - bind:amount={a} - bind:fiat - {currency} - {submit} - bind:rate={$rate} - {locale} - /> + <Numpad bind:amount={a} bind:fiat {currency} {submit} bind:rate={$rate} {locale} /> <div class="flex justify-center gap-2"> - <button - type="button" - class="btn !w-auto grow" - onclick={setMax} - onkeydown={setMax} + <button type="button" class="btn !w-auto grow" onclick={setMax} onkeydown={setMax} >{#if $fiatStore} Max {f((balance * $rate) / sats, currency, locale)} {:else} @@ -57,11 +46,7 @@ > <form action={`/send/ark/${address}/${amount}`} class="contents"> - <button - bind:this={submit} - type="submit" - class="btn !w-auto grow btn-accent" - > + <button bind:this={submit} type="submit" class="btn !w-auto grow btn-accent"> {$t("payments.next")} </button> </form> diff --git a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts index 07972e6c..10a6a737 100644 --- a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts +++ b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts @@ -36,19 +36,11 @@ export async function load({ params: { address, amount }, cookies, parent }) { } export const actions = { - default: async ({ - cookies, - params: { address, amount, feeRate }, - request, - }) => { + default: async ({ cookies, params: { address, amount, feeRate }, request }) => { let p; try { const body = await fd(request); - p = await post( - "/ark/send", - { ...body, address, amount: parseInt(amount) }, - auth(cookies), - ); + p = await post("/ark/send", { ...body, address, amount: parseInt(amount) }, auth(cookies)); } catch (e) { console.log("problem sending bitcoin", e); const { message } = e as Error; diff --git a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte index f5bc3bc6..c7c08772 100644 --- a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte +++ b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte @@ -68,9 +68,7 @@ submit = $state(); </script> -<div - class="container px-4 max-w-xl mx-auto space-y-5 text-center no-transition" -> +<div class="container px-4 max-w-xl mx-auto space-y-5 text-center no-transition"> <h1 class="text-3xl md:text-4xl font-semibold mb-2">{$t("payments.send")}</h1> {#if form?.message || message || error} diff --git a/src/routes/(app)/send/bitcoin/[address]/+page.svelte b/src/routes/(app)/send/bitcoin/[address]/+page.svelte index 6c49ad6c..76ac093e 100644 --- a/src/routes/(app)/send/bitcoin/[address]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/+page.svelte @@ -34,21 +34,10 @@ <div class="text-xl text-secondary break-all">{address}</div> - <Numpad - bind:amount={a} - bind:fiat - {currency} - {submit} - bind:rate={$rate} - {locale} - /> + <Numpad bind:amount={a} bind:fiat {currency} {submit} bind:rate={$rate} {locale} /> <div class="flex justify-center gap-2"> - <button - type="button" - class="btn !w-auto grow" - onclick={setMax} - onkeydown={setMax} + <button type="button" class="btn !w-auto grow" onclick={setMax} onkeydown={setMax} >{#if $fiatStore} Max {f((balance * $rate) / sats, currency, locale)} {:else} @@ -57,12 +46,7 @@ > <form action={`/send/bitcoin/${address}/${amount}`} class="contents"> - <button - use:focus - bind:this={submit} - type="submit" - class="btn !w-auto grow btn-accent" - > + <button use:focus bind:this={submit} type="submit" class="btn !w-auto grow btn-accent"> {$t("payments.next")} </button> </form> diff --git a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts index 7cdd86f5..c5149a93 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts @@ -2,11 +2,7 @@ import getRates from "$lib/rates"; import { auth, fd, get, post } from "$lib/utils"; import { fail, redirect } from "@sveltejs/kit"; -export async function load({ - params: { address, amount, feeRate }, - cookies, - parent, -}) { +export async function load({ params: { address, amount, feeRate }, cookies, parent }) { const rates = await getRates(); const { user } = await parent(); const aid = cookies.get("aid") || user.id; @@ -50,11 +46,7 @@ export async function load({ } export const actions = { - default: async ({ - cookies, - params: { address, amount, feeRate }, - request, - }) => { + default: async ({ cookies, params: { address, amount, feeRate }, request }) => { let p; try { const body = await fd(request); diff --git a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte index 6581e12f..49dbe7c6 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte @@ -14,10 +14,7 @@ import { hex as hexUtil } from "@scure/base"; import * as btc from "@scure/btc-signer"; import { decrypt } from "nostr-tools/nip49"; - import { - getRememberedWalletPassword, - forgetWalletPassword, - } from "$lib/passwordCache"; + import { getRememberedWalletPassword, forgetWalletPassword } from "$lib/passwordCache"; import { sendArkViaForward } from "$lib/ark"; import Amount from "$comp/Amount.svelte"; @@ -78,8 +75,7 @@ return; } - if ((account.seed || data.user.seed) && !signed) - (cancel(), void togglePassword()); + if ((account.seed || data.user.seed) && !signed) (cancel(), void togglePassword()); return async ({ result }) => { if (result.type === "redirect") { goto(result.location); @@ -92,29 +88,21 @@ let signTx = async () => { const { decrypt } = await import("nostr-tools/nip49"); - const [ - { Transaction }, - { HDKey }, - { entropyToMnemonic, mnemonicToSeed }, - { wordlist }, - ] = await Promise.all([ - import("@scure/btc-signer"), - import("@scure/bip32"), - import("@scure/bip39"), - import("@scure/bip39/wordlists/english.js"), - ]); - let entropy = await decrypt( - account.seed || data.user.seed, - password as string, - ); + const [{ Transaction }, { HDKey }, { entropyToMnemonic, mnemonicToSeed }, { wordlist }] = + await Promise.all([ + import("@scure/btc-signer"), + import("@scure/bip32"), + import("@scure/bip39"), + import("@scure/bip39/wordlists/english.js"), + ]); + let entropy = await decrypt(account.seed || data.user.seed, password as string); let mnemonic = entropyToMnemonic(entropy, wordlist); let seed = await mnemonicToSeed(mnemonic, password as string); let master = HDKey.fromMasterSeed(seed, network as any); let child = master.derive(`m/84'/0'/${account.accountIndex ?? 0}'`); let raw = decode(hex); - let isPSBT = - raw[0] === 0x70 && raw[1] === 0x73 && raw[2] === 0x62 && raw[3] === 0x74; + let isPSBT = raw[0] === 0x70 && raw[1] === 0x73 && raw[2] === 0x62 && raw[3] === 0x74; let tx: any = isPSBT ? Transaction.fromPSBT(raw) : Transaction.fromRaw(raw); for (let [i, input] of tx.inputs.entries()) { @@ -137,27 +125,15 @@ let toggle = () => (submitting = !submitting); - let { - account, - amount, - address, - message, - fee, - fees, - subtract, - ourfee, - hex, - inputs, - } = $derived(data); + let { account, amount, address, message, fee, fees, subtract, ourfee, hex, inputs } = + $derived(data); let { feeRate }: any = $state(data); $effect(() => { if (fees) { delete fees.minimumFee; - feeRate = feeRate - ? closest(Object.values(fees), feeRate) - : fees.halfHourFee; + feeRate = feeRate ? closest(Object.values(fees), feeRate) : fees.halfHourFee; } }); @@ -182,9 +158,7 @@ let goBack = () => goto(`/send/bitcoin/${address}`); </script> -<div - class="container px-4 max-w-xl mx-auto space-y-5 text-center no-transition" -> +<div class="container px-4 max-w-xl mx-auto space-y-5 text-center no-transition"> <h1 class="text-3xl md:text-4xl font-semibold mb-2">{$t("payments.send")}</h1> {#if form?.message || message || error} @@ -194,11 +168,7 @@ {:else} <div class="text-xl text-secondary break-all">{address}</div> - <Amount - amount={subtract ? amount - fee - ourfee : amount} - rate={$rate} - {currency} - /> + <Amount amount={subtract ? amount - fee - ourfee : amount} rate={$rate} {currency} /> {#if fees} <div class="text-center"> diff --git a/src/routes/(app)/send/fund/[...name]/[...amount]/+page.svelte b/src/routes/(app)/send/fund/[...name]/[...amount]/+page.svelte index 58d4812f..d0cf6743 100644 --- a/src/routes/(app)/send/fund/[...name]/[...amount]/+page.svelte +++ b/src/routes/(app)/send/fund/[...name]/[...amount]/+page.svelte @@ -52,12 +52,7 @@ <div class="container px-4 mt-20 max-w-xl mx-auto"> <Numpad bind:amount {currency} {rate} {fiat} {submit} {locale} /> - <form - use:enhance={handler(toggle)} - method="POST" - class="space-y-5" - bind:this={formElement} - > + <form use:enhance={handler(toggle)} method="POST" class="space-y-5" bind:this={formElement}> <input name="fund" value={name} type="hidden" /> <input name="amount" value={amount} type="hidden" /> <input name="pin" value={$pin} type="hidden" /> @@ -76,12 +71,7 @@ {/if}</button > - <button - use:focus - bind:this={submit} - type="submit" - class="btn btn-accent !w-auto grow" - > + <button use:focus bind:this={submit} type="submit" class="btn btn-accent !w-auto grow"> {#if submitting} <Spinner /> {:else} diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index 2e268b99..59add224 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -32,21 +32,13 @@ export async function load({ cookies, depends, params: { id }, parent }) { if (p) redirect(307, `/sent/${p.id}`); } - if (invoice.amount && invoice.prompt && invoice.tip === null) - redirect(307, `/invoice/${id}/tip`); + if (invoice.amount && invoice.prompt && invoice.tip === null) redirect(307, `/invoice/${id}/tip`); - if (invoice.memoPrompt && invoice.memo === null) - redirect(307, `/invoice/${id}/memo`); + if (invoice.memoPrompt && invoice.memo === null) redirect(307, `/invoice/${id}/memo`); - if (user && invoice.aid === aid) - error(500, { message: "Cannot send to self" }); + if (user && invoice.aid === aid) error(500, { message: "Cannot send to self" }); else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) - redirect( - 307, - `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${ - invoice.hash - }`, - ); + redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`); if (!user) redirect(307, `/invoice/${id}`); diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index f3f2f618..9174cf4c 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -11,18 +11,7 @@ import Numpad from "$comp/Numpad.svelte"; import Spinner from "$comp/Spinner.svelte"; import { page } from "$app/stores"; - import { - btc, - sat, - post, - back, - f, - toFiat, - s, - sats, - focus, - loc, - } from "$lib/utils"; + import { btc, sat, post, back, f, toFiat, s, sats, focus, loc } from "$lib/utils"; let { data, form }: any = $props(); let { trusted, balance, invoice, user } = $state(data); @@ -156,14 +145,7 @@ {/each} {/if} {:else} - <Numpad - bind:amount={a} - bind:amountFiat={af} - bind:fiat - {currency} - {rate} - {submit} - /> + <Numpad bind:amount={a} bind:amountFiat={af} bind:fiat {currency} {rate} {submit} /> {/if} <form method="POST" use:enhance={handler(toggle)} class="space-y-2"> @@ -175,12 +157,7 @@ <div class="flex w-full text-xl"> {#if amount} - <button - use:focus - type="submit" - class="btn btn-primary" - disabled={submitting} - > + <button use:focus type="submit" class="btn btn-primary" disabled={submitting}> {#if submitting} <Spinner /> {:else} @@ -188,11 +165,7 @@ {/if} </button> {:else} - <button - type="button" - class="btn !w-auto grow" - onclick={setMax} - onkeydown={setMax} + <button type="button" class="btn !w-auto grow" onclick={setMax} onkeydown={setMax} >{#if $fiatStore} Max {f((balance * rate) / sats, currency, locale)} {:else} @@ -210,9 +183,7 @@ </button> {/if} </div> - <button type="button" class="btn" onclick={external} - >{$t("payments.moreOptions")}</button - > + <button type="button" class="btn" onclick={external}>{$t("payments.moreOptions")}</button> {#if !trusted} <button type="button" class="btn" onclick={toggleTrust}> diff --git a/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte b/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte index 718f3ee2..fbafd7d4 100644 --- a/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte +++ b/src/routes/(app)/send/lightning/[payreq]/[...memo]/+page.svelte @@ -34,9 +34,7 @@ let show = $state(false); let toggle = () => (show = !show); let amount = $derived(form?.amount || data.amount); - let maxfee = $state( - Math.max(5, Math.round(untrack(() => amount) * 0.02 || 0)), - ); + let maxfee = $state(Math.max(5, Math.round(untrack(() => amount) * 0.02 || 0))); $effect(() => { maxfee = Math.max(5, Math.round(amount * 0.02) || 0); }); @@ -144,9 +142,7 @@ {#if form?.message || showMax} <div class="mx-auto space-y-2"> - <label for="maxfee" class="text-lg text-secondary" - >{$t("payments.maxfee")}</label - > + <label for="maxfee" class="text-lg text-secondary">{$t("payments.maxfee")}</label> <div class="text-secondary"> {$t("payments.maxFeeDesc")} @@ -155,23 +151,13 @@ <label class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2 text-left" > - <input - id="maxfee" - name="fee" - bind:value={maxfee} - class="clean !grow" - /> + <input id="maxfee" name="fee" bind:value={maxfee} class="clean !grow" /> <div class="ml-auto">⚡️</div> </label> </div> {/if} - <button - type="submit" - class="btn btn-primary" - disabled={loading} - use:focus - > + <button type="submit" class="btn btn-primary" disabled={loading} use:focus> {#if loading} <Spinner /> {:else} @@ -199,9 +185,7 @@ submit={next} element={undefined} /> - <button type="submit" class="btn" bind:this={next} - >{$t("payments.next")}</button - > + <button type="submit" class="btn" bind:this={next}>{$t("payments.next")}</button> </form> {/if} </div> diff --git a/src/routes/(app)/send/zap/[id]/[...amount]/+page.server.ts b/src/routes/(app)/send/zap/[id]/[...amount]/+page.server.ts index a658a5c1..2886f00a 100644 --- a/src/routes/(app)/send/zap/[id]/[...amount]/+page.server.ts +++ b/src/routes/(app)/send/zap/[id]/[...amount]/+page.server.ts @@ -8,8 +8,7 @@ export async function load({ cookies, params, parent }) { const rates = await getRates(); let request; - if (amount) - request = await post("/zapRequest", { amount, id }, auth(cookies)); + if (amount) request = await post("/zapRequest", { amount, id }, auth(cookies)); const rate = rates[user.currency]; return { amount, id, rates, rate, request }; diff --git a/src/routes/(app)/send/zap/[id]/[...amount]/+page.svelte b/src/routes/(app)/send/zap/[id]/[...amount]/+page.svelte index 3d0d144c..bf5f5202 100644 --- a/src/routes/(app)/send/zap/[id]/[...amount]/+page.svelte +++ b/src/routes/(app)/send/zap/[id]/[...amount]/+page.svelte @@ -70,8 +70,6 @@ submit={next} element={undefined} /> - <button type="submit" class="btn" bind:this={next} - >{$t("payments.next")}</button - > + <button type="submit" class="btn" bind:this={next}>{$t("payments.next")}</button> </form> </div> diff --git a/src/routes/(app)/sent/[id]/+page.svelte b/src/routes/(app)/sent/[id]/+page.svelte index ba2b7366..3dde854f 100644 --- a/src/routes/(app)/sent/[id]/+page.svelte +++ b/src/routes/(app)/sent/[id]/+page.svelte @@ -10,14 +10,7 @@ let locale = $derived(loc(user)); </script> -<Success - {amount} - {rate} - {tip} - {currency} - {locale} - title={`${$t("payments.sent")}!`} -/> +<Success {amount} {rate} {tip} {currency} {locale} title={`${$t("payments.sent")}!`} /> <a href={`/${username}`} use:focus aria-label="Continue"> <div class="opacity-0 w-screen h-screen fixed top-0 left-0 z-50"></div> </a> diff --git a/src/routes/(app)/settings/+layout.svelte b/src/routes/(app)/settings/+layout.svelte index b670737f..b14f59d4 100644 --- a/src/routes/(app)/settings/+layout.svelte +++ b/src/routes/(app)/settings/+layout.svelte @@ -49,9 +49,7 @@ import { PUBLIC_DM_RELAYS } from "$env/static/public"; const DM_RELAYS_LIST = PUBLIC_DM_RELAYS.split(","); const updateRelaysIfAvailable = async () => { - const relayEntry = document.getElementById( - "dmRelays", - ) as HTMLTextAreaElement | null; + const relayEntry = document.getElementById("dmRelays") as HTMLTextAreaElement | null; if (!relayEntry || relayEntry.value.length === 0) return; const newRelays = relayEntry.value.split(/[ \r\n\t]+/).filter(isValidURL); @@ -233,8 +231,7 @@ } }); $effect(() => { - if (!$loading && $page.url.searchParams.get("verified")) - success($t("user.settings.verified")); + if (!$loading && $page.url.searchParams.get("verified")) success($t("user.settings.verified")); }); </script> @@ -242,12 +239,7 @@ <Pin /> {/if} -<form - method="POST" - class="mb-[154px] settings" - onsubmit={handleSubmit} - bind:this={formElement} -> +<form method="POST" class="mb-[154px] settings" onsubmit={handleSubmit} bind:this={formElement}> <input type="hidden" name="pin" value={$pin} /> <input type="hidden" name="tab" value={tab} /> diff --git a/src/routes/(app)/settings/account/+page.svelte b/src/routes/(app)/settings/account/+page.svelte index fb182887..7a1bbab1 100644 --- a/src/routes/(app)/settings/account/+page.svelte +++ b/src/routes/(app)/settings/account/+page.svelte @@ -20,8 +20,7 @@ let fiats = Object.keys(rates).sort((a, b) => a.localeCompare(b)); let el: any; - let keypress = (e: any) => - e.key === "Enter" && (e.preventDefault() || el.click()); + let keypress = (e: any) => e.key === "Enter" && (e.preventDefault() || el.click()); let editingReserve = $state(), editingThreshold = $state(), @@ -56,9 +55,7 @@ onMount(async () => { if (!browser) return; - pm = - navigator?.serviceWorker && - (await navigator.serviceWorker.getRegistration())?.pushManager; + pm = navigator?.serviceWorker && (await navigator.serviceWorker.getRegistration())?.pushManager; permission = await pm.permissionState({ userVisibleOnly: true, @@ -105,16 +102,12 @@ </script> <div> - <label for="language" class="font-bold block mb-1" - >{$t("user.settings.locale")}</label - > + <label for="language" class="font-bold block mb-1">{$t("user.settings.locale")}</label> <LocaleSelector style="select-styles block py-3 w-full" /> </div> <div> - <label for="currency" class="font-bold block mb-1" - >{$t("user.settings.localCurrency")}</label - > + <label for="currency" class="font-bold block mb-1">{$t("user.settings.localCurrency")}</label> <select name="currency" value={currency}> {#each fiats as fiat} <option value={fiat}>{fiat}</option> @@ -128,23 +121,13 @@ {$t("user.settings.emailDescription")} </p> - <label - class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2" - > + <label class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2"> <input type="text" name="email" class="clean" bind:value={email} /> {#if verified} - <iconify-icon - noobserver - icon="ph:check-bold" - class="text-success ml-auto" - width="32" + <iconify-icon noobserver icon="ph:check-bold" class="text-success ml-auto" width="32" ></iconify-icon> {:else if email} - <iconify-icon - noobserver - icon="ph:clock-bold" - class="text-warning ml-auto" - width="32" + <iconify-icon noobserver icon="ph:clock-bold" class="text-warning ml-auto" width="32" ></iconify-icon> {/if} </label> @@ -192,9 +175,7 @@ {$t("user.settings.tipDesc")} </p> - <label - class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2" - > + <label class="input input-bordered border-primary input-lg rounded-2xl flex items-center gap-2"> <input type="text" name="tip" class="clean" bind:value={tip} /> </label> </div> @@ -211,9 +192,7 @@ <div class:hidden={!user.autowithdraw}> <div class="mb-2"> - <label for="display" class="font-bold mb-1 block" - >{$t("user.settings.destination")}</label - > + <label for="display" class="font-bold mb-1 block">{$t("user.settings.destination")}</label> <textarea name="destination" placeholder={$t("user.settings.destinationPlaceholder")} @@ -224,20 +203,12 @@ </div> <div> - <label for="display" class="font-bold mb-1 block" - >{$t("user.settings.threshold")}</label - > + <label for="display" class="font-bold mb-1 block">{$t("user.settings.threshold")}</label> <button type="button" class="flex w-full" onclick={editThreshold}> <div class="p-4 border rounded-2xl rounded-r-none border-r-0 bg-base-200"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> </div> - <div - class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left" - > + <div class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left"> {user.threshold} </div> <input type="hidden" name="threshold" bind:value={user.threshold} /> @@ -248,20 +219,12 @@ </div> <div> - <label for="display" class="font-bold mb-1 block" - >{$t("user.settings.reserve")}</label - > + <label for="display" class="font-bold mb-1 block">{$t("user.settings.reserve")}</label> <button type="button" class="flex w-full" onclick={editReserve}> <div class="p-4 border rounded-2xl rounded-r-none border-r-0 bg-base-200"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon> + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon> </div> - <div - class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left" - > + <div class="border-l-0 rounded-l-none pl-2 w-full p-4 border rounded-2xl text-left"> {user.reserve} </div> <input type="hidden" name="reserve" bind:value={user.reserve} /> @@ -273,9 +236,7 @@ </div> {#if editingThreshold} - <div - class="fixed bg-base-100/90 inset-0 overflow-y-auto h-full w-full z-50 max-w-lg mx-auto" - > + <div class="fixed bg-base-100/90 inset-0 overflow-y-auto h-full w-full z-50 max-w-lg mx-auto"> <div class="relative p-5 border shadow-lg rounded-md bg-base-100 space-y-5"> <h1 class="text-center text-2xl font-semibold"> {$t("user.settings.threshold")} @@ -288,23 +249,14 @@ bind:element={thresholdEl} /> - <button - bind:this={doneReserve} - type="button" - onclick={doneEditing} - class="btn">Ok</button - > + <button bind:this={doneReserve} type="button" onclick={doneEditing} class="btn">Ok</button> </div> </div> {/if} {#if editingReserve} - <div - class="fixed bg-base-100/90 inset-0 overflow-y-auto h-full w-full z-50 mx-auto max-w-lg" - > - <div - class="relative mx-auto p-5 border shadow-lg rounded-md bg-base-100 space-y-5 text-center" - > + <div class="fixed bg-base-100/90 inset-0 overflow-y-auto h-full w-full z-50 mx-auto max-w-lg"> + <div class="relative mx-auto p-5 border shadow-lg rounded-md bg-base-100 space-y-5 text-center"> <h1 class="text-2xl font-semibold"> {$t("user.settings.reserve")} </h1> @@ -315,12 +267,7 @@ bind:submit={doneReserve} bind:element={reserveEl} /> - <button - bind:this={doneReserve} - type="button" - onclick={doneEditing} - class="btn">Ok</button - > + <button bind:this={doneReserve} type="button" onclick={doneEditing} class="btn">Ok</button> </div> </div> {/if} @@ -332,12 +279,7 @@ > {:else} <button type="button" onclick={revoke} class="btn"> - <img - src="/images/square.svg" - class="w-12" - class:invert={$theme === "dark"} - alt="Square" - /> + <img src="/images/square.svg" class="w-12" class:invert={$theme === "dark"} alt="Square" /> <div>{$t("user.settings.revokeSquare")}</div> </button> {/if} diff --git a/src/routes/(app)/settings/nostr/+page.svelte b/src/routes/(app)/settings/nostr/+page.svelte index c91150a3..35ae2b92 100644 --- a/src/routes/(app)/settings/nostr/+page.svelte +++ b/src/routes/(app)/settings/nostr/+page.svelte @@ -46,9 +46,7 @@ const DM_RELAYS_LIST = PUBLIC_DM_RELAYS.split(","); const pool = new SimplePool(); getPreferredRelays(user.pubkey).then((relays) => { - const relayEntry = document.getElementById( - "dmRelays", - ) as HTMLTextAreaElement | null; + const relayEntry = document.getElementById("dmRelays") as HTMLTextAreaElement | null; if (relayEntry) relayEntry.value = relays.join("\n"); }); </script> @@ -74,22 +72,11 @@ {#if app.max_amount > 0} <div class="flex gap-1 text-base"> <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" ></iconify-icon> {#if $fiat && $rate} - {f( - (app.spent * ($rate as number)) / sats, - user.currency, - locale, - )} / - {f( - (app.max_amount * ($rate as number)) / sats, - user.currency, - locale, - )} + {f((app.spent * ($rate as number)) / sats, user.currency, locale)} / + {f((app.max_amount * ($rate as number)) / sats, user.currency, locale)} {:else} {s(app.spent, locale)} / {s(app.max_amount, locale)} @@ -152,8 +139,7 @@ class:btn-disabled={!app.secret} aria-label="Open nostr" > - <iconify-icon icon="ph:arrow-square-out-bold" width="32" - ></iconify-icon> + <iconify-icon icon="ph:arrow-square-out-bold" width="32"></iconify-icon> <div>{$t("accounts.connect")}</div> </a> </div> @@ -202,8 +188,7 @@ class="my-auto btn btn-circle !w-auto grow" aria-label="QR" > - <iconify-icon noobserver icon="ph:qr-code-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:qr-code-bold" width="32"></iconify-icon> {$t("accounts.qr")} </a> </div> @@ -219,9 +204,7 @@ {#if user.nsec} <div class="space-y-2"> - <label for="seedphrase" class="font-bold" - >{$t("user.settings.nostrKeys")}</label - > + <label for="seedphrase" class="font-bold">{$t("user.settings.nostrKeys")}</label> <p class="text-secondary mb-1"> {$t("user.settings.nostrDescription")} @@ -230,12 +213,10 @@ <div class="flex flex-wrap sm:flex-nowrap gap-2"> <button type="button" class="btn !w-auto flex-grow" onclick={toggleNsec}> {#if revealNsec} - <iconify-icon noobserver icon="ph:eye-slash-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:eye-slash-bold" width="32"></iconify-icon> {$t("user.settings.hideNsec")} {:else} - <iconify-icon noobserver icon="ph:warning-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:warning-bold" width="32"></iconify-icon> {$t("user.settings.revealNsec")} {/if} </button> diff --git a/src/routes/(app)/settings/profile/+page.svelte b/src/routes/(app)/settings/profile/+page.svelte index 5cb4f7ae..e56f8a70 100644 --- a/src/routes/(app)/settings/profile/+page.svelte +++ b/src/routes/(app)/settings/profile/+page.svelte @@ -71,9 +71,7 @@ </script> <div> - <label for="username" class="font-bold mb-1 block" - >{$t("user.settings.username")}</label - > + <label for="username" class="font-bold mb-1 block">{$t("user.settings.username")}</label> <div class="flex mb-2"> <input type="text" name="username" bind:value={username} /> </div> @@ -82,20 +80,13 @@ <input type="hidden" name="confirm" bind:value={password} /> <div> - <label for="password" class="block font-bold block mb-1" - >{$t("user.settings.newPassword")}</label - > + <label for="password" class="block font-bold block mb-1">{$t("user.settings.newPassword")}</label> - <PasswordInput - bind:value={password} - placeholder="(Leave blank to keep unchanged)" - /> + <PasswordInput bind:value={password} placeholder="(Leave blank to keep unchanged)" /> </div> <div> - <label for="display" class="font-bold mb-1 block" - >{$t("user.settings.displayName")}</label - > + <label for="display" class="font-bold mb-1 block">{$t("user.settings.displayName")}</label> <input type="text" name="display" bind:value={display} /> </div> @@ -107,8 +98,7 @@ <div class="relative rounded-full overflow-hidden text-center w-20 h-20 my-auto hover:opacity-80 cursor-pointer" onclick={selectAvatar} - onkeydown={(e) => - (e.key === "Enter" || e.key === " ") && selectAvatar()} + onkeydown={(e) => (e.key === "Enter" || e.key === " ") && selectAvatar()} role="button" tabindex="0" > @@ -122,19 +112,15 @@ <div class="rounded-full border-4 border-base-100 p-4 bg-base-200 w-24 h-24 my-auto hover:opacity-80 cursor-pointer" onclick={selectAvatar} - onkeydown={(e) => - (e.key === "Enter" || e.key === " ") && selectAvatar()} + onkeydown={(e) => (e.key === "Enter" || e.key === " ") && selectAvatar()} role="button" tabindex="0" ></div> {/if} <div class="ml-2 p-2"> <!-- found missing translation --> - <button - type="button" - class="btn" - onclick={selectAvatar} - onkeydown={selectAvatar}>{$t("user.settings.select")}</button + <button type="button" class="btn" onclick={selectAvatar} onkeydown={selectAvatar} + >{$t("user.settings.select")}</button > <input type="file" @@ -156,12 +142,7 @@ </div> {#if $bannerStore || banner} - <button - type="button" - class="w-full" - onclick={selectBanner} - aria-label="Select banner" - > + <button type="button" class="w-full" onclick={selectBanner} aria-label="Select banner"> <img src={$bannerStore ? ($bannerStore as any).src : banner} class="w-full object-cover object-center visible overflow-hidden h-48 mb-4 hover:opacity-80" @@ -178,11 +159,8 @@ ></div> {/if} - <button - type="button" - class="btn !w-auto" - onclick={selectBanner} - onkeydown={selectBanner}>{$t("user.settings.select")}</button + <button type="button" class="btn !w-auto" onclick={selectBanner} onkeydown={selectBanner} + >{$t("user.settings.select")}</button > <input type="file" @@ -197,12 +175,7 @@ </div> <div> - <label for="about" class="font-bold mb-1 block" - >{$t("user.settings.about")}</label - > - <textarea - name="about" - bind:value={about} - placeholder={$t("user.settings.aboutPlaceholder")} + <label for="about" class="font-bold mb-1 block">{$t("user.settings.about")}</label> + <textarea name="about" bind:value={about} placeholder={$t("user.settings.aboutPlaceholder")} ></textarea> </div> diff --git a/src/routes/(app)/settings/security/+page.svelte b/src/routes/(app)/settings/security/+page.svelte index 193cd91b..cb9897a1 100644 --- a/src/routes/(app)/settings/security/+page.svelte +++ b/src/routes/(app)/settings/security/+page.svelte @@ -164,9 +164,7 @@ <div> <span class="font-bold mb-1" - >{verifying - ? $t("user.settings.verifyPIN") - : $t("user.settings.securityPIN")}</span + >{verifying ? $t("user.settings.verifyPIN") : $t("user.settings.securityPIN")}</span > <p class="text-secondary mb-1"> {$t("user.settings.securityPINDescription")} @@ -174,12 +172,7 @@ {#if verifying} <Pin bind:value={verify} {cancel} notify={false} /> {:else if settingPin} - <Pin - bind:value={pin} - title={$t("user.settings.setPIN")} - {cancel} - notify={false} - /> + <Pin bind:value={pin} title={$t("user.settings.setPIN")} {cancel} notify={false} /> {:else} <button type="button" class="btn" onclick={togglePin}> <iconify-icon @@ -187,9 +180,7 @@ icon={haspin ? "ph:lock-key-open-bold" : "ph:lock-key-bold"} width="32" ></iconify-icon> - {haspin - ? $t("user.settings.disablePIN") - : $t("user.settings.enablePIN")}</button + {haspin ? $t("user.settings.disablePIN") : $t("user.settings.enablePIN")}</button > {/if} </div> @@ -216,14 +207,12 @@ </button> {:else if user.twofa} <button type="button" class="btn" onclick={startDisabling2fa}> - <iconify-icon noobserver icon="ph:device-mobile-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:device-mobile-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.settings.twofaDisable")}</div> </button> {:else} <button type="button" class="btn" onclick={startEnabling2fa}> - <iconify-icon noobserver icon="ph:device-mobile-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:device-mobile-bold" width="32"></iconify-icon> <div class="my-auto">{$t("user.settings.twofaSetup")}</div> </button> {/if} @@ -236,8 +225,7 @@ <div> <a href={`/account/new`} class="contents"> <button class="btn btn-lg w-full rounded-2xl whitespace-nowrap"> - <iconify-icon noobserver icon="ph:plus-circle-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:plus-circle-bold" width="32"></iconify-icon> {$t("accounts.addAccount")} </button> </a> diff --git a/src/routes/(app)/thread/[id]/+page.svelte b/src/routes/(app)/thread/[id]/+page.svelte index a77e6e36..70397e17 100644 --- a/src/routes/(app)/thread/[id]/+page.svelte +++ b/src/routes/(app)/thread/[id]/+page.svelte @@ -6,9 +6,7 @@ </script> <div class="container px-4 max-w-xl mx-auto space-y-5"> - <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold"> - Thread - </h1> + <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Thread</h1> {#each thread as event} <Event {event} minimal={true} /> diff --git a/src/routes/(app)/verify/[code]/+page.svelte b/src/routes/(app)/verify/[code]/+page.svelte index 17ff858a..813c29e6 100644 --- a/src/routes/(app)/verify/[code]/+page.svelte +++ b/src/routes/(app)/verify/[code]/+page.svelte @@ -8,24 +8,14 @@ <div class="container px-4 text-center mx-auto"> {#if error} - <h1 class="text-3xl md:text-4xl font-bold mb-6"> - Email verification failed - </h1> + <h1 class="text-3xl md:text-4xl font-bold mb-6">Email verification failed</h1> {:else if user.verified} - <div - class="flex w-full py-5 max-w-[200px] mx-auto" - in:scale={{ start: 0.5 }} - > - <iconify-icon - noobserver - icon="ph:check-bold" - class="mx-auto w-full text-[#7ACC8F]" + <div class="flex w-full py-5 max-w-[200px] mx-auto" in:scale={{ start: 0.5 }}> + <iconify-icon noobserver icon="ph:check-bold" class="mx-auto w-full text-[#7ACC8F]" ></iconify-icon> </div> - <h1 class="text-3xl md:text-4xl font-bold mb-6"> - Email verified successfully! - </h1> + <h1 class="text-3xl md:text-4xl font-bold mb-6">Email verified successfully!</h1> {/if} </div> diff --git a/src/routes/(static)/+layout.svelte b/src/routes/(static)/+layout.svelte index a6f6d858..9c7f5e5e 100644 --- a/src/routes/(static)/+layout.svelte +++ b/src/routes/(static)/+layout.svelte @@ -16,10 +16,7 @@ <SvelteToast options={{ reversed: true, intro: { y: 192 } }} /> <LandingHeader {user} /> <Nostr /> -<main - class="container flex px-4 md:px-40 mx-auto min-h-[600px]" - data-theme={theme} -> +<main class="container flex px-4 md:px-40 mx-auto min-h-[600px]" data-theme={theme}> {@render children?.()} </main> <Footer /> diff --git a/src/routes/(static)/bounties/+page.svelte b/src/routes/(static)/bounties/+page.svelte index 3cc269dc..fad8c041 100644 --- a/src/routes/(static)/bounties/+page.svelte +++ b/src/routes/(static)/bounties/+page.svelte @@ -41,10 +41,7 @@ <div class="flex max-w-xs sm:max-w-xl"> <div>First {b}</div> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 ml-auto" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 ml-auto" ></iconify-icon>{s(100000, "en-CA")} </div> {/each} @@ -57,10 +54,7 @@ <div class="flex max-w-xs sm:max-w-xl"> <div>{b.type}</div> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300 ml-auto" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300 ml-auto" ></iconify-icon>{s(b.amount, "en-CA")} </div> {/each} @@ -85,9 +79,7 @@ class="whitespace-wrap text-base font-semibold max-w-[150px] truncate sm:max-w-full" title={merchant.display || merchant.username} > - <a href={`/${merchant.username}`} - >{merchant.display || merchant.username}</a - > + <a href={`/${merchant.username}`}>{merchant.display || merchant.username}</a> </h3> <span @@ -102,17 +94,12 @@ class="mt-2 flex items-center gap-2 text-sm text-neutral-600 dark:text-neutral-300 min-w-0" > <Avatar {user} size={8} class="shrink-0" /> - <span class="truncate max-w-full" - >Referred by @{user.username}</span - > + <span class="truncate max-w-full">Referred by @{user.username}</span> </div> </div> <div class="ml-auto flex shrink-0 items-center gap-1 whitespace"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" + <iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300" ></iconify-icon> <span class="text-sm font-semibold tabular-nums"> {s(amount, "en-CA")} @@ -145,38 +132,32 @@ </ul> <p> - 25% of the bounty will be awarded once the business is ready to take - payments and has been announced + 25% of the bounty will be awarded once the business is ready to take payments and has been + announced </p> - <p> - The rest will be awarded once they've been accepting Bitcoin for 6 months - </p> + <p>The rest will be awarded once they've been accepting Bitcoin for 6 months</p> <p>Bounties will be awarded at our discretion</p> - <p> - We reserve the right to refuse applicants and change these terms without - cause or notice - </p> + <p>We reserve the right to refuse applicants and change these terms without cause or notice</p> <h2 class="text-2xl font-bold">Get Started!</h2> <p> - Reach out to <a - href="mailto:[email protected]" - class="text-blue-600 hover:underline">[email protected]</a + Reach out to <a href="mailto:[email protected]" class="text-blue-600 hover:underline" + >[email protected]</a > and let us know who we should contact </p> <p> - We'll update this page as the bounties are claimed so you'll be able to see - which ones are still available. + We'll update this page as the bounties are claimed so you'll be able to see which ones are still + available. </p> <p> - Have a lead or idea for something that's not on the list? Reach out! We - offer sats for all sorts of referrals! + Have a lead or idea for something that's not on the list? Reach out! We offer sats for all sorts + of referrals! </p> <p>Thanks for participating and helping to orange pill Vancouver!</p> diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte index 51b1f54e..fc803158 100644 --- a/src/routes/(static)/docs/+page.svelte +++ b/src/routes/(static)/docs/+page.svelte @@ -11,20 +11,13 @@ ? `${PUBLIC_COINOS_URL}` : `https://${PUBLIC_DOMAIN}/api`; - let tokenSample = token - ? `export token="${token}"` - : `export token=<your auth token>`; + let tokenSample = token ? `export token="${token}"` : `export token=<your auth token>`; let roSample = `export token="${ro}"`; </script> {#snippet cp(something)} - <button - type="button" - class="ml-auto" - onclick={() => copy(something)} - aria-label="Copy value" - > + <button type="button" class="ml-auto" onclick={() => copy(something)} aria-label="Copy value"> <iconify-icon noobserver icon="ph:copy-bold" width="42"></iconify-icon> </button> {/snippet} @@ -40,17 +33,15 @@ </p> <p class="text-secondary"> - Coinos has a REST API that can be used to register accounts and make - payments. The following examples show how you can call the API with <a + Coinos has a REST API that can be used to register accounts and make payments. The following + examples show how you can call the API with <a href="https://curl.se/" class="text-secondary underline">curl</a > </p> <h2 class="text-2xl">API Base URL</h2> - <div - class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 items-center" - > + <div class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 items-center"> <div>{api}</div> {@render cp(api)} </div> @@ -60,38 +51,32 @@ {#if user && token} This token authorizes you to use the API as <b>{user.username}</b>. {:else} - <a href="/login" class="font-bold">Sign in</a> to view your auth token here, - or get one from the /login endpoint. + <a href="/login" class="font-bold">Sign in</a> to view your auth token here, or get one from the + /login endpoint. {/if} - Save it in a variable called <b>$token</b> to run the examples. It gives full - access to your account so keep it safe. + Save it in a variable called <b>$token</b> to run the examples. It gives full access to your account + so keep it safe. </p> - <div - class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 items-center" - > + <div class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 items-center"> <div class="w-full break-all">{tokenSample}</div> {@render cp(tokenSample)} </div> {#if ro} <p class="text-secondary"> - This read-only token has permission to create invoices and fetch payments - but can't be used to make withdrawals + This read-only token has permission to create invoices and fetch payments but can't be used to + make withdrawals </p> - <div - class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 items-center" - > + <div class="bg-primary text-primary-content rounded-lg p-4 flex gap-4 items-center"> <div class="w-full break-all">{roSample}</div> {@render cp(roSample)} </div> {/if} <h2 class="text-2xl">POST /register</h2> - <p class="text-secondary"> - Register a new user account with a username and password - </p> + <p class="text-secondary">Register a new user account with a username and password</p> <Code sample="register" /> <h2 class="text-2xl">POST /login</h2> @@ -111,13 +96,9 @@ <div class="font-bold">display</div> <div class="col-span-2">string - spaces allowed</div> <div class="font-bold">currency</div> - <div class="col-span-2"> - string - three-letter ISO currency code e.g. CAD or USD - </div> + <div class="col-span-2">string - three-letter ISO currency code e.g. CAD or USD</div> <div class="font-bold">language</div> - <div class="col-span-2"> - string - two-letter language code e.g. en, fr, es - </div> + <div class="col-span-2">string - two-letter language code e.g. en, fr, es</div> </div> <Code sample="update" /> @@ -131,19 +112,13 @@ <div class="font-bold">type (string, default: lightning)</div> <div class="col-span-2">bitcoin or lightning</div> <div class="font-bold">fiat (boolean, default: false)</div> - <div class="col-span-2"> - whether the amount is denominated in satoshis or local currency - </div> + <div class="col-span-2">whether the amount is denominated in satoshis or local currency</div> <div class="font-bold">amount (numeric)</div> <div class="col-span-2">amount to be paid</div> <div class="font-bold">webhook (string, optional)</div> - <div class="col-span-2"> - remote endpoint to call when the invoice is paid - </div> + <div class="col-span-2">remote endpoint to call when the invoice is paid</div> <div class="font-bold">secret (string, optional)</div> - <div class="col-span-2"> - a secret value passed to the webhook to authenticate the request - </div> + <div class="col-span-2">a secret value passed to the webhook to authenticate the request</div> </div> </div> @@ -178,9 +153,7 @@ <Code sample="bitcoin" /> <h2 class="text-2xl">GET /payments</h2> - <p class="text-secondary"> - Get all payments sent or received by the current user - </p> + <p class="text-secondary">Get all payments sent or received by the current user</p> <div class="text-secondary"> <div>Query params</div> diff --git a/src/routes/(static)/forgot/+page.svelte b/src/routes/(static)/forgot/+page.svelte index 711c5568..82ea75a3 100644 --- a/src/routes/(static)/forgot/+page.svelte +++ b/src/routes/(static)/forgot/+page.svelte @@ -8,9 +8,7 @@ let loading; </script> -<div - class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 mb-20 space-y-5" -> +<div class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 mb-20 space-y-5"> <h1 class="text-2xl font-bold text-center">{$t("login.reset")}</h1> <div class="text-secondary"> diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte index 08694cd8..7c9c29fc 100644 --- a/src/routes/(static)/login/+page.svelte +++ b/src/routes/(static)/login/+page.svelte @@ -45,8 +45,7 @@ onMount(() => { if (!isTor && recaptchaSiteKey) { let s = document.createElement("script"); - s.src = - "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; + s.src = "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; document.head.appendChild(s); } }); @@ -72,13 +71,9 @@ const getRecaptchaToken = () => new Promise((resolve, reject) => { if (isTor || !recaptchaSiteKey) return resolve(""); - if (!browser || !grecaptcha) - return reject(new Error("captcha unavailable")); + if (!browser || !grecaptcha) return reject(new Error("captcha unavailable")); grecaptcha.ready(() => { - grecaptcha - .execute(recaptchaSiteKey, { action: "login" }) - .then(resolve) - .catch(reject); + grecaptcha.execute(recaptchaSiteKey, { action: "login" }).then(resolve).catch(reject); }); }); @@ -108,9 +103,7 @@ }); }); - let redirect = $derived( - $loginRedirect || $page.url.searchParams.get("redirect"), - ); + let redirect = $derived($loginRedirect || $page.url.searchParams.get("redirect")); let nostrLogin = async () => { let event = { @@ -157,9 +150,7 @@ } const scriptSelector = - "script[src='https://www.google.com/recaptcha/api.js?render=" + - recaptchaSiteKey + - "']"; + "script[src='https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey + "']"; const script = document.querySelector(scriptSelector); if (script) { script.remove(); @@ -167,9 +158,7 @@ }); </script> -<div - class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 mb-20 space-y-5" -> +<div class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 mb-20 space-y-5"> <h1 class="text-2xl font-bold text-center">{$t("login.signIn")}</h1> {#if form?.error && !form?.message.includes("2fa")} <div class="text-red-600 text-center" in:fly> @@ -177,12 +166,7 @@ </div> {/if} - <form - use:enhance={enhanceLogin} - class="space-y-5" - method="POST" - action="?/login" - > + <form use:enhance={enhanceLogin} class="space-y-5" method="POST" action="?/login"> <input type="hidden" name="loginRedirect" value={redirect} /> <input type="hidden" name="token" value={token} /> @@ -205,12 +189,7 @@ > </div> - <button - type="submit" - class="btn btn-accent" - bind:this={btn} - data-testid="login-submit" - > + <button type="submit" class="btn btn-accent" bind:this={btn} data-testid="login-submit"> {$t("login.signIn")} </button> @@ -246,9 +225,7 @@ aria-labelledby="title" tabindex="-1" > - <div - class="mx-auto p-5 border shadow-lg rounded-md bg-base-100 space-y-5 max-w-lg" - > + <div class="mx-auto p-5 border shadow-lg rounded-md bg-base-100 space-y-5 max-w-lg"> <h1 id="title" class="text-center text-2xl font-semibold">2FA</h1> <Pinpad bind:v={token} {cancel} /> diff --git a/src/routes/(static)/privacy/+page.svelte b/src/routes/(static)/privacy/+page.svelte index 7b21a5be..ccbe8a92 100644 --- a/src/routes/(static)/privacy/+page.svelte +++ b/src/routes/(static)/privacy/+page.svelte @@ -2,15 +2,14 @@ <div class="text-2xl font-bold">Privacy Policy</div> <div> - The only personal information we require to create an account is a username - and password. Some users may provide an email address for notification or - password reset purposes. We will not share your email with anyone or use it - for anything other than the purposes stated. + The only personal information we require to create an account is a username and password. Some + users may provide an email address for notification or password reset purposes. We will not + share your email with anyone or use it for anything other than the purposes stated. </div> <div> - We keep records of payment history associated to accounts and may be - obligated to share our records with financial authorities. You may request - that your account be deleted by visiting https://coinos.io/removal + We keep records of payment history associated to accounts and may be obligated to share our + records with financial authorities. You may request that your account be deleted by visiting + https://coinos.io/removal </div> </div> diff --git a/src/routes/(static)/register/+page.svelte b/src/routes/(static)/register/+page.svelte index 0200b15b..f594244c 100644 --- a/src/routes/(static)/register/+page.svelte +++ b/src/routes/(static)/register/+page.svelte @@ -18,12 +18,7 @@ import { avatar, signer, password, pin, loginRedirect } from "$lib/store"; import { t } from "$lib/translations"; import { page } from "$app/stores"; - import { - NumberDictionary, - uniqueNamesGenerator, - colors, - animals, - } from "unique-names-generator"; + import { NumberDictionary, uniqueNamesGenerator, colors, animals } from "unique-names-generator"; import { sign } from "$lib/nostr"; let { form, data }: any = $props(); @@ -34,8 +29,7 @@ onMount(() => { if (!isTor && recaptchaSiteKey) { let s = document.createElement("script"); - s.src = - "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; + s.src = "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; document.head.appendChild(s); } }); @@ -109,13 +103,9 @@ const getRecaptchaToken = () => new Promise((resolve, reject) => { if (isTor) return resolve(""); - if (!browser || !grecaptcha) - return reject(new Error("captcha unavailable")); + if (!browser || !grecaptcha) return reject(new Error("captcha unavailable")); grecaptcha.ready(() => { - grecaptcha - .execute(recaptchaSiteKey, { action: "register" }) - .then(resolve) - .catch(reject); + grecaptcha.execute(recaptchaSiteKey, { action: "register" }).then(resolve).catch(reject); }); }); @@ -260,9 +250,7 @@ } const scriptSelector = - "script[src='https://www.google.com/recaptcha/api.js?render=" + - recaptchaSiteKey + - "']"; + "script[src='https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey + "']"; const script = document.querySelector(scriptSelector); if (script) { script.remove(); @@ -274,16 +262,9 @@ <Pin bind:value={token} title="Enter 2FA Code" {cancel} notify={false} /> {/if} -<div - class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 space-y-5 mb-20" -> +<div class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 space-y-5 mb-20"> <h1 class="text-2xl font-bold text-center">{$t("login.createAccount")}</h1> - <input - type="file" - class="hidden!" - bind:this={avatarInput} - onchange={(e: any) => handleFile(e)} - /> + <input type="file" class="hidden!" bind:this={avatarInput} onchange={(e: any) => handleFile(e)} /> <div class="relative"> <button @@ -291,8 +272,7 @@ onclick={decr} aria-label="Previous" > - <iconify-icon noobserver icon="ph:caret-left-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:caret-left-bold" width="32"></iconify-icon> </button> <button class="block relative w-32 mx-auto" onclick={selectAvatar}> <div @@ -304,11 +284,8 @@ alt={username} /> </div> - <div - class="absolute bg-base-100 rounded-full p-2 mx-auto right-0 bottom-0 z-10 w-12" - > - <iconify-icon noobserver icon="ph:upload-simple-bold" width="24" - ></iconify-icon> + <div class="absolute bg-base-100 rounded-full p-2 mx-auto right-0 bottom-0 z-10 w-12"> + <iconify-icon noobserver icon="ph:upload-simple-bold" width="24"></iconify-icon> </div> </button> <button @@ -316,8 +293,7 @@ onclick={incr} aria-label="Next" > - <iconify-icon noobserver icon="ph:caret-right-bold" width="32" - ></iconify-icon> + <iconify-icon noobserver icon="ph:caret-right-bold" width="32"></iconify-icon> </button> </div> @@ -337,10 +313,7 @@ <input type="hidden" name="token" value={token} /> <input type="hidden" name="challenge" value={challenge} /> - <label - for="username" - class="input flex items-center justify-center gap-2 w-full" - > + <label for="username" class="input flex items-center justify-center gap-2 w-full"> <input class="clean" use:focus @@ -352,15 +325,8 @@ autocapitalize="none" placeholder={$t("login.username")} /> - <button - type="button" - tabindex="-1" - onclick={refresh} - aria-label="Randomize" - class="contents" - > - <iconify-icon noobserver icon="ph:dice-three-bold" width="32" - ></iconify-icon></button + <button type="button" tabindex="-1" onclick={refresh} aria-label="Randomize" class="contents"> + <iconify-icon noobserver icon="ph:dice-three-bold" width="32"></iconify-icon></button > </label> @@ -370,12 +336,7 @@ bind:show={revealPassword} /> - <button - type="submit" - class="btn btn-accent" - disabled={loading} - bind:this={btn} - > + <button type="submit" class="btn btn-accent" disabled={loading} bind:this={btn}> {#if loading} <Spinner /> {:else} diff --git a/src/routes/(static)/removal/+page.svelte b/src/routes/(static)/removal/+page.svelte index 9ce4eab1..6cfc6d82 100644 --- a/src/routes/(static)/removal/+page.svelte +++ b/src/routes/(static)/removal/+page.svelte @@ -2,8 +2,8 @@ <div class="text-2xl font-bold">Data Removal</div> <div> - If you wish to delete your account and have your data removed, please add a - verified email address to your account and send an email from it to + If you wish to delete your account and have your data removed, please add a verified email + address to your account and send an email from it to <b>[email protected]</b> requesting that we delete your account data. </div> </div> diff --git a/src/routes/(static)/support/+page.svelte b/src/routes/(static)/support/+page.svelte index dd5439d5..8a7f55bf 100644 --- a/src/routes/(static)/support/+page.svelte +++ b/src/routes/(static)/support/+page.svelte @@ -23,8 +23,7 @@ onMount(() => { if (!isTor && recaptchaSiteKey) { let s = document.createElement("script"); - s.src = - "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; + s.src = "https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey; document.head.appendChild(s); } }); @@ -64,9 +63,7 @@ } const scriptSelector = - "script[src='https://www.google.com/recaptcha/api.js?render=" + - recaptchaSiteKey + - "']"; + "script[src='https://www.google.com/recaptcha/api.js?render=" + recaptchaSiteKey + "']"; const script = document.querySelector(scriptSelector); if (script) { script.remove(); @@ -77,9 +74,7 @@ <div class="container max-w-lg mx-auto space-y-8 p-4 pb-20"> {#if sent} <h1 class="text-center text-3xl lg:text-4xl font-semibold">Thank you!</h1> - <div class="text-center text-lg text-secondary"> - Someone will be in touch shortly. - </div> + <div class="text-center text-lg text-secondary">Someone will be in touch shortly.</div> <div> <a href={user ? `/${user.username}` : "/"}> @@ -102,25 +97,18 @@ <form onsubmit={submit}> <div class="mb-4"> - <label for="username" class="font-semibold" - >{$t("user.support.accountName")}</label - > + <label for="username" class="font-semibold">{$t("user.support.accountName")}</label> <input type="text" name="username" required bind:value={username} /> </div> <div class="mb-4"> - <label for="email" class="font-semibold" - >{$t("user.support.email")}</label - > + <label for="email" class="font-semibold">{$t("user.support.email")}</label> <input type="email" name="email" bind:value={email} required /> </div> <div class="mb-4"> - <label for="message" class="font-semibold" - >{$t("user.support.message")}</label - > - <textarea rows={5} name="message" bind:value={message} required - ></textarea> + <label for="message" class="font-semibold">{$t("user.support.message")}</label> + <textarea rows={5} name="message" bind:value={message} required></textarea> </div> <button diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 9997183d..5e2c7fbd 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -1,8 +1,4 @@ -import { - defaultLocale, - loadTranslations, - locales, -} from "$lib/translations/index"; +import { defaultLocale, loadTranslations, locales } from "$lib/translations/index"; import { auth, get, isInvalidTokenError, sleep } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 88454d85..71613871 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -63,10 +63,7 @@ window.AndroidNotch.getInsetBottom( (px) => { - document.documentElement.style.setProperty( - "--safe-area-inset-bottom", - 24 + "px", - ); + document.documentElement.style.setProperty("--safe-area-inset-bottom", 24 + "px"); }, (err) => { console.error("Failed to get bottom inset:", err); diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 1feee3e6..eee702d1 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -23,9 +23,7 @@ export const load = async ({ data }) => { let theme = cookies.get("theme"); if (!theme) { - theme = matchMedia("(prefers-color-scheme: dark)").matches - ? "dark" - : "light"; + theme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; cookies.set("theme", theme, opts); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ee73adfb..eee8e40c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -34,11 +34,7 @@ description={$t("landing.info1.description")} /> - <LandingInfoCard - image="phone-checkout" - title={$t("landing.info2.title")} - order="reverse" - > + <LandingInfoCard image="phone-checkout" title={$t("landing.info2.title")} order="reverse"> {$t("landing.info2.description1")} <br /><br /> {$t("landing.info2.description2")} diff --git a/src/routes/phtest/+page.svelte b/src/routes/phtest/+page.svelte index f526d546..625f0465 100644 --- a/src/routes/phtest/+page.svelte +++ b/src/routes/phtest/+page.svelte @@ -1,3 +1 @@ -<a href="bitcoin:lnurl1dp68gurn8ghj7cm0d9hx7uewd9hj7up0v9kxjcm9lgkapg" - >Bitcoin link</a -> +<a href="bitcoin:lnurl1dp68gurn8ghj7cm0d9hx7uewd9hj7up0v9kxjcm9lgkapg">Bitcoin link</a> diff --git a/src/service-worker.js b/src/service-worker.js index 383f62d0..9d33d322 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -19,17 +19,15 @@ self.addEventListener("notificationclick", (event) => { const url = event.notification.data.url || "/"; event.waitUntil( - clients - .matchAll({ type: "window", includeUncontrolled: true }) - .then((clientList) => { - for (const client of clientList) { - if (client.url === url && "focus" in client) { - return client.focus(); - } + clients.matchAll({ type: "window", includeUncontrolled: true }).then((clientList) => { + for (const client of clientList) { + if (client.url === url && "focus" in client) { + return client.focus(); } - if (clients.openWindow) { - return clients.openWindow(url); - } - }), + } + if (clients.openWindow) { + return clients.openWindow(url); + } + }), ); }); |
