aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-03-14 13:34:23 -0700
committerAdam Soltys <[email protected]>2025-03-14 13:34:23 -0700
commit32f51142a734136803f134524eb2b90fdc71c302 (patch)
tree3fd17880cc63b39d87df81331c3492c252624d1d
parent37d4f46c24532150654bc5e14c4cf7b16d822712 (diff)
downloadcoinos-server-32f51142a734136803f134524eb2b90fdc71c302.tar.gz
coinos-server-32f51142a734136803f134524eb2b90fdc71c302.zip
pass nwc string in app
-rw-r--r--routes/users.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/routes/users.ts b/routes/users.ts
index 8fb078e1..74ad79b5 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -22,6 +22,9 @@ import { v4 } from "uuid";
import { PaymentType } from "$lib/types";
import type { ProfilePointer } from "nostr-tools/nip19";
+const { host } = new URL(process.env.URL);
+const relay = encodeURIComponent(config.publicRelay);
+
export default {
upload,
@@ -839,7 +842,11 @@ export default {
async app(req, res) {
const { pubkey } = req.params;
+ const { user } = req;
const app = await g(`app:${pubkey}`);
+ if (app.uid !== user.id) fail("unauthorized");
+
+ const lud16 = `${user.username}@${host}`;
const pids = (await db.lRange(`${pubkey}:payments`, 0, -1)) || [];
@@ -851,6 +858,7 @@ export default {
}),
);
+ app.nwc = `nostr+walletconnect://${serverPubkey}?relay=${relay}&secret=${app.secret}&lud16=${lud16}`;
app.payments = payments.filter((p) => p);
res.send(app);
@@ -861,9 +869,7 @@ export default {
const pubkeys = await db.sMembers(`${user.id}:apps`);
const apps = await Promise.all(pubkeys.map((p) => g(`app:${p}`)));
- const { host } = new URL(process.env.URL);
const lud16 = `${user.username}@${host}`;
- const relay = encodeURIComponent(config.publicRelay);
await Promise.all(
apps.map(async (a) => {