Creates a bootstrap relay list for inbox that doesn't have nostr.wine to avoid sending posts there and getting the notify

This commit is contained in:
Vitor Pamplona
2025-08-28 18:12:55 -04:00
parent 0fe01696a5
commit e4311ddfa3
4 changed files with 7 additions and 17 deletions
@@ -46,6 +46,7 @@ object Constants {
val coracle = RelayUrlNormalizer.normalize("wss://indexer.coracle.social")
val userkinds = RelayUrlNormalizer.normalize("wss://user.kindpag.es")
val bootstrapInbox = setOf(band, damus, primal, mom, nos, bitcoiner, oxtr, fmtwiz)
val eventFinderRelays = setOf(band, wine, damus, primal, mom, nos, bitcoiner, oxtr, fmtwiz)
val defaultSearchRelaySet = setOf(band, wine, where)
@@ -61,7 +61,7 @@ class Nip65RelayListState(
fun normalizeNIP65WriteRelayListWithBackup(note: Note): Set<NormalizedRelayUrl> = nip65Event(note)?.writeRelaysNorm()?.toSet() ?: Constants.eventFinderRelays
fun normalizeNIP65ReadRelayListWithBackup(note: Note): Set<NormalizedRelayUrl> = nip65Event(note)?.readRelaysNorm()?.toSet() ?: Constants.eventFinderRelays
fun normalizeNIP65ReadRelayListWithBackup(note: Note): Set<NormalizedRelayUrl> = nip65Event(note)?.readRelaysNorm()?.toSet() ?: Constants.bootstrapInbox
fun normalizeNIP65AllRelayListWithBackup(note: Note): Set<NormalizedRelayUrl> = nip65Event(note)?.relays()?.map { it.relayUrl }?.toSet() ?: Constants.eventFinderRelays
@@ -89,17 +89,6 @@ class Nip65RelayListState(
emptySet(),
)
val allFlow =
getNIP65RelayListFlow()
.map { normalizeNIP65AllRelayListWithBackup(it.note) }
.onStart { emit(normalizeNIP65AllRelayListWithBackup(getNIP65RelayListNote())) }
.flowOn(Dispatchers.Default)
.stateIn(
scope,
SharingStarted.Eagerly,
emptySet(),
)
val allFlowNoDefaults =
getNIP65RelayListFlow()
.map { normalizeNIP65AllRelayListWithBackupNoDefaults(it.note) }
@@ -65,11 +65,11 @@ class TrustedRelayListsState(
emit(
mergeLists(
arrayOf(
nip65RelayList.allFlow.value,
nip65RelayList.allFlowNoDefaults.value,
privateOutboxRelayList.flow.value,
localRelayList.flow.value,
dmRelayList.flow.value,
searchRelayListState.flow.value,
searchRelayListState.flowNoDefaults.value,
trustedRelayList.flow.value,
broadcastRelayList.flow.value,
),
@@ -81,11 +81,11 @@ class TrustedRelayListsState(
SharingStarted.Eagerly,
mergeLists(
arrayOf(
nip65RelayList.allFlow.value,
nip65RelayList.allFlowNoDefaults.value,
privateOutboxRelayList.flow.value,
localRelayList.flow.value,
dmRelayList.flow.value,
searchRelayListState.flow.value,
searchRelayListState.flowNoDefaults.value,
trustedRelayList.flow.value,
broadcastRelayList.flow.value,
),
@@ -66,7 +66,7 @@ fun ObserveRelayListForSearchAndDisplayIfNotFound(
accountViewModel: AccountViewModel,
nav: INav,
) {
val searchRelayList by accountViewModel.account.searchRelayList.flow
val searchRelayList by accountViewModel.account.searchRelayList.flowNoDefaults
.collectAsStateWithLifecycle()
if (searchRelayList.isEmpty()) {