From efa4a719786633ba905798cdc46e6f35ada51372 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 3 Aug 2026 13:04:37 -0700 Subject: migrate: flag the account instead of renaming it Renaming to v2 was a hack for freeing the username, and v3/v4/v9 fallbacks made it worse. The page now sweeps the balance and sets the new `migrated` flag: the registrar takes over receiving for the name while the old account keeps working here, unchanged. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Wvj4aoeMZwA7VUGdJP9Swi --- src/routes/(app)/migrate/+page.server.ts | 36 +++++--------------------------- src/routes/(app)/migrate/+page.svelte | 14 ++++++------- 2 files changed, 12 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/routes/(app)/migrate/+page.server.ts b/src/routes/(app)/migrate/+page.server.ts index 5182e8a0..f1964d1b 100644 --- a/src/routes/(app)/migrate/+page.server.ts +++ b/src/routes/(app)/migrate/+page.server.ts @@ -20,26 +20,12 @@ async function invoiceFor(address: string, sats: number) { return inv.pr as string; } -// The server only accepts letters and numbers, 2–24 of them, so the retired -// name can't carry a separator. Candidates are v2, v3, … each -// trimmed to fit, so a long username still lands inside the limit. -function retiredNames(username: string) { - const base = String(username).replace(/[^\p{L}\p{N}]/gu, ""); - const out: string[] = []; - for (let n = 2; n <= 9; n++) { - const suffix = `v${n}`; - out.push(base.slice(0, 24 - suffix.length) + suffix); - } - return out; -} - export async function load({ parent, url }) { const { user } = await parent(); if (!user) redirect(307, `/login?redirect=${encodeURIComponent(url.pathname + url.search)}`); return { to: url.searchParams.get("to") || "", back: url.searchParams.get("back") || "", - newName: retiredNames(user.username)[0], }; } @@ -76,23 +62,11 @@ export const actions = { } if (!sent) throw lastErr; } - // Releasing the username is what lets them keep it on v3. If the - // retired name is itself taken, step to the next candidate. - let renamed = ""; - let renameErr; - for (const candidate of retiredNames(username)) { - try { - await post("/user", { username: candidate, ...(pin ? { pin } : {}) }, auth(cookies)); - renamed = candidate; - break; - } catch (e) { - renameErr = e; - const msg = String((e as any)?.message || e); - if (!/taken/i.test(msg)) throw e; - } - } - if (!renamed) throw renameErr; - return { ok: true, sent, released: username, renamed }; + // Hand the name over for receiving. The account itself stays exactly + // as it is — same username, same history, still usable here; the + // registrar just becomes the answer for incoming payments. + await post("/user", { migrated: true, ...(pin ? { pin } : {}) }, auth(cookies)); + return { ok: true, sent, released: username }; } catch (e) { const msg = e && typeof e === "object" && "message" in e ? String(e.message) : String(e); return { error: msg, sent }; diff --git a/src/routes/(app)/migrate/+page.svelte b/src/routes/(app)/migrate/+page.svelte index e1e4a79d..0853c15b 100644 --- a/src/routes/(app)/migrate/+page.svelte +++ b/src/routes/(app)/migrate/+page.svelte @@ -9,7 +9,7 @@ import { enhance } from "$app/forms"; let { data, form } = $props(); - let { user, to, back, newName } = $derived(data); + let { user, to, back } = $derived(data); let working = $state(false); let balance = $derived(user?.balance || 0); @@ -36,16 +36,16 @@

{form.sent.toLocaleString()} sats are on their way to your new wallet.

{/if}

- Your username was released, so {form.released} can be yours again on - coinos v3. + {form.released}@coinos.io now receives into your coinos v3 wallet.

Back to coinos v3 {:else}

- This sends your balance to your new wallet and frees up your username so you can keep - it there. Your old account stays, renamed to {newName}, and stops - receiving payments. + This sends your balance to your new wallet and points + {user.username}@coinos.io at it, so payments to your address arrive + there from now on. This account stays exactly as it is — same name, same history — + you just receive on coinos v3.

@@ -76,7 +76,7 @@ name="pin" placeholder="Your PIN" /> {/if} -- cgit v1.2.3