Adds EOSE limits to the Discovery tab.
This commit is contained in:
@@ -17,7 +17,6 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
lateinit var account: Account
|
lateinit var account: Account
|
||||||
|
|
||||||
val latestEOSEs = EOSEAccount()
|
val latestEOSEs = EOSEAccount()
|
||||||
val dataSource = "Discovery"
|
|
||||||
|
|
||||||
fun createLiveStreamFilter(): TypedFilter {
|
fun createLiveStreamFilter(): TypedFilter {
|
||||||
val follows = account.selectedUsersFollowList(account.defaultDiscoveryFollowList)
|
val follows = account.selectedUsersFollowList(account.defaultDiscoveryFollowList)
|
||||||
@@ -32,7 +31,7 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
authors = followKeys,
|
authors = followKeys,
|
||||||
kinds = listOf(LiveActivitiesChatMessageEvent.kind, LiveActivitiesEvent.kind),
|
kinds = listOf(LiveActivitiesChatMessageEvent.kind, LiveActivitiesEvent.kind),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(dataSource)?.relayList
|
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultDiscoveryFollowList)?.relayList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -50,7 +49,7 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
authors = followKeys,
|
authors = followKeys,
|
||||||
kinds = listOf(ChannelCreateEvent.kind, ChannelMetadataEvent.kind, ChannelMessageEvent.kind),
|
kinds = listOf(ChannelCreateEvent.kind, ChannelMetadataEvent.kind, ChannelMessageEvent.kind),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(dataSource)?.relayList
|
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultDiscoveryFollowList)?.relayList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -68,7 +67,7 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
authors = followKeys,
|
authors = followKeys,
|
||||||
kinds = listOf(CommunityDefinitionEvent.kind, CommunityPostApprovalEvent.kind),
|
kinds = listOf(CommunityDefinitionEvent.kind, CommunityPostApprovalEvent.kind),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(dataSource)?.relayList
|
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultDiscoveryFollowList)?.relayList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -88,7 +87,7 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
}.flatten()
|
}.flatten()
|
||||||
),
|
),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(dataSource)?.relayList
|
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultDiscoveryFollowList)?.relayList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -108,7 +107,7 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
}.flatten()
|
}.flatten()
|
||||||
),
|
),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(dataSource)?.relayList
|
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultDiscoveryFollowList)?.relayList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -128,12 +127,14 @@ object NostrDiscoveryDataSource : NostrDataSource("DiscoveryFeed") {
|
|||||||
}.flatten()
|
}.flatten()
|
||||||
),
|
),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
since = latestEOSEs.users[account.userProfile()]?.followList?.get(dataSource)?.relayList
|
since = latestEOSEs.users[account.userProfile()]?.followList?.get(account.defaultDiscoveryFollowList)?.relayList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val discoveryFeedChannel = requestNewChannel()
|
val discoveryFeedChannel = requestNewChannel() { time, relayUrl ->
|
||||||
|
latestEOSEs.addOrUpdate(account.userProfile(), account.defaultDiscoveryFollowList, relayUrl, time)
|
||||||
|
}
|
||||||
|
|
||||||
override fun updateChannelFilters() {
|
override fun updateChannelFilters() {
|
||||||
discoveryFeedChannel.typedFilters = listOfNotNull(
|
discoveryFeedChannel.typedFilters = listOfNotNull(
|
||||||
|
|||||||
Reference in New Issue
Block a user