From b47f5e2b709b1ab1b744fded1220aec8cb8e2a34 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Wed, 21 Jan 2026 08:40:09 +0100 Subject: [PATCH] Add NIP-05 handles for Vereinsmitglieders :D --- .github/workflows/build.yml | 9 +++++---- package.json | 1 + tasks/generate_nostr.js | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b531d88ac6..19223b29fc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,13 +8,14 @@ on: pull_request: branches: - master - # Used to trigger the build for Anchor feed updates. Can by kicked off via: - # curl -X POST -H "Authorization: token $GH_PAT" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/Einundzwanzig-Podcast/einundzwanzig.space/dispatches --data '{"event_type": "build_docs"}' + # Used to trigger the build via external updates (e.g. Anchor feed or Verein). Can by kicked off via: + # curl -X POST -H "Authorization: token $GH_PAT" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/Einundzwanzig-Podcast/einundzwanzig.space/dispatches --data '{"event_type": "anchor_update"}' repository_dispatch: types: - anchor_update - # schedule: - # - cron: "0 7 * * *" + - verein_update + schedule: + - cron: "0 7 * * *" jobs: build: diff --git a/package.json b/package.json index 7db62b8b38d..a00bcbde5eb 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "init": "run-s clean copy && run-p fetch build:data", "start": "cross-env NODE_ENV=development npm run init && cross-env NODE_ENV=development run-p start:*", "start:data": "onchange -k 'content/**/*' 'tasks/generate_site_data.js' -- npm run build:data", + "start:nostr": "onchange -i -k 'content/participants' 'tasks/generate_nostr.js' -- npm run build:nostr", "start:feed": "onchange -i -k 'generated/feed.json' 'tasks/generate_feed.js' -- npm run build:feed", "start:pages": "onchange -i -k 'pug.config.js' 'markdown.js' 'content/**' 'generated/**' 'src/**/*.pug' 'tasks/generate_pages.js' -- npm run build:pages -- {{file}}", "start:styles": "onchange -i -k 'src/**/*.css' -- npm run build:styles", diff --git a/tasks/generate_nostr.js b/tasks/generate_nostr.js index d15787c67bd..44117c788e7 100644 --- a/tasks/generate_nostr.js +++ b/tasks/generate_nostr.js @@ -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 }