From 100a5056eb9401ccee3f4fe0d89988ab97fd1d72 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 13 Jun 2024 16:54:03 -0500 Subject: [PATCH 1/3] nameRequestsController: display only owned 3036 events --- src/controllers/api/ditto.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/api/ditto.ts b/src/controllers/api/ditto.ts index 5723a9e..832f487 100644 --- a/src/controllers/api/ditto.ts +++ b/src/controllers/api/ditto.ts @@ -126,7 +126,11 @@ export const nameRequestsController: AppController = async (c) => { } } - const events = await store.query([{ kinds: [3036], ids: [...ids] }]) + if (ids.size === 0) { + return c.json([]); + } + + const events = await store.query([{ kinds: [3036], ids: [...ids], authors: [pubkey] }]) .then((events) => hydrateEvents({ store, events: events, signal: c.req.raw.signal })); const nameRequests = await Promise.all( From 44fe0c5e1d5446f3b97215cc4a90950d593a9c6d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 13 Jun 2024 18:43:04 -0500 Subject: [PATCH 2/3] Bump Nostrify to v0.23.2 --- deno.json | 2 +- deno.lock | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/deno.json b/deno.json index a2b8733..1a7f5e8 100644 --- a/deno.json +++ b/deno.json @@ -23,7 +23,7 @@ "@db/sqlite": "jsr:@db/sqlite@^0.11.1", "@isaacs/ttlcache": "npm:@isaacs/ttlcache@^1.4.1", "@noble/secp256k1": "npm:@noble/secp256k1@^2.0.0", - "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.23.1", + "@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.23.2", "@scure/base": "npm:@scure/base@^1.1.6", "@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs", "@soapbox/kysely-deno-sqlite": "jsr:@soapbox/kysely-deno-sqlite@^2.1.0", diff --git a/deno.lock b/deno.lock index 928bf2c..4a79b8f 100644 --- a/deno.lock +++ b/deno.lock @@ -10,7 +10,7 @@ "jsr:@nostrify/nostrify@^0.22.1": "jsr:@nostrify/nostrify@0.22.5", "jsr:@nostrify/nostrify@^0.22.4": "jsr:@nostrify/nostrify@0.22.4", "jsr:@nostrify/nostrify@^0.22.5": "jsr:@nostrify/nostrify@0.22.5", - "jsr:@nostrify/nostrify@^0.23.1": "jsr:@nostrify/nostrify@0.23.1", + "jsr:@nostrify/nostrify@^0.23.2": "jsr:@nostrify/nostrify@0.23.2", "jsr:@soapbox/kysely-deno-sqlite@^2.1.0": "jsr:@soapbox/kysely-deno-sqlite@2.2.0", "jsr:@soapbox/stickynotes@^0.4.0": "jsr:@soapbox/stickynotes@0.4.0", "jsr:@std/assert@^0.217.0": "jsr:@std/assert@0.217.0", @@ -122,11 +122,10 @@ "npm:zod@^3.23.8" ] }, - "@nostrify/nostrify@0.23.1": { - "integrity": "7a242dedfe33cf38131696ad96d789d54257cfbfd5b5e63748fe5d53c057d99a", + "@nostrify/nostrify@0.23.2": { + "integrity": "c880fd91b5fe69a6239f98cae62297ffccc2a78d160af4d376dd05899352daf0", "dependencies": [ "jsr:@std/encoding@^0.224.1", - "npm:@scure/base@^1.1.6", "npm:@scure/bip32@^1.4.0", "npm:@scure/bip39@^1.3.0", "npm:kysely@^0.27.3", @@ -1360,7 +1359,7 @@ "dependencies": [ "jsr:@bradenmacdonald/s3-lite-client@^0.7.4", "jsr:@db/sqlite@^0.11.1", - "jsr:@nostrify/nostrify@^0.23.1", + "jsr:@nostrify/nostrify@^0.23.2", "jsr:@soapbox/kysely-deno-sqlite@^2.1.0", "jsr:@soapbox/stickynotes@^0.4.0", "jsr:@std/assert@^0.225.1", From 5658c5db081ffb0cf4c36cc70b5a37e57e77b130 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 13 Jun 2024 23:47:12 +0000 Subject: [PATCH 3/3] nameRequestsController: `ids.size === 0` => `!ids.size` --- src/controllers/api/ditto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/api/ditto.ts b/src/controllers/api/ditto.ts index 832f487..c9c7896 100644 --- a/src/controllers/api/ditto.ts +++ b/src/controllers/api/ditto.ts @@ -126,7 +126,7 @@ export const nameRequestsController: AppController = async (c) => { } } - if (ids.size === 0) { + if (!ids.size) { return c.json([]); }