Create nip29 group when creating a room

This commit is contained in:
Jon Staab
2024-12-10 15:16:54 -08:00
parent 73c6b9656c
commit d8c3378e5c
4 changed files with 62 additions and 13 deletions
+5 -5
View File
@@ -150,15 +150,15 @@
setupAnalytics()
ready = initStorage("flotilla", 4, {
relays: {keyPath: "url", store: throttled(1000, relays)},
handles: {keyPath: "nip05", store: throttled(1000, handles)},
checked: storageAdapters.fromObjectStore(checked, {throttle: 1000}),
relays: {keyPath: "url", store: throttled(3000, relays)},
handles: {keyPath: "nip05", store: throttled(3000, handles)},
checked: storageAdapters.fromObjectStore(checked, {throttle: 3000}),
freshness: storageAdapters.fromObjectStore(freshness, {
throttle: 1000,
throttle: 3000,
migrate: migrateFreshness,
}),
plaintext: storageAdapters.fromObjectStore(plaintext, {
throttle: 1000,
throttle: 3000,
migrate: migratePlaintext,
}),
events: storageAdapters.fromRepositoryAndTracker(repository, tracker, {
@@ -9,7 +9,6 @@
import type {TrustedEvent, EventContent} from "@welshman/util"
import {throttled} from "@welshman/store"
import {createEvent, DELETE, MESSAGE} from "@welshman/util"
import {PublishStatus} from "@welshman/net"
import {formatTimestampAsDate, load, publishThunk, deriveRelay} from "@welshman/app"
import {slide} from "@lib/transition"
import {createScroller, type Scroller} from "@lib/html"
@@ -35,7 +34,13 @@
displayChannel,
} from "@app/state"
import {setChecked} from "@app/notifications"
import {nip29, addRoomMembership, removeRoomMembership, subscribePersistent} from "@app/commands"
import {
nip29,
addRoomMembership,
removeRoomMembership,
getThunkError,
subscribePersistent,
} from "@app/commands"
import {PROTECTED} from "@app/state"
import {popKey} from "@app/implicit"
import {pushToast} from "@app/toast"
@@ -50,11 +55,9 @@
const joinRoom = async () => {
if (nip29.isSupported($relay)) {
const thunk = nip29.joinRoom(url, room)
const result = await thunk.result
const {status, message} = result[url]!
const message = await getThunkError(nip29.joinRoom(url, room))
if (status !== PublishStatus.Success) {
if (message && !message.includes("already")) {
return pushToast({theme: "error", message})
}
}