From 74f8a634073fc04be9983f0e0c39ad46b8df5b67 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 26 Aug 2025 21:53:38 -0700 Subject: fix autopay with tip logic --- src/routes/(app)/invoice/[id]/tip/+page.server.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/invoice/[id]/tip/+page.server.ts b/src/routes/(app)/invoice/[id]/tip/+page.server.ts index 23e3a07c..851d3f1b 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.server.ts +++ b/src/routes/(app)/invoice/[id]/tip/+page.server.ts @@ -19,14 +19,13 @@ export async function load({ cookies, params, parent }) { if (user.tip > 0) { invoice.tip = Math.round(invoice.amount * (user.tip / 100)); invoice = await post(`/invoice/${id}`, { invoice }, auth(cookies)); - } else { - throw new Error("tip"); + p = await post("/payments", { ...invoice, pin }, auth(cookies)); } + } else { + p = await post("/payments", { ...invoice, pin }, auth(cookies)); } - p = await post("/payments", { ...invoice, pin }, auth(cookies)); } catch (e) { const { message } = e as Error; - if (message === "tip") redirect(307, `/invoice/${id}/tip`); fail(400, { message }); } if (p) redirect(307, `/sent/${p.id}`); -- cgit v1.2.3 From 9ebdd6b3f928d25ca1b7488761c35928788e4e1f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 3 Sep 2025 00:54:45 -0700 Subject: always show lnurl button --- src/routes/(app)/[username]/accepted/[text]/+page.svelte | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/accepted/[text]/+page.svelte b/src/routes/(app)/[username]/accepted/[text]/+page.svelte index 95b6cc3e..1483a294 100644 --- a/src/routes/(app)/[username]/accepted/[text]/+page.svelte +++ b/src/routes/(app)/[username]/accepted/[text]/+page.svelte @@ -50,10 +50,8 @@ - {#if nfc} - - {/if} + -- cgit v1.2.3 From 76b781b2870e793cdeae85088b2d70e6a271e6a4 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 9 Sep 2025 09:18:11 -0700 Subject: check for user in invoice route --- bun.lockb | Bin 292357 -> 292349 bytes src/routes/(app)/invoice/[id]/+layout.server.ts | 4 ++-- src/routes/(app)/invoice/[id]/+page.svelte | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/routes/(app)') diff --git a/bun.lockb b/bun.lockb index 8dd85e14..e557130e 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts index d6ab979e..df8693be 100644 --- a/src/routes/(app)/invoice/[id]/+layout.server.ts +++ b/src/routes/(app)/invoice/[id]/+layout.server.ts @@ -19,7 +19,7 @@ export async function load({ cookies, depends, params, url, parent }) { (!amount && (pending || received)) || (amount > 0 && (pending >= amount || received >= amount)); if (paid && !url.pathname.endsWith("paid")) { - if (invoice.uid === user.id) + if (invoice.uid === user?.id) redirect(307, `/invoice/${id}/paid` + (options ? "?options=true" : "")); else redirect(307, `/pay/${subject.username}/${invoice.amount}`); } @@ -28,7 +28,7 @@ export async function load({ cookies, depends, params, url, parent }) { if ( user && - invoice.uid !== user.id && + invoice.uid !== user?.id && !(url.pathname.includes("tip") || url.pathname.includes("memo")) && !options ) { diff --git a/src/routes/(app)/invoice/[id]/+page.svelte b/src/routes/(app)/invoice/[id]/+page.svelte index 0cb5aeac..29dd815d 100644 --- a/src/routes/(app)/invoice/[id]/+page.svelte +++ b/src/routes/(app)/invoice/[id]/+page.svelte @@ -56,16 +56,18 @@ let subbed = false; + $effect(() => { + if (!browser) return; + last.subscribe((v) => { + if (!v || subbed) return; + subbed = true; + send("subscribe", invoice); + }); + }); + onMount(async () => { - if (browser) { - last.subscribe((v) => { - if (!v || subbed) return; - subbed = true; - send("subscribe", invoice); - }); - - if ($amountPrompt && !amount) toggleAmount(); - } + if (!browser) return; + if ($amountPrompt && !amount) toggleAmount(); }); let update = async () => { -- cgit v1.2.3 From a8d18ab66a8beb203b8ff0a056810000a3e069ea Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 9 Sep 2025 12:38:40 -0700 Subject: redirect to paid route --- src/components/Numpad.svelte | 1 - src/routes/(app)/invoice/[id]/+layout.server.ts | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 0290b9e2..c321e0bc 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -63,7 +63,6 @@ return `${whole}${dec}${cents}`; } - // --- NEW: normalize sats to remove leading zeros but keep single "0" function normalizeSats(str) { const digits = (str ?? "").replace(/[^\d]/g, ""); const noLead = digits.replace(/^0+(?=\d)/, ""); diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts index df8693be..ab41dddc 100644 --- a/src/routes/(app)/invoice/[id]/+layout.server.ts +++ b/src/routes/(app)/invoice/[id]/+layout.server.ts @@ -19,9 +19,7 @@ export async function load({ cookies, depends, params, url, parent }) { (!amount && (pending || received)) || (amount > 0 && (pending >= amount || received >= amount)); if (paid && !url.pathname.endsWith("paid")) { - if (invoice.uid === user?.id) - redirect(307, `/invoice/${id}/paid` + (options ? "?options=true" : "")); - else redirect(307, `/pay/${subject.username}/${invoice.amount}`); + redirect(307, `/invoice/${id}/paid` + (options ? "?options=true" : "")); } subject = invoice.user; @@ -34,7 +32,9 @@ export async function load({ cookies, depends, params, url, parent }) { ) { if (invoice.prompt && invoice.tip === null) redirect(307, `/invoice/${id}/tip`); - else redirect(307, `/send/invoice/${id}`); + else { + redirect(307, `/send/invoice/${id}`); + } } } -- cgit v1.2.3 From 71f72613f2540fbe3ee1e68a2fb9a29c6f52b7c3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 9 Sep 2025 14:58:59 -0700 Subject: daisy fixes --- src/app.css | 99 +++++++++++--------------- src/routes/(app)/settings/nostr/+page.svelte | 38 +++++----- src/routes/(app)/settings/profile/+page.svelte | 4 +- src/routes/(static)/login/+page.svelte | 2 +- src/routes/(static)/register/+page.svelte | 2 +- 5 files changed, 66 insertions(+), 79 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/app.css b/src/app.css index c04131bd..fca47b23 100644 --- a/src/app.css +++ b/src/app.css @@ -1,50 +1,59 @@ +/* 1) Load Tailwind first */ @import "tailwindcss"; @tailwind base; @tailwind components; @tailwind utilities; - -@font-face { - font-family: "PublicSans"; - src: url("/fonts/Public_Sans/static/PublicSans-Regular.ttf") - format("truetype"); +/* 2) Register DaisyUI themes */ +@plugin "daisyui" { + themes: lofi --default, black --prefersdark; } -html { - font-family: PublicSans, sans-serif; +@plugin "daisyui/theme" { + name: "lofi"; + default: true; + --gradient: #C3CFE2; + --color-error: #b91c1c; } -::selection { - color: black; - background: #eaf2ff; +@plugin "daisyui/theme" { + name: "black"; + prefersdark: true; + --gradient: #C3CFE2; + --color-secondary: #CCC; + --color-error: #f87171; } -:fullscreen { - background-color: white; -} +/* 3) Tell Tailwind which layers we’ll @apply from */ +@reference utilities; +@reference components; -input:not([type="range"]) { - @apply input +/* 4) Now your custom CSS that uses @apply */ +.btn-menu { + @apply flex justify-center items-center bg-base-100 p-2 rounded-full + w-12 h-12 sm:w-16 sm:h-16 drop-shadow-xl; } -.input { - @apply input-lg input-primary; +@font-face { + font-family: "PublicSans"; + src: url("/fonts/Public_Sans/static/PublicSans-Regular.ttf") format("truetype"); } -textarea { - @apply textarea textarea-lg textarea-primary; -} +html { font-family: PublicSans, sans-serif; } -select { - @apply select select-lg select-primary; -} +::selection { color: black; background: #eaf2ff; } +:fullscreen { background-color: white; } -input:not([type="range"]), textarea, select, .input { - @apply w-full rounded-2xl; -} +/* Note: @apply-ing DaisyUI component classes requires components reference */ +.input { @apply input-lg input-primary h-16 px-4; } + +/* If you want to *turn* native inputs into DaisyUI inputs via @apply: */ +input:not([type="range"]) { @apply input input-lg input-primary h-16 px-4; } +textarea { @apply textarea textarea-lg textarea-primary py-4; } +select { @apply select select-lg select-primary h-16 px-4; } -textarea:focus, textarea:focus-within, .input:focus, .input:focus-within { - @apply outline-offset-0; +input:not([type="range"]), textarea, select, .input { + @apply rounded-2xl w-full; } input.clean, textarea.clean { @@ -56,33 +65,11 @@ input.clean, textarea.clean { box-shadow: none !important; } -.btn { - @apply rounded-2xl btn-lg btn-block outline-none -} - -@plugin "daisyui" { - themes: light --default, dark --prefersdark; -} - -@plugin "daisyui/theme" { - name: "light"; - default: true; - - --gradient: #C3CFE2; - --color-error: #b91c1c; - --color-primary: #000; - --color-secondary: #111; -} - -@plugin "daisyui/theme" { - name: "dark"; - prefersdark: true; - - --gradient: #C3CFE2; - --color-primary: #FFF; - --color-secondary: #CCC; - --color-error: #f87171; -} +button { cursor: pointer !important; } +.btn { @apply rounded-2xl btn-lg btn-block outline-none h-16 cursor-pointer; } -:root, [data-theme="dark"] { +@layer components { + :where(input, textarea, select, .input, .textarea, .select) { + outline-offset: 0 !important; + } } diff --git a/src/routes/(app)/settings/nostr/+page.svelte b/src/routes/(app)/settings/nostr/+page.svelte index 421b590a..9129e8f3 100644 --- a/src/routes/(app)/settings/nostr/+page.svelte +++ b/src/routes/(app)/settings/nostr/+page.svelte @@ -163,25 +163,25 @@
{$t("user.nostrPubkey")}
-
- -
- - - - + +
+
+ + + + +
diff --git a/src/routes/(app)/settings/profile/+page.svelte b/src/routes/(app)/settings/profile/+page.svelte index ec9855d0..3b7de9d3 100644 --- a/src/routes/(app)/settings/profile/+page.svelte +++ b/src/routes/(app)/settings/profile/+page.svelte @@ -116,7 +116,7 @@ > handleFile(e, "picture")} /> @@ -158,7 +158,7 @@ > handleFile(e, "banner")} /> diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte index 1a1f745c..825f6a88 100644 --- a/src/routes/(static)/login/+page.svelte +++ b/src/routes/(static)/login/+page.svelte @@ -124,7 +124,7 @@

{$t("login.signIn")}

{#if form?.error && !form?.message.includes("2fa")} diff --git a/src/routes/(static)/register/+page.svelte b/src/routes/(static)/register/+page.svelte index edb63de1..b0368d47 100644 --- a/src/routes/(static)/register/+page.svelte +++ b/src/routes/(static)/register/+page.svelte @@ -222,7 +222,7 @@

{$t("login.createAccount")}

handleFile(e, "picture")} /> -- cgit v1.2.3 From 19769c1eafbcb97dbea37cf210497acb7aad56e8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 9 Sep 2025 15:15:24 -0700 Subject: dark mode fix --- src/app.css | 10 +++++++++- src/routes/(app)/settings/nostr/+page.svelte | 3 ++- src/routes/+layout.svelte | 14 +++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/app.css b/src/app.css index fca47b23..901893b9 100644 --- a/src/app.css +++ b/src/app.css @@ -48,7 +48,15 @@ html { font-family: PublicSans, sans-serif; } .input { @apply input-lg input-primary h-16 px-4; } /* If you want to *turn* native inputs into DaisyUI inputs via @apply: */ -input:not([type="range"]) { @apply input input-lg input-primary h-16 px-4; } +input[type="text"], +input[type="email"], +input[type="password"], +input[type="number"], +input[type="search"], +input[type="url"], +input[type="tel"] { + @apply input input-lg input-primary h-16 px-4; +} textarea { @apply textarea textarea-lg textarea-primary py-4; } select { @apply select select-lg select-primary h-16 px-4; } diff --git a/src/routes/(app)/settings/nostr/+page.svelte b/src/routes/(app)/settings/nostr/+page.svelte index 9129e8f3..7168f4f7 100644 --- a/src/routes/(app)/settings/nostr/+page.svelte +++ b/src/routes/(app)/settings/nostr/+page.svelte @@ -172,7 +172,7 @@ onclick={() => copy(npub)} aria-label="Copy" > {$t("accounts.copy")} +{$t("accounts.qr")}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 8ae31608..7653e05a 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -7,13 +7,21 @@ import { onMount } from "svelte"; import { installPrompt, theme as themeStore } from "$lib/store"; + +const map = { light: 'lofi', dark: 'black', system: 'system' }; + let { data, children } = $props(); let { pathname, theme } = $state(data); $effect(() => ($themeStore = data.theme)); $effect(() => (theme = $themeStore)); - $effect(() => { - document.documentElement.setAttribute("data-theme", theme); - }); +$effect(() => { + const v = map[theme] ?? theme; + if (!v || v === 'system') { + document.documentElement.removeAttribute('data-theme'); + } else { + document.documentElement.setAttribute('data-theme', v); + } +}); let host = PUBLIC_DOMAIN.includes("localhost") ? `http://${PUBLIC_DOMAIN}` -- cgit v1.2.3 From d2226b8988903dd18d5b09b0906d0235a4cbd5ac Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 9 Sep 2025 15:23:16 -0700 Subject: remove unused import --- .../(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte | 1 - 1 file changed, 1 deletion(-) (limited to 'src/routes/(app)') 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 200c93d5..1551cc2c 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte @@ -13,7 +13,6 @@ import { applyAction } from "$app/forms"; import { hex as hexUtil } from "@scure/base"; import * as btc from "@scure/btc-signer"; - import { hash160 } from "@scure/btc-signer/utils"; import { decrypt } from "nostr-tools/nip49"; import { HDKey } from "@scure/bip32"; import { entropyToMnemonic, mnemonicToSeed } from "@scure/bip39"; -- cgit v1.2.3 From 934f87270369cd294626cf5142817edcac6c3a6c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 11 Sep 2025 16:01:17 -0700 Subject: pos route --- src/routes/(app)/pos/+page.server.ts | 21 +++++++ src/routes/(app)/pos/+page.svelte | 105 +++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 src/routes/(app)/pos/+page.server.ts create mode 100644 src/routes/(app)/pos/+page.svelte (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/pos/+page.server.ts b/src/routes/(app)/pos/+page.server.ts new file mode 100644 index 00000000..f7a3fda3 --- /dev/null +++ b/src/routes/(app)/pos/+page.server.ts @@ -0,0 +1,21 @@ +import { PUBLIC_COINOS_URL } from "$env/static/public"; +import { fd } from "$lib/utils"; +import { hex } from "@scure/base"; + +export const actions = { + default: async ({ fetch, request }) => { + const body = await fd(request); + console.log("POSTING", body); + const res = await fetch(`${PUBLIC_COINOS_URL}/flash`, { + method: "POST", + body: JSON.stringify(body), + headers: { + "content-type": "application/json", + accept: "application/octet-stream", + }, + }); + + const buf = new Uint8Array(await res.arrayBuffer()); + return { data: hex.encode(buf) }; + }, +}; diff --git a/src/routes/(app)/pos/+page.svelte b/src/routes/(app)/pos/+page.svelte new file mode 100644 index 00000000..760a89b4 --- /dev/null +++ b/src/routes/(app)/pos/+page.svelte @@ -0,0 +1,105 @@ + + +
+

+ Flash config +

+ + {#if esploader} + {#if data} + {#if progress} +
Done!
+ {:else} +
Generated config file ({data.length * 2} bytes)
+ + {/if} + {:else} +
+ + + + +
+ {/if} + {:else} + + {/if} +
-- cgit v1.2.3