From bf7d8d373c11cd7a6e1487175147c9a84e775a98 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 27 Feb 2026 10:09:16 -0800 Subject: map updates --- src/routes/(app)/locations/+server.ts | 16 +++++++++-- src/routes/(app)/settings/security/+page.svelte | 35 ++++++++++++++++++++----- 2 files changed, 43 insertions(+), 8 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/locations/+server.ts b/src/routes/(app)/locations/+server.ts index 9980c5fc..ecbb234b 100644 --- a/src/routes/(app)/locations/+server.ts +++ b/src/routes/(app)/locations/+server.ts @@ -1,11 +1,23 @@ import { get } from "$lib/utils"; import { json } from "@sveltejs/kit"; -export async function GET({ setHeaders }) { +export async function GET({ setHeaders, url }) { + const lat = url.searchParams.get("lat"); + const lon = url.searchParams.get("lon"); + const radius = url.searchParams.get("radius"); + const count = url.searchParams.get("count"); + let locations = []; try { - ({ locations } = await get("/locations")); + if (lat && lon) { + const params = new URLSearchParams({ lat, lon }); + if (radius) params.set("radius", radius); + if (count) params.set("count", count); + ({ locations } = await get(`/locations/nearby?${params}`)); + } else { + ({ locations } = await get("/locations")); + } setHeaders({ "cache-control": "public, max-age=600" }); } catch { console.log("failed to fetch locations"); diff --git a/src/routes/(app)/settings/security/+page.svelte b/src/routes/(app)/settings/security/+page.svelte index 33981645..0991c679 100644 --- a/src/routes/(app)/settings/security/+page.svelte +++ b/src/routes/(app)/settings/security/+page.svelte @@ -4,9 +4,12 @@ import { t } from "$lib/translations"; import Pin from "$comp/Pin.svelte"; import Qr from "$comp/Qr.svelte"; + import Spinner from "$comp/Spinner.svelte"; import { copy, post, success, fail } from "$lib/utils"; import { save, pin as current } from "$lib/store"; import { getNsec } from "$lib/nostr"; + import { registerPasskey } from "$lib/passkey"; + import { rememberPrfKey, defaultRememberForMs } from "$lib/passwordCache"; import { invalidate } from "$app/navigation"; import { page } from "$app/stores"; @@ -147,6 +150,22 @@ fail("Failed to disable 2FA, try again"); } }; + let passkeyLoading = $state(false); + + let addPasskey = async () => { + passkeyLoading = true; + try { + const prfKey = await registerPasskey(); + rememberPrfKey(prfKey, defaultRememberForMs); + success("Passkey added"); + } catch (e: any) { + if (e.name !== "NotAllowedError") { + fail(e.message || "Passkey registration failed"); + } + } + passkeyLoading = false; + }; + let verifying = $derived(pin?.length > 5); $effect(() => { @@ -220,10 +239,14 @@
- - - + Passkey +

Add a passkey for passwordless sign-in

+
-- cgit v1.2.3