Support resources with kind:30023 articles

This commit is contained in:
dtonon 2026-05-19 15:14:53 +01:00
parent f6bea700f0
commit b901215e1a
13 changed files with 285 additions and 75 deletions

View file

@ -1,5 +1,6 @@
import { SimplePool } from "@nostr/tools";
import { RELAY_URL } from "$lib/config";
import { RELAY_URL, MODE } from "$lib/config";
import { groupStore } from "$lib/group.svelte";
// room id -> admin pubkeys (NIP-29 kind 39001 `p` tags), across all rooms.
let byRoom = $state<Record<string, string[]>>({});
@ -15,6 +16,19 @@ export const roomAdminsStore = {
},
};
// Single source of truth for "who is an admin": the union of every room's
// admins in full mode, or the one group's admins in simple mode.
export const adminPubkeys = {
get list(): string[] {
return MODE === "full"
? [...new Set(Object.values(byRoom).flat())]
: (groupStore.data?.admins ?? []);
},
get loaded(): boolean {
return MODE === "full" ? loaded : groupStore.loaded;
},
};
export async function loadRoomAdmins(roomIds: string[]) {
if (roomIds.length === 0) return;
const key = [...roomIds].sort().join(",");