mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2026-01-27 06:03:22 +00:00
Add NIP-05 handles for Vereinsmitglieders :D
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user