diff --git a/deno.json b/deno.json index 4033136b..b7a7cd9a 100644 --- a/deno.json +++ b/deno.json @@ -10,7 +10,7 @@ "nostr:pull": "deno run -A --env-file --deny-read=.env scripts/nostr-pull.ts", "debug": "deno run -A --env-file --deny-read=.env --inspect src/server.ts", "test": "deno test -A --env-file=.env.test --deny-read=.env --junit-path=./deno-test.xml", - "check": "deno check --allow-import src/server.ts", + "check": "deno check --allow-import .", "nsec": "deno run scripts/nsec.ts", "admin:event": "deno run -A --env-file --deny-read=.env scripts/admin-event.ts", "admin:role": "deno run -A --env-file --deny-read=.env scripts/admin-role.ts", diff --git a/scripts/db-import.ts b/scripts/db-import.ts index 45a530d3..c34384bf 100644 --- a/scripts/db-import.ts +++ b/scripts/db-import.ts @@ -30,7 +30,7 @@ for await (const line of readable) { await store.event(event); console.warn(`(${count}) Event<${event.kind}> ${event.id}`); } catch (error) { - if (error.message.includes('violates unique constraint')) { + if (error instanceof Error && error.message.includes('violates unique constraint')) { console.warn(`(${count}) Skipping existing event... ${event.id}`); } else { console.error(error); diff --git a/scripts/db-populate-search.ts b/scripts/db-populate-search.ts index e34aaa75..81b84ee6 100644 --- a/scripts/db-populate-search.ts +++ b/scripts/db-populate-search.ts @@ -12,9 +12,12 @@ for await (const msg of store.req([{ kinds: [0] }])) { const search = [name, nip05].filter(Boolean).join(' ').trim(); try { - await kysely.insertInto('author_search').values({ + await kysely.insertInto('author_stats').values({ pubkey, search, + followers_count: 0, + following_count: 0, + notes_count: 0, }).onConflict( (oc) => oc.column('pubkey') diff --git a/scripts/nostr-pull.ts b/scripts/nostr-pull.ts index f7a3840c..573b5f01 100644 --- a/scripts/nostr-pull.ts +++ b/scripts/nostr-pull.ts @@ -31,7 +31,7 @@ const importUsers = async ( try { await doEvent(event); } catch (error) { - if (error.message.includes('violates unique constraint')) { + if (error instanceof Error && error.message.includes('violates unique constraint')) { console.warn(`Skipping existing event ${event.id}...`); } else { console.error(error); diff --git a/scripts/setup-kind0.ts b/scripts/setup-kind0.ts index c62cc706..040af089 100644 --- a/scripts/setup-kind0.ts +++ b/scripts/setup-kind0.ts @@ -56,7 +56,7 @@ if (import.meta.main) { }) .then(async (blob) => await pngToIco(Buffer.from(await blob.arrayBuffer())) - .then(async (buf) => await Deno.writeFile('./public/favicon.ico', buf)) + .then(async (buf) => await Deno.writeFile('./public/favicon.ico', new Uint8Array(buf))) ); } catch (e) { die(1, `Error generating favicon from url ${image}: "${e}". Please check this or try again without --image.`);