diff options
| author | Adam Soltys <[email protected]> | 2026-08-02 08:30:10 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-02 08:50:15 -0700 |
| commit | 4f8c04659fd6efe4912a1a79453b8f6ed0b6a652 (patch) | |
| tree | ba15c970bd5a5c7d58b5062d4431407dba8481d4 /src | |
| parent | f1bd471cf5cbab6ee60a18eded0a9ed489904b13 (diff) | |
| download | coinos-ui-4f8c04659fd6efe4912a1a79453b8f6ed0b6a652.tar.gz coinos-ui-4f8c04659fd6efe4912a1a79453b8f6ed0b6a652.zip | |
Only pay internally when the name is really a local account
Addresses at our own domain used to have the domain stripped and get
paid internally on the assumption that every one of them was ours. v3
payment addresses live at the same domain, so check the account exists
first and otherwise leave the address intact — it then flows through
the normal lightning-address path.
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/parse.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/parse.ts b/src/lib/parse.ts index f41fe78f..03cd0c3d 100644 --- a/src/lib/parse.ts +++ b/src/lib/parse.ts @@ -21,7 +21,16 @@ export default async (s, host, cookies) => { } if (t.startsWith("lightning:")) t = t.replace("lightning:", ""); - if (t.includes("@") && t.split("@").pop() === PUBLIC_DOMAIN) t = t.split("@")[0]; + // Our own domain is no longer only ours: coinos v3 payment addresses live + // here too and are paid over lightning like anyone else's. Only strip the + // domain (and pay internally) when the name really is a local account. + if (t.includes("@") && t.split("@").pop() === PUBLIC_DOMAIN) { + const name = t.split("@")[0]; + try { + const u = await get(`/users/${name}`); + if (u && !u.anon) t = name; + } catch (e) {} + } if (t.includes("@") && t.includes(".")) { try { t = await get(`/encode?address=${t}`); |
