Add NIP-05 handles for Vereinsmitglieders :D

This commit is contained in:
Dennis Reimann
2026-01-21 08:40:09 +01:00
parent fa0ef9e6ba
commit b47f5e2b70
3 changed files with 24 additions and 4 deletions

View File

@@ -1,9 +1,18 @@
const { mkdirSync, writeFileSync } = require('fs')
const { dirname, resolve } = require('path')
const { NDKUser } = require('@nostr-dev-kit/ndk')
const request = require('sync-request')
const participants = require('../content/participants.json')
const { npub } = require('../content/meta.json')
let members = []
try {
const jsonBody = request('GET', 'https://verein.einundzwanzig.space/api/members/2026').getBody('utf8')
members = JSON.parse(jsonBody)
} catch (err) {
console.error('Could not load members:', err)
}
const einundzwanzig = new NDKUser({ npub: npub.einundzwanzig })
const nostrtalk = new NDKUser({ npub: npub.nostrTalk })
const zitadelle = new NDKUser({ npub: npub.zitadelle })
@@ -25,6 +34,15 @@ Object.entries(participants).forEach(([key, { nostr: npub }]) => {
names[id] = new NDKUser({ npub }).pubkey
})
Object.entries(members).forEach(([key, { npub, pubkey, nip05_handle }]) => {
if (!nip05_handle) return
const id = nip05_handle.replace(/[\s]/g, '_')
// don't overwrite participant entry
if (names[id]) return
names[id] = new NDKUser({ npub }).pubkey
})
const dst = resolve(__dirname, '..', 'dist', '.well-known', 'nostr.json')
const dir = dirname(dst)
const res = { names, relays }