Fixes the use of index relays and search relays to load users and events as well as become the default for global feeds.
This commit is contained in:
@@ -81,6 +81,9 @@ import com.vitorpamplona.amethyst.model.nip96FileStorage.FileStorageServerListSt
|
||||
import com.vitorpamplona.amethyst.model.nipB7Blossom.BlossomServerListState
|
||||
import com.vitorpamplona.amethyst.model.serverList.MergedFollowListsState
|
||||
import com.vitorpamplona.amethyst.model.serverList.MergedFollowPlusMineRelayListsState
|
||||
import com.vitorpamplona.amethyst.model.serverList.MergedFollowPlusMineWithIndexAndSearchRelayListsState
|
||||
import com.vitorpamplona.amethyst.model.serverList.MergedFollowPlusMineWithIndexRelayListsState
|
||||
import com.vitorpamplona.amethyst.model.serverList.MergedFollowPlusMineWithSearchRelayListsState
|
||||
import com.vitorpamplona.amethyst.model.serverList.MergedServerListState
|
||||
import com.vitorpamplona.amethyst.model.serverList.TrustedRelayListsState
|
||||
import com.vitorpamplona.amethyst.model.topNavFeeds.FeedDecryptionCaches
|
||||
@@ -305,7 +308,10 @@ class Account(
|
||||
|
||||
// Follows Relays
|
||||
val followOutboxesOrProxy = FollowListOutboxOrProxyRelays(kind3FollowList, blockedRelayList, proxyRelayList, cache, scope)
|
||||
val followPlusAllMine = MergedFollowPlusMineRelayListsState(followOutboxesOrProxy, nip65RelayList, privateStorageRelayList, localRelayList, indexerRelayList, scope)
|
||||
val followPlusAllMineWithIndex = MergedFollowPlusMineWithIndexRelayListsState(followOutboxesOrProxy, nip65RelayList, privateStorageRelayList, localRelayList, indexerRelayList, scope)
|
||||
val followPlusAllMineWithSearch = MergedFollowPlusMineWithSearchRelayListsState(followOutboxesOrProxy, nip65RelayList, privateStorageRelayList, localRelayList, searchRelayList, scope)
|
||||
val followPlusAllMineWithIndexAndSearch = MergedFollowPlusMineWithIndexAndSearchRelayListsState(followOutboxesOrProxy, nip65RelayList, privateStorageRelayList, localRelayList, indexerRelayList, searchRelayList, scope)
|
||||
val defaultGlobalRelays = MergedFollowPlusMineRelayListsState(followOutboxesOrProxy, nip65RelayList, privateStorageRelayList, localRelayList, scope)
|
||||
|
||||
// keeps a cache of the outbox relays for each author
|
||||
val followsPerRelay = FollowsPerOutboxRelay(kind3FollowList, blockedRelayList, proxyRelayList, cache, scope).flow
|
||||
@@ -338,7 +344,7 @@ class Account(
|
||||
feedFilterListName = settings.defaultHomeFollowList,
|
||||
allFollows = allFollows.flow,
|
||||
locationFlow = geolocationFlow,
|
||||
followsRelays = followPlusAllMine.flow,
|
||||
followsRelays = defaultGlobalRelays.flow,
|
||||
blockedRelays = blockedRelayList.flow,
|
||||
proxyRelays = proxyRelayList.flow,
|
||||
caches = feedDecryptionCaches,
|
||||
@@ -353,7 +359,7 @@ class Account(
|
||||
feedFilterListName = settings.defaultStoriesFollowList,
|
||||
allFollows = allFollows.flow,
|
||||
locationFlow = geolocationFlow,
|
||||
followsRelays = followPlusAllMine.flow,
|
||||
followsRelays = defaultGlobalRelays.flow,
|
||||
blockedRelays = blockedRelayList.flow,
|
||||
proxyRelays = proxyRelayList.flow,
|
||||
caches = feedDecryptionCaches,
|
||||
@@ -368,7 +374,7 @@ class Account(
|
||||
feedFilterListName = settings.defaultDiscoveryFollowList,
|
||||
allFollows = allFollows.flow,
|
||||
locationFlow = geolocationFlow,
|
||||
followsRelays = followPlusAllMine.flow,
|
||||
followsRelays = defaultGlobalRelays.flow,
|
||||
blockedRelays = blockedRelayList.flow,
|
||||
proxyRelays = proxyRelayList.flow,
|
||||
caches = feedDecryptionCaches,
|
||||
@@ -383,7 +389,7 @@ class Account(
|
||||
feedFilterListName = settings.defaultNotificationFollowList,
|
||||
allFollows = allFollows.flow,
|
||||
locationFlow = geolocationFlow,
|
||||
followsRelays = followPlusAllMine.flow,
|
||||
followsRelays = defaultGlobalRelays.flow,
|
||||
blockedRelays = blockedRelayList.flow,
|
||||
proxyRelays = proxyRelayList.flow,
|
||||
caches = feedDecryptionCaches,
|
||||
@@ -686,7 +692,8 @@ class Account(
|
||||
|
||||
fun computeRelayListToBroadcast(event: Event): Set<NormalizedRelayUrl> {
|
||||
if (event is MetadataEvent || event is AdvertisedRelayListEvent) {
|
||||
return followPlusAllMine.flow.value + client.relayStatusFlow().value.available
|
||||
// everywhere
|
||||
return followPlusAllMineWithIndex.flow.value + client.relayStatusFlow().value.available
|
||||
}
|
||||
if (event is GiftWrapEvent) {
|
||||
val receiver = event.recipientPubKey()
|
||||
@@ -886,7 +893,7 @@ class Account(
|
||||
}
|
||||
|
||||
fun sendLiterallyEverywhere(event: Event) {
|
||||
client.send(event, outboxRelays.flow.value + indexerRelayList.flow.value + client.relayStatusFlow().value.available)
|
||||
client.send(event, followPlusAllMineWithIndex.flow.value + client.relayStatusFlow().value.available)
|
||||
cache.justConsumeMyOwnEvent(event)
|
||||
}
|
||||
|
||||
|
||||
-3
@@ -158,9 +158,7 @@ class TorSharedPreferences(
|
||||
try {
|
||||
// Get the preference flow and take the first value.
|
||||
val preferences = context.sharedPreferencesDataStore.data.first()
|
||||
println("AABBCC Loading TorSettings: ${preferences[TOR_SETTINGS]}")
|
||||
preferences[TOR_SETTINGS]?.let {
|
||||
println("AABBCC Loading TorSettings: $it")
|
||||
JsonMapper.mapper.readValue<TorSettings>(it)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
@@ -171,7 +169,6 @@ class TorSharedPreferences(
|
||||
|
||||
suspend fun save(torSettings: TorSettings) {
|
||||
try {
|
||||
println("AABBCC Saving TorSettings: $torSettings")
|
||||
val str = JsonMapper.mapper.writeValueAsString(torSettings)
|
||||
context.sharedPreferencesDataStore.edit { preferences ->
|
||||
preferences[TOR_SETTINGS] = str
|
||||
|
||||
-5
@@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.model.serverList
|
||||
import com.vitorpamplona.amethyst.model.edits.PrivateStorageRelayListState
|
||||
import com.vitorpamplona.amethyst.model.localRelays.LocalRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip02FollowLists.FollowListOutboxOrProxyRelays
|
||||
import com.vitorpamplona.amethyst.model.nip51Lists.indexerRelays.IndexerRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip65RelayList.Nip65RelayListState
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -40,7 +39,6 @@ class MergedFollowPlusMineRelayListsState(
|
||||
val nip65RelayList: Nip65RelayListState,
|
||||
val privateOutboxRelayList: PrivateStorageRelayListState,
|
||||
val localRelayList: LocalRelayListState,
|
||||
val indexerRelayList: IndexerRelayListState,
|
||||
val scope: CoroutineScope,
|
||||
) {
|
||||
fun mergeLists(lists: Array<Set<NormalizedRelayUrl>>): Set<NormalizedRelayUrl> = lists.reduce { acc, set -> acc + set }
|
||||
@@ -53,7 +51,6 @@ class MergedFollowPlusMineRelayListsState(
|
||||
nip65RelayList.inboxFlow,
|
||||
privateOutboxRelayList.flow,
|
||||
localRelayList.flow,
|
||||
indexerRelayList.flow,
|
||||
),
|
||||
::mergeLists,
|
||||
).onStart {
|
||||
@@ -65,7 +62,6 @@ class MergedFollowPlusMineRelayListsState(
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
indexerRelayList.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -80,7 +76,6 @@ class MergedFollowPlusMineRelayListsState(
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
indexerRelayList.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.model.serverList
|
||||
|
||||
import com.vitorpamplona.amethyst.model.edits.PrivateStorageRelayListState
|
||||
import com.vitorpamplona.amethyst.model.localRelays.LocalRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip02FollowLists.FollowListOutboxOrProxyRelays
|
||||
import com.vitorpamplona.amethyst.model.nip51Lists.indexerRelays.IndexerRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip51Lists.searchRelays.SearchRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip65RelayList.Nip65RelayListState
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
|
||||
class MergedFollowPlusMineWithIndexAndSearchRelayListsState(
|
||||
val followsOutboxOrProxyRelayList: FollowListOutboxOrProxyRelays,
|
||||
val nip65RelayList: Nip65RelayListState,
|
||||
val privateOutboxRelayList: PrivateStorageRelayListState,
|
||||
val localRelayList: LocalRelayListState,
|
||||
val indexerRelayList: IndexerRelayListState,
|
||||
val searchRelayListsState: SearchRelayListState,
|
||||
val scope: CoroutineScope,
|
||||
) {
|
||||
fun mergeLists(lists: Array<Set<NormalizedRelayUrl>>): Set<NormalizedRelayUrl> = lists.reduce { acc, set -> acc + set }
|
||||
|
||||
val flow: StateFlow<Set<NormalizedRelayUrl>> =
|
||||
combine(
|
||||
listOf(
|
||||
followsOutboxOrProxyRelayList.flow,
|
||||
nip65RelayList.outboxFlow,
|
||||
nip65RelayList.inboxFlow,
|
||||
privateOutboxRelayList.flow,
|
||||
localRelayList.flow,
|
||||
indexerRelayList.flow,
|
||||
searchRelayListsState.flow,
|
||||
),
|
||||
::mergeLists,
|
||||
).onStart {
|
||||
emit(
|
||||
mergeLists(
|
||||
arrayOf(
|
||||
followsOutboxOrProxyRelayList.flow.value,
|
||||
nip65RelayList.outboxFlow.value,
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
indexerRelayList.flow.value,
|
||||
searchRelayListsState.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
}.flowOn(Dispatchers.Default)
|
||||
.stateIn(
|
||||
scope,
|
||||
SharingStarted.Eagerly,
|
||||
mergeLists(
|
||||
arrayOf(
|
||||
followsOutboxOrProxyRelayList.flow.value,
|
||||
nip65RelayList.outboxFlow.value,
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
indexerRelayList.flow.value,
|
||||
searchRelayListsState.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.model.serverList
|
||||
|
||||
import com.vitorpamplona.amethyst.model.edits.PrivateStorageRelayListState
|
||||
import com.vitorpamplona.amethyst.model.localRelays.LocalRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip02FollowLists.FollowListOutboxOrProxyRelays
|
||||
import com.vitorpamplona.amethyst.model.nip51Lists.indexerRelays.IndexerRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip65RelayList.Nip65RelayListState
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
|
||||
class MergedFollowPlusMineWithIndexRelayListsState(
|
||||
val followsOutboxOrProxyRelayList: FollowListOutboxOrProxyRelays,
|
||||
val nip65RelayList: Nip65RelayListState,
|
||||
val privateOutboxRelayList: PrivateStorageRelayListState,
|
||||
val localRelayList: LocalRelayListState,
|
||||
val indexerRelayList: IndexerRelayListState,
|
||||
val scope: CoroutineScope,
|
||||
) {
|
||||
fun mergeLists(lists: Array<Set<NormalizedRelayUrl>>): Set<NormalizedRelayUrl> = lists.reduce { acc, set -> acc + set }
|
||||
|
||||
val flow: StateFlow<Set<NormalizedRelayUrl>> =
|
||||
combine(
|
||||
listOf(
|
||||
followsOutboxOrProxyRelayList.flow,
|
||||
nip65RelayList.outboxFlow,
|
||||
nip65RelayList.inboxFlow,
|
||||
privateOutboxRelayList.flow,
|
||||
localRelayList.flow,
|
||||
indexerRelayList.flow,
|
||||
),
|
||||
::mergeLists,
|
||||
).onStart {
|
||||
emit(
|
||||
mergeLists(
|
||||
arrayOf(
|
||||
followsOutboxOrProxyRelayList.flow.value,
|
||||
nip65RelayList.outboxFlow.value,
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
indexerRelayList.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
}.flowOn(Dispatchers.Default)
|
||||
.stateIn(
|
||||
scope,
|
||||
SharingStarted.Eagerly,
|
||||
mergeLists(
|
||||
arrayOf(
|
||||
followsOutboxOrProxyRelayList.flow.value,
|
||||
nip65RelayList.outboxFlow.value,
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
indexerRelayList.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.model.serverList
|
||||
|
||||
import com.vitorpamplona.amethyst.model.edits.PrivateStorageRelayListState
|
||||
import com.vitorpamplona.amethyst.model.localRelays.LocalRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip02FollowLists.FollowListOutboxOrProxyRelays
|
||||
import com.vitorpamplona.amethyst.model.nip51Lists.searchRelays.SearchRelayListState
|
||||
import com.vitorpamplona.amethyst.model.nip65RelayList.Nip65RelayListState
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
|
||||
class MergedFollowPlusMineWithSearchRelayListsState(
|
||||
val followsOutboxOrProxyRelayList: FollowListOutboxOrProxyRelays,
|
||||
val nip65RelayList: Nip65RelayListState,
|
||||
val privateOutboxRelayList: PrivateStorageRelayListState,
|
||||
val localRelayList: LocalRelayListState,
|
||||
val searchRelayListsState: SearchRelayListState,
|
||||
val scope: CoroutineScope,
|
||||
) {
|
||||
fun mergeLists(lists: Array<Set<NormalizedRelayUrl>>): Set<NormalizedRelayUrl> = lists.reduce { acc, set -> acc + set }
|
||||
|
||||
val flow: StateFlow<Set<NormalizedRelayUrl>> =
|
||||
combine(
|
||||
listOf(
|
||||
followsOutboxOrProxyRelayList.flow,
|
||||
nip65RelayList.outboxFlow,
|
||||
nip65RelayList.inboxFlow,
|
||||
privateOutboxRelayList.flow,
|
||||
localRelayList.flow,
|
||||
searchRelayListsState.flow,
|
||||
),
|
||||
::mergeLists,
|
||||
).onStart {
|
||||
emit(
|
||||
mergeLists(
|
||||
arrayOf(
|
||||
followsOutboxOrProxyRelayList.flow.value,
|
||||
nip65RelayList.outboxFlow.value,
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
searchRelayListsState.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
}.flowOn(Dispatchers.Default)
|
||||
.stateIn(
|
||||
scope,
|
||||
SharingStarted.Eagerly,
|
||||
mergeLists(
|
||||
arrayOf(
|
||||
followsOutboxOrProxyRelayList.flow.value,
|
||||
nip65RelayList.outboxFlow.value,
|
||||
nip65RelayList.inboxFlow.value,
|
||||
privateOutboxRelayList.flow.value,
|
||||
localRelayList.flow.value,
|
||||
searchRelayListsState.flow.value,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -93,7 +93,6 @@ class TorRelayState(
|
||||
trustedRelays,
|
||||
dmRelays,
|
||||
) { torSettings: TorRelaySettings, trustedRelayList: Set<NormalizedRelayUrl>, dmRelayList: Set<NormalizedRelayUrl> ->
|
||||
println("AABBCC New tor evaluation: $torSettings $trustedRelayList $dmRelayList")
|
||||
emit(
|
||||
TorRelayEvaluation(
|
||||
torSettings = torSettings,
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ fun filterMissingAddressables(keys: List<EventFinderQueryState>): List<RelayBase
|
||||
val addressesPerRelay =
|
||||
mapOfSet {
|
||||
keys.forEach { key ->
|
||||
val default = key.account.followPlusAllMine.flow.value
|
||||
val default = key.account.followPlusAllMineWithSearch.flow.value
|
||||
if (key.note is AddressableNote && key.note.event == null) {
|
||||
potentialRelaysToFindAddress(key.note).ifEmpty { default }.forEach { relayUrl ->
|
||||
add(relayUrl, key.note.address)
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ fun filterMissingEvents(keys: List<EventFinderQueryState>): List<RelayBasedFilte
|
||||
val eventsPerRelay =
|
||||
mapOfSet {
|
||||
keys.forEach { key ->
|
||||
val default = key.account.followPlusAllMine.flow.value
|
||||
val default = key.account.followPlusAllMineWithSearch.flow.value
|
||||
|
||||
if (key.note !is AddressableNote && key.note.event == null) {
|
||||
potentialRelaysToFindEvent(key.note).ifEmpty { default }.forEach { relayUrl ->
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ class UserLoaderSubAssembler(
|
||||
val defaultRelays = mutableSetOf<NormalizedRelayUrl>()
|
||||
|
||||
keys.mapTo(mutableSetOf()) { it.account }.forEach {
|
||||
defaultRelays.addAll(it.followPlusAllMine.flow.value)
|
||||
defaultRelays.addAll(it.followPlusAllMineWithIndexAndSearch.flow.value)
|
||||
|
||||
it.kind3FollowList.flow.value.authors.forEach {
|
||||
val user = LocalCache.getOrCreateUser(it)
|
||||
|
||||
+9
-8
@@ -55,27 +55,28 @@ class SearchWatcherSubAssembler(
|
||||
|
||||
if (mySearchString.isBlank()) return null
|
||||
|
||||
val defaultRelays = key.account.followPlusAllMine.flow.value
|
||||
val defaultRelaysWithIndexAndSearch = key.account.followPlusAllMineWithIndexAndSearch.flow.value
|
||||
val defaultRelaysWithSearch = key.account.followPlusAllMineWithSearch.flow.value
|
||||
|
||||
val directFilters =
|
||||
runCatching {
|
||||
if (Hex.isHex(mySearchString)) {
|
||||
val hexKey = Hex.decode(mySearchString).toHexKey()
|
||||
filterByAuthor(hexKey, defaultRelays) + filterByEvent(hexKey, defaultRelays)
|
||||
filterByAuthor(hexKey, defaultRelaysWithIndexAndSearch) + filterByEvent(hexKey, defaultRelaysWithSearch)
|
||||
} else {
|
||||
val parsed = Nip19Parser.uriToRoute(mySearchString)?.entity
|
||||
if (parsed != null) {
|
||||
cache.consume(parsed)
|
||||
|
||||
when (parsed) {
|
||||
is NSec -> filterByAuthor(parsed.toPubKeyHex(), defaultRelays)
|
||||
is NPub -> filterByAuthor(parsed.hex, defaultRelays)
|
||||
is NProfile -> filterByAuthor(parsed.hex, defaultRelays)
|
||||
is NNote -> filterByEvent(parsed.hex, defaultRelays)
|
||||
is NEvent -> filterByEvent(parsed.hex, defaultRelays)
|
||||
is NSec -> filterByAuthor(parsed.toPubKeyHex(), defaultRelaysWithIndexAndSearch)
|
||||
is NPub -> filterByAuthor(parsed.hex, defaultRelaysWithIndexAndSearch)
|
||||
is NProfile -> filterByAuthor(parsed.hex, defaultRelaysWithIndexAndSearch)
|
||||
is NNote -> filterByEvent(parsed.hex, defaultRelaysWithSearch)
|
||||
is NEvent -> filterByEvent(parsed.hex, defaultRelaysWithSearch)
|
||||
is NEmbed -> emptyList()
|
||||
is NRelay -> emptyList()
|
||||
is NAddress -> filterByAddress(parsed, defaultRelays)
|
||||
is NAddress -> filterByAddress(parsed, defaultRelaysWithSearch)
|
||||
else -> emptyList()
|
||||
}
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ class ThreadEventLoaderSubAssembler(
|
||||
since: SincePerRelayMap?,
|
||||
): List<RelayBasedFilter>? {
|
||||
val branches = ThreadAssembler().findThreadFor(key.eventId) ?: return null
|
||||
val defaultRelays = key.account.followPlusAllMine.flow.value
|
||||
val defaultRelays = key.account.followPlusAllMineWithSearch.flow.value
|
||||
return filterMissingEventsForThread(branches, defaultRelays)
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,6 @@ class TorSettingsFlow(
|
||||
fun update(torSettings: TorSettings): Boolean {
|
||||
var any = false
|
||||
|
||||
println("AABBCC updating 1 $torSettings")
|
||||
|
||||
if (torType.value != torSettings.torType) {
|
||||
torType.tryEmit(torSettings.torType)
|
||||
any = true
|
||||
@@ -150,8 +148,6 @@ class TorSettingsFlow(
|
||||
any = true
|
||||
}
|
||||
|
||||
println("AABBCC updating 2 ${toSettings()}")
|
||||
|
||||
return any
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user