aboutsummaryrefslogtreecommitdiffstats
path: root/routes/nostr.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-14 16:55:44 -0800
committerAdam Soltys <[email protected]>2025-01-14 16:55:44 -0800
commit81a576c2007805849f963242bc93ef60bee8efa4 (patch)
treecfb4e4f62f749b658271d91f03d819ed698b1da3 /routes/nostr.ts
parent0a8a8988d27d26feec689a28447eed85c1069584 (diff)
downloadcoinos-server-81a576c2007805849f963242bc93ef60bee8efa4.tar.gz
coinos-server-81a576c2007805849f963242bc93ef60bee8efa4.zip
public fields
Diffstat (limited to 'routes/nostr.ts')
-rw-r--r--routes/nostr.ts19
1 files changed, 7 insertions, 12 deletions
diff --git a/routes/nostr.ts b/routes/nostr.ts
index 6c252927..ae2be7e9 100644
--- a/routes/nostr.ts
+++ b/routes/nostr.ts
@@ -1,21 +1,18 @@
import config from "$config";
-import { db, g, s } from "$lib/db";
+import { db, g } from "$lib/db";
import {
anon,
getCount,
getProfile,
getRelays,
- pool,
send,
serverPubkey,
} from "$lib/nostr";
-import { count, scan } from "$lib/strfry";
-import { bail, fail, getUser, publicFields } from "$lib/utils";
+import { scan } from "$lib/strfry";
+import { bail, fail, fields, getUser } from "$lib/utils";
import { decode } from "nostr-tools/nip19";
import type { ProfilePointer } from "nostr-tools/nip19";
-const opts = { maxWait: 2000 };
-
export default {
async event(req, res) {
const {
@@ -78,7 +75,7 @@ export default {
const profiles = await scan({ authors: pubkeys, kinds: [0] });
for (const p of profiles) {
const { content, pubkey } = p;
- let user = await getUser(pubkey, publicFields);
+ let user = await getUser(pubkey, fields);
user = { ...user, ...JSON.parse(content) };
user.pubkey = pubkey;
follows.push(user);
@@ -89,8 +86,7 @@ export default {
pubkeys
.filter((p) => !keys.includes(p))
.map(
- async (pubkey) =>
- (await getUser(pubkey, publicFields)) || anon(pubkey),
+ async (pubkey) => (await getUser(pubkey, fields)) || anon(pubkey),
),
);
@@ -120,7 +116,7 @@ export default {
const profiles = await scan({ authors: pubkeys, kinds: [0] });
for (const p of profiles) {
const { content, pubkey } = p;
- let user = await getUser(pubkey, publicFields);
+ let user = await getUser(pubkey, fields);
user = { ...user, ...JSON.parse(content) };
user.pubkey = pubkey;
followers.push(user);
@@ -131,8 +127,7 @@ export default {
pubkeys
.filter((p) => !keys.includes(p))
.map(
- async (pubkey) =>
- (await getUser(pubkey, publicFields)) || anon(pubkey),
+ async (pubkey) => (await getUser(pubkey, fields)) || anon(pubkey),
),
);