mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 23:26:49 +01:00
Renames PerRelayFilter to SincePerRelay
Creates PerRelay interface to allow other types of filters
This commit is contained in:
@@ -42,7 +42,7 @@ import com.vitorpamplona.ammolite.relays.FeedType
|
|||||||
import com.vitorpamplona.ammolite.relays.Relay
|
import com.vitorpamplona.ammolite.relays.Relay
|
||||||
import com.vitorpamplona.ammolite.relays.RelaySetupInfo
|
import com.vitorpamplona.ammolite.relays.RelaySetupInfo
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.crypto.KeyPair
|
import com.vitorpamplona.quartz.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.encoders.ATag
|
import com.vitorpamplona.quartz.encoders.ATag
|
||||||
import com.vitorpamplona.quartz.encoders.HexKey
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
@@ -1126,7 +1126,7 @@ class Account(
|
|||||||
listOf(
|
listOf(
|
||||||
TypedFilter(
|
TypedFilter(
|
||||||
setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS, FeedType.GLOBAL),
|
setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS, FeedType.GLOBAL),
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
ids = listOf(it.id),
|
ids = listOf(it.id),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
|||||||
import com.vitorpamplona.ammolite.relays.Relay
|
import com.vitorpamplona.ammolite.relays.Relay
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.EOSETime
|
import com.vitorpamplona.ammolite.relays.filters.EOSETime
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.encoders.HexKey
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
import com.vitorpamplona.quartz.events.AdvertisedRelayListEvent
|
import com.vitorpamplona.quartz.events.AdvertisedRelayListEvent
|
||||||
import com.vitorpamplona.quartz.events.BadgeAwardEvent
|
import com.vitorpamplona.quartz.events.BadgeAwardEvent
|
||||||
@@ -81,7 +81,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ContactListEvent.KIND),
|
kinds = listOf(ContactListEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
limit = 1,
|
limit = 1,
|
||||||
@@ -92,7 +92,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND),
|
kinds = listOf(MetadataEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
limit = 1,
|
limit = 1,
|
||||||
@@ -103,7 +103,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
StatusEvent.KIND,
|
StatusEvent.KIND,
|
||||||
@@ -124,7 +124,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
MetadataEvent.KIND,
|
MetadataEvent.KIND,
|
||||||
@@ -146,7 +146,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(BookmarkListEvent.KIND, PeopleListEvent.KIND, MuteListEvent.KIND, BadgeProfilesEvent.KIND, EmojiPackSelectionEvent.KIND),
|
kinds = listOf(BookmarkListEvent.KIND, PeopleListEvent.KIND, MuteListEvent.KIND, BadgeProfilesEvent.KIND, EmojiPackSelectionEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
limit = 100,
|
limit = 100,
|
||||||
@@ -157,7 +157,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(DraftEvent.KIND, ReportEvent.KIND),
|
kinds = listOf(DraftEvent.KIND, ReportEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
since =
|
since =
|
||||||
@@ -172,7 +172,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
limit = 400,
|
limit = 400,
|
||||||
),
|
),
|
||||||
@@ -189,7 +189,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -222,7 +222,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
GitReplyEvent.KIND,
|
GitReplyEvent.KIND,
|
||||||
@@ -244,7 +244,7 @@ object NostrAccountDataSource : AmethystNostrDataSource("AccountData") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(GiftWrapEvent.KIND),
|
kinds = listOf(GiftWrapEvent.KIND),
|
||||||
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
||||||
since =
|
since =
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.model.LiveActivitiesChannel
|
|||||||
import com.vitorpamplona.amethyst.model.PublicChatChannel
|
import com.vitorpamplona.amethyst.model.PublicChatChannel
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
import com.vitorpamplona.quartz.events.LiveActivitiesChatMessageEvent
|
import com.vitorpamplona.quartz.events.LiveActivitiesChatMessageEvent
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ object NostrChannelDataSource : AmethystNostrDataSource("ChatroomFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS, FeedType.GLOBAL, FeedType.SEARCH),
|
types = setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS, FeedType.GLOBAL, FeedType.SEARCH),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelMessageEvent.KIND),
|
kinds = listOf(ChannelMessageEvent.KIND),
|
||||||
authors = listOf(myAccount.userProfile().pubkeyHex),
|
authors = listOf(myAccount.userProfile().pubkeyHex),
|
||||||
limit = 50,
|
limit = 50,
|
||||||
@@ -71,7 +71,7 @@ object NostrChannelDataSource : AmethystNostrDataSource("ChatroomFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS, FeedType.GLOBAL, FeedType.SEARCH),
|
types = setOf(FeedType.FOLLOWS, FeedType.PRIVATE_DMS, FeedType.GLOBAL, FeedType.SEARCH),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND),
|
kinds = listOf(LiveActivitiesChatMessageEvent.KIND),
|
||||||
authors = listOf(myAccount.userProfile().pubkeyHex),
|
authors = listOf(myAccount.userProfile().pubkeyHex),
|
||||||
limit = 50,
|
limit = 50,
|
||||||
@@ -86,7 +86,7 @@ object NostrChannelDataSource : AmethystNostrDataSource("ChatroomFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelMessageEvent.KIND),
|
kinds = listOf(ChannelMessageEvent.KIND),
|
||||||
tags = mapOf("e" to listOfNotNull(channel?.idHex)),
|
tags = mapOf("e" to listOfNotNull(channel?.idHex)),
|
||||||
limit = 200,
|
limit = 200,
|
||||||
@@ -96,7 +96,7 @@ object NostrChannelDataSource : AmethystNostrDataSource("ChatroomFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND),
|
kinds = listOf(LiveActivitiesChatMessageEvent.KIND),
|
||||||
tags = mapOf("a" to listOfNotNull(channel?.idHex)),
|
tags = mapOf("a" to listOfNotNull(channel?.idHex)),
|
||||||
limit = 200,
|
limit = 200,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.vitorpamplona.amethyst.model.Account
|
|||||||
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.ChatroomKey
|
import com.vitorpamplona.quartz.events.ChatroomKey
|
||||||
import com.vitorpamplona.quartz.events.PrivateDmEvent
|
import com.vitorpamplona.quartz.events.PrivateDmEvent
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ object NostrChatroomDataSource : AmethystNostrDataSource("ChatroomFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PRIVATE_DMS),
|
types = setOf(FeedType.PRIVATE_DMS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(PrivateDmEvent.KIND),
|
kinds = listOf(PrivateDmEvent.KIND),
|
||||||
authors = myPeer.users.toList(),
|
authors = myPeer.users.toList(),
|
||||||
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
||||||
@@ -73,7 +73,7 @@ object NostrChatroomDataSource : AmethystNostrDataSource("ChatroomFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PRIVATE_DMS),
|
types = setOf(FeedType.PRIVATE_DMS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(PrivateDmEvent.KIND),
|
kinds = listOf(PrivateDmEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
tags = mapOf("p" to myPeer.users.map { it }),
|
tags = mapOf("p" to myPeer.users.map { it }),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
|||||||
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMetadataEvent
|
import com.vitorpamplona.quartz.events.ChannelMetadataEvent
|
||||||
@@ -41,7 +41,7 @@ object NostrChatroomListDataSource : AmethystNostrDataSource("MailBoxFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PRIVATE_DMS),
|
types = setOf(FeedType.PRIVATE_DMS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(PrivateDmEvent.KIND),
|
kinds = listOf(PrivateDmEvent.KIND),
|
||||||
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
||||||
since =
|
since =
|
||||||
@@ -56,7 +56,7 @@ object NostrChatroomListDataSource : AmethystNostrDataSource("MailBoxFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PRIVATE_DMS),
|
types = setOf(FeedType.PRIVATE_DMS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(PrivateDmEvent.KIND),
|
kinds = listOf(PrivateDmEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
since =
|
since =
|
||||||
@@ -71,7 +71,7 @@ object NostrChatroomListDataSource : AmethystNostrDataSource("MailBoxFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND),
|
kinds = listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND),
|
||||||
authors = listOf(account.userProfile().pubkeyHex),
|
authors = listOf(account.userProfile().pubkeyHex),
|
||||||
since =
|
since =
|
||||||
@@ -91,7 +91,7 @@ object NostrChatroomListDataSource : AmethystNostrDataSource("MailBoxFeed") {
|
|||||||
// Metadata comes from any relay
|
// Metadata comes from any relay
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelCreateEvent.KIND),
|
kinds = listOf(ChannelCreateEvent.KIND),
|
||||||
ids = followingEvents.toList(),
|
ids = followingEvents.toList(),
|
||||||
since =
|
since =
|
||||||
@@ -113,7 +113,7 @@ object NostrChatroomListDataSource : AmethystNostrDataSource("MailBoxFeed") {
|
|||||||
// Metadata comes from any relay
|
// Metadata comes from any relay
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelMetadataEvent.KIND),
|
kinds = listOf(ChannelMetadataEvent.KIND),
|
||||||
tags = mapOf("e" to listOf(it)),
|
tags = mapOf("e" to listOf(it)),
|
||||||
limit = 1,
|
limit = 1,
|
||||||
@@ -131,7 +131,7 @@ object NostrChatroomListDataSource : AmethystNostrDataSource("MailBoxFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelMessageEvent.KIND),
|
kinds = listOf(ChannelMessageEvent.KIND),
|
||||||
tags = mapOf("e" to listOf(it)),
|
tags = mapOf("e" to listOf(it)),
|
||||||
since =
|
since =
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
import com.vitorpamplona.amethyst.model.AddressableNote
|
import com.vitorpamplona.amethyst.model.AddressableNote
|
||||||
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
import com.vitorpamplona.quartz.events.CommunityDefinitionEvent
|
||||||
import com.vitorpamplona.quartz.events.CommunityPostApprovalEvent
|
import com.vitorpamplona.quartz.events.CommunityPostApprovalEvent
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ object NostrCommunityDataSource : AmethystNostrDataSource("SingleCommunityFeed")
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors =
|
authors =
|
||||||
community
|
community
|
||||||
.moderators()
|
.moderators()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.model.Account
|
|||||||
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.AppDefinitionEvent
|
import com.vitorpamplona.quartz.events.AppDefinitionEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
@@ -83,7 +83,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors = follows,
|
authors = follows,
|
||||||
kinds = listOf(ClassifiedsEvent.KIND),
|
kinds = listOf(ClassifiedsEvent.KIND),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
@@ -98,7 +98,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ClassifiedsEvent.KIND),
|
kinds = listOf(ClassifiedsEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -120,7 +120,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ClassifiedsEvent.KIND),
|
kinds = listOf(ClassifiedsEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -146,7 +146,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(AppDefinitionEvent.KIND),
|
kinds = listOf(AppDefinitionEvent.KIND),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
tags = mapOf("k" to kTags),
|
tags = mapOf("k" to kTags),
|
||||||
@@ -169,7 +169,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors = follows,
|
authors = follows,
|
||||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
@@ -184,7 +184,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
tags = mapOf("p" to it),
|
tags = mapOf("p" to it),
|
||||||
kinds = listOf(LiveActivitiesEvent.KIND),
|
kinds = listOf(LiveActivitiesEvent.KIND),
|
||||||
limit = 100,
|
limit = 100,
|
||||||
@@ -210,7 +210,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors = follows,
|
authors = follows,
|
||||||
kinds = listOf(ChannelMessageEvent.KIND),
|
kinds = listOf(ChannelMessageEvent.KIND),
|
||||||
limit = 500,
|
limit = 500,
|
||||||
@@ -225,7 +225,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
ids = followChats,
|
ids = followChats,
|
||||||
kinds = listOf(ChannelCreateEvent.KIND, ChannelMessageEvent.KIND),
|
kinds = listOf(ChannelCreateEvent.KIND, ChannelMessageEvent.KIND),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
@@ -251,7 +251,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors = follows,
|
authors = follows,
|
||||||
kinds = listOf(CommunityDefinitionEvent.KIND, CommunityPostApprovalEvent.KIND),
|
kinds = listOf(CommunityDefinitionEvent.KIND, CommunityPostApprovalEvent.KIND),
|
||||||
limit = 300,
|
limit = 300,
|
||||||
@@ -275,7 +275,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -305,7 +305,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
kinds = listOf(LiveActivitiesChatMessageEvent.KIND, LiveActivitiesEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -335,7 +335,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND, ChannelMessageEvent.KIND),
|
listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND, ChannelMessageEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
@@ -366,7 +366,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND, ChannelMessageEvent.KIND),
|
listOf(ChannelCreateEvent.KIND, ChannelMetadataEvent.KIND, ChannelMessageEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
@@ -397,7 +397,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(CommunityDefinitionEvent.KIND, CommunityPostApprovalEvent.KIND),
|
kinds = listOf(CommunityDefinitionEvent.KIND, CommunityPostApprovalEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -427,7 +427,7 @@ object NostrDiscoveryDataSource : AmethystNostrDataSource("DiscoveryFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(CommunityDefinitionEvent.KIND, CommunityPostApprovalEvent.KIND),
|
kinds = listOf(CommunityDefinitionEvent.KIND, CommunityPostApprovalEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
|
|
||||||
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
@@ -43,7 +43,7 @@ object NostrGeohashDataSource : AmethystNostrDataSource("SingleGeoHashFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
"g" to
|
"g" to
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
|
|
||||||
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
import com.vitorpamplona.quartz.events.ChannelMessageEvent
|
||||||
@@ -43,7 +43,7 @@ object NostrHashtagDataSource : AmethystNostrDataSource("SingleHashtagFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
"t" to
|
"t" to
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.model.Account
|
|||||||
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.AdvertisedRelayListEvent
|
import com.vitorpamplona.quartz.events.AdvertisedRelayListEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
||||||
@@ -82,7 +82,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(if (follows == null) FeedType.GLOBAL else FeedType.FOLLOWS),
|
types = setOf(if (follows == null) FeedType.GLOBAL else FeedType.FOLLOWS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -118,7 +118,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS),
|
types = setOf(FeedType.FOLLOWS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
MetadataEvent.KIND,
|
MetadataEvent.KIND,
|
||||||
@@ -145,7 +145,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS),
|
types = setOf(FeedType.FOLLOWS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -184,7 +184,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS),
|
types = setOf(FeedType.FOLLOWS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -223,7 +223,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.FOLLOWS),
|
types = setOf(FeedType.FOLLOWS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
|
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.LnZapPaymentResponseEvent
|
import com.vitorpamplona.quartz.events.LnZapPaymentResponseEvent
|
||||||
import com.vitorpamplona.quartz.signers.NostrSigner
|
import com.vitorpamplona.quartz.signers.NostrSigner
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class NostrLnZapPaymentResponseDataSource(
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = feedTypes,
|
types = feedTypes,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(LnZapPaymentResponseEvent.KIND),
|
kinds = listOf(LnZapPaymentResponseEvent.KIND),
|
||||||
authors = listOf(fromServiceHex),
|
authors = listOf(fromServiceHex),
|
||||||
tags =
|
tags =
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.crypto.KeyPair
|
import com.vitorpamplona.quartz.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.encoders.ATag
|
import com.vitorpamplona.quartz.encoders.ATag
|
||||||
import com.vitorpamplona.quartz.encoders.Hex
|
import com.vitorpamplona.quartz.encoders.Hex
|
||||||
@@ -95,7 +95,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND, aTag.kind),
|
kinds = listOf(MetadataEvent.KIND, aTag.kind),
|
||||||
authors = listOfNotNull(aTag.pubKeyHex),
|
authors = listOfNotNull(aTag.pubKeyHex),
|
||||||
// just to be sure
|
// just to be sure
|
||||||
@@ -110,7 +110,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
ids = listOfNotNull(hexToWatch),
|
ids = listOfNotNull(hexToWatch),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -118,7 +118,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND),
|
kinds = listOf(MetadataEvent.KIND),
|
||||||
authors = listOfNotNull(hexToWatch),
|
authors = listOfNotNull(hexToWatch),
|
||||||
// just to be sure
|
// just to be sure
|
||||||
@@ -135,7 +135,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.SEARCH),
|
types = setOf(FeedType.SEARCH),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND),
|
kinds = listOf(MetadataEvent.KIND),
|
||||||
search = mySearchString,
|
search = mySearchString,
|
||||||
limit = 1000,
|
limit = 1000,
|
||||||
@@ -144,7 +144,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.SEARCH),
|
types = setOf(FeedType.SEARCH),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -165,7 +165,7 @@ object NostrSearchEventOrUserDataSource : AmethystNostrDataSource("SearchEventFe
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = setOf(FeedType.SEARCH),
|
types = setOf(FeedType.SEARCH),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
ChannelMetadataEvent.KIND,
|
ChannelMetadataEvent.KIND,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.model.PublicChatChannel
|
|||||||
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
import com.vitorpamplona.quartz.events.ChannelCreateEvent
|
||||||
import com.vitorpamplona.quartz.events.ChannelMetadataEvent
|
import com.vitorpamplona.quartz.events.ChannelMetadataEvent
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ object NostrSingleChannelDataSource : AmethystNostrDataSource("SingleChannelFeed
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.PUBLIC_CHATS),
|
types = setOf(FeedType.PUBLIC_CHATS),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelMetadataEvent.KIND),
|
kinds = listOf(ChannelMetadataEvent.KIND),
|
||||||
tags = mapOf("e" to reactionsToWatch),
|
tags = mapOf("e" to reactionsToWatch),
|
||||||
),
|
),
|
||||||
@@ -65,7 +65,7 @@ object NostrSingleChannelDataSource : AmethystNostrDataSource("SingleChannelFeed
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ChannelCreateEvent.KIND),
|
kinds = listOf(ChannelCreateEvent.KIND),
|
||||||
ids = interestedEvents.toList(),
|
ids = interestedEvents.toList(),
|
||||||
),
|
),
|
||||||
@@ -88,7 +88,7 @@ object NostrSingleChannelDataSource : AmethystNostrDataSource("SingleChannelFeed
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(aTag.kind),
|
kinds = listOf(aTag.kind),
|
||||||
tags = mapOf("d" to listOf(aTag.dTag)),
|
tags = mapOf("d" to listOf(aTag.dTag)),
|
||||||
authors = listOf(aTag.pubKeyHex),
|
authors = listOf(aTag.pubKeyHex),
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.vitorpamplona.amethyst.model.User
|
|||||||
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.EOSETime
|
import com.vitorpamplona.ammolite.relays.filters.EOSETime
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.CommunityPostApprovalEvent
|
import com.vitorpamplona.quartz.events.CommunityPostApprovalEvent
|
||||||
import com.vitorpamplona.quartz.events.DeletionEvent
|
import com.vitorpamplona.quartz.events.DeletionEvent
|
||||||
import com.vitorpamplona.quartz.events.GenericRepostEvent
|
import com.vitorpamplona.quartz.events.GenericRepostEvent
|
||||||
@@ -67,7 +67,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -89,7 +89,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
DeletionEvent.KIND,
|
DeletionEvent.KIND,
|
||||||
@@ -117,7 +117,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(aTag.kind),
|
kinds = listOf(aTag.kind),
|
||||||
authors = listOf(aTag.pubKeyHex),
|
authors = listOf(aTag.pubKeyHex),
|
||||||
limit = 5,
|
limit = 5,
|
||||||
@@ -127,7 +127,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(aTag.kind),
|
kinds = listOf(aTag.kind),
|
||||||
tags = mapOf("d" to listOf(aTag.dTag)),
|
tags = mapOf("d" to listOf(aTag.dTag)),
|
||||||
authors = listOf(aTag.pubKeyHex),
|
authors = listOf(aTag.pubKeyHex),
|
||||||
@@ -150,7 +150,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -173,7 +173,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
DeletionEvent.KIND,
|
DeletionEvent.KIND,
|
||||||
@@ -200,7 +200,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(TextNoteEvent.KIND),
|
kinds = listOf(TextNoteEvent.KIND),
|
||||||
tags = mapOf("q" to it.map { it.idHex }),
|
tags = mapOf("q" to it.map { it.idHex }),
|
||||||
since = findMinimumEOSEs(it),
|
since = findMinimumEOSEs(it),
|
||||||
@@ -232,7 +232,7 @@ object NostrSingleEventDataSource : AmethystNostrDataSource("SingleEventFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
ids = interestedEvents.toList(),
|
ids = interestedEvents.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.vitorpamplona.amethyst.model.User
|
|||||||
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
import com.vitorpamplona.ammolite.relays.EVENT_FINDER_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.EOSETime
|
import com.vitorpamplona.ammolite.relays.filters.EOSETime
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.AdvertisedRelayListEvent
|
import com.vitorpamplona.quartz.events.AdvertisedRelayListEvent
|
||||||
import com.vitorpamplona.quartz.events.ChatMessageRelayListEvent
|
import com.vitorpamplona.quartz.events.ChatMessageRelayListEvent
|
||||||
import com.vitorpamplona.quartz.events.MetadataEvent
|
import com.vitorpamplona.quartz.events.MetadataEvent
|
||||||
@@ -45,7 +45,7 @@ object NostrSingleUserDataSource : AmethystNostrDataSource("SingleUserFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND, AdvertisedRelayListEvent.KIND),
|
kinds = listOf(MetadataEvent.KIND, AdvertisedRelayListEvent.KIND),
|
||||||
authors = firstTimers,
|
authors = firstTimers,
|
||||||
),
|
),
|
||||||
@@ -69,7 +69,7 @@ object NostrSingleUserDataSource : AmethystNostrDataSource("SingleUserFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND, StatusEvent.KIND, AdvertisedRelayListEvent.KIND, ChatMessageRelayListEvent.KIND),
|
kinds = listOf(MetadataEvent.KIND, StatusEvent.KIND, AdvertisedRelayListEvent.KIND, ChatMessageRelayListEvent.KIND),
|
||||||
authors = groupIds,
|
authors = groupIds,
|
||||||
since = minEOSEs,
|
since = minEOSEs,
|
||||||
@@ -78,7 +78,7 @@ object NostrSingleUserDataSource : AmethystNostrDataSource("SingleUserFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = EVENT_FINDER_TYPES,
|
types = EVENT_FINDER_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ReportEvent.KIND),
|
kinds = listOf(ReportEvent.KIND),
|
||||||
tags = mapOf("p" to groupIds),
|
tags = mapOf("p" to groupIds),
|
||||||
since = minEOSEs,
|
since = minEOSEs,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
import com.vitorpamplona.amethyst.model.ThreadAssembler
|
import com.vitorpamplona.amethyst.model.ThreadAssembler
|
||||||
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
|
|
||||||
object NostrThreadDataSource : AmethystNostrDataSource("SingleThreadFeed") {
|
object NostrThreadDataSource : AmethystNostrDataSource("SingleThreadFeed") {
|
||||||
private var eventToWatch: String? = null
|
private var eventToWatch: String? = null
|
||||||
@@ -45,7 +45,7 @@ object NostrThreadDataSource : AmethystNostrDataSource("SingleThreadFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
ids = eventsToLoad.toList(),
|
ids = eventsToLoad.toList(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package com.vitorpamplona.amethyst.service
|
|||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.AppRecommendationEvent
|
import com.vitorpamplona.quartz.events.AppRecommendationEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
import com.vitorpamplona.quartz.events.AudioHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
import com.vitorpamplona.quartz.events.AudioTrackEvent
|
||||||
@@ -56,7 +56,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(MetadataEvent.KIND),
|
kinds = listOf(MetadataEvent.KIND),
|
||||||
authors = listOf(it.pubkeyHex),
|
authors = listOf(it.pubkeyHex),
|
||||||
limit = 1,
|
limit = 1,
|
||||||
@@ -69,7 +69,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(
|
listOf(
|
||||||
TextNoteEvent.KIND,
|
TextNoteEvent.KIND,
|
||||||
@@ -94,7 +94,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(LnZapEvent.KIND),
|
kinds = listOf(LnZapEvent.KIND),
|
||||||
tags = mapOf("p" to listOf(it.pubkeyHex)),
|
tags = mapOf("p" to listOf(it.pubkeyHex)),
|
||||||
limit = 200,
|
limit = 200,
|
||||||
@@ -107,7 +107,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ContactListEvent.KIND),
|
kinds = listOf(ContactListEvent.KIND),
|
||||||
authors = listOf(it.pubkeyHex),
|
authors = listOf(it.pubkeyHex),
|
||||||
limit = 1,
|
limit = 1,
|
||||||
@@ -120,7 +120,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(ContactListEvent.KIND),
|
kinds = listOf(ContactListEvent.KIND),
|
||||||
tags = mapOf("p" to listOf(it.pubkeyHex)),
|
tags = mapOf("p" to listOf(it.pubkeyHex)),
|
||||||
),
|
),
|
||||||
@@ -132,7 +132,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(BadgeProfilesEvent.KIND),
|
kinds = listOf(BadgeProfilesEvent.KIND),
|
||||||
authors = listOf(it.pubkeyHex),
|
authors = listOf(it.pubkeyHex),
|
||||||
limit = 1,
|
limit = 1,
|
||||||
@@ -145,7 +145,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(BookmarkListEvent.KIND, PeopleListEvent.KIND, AppRecommendationEvent.KIND),
|
listOf(BookmarkListEvent.KIND, PeopleListEvent.KIND, AppRecommendationEvent.KIND),
|
||||||
authors = listOf(it.pubkeyHex),
|
authors = listOf(it.pubkeyHex),
|
||||||
@@ -159,7 +159,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds =
|
kinds =
|
||||||
listOf(ProfileGalleryEntryEvent.KIND),
|
listOf(ProfileGalleryEntryEvent.KIND),
|
||||||
authors = listOf(it.pubkeyHex),
|
authors = listOf(it.pubkeyHex),
|
||||||
@@ -173,7 +173,7 @@ object NostrUserProfileDataSource : AmethystNostrDataSource("UserProfileFeed") {
|
|||||||
TypedFilter(
|
TypedFilter(
|
||||||
types = COMMON_FEED_TYPES,
|
types = COMMON_FEED_TYPES,
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(BadgeAwardEvent.KIND),
|
kinds = listOf(BadgeAwardEvent.KIND),
|
||||||
tags = mapOf("p" to listOf(it.pubkeyHex)),
|
tags = mapOf("p" to listOf(it.pubkeyHex)),
|
||||||
limit = 20,
|
limit = 20,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.vitorpamplona.amethyst.model.Account
|
|||||||
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
import com.vitorpamplona.amethyst.service.relays.EOSEAccount
|
||||||
import com.vitorpamplona.ammolite.relays.FeedType
|
import com.vitorpamplona.ammolite.relays.FeedType
|
||||||
import com.vitorpamplona.ammolite.relays.TypedFilter
|
import com.vitorpamplona.ammolite.relays.TypedFilter
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import com.vitorpamplona.quartz.events.FileHeaderEvent
|
import com.vitorpamplona.quartz.events.FileHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.FileStorageHeaderEvent
|
import com.vitorpamplona.quartz.events.FileStorageHeaderEvent
|
||||||
import com.vitorpamplona.quartz.events.VideoHorizontalEvent
|
import com.vitorpamplona.quartz.events.VideoHorizontalEvent
|
||||||
@@ -72,7 +72,7 @@ object NostrVideoDataSource : AmethystNostrDataSource("VideoFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
authors = follows,
|
authors = follows,
|
||||||
kinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND),
|
kinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND),
|
||||||
limit = 200,
|
limit = 200,
|
||||||
@@ -97,7 +97,7 @@ object NostrVideoDataSource : AmethystNostrDataSource("VideoFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND),
|
kinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -128,7 +128,7 @@ object NostrVideoDataSource : AmethystNostrDataSource("VideoFeed") {
|
|||||||
return TypedFilter(
|
return TypedFilter(
|
||||||
types = setOf(FeedType.GLOBAL),
|
types = setOf(FeedType.GLOBAL),
|
||||||
filter =
|
filter =
|
||||||
PerRelayFilter(
|
SincePerRelayFilter(
|
||||||
kinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND),
|
kinds = listOf(FileHeaderEvent.KIND, FileStorageHeaderEvent.KIND, VideoHorizontalEvent.KIND, VideoVerticalEvent.KIND),
|
||||||
tags =
|
tags =
|
||||||
mapOf(
|
mapOf(
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.ammolite.relays
|
package com.vitorpamplona.ammolite.relays
|
||||||
|
|
||||||
|
import com.vitorpamplona.ammolite.relays.filters.SincePerRelayFilter
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
data class Subscription(
|
data class Subscription(
|
||||||
@@ -42,28 +43,40 @@ data class Subscription(
|
|||||||
typedFilters?.forEachIndexed { index, typedFilter ->
|
typedFilters?.forEachIndexed { index, typedFilter ->
|
||||||
val otherFilter = otherFilters?.getOrNull(index) ?: return true
|
val otherFilter = otherFilters?.getOrNull(index) ?: return true
|
||||||
|
|
||||||
// Does not check SINCE on purpose. Avoids replacing the filter if SINCE was all that changed.
|
if (typedFilter.filter is SincePerRelayFilter && otherFilter.filter is SincePerRelayFilter) {
|
||||||
// fast check
|
return isDifferent(typedFilter.filter, otherFilter.filter)
|
||||||
if (typedFilter.filter.authors?.size != otherFilter.filter.authors?.size ||
|
|
||||||
typedFilter.filter.ids?.size != otherFilter.filter.ids?.size ||
|
|
||||||
typedFilter.filter.tags?.size != otherFilter.filter.tags?.size ||
|
|
||||||
typedFilter.filter.kinds?.size != otherFilter.filter.kinds?.size ||
|
|
||||||
typedFilter.filter.limit != otherFilter.filter.limit ||
|
|
||||||
typedFilter.filter.search?.length != otherFilter.filter.search?.length ||
|
|
||||||
typedFilter.filter.until != otherFilter.filter.until
|
|
||||||
) {
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// deep check
|
return true
|
||||||
if (typedFilter.filter.ids != otherFilter.filter.ids ||
|
}
|
||||||
typedFilter.filter.authors != otherFilter.filter.authors ||
|
return false
|
||||||
typedFilter.filter.tags != otherFilter.filter.tags ||
|
}
|
||||||
typedFilter.filter.kinds != otherFilter.filter.kinds ||
|
|
||||||
typedFilter.filter.search != otherFilter.filter.search
|
fun isDifferent(
|
||||||
) {
|
filter1: SincePerRelayFilter,
|
||||||
return true
|
filter2: SincePerRelayFilter,
|
||||||
}
|
): Boolean {
|
||||||
|
// Does not check SINCE on purpose. Avoids replacing the filter if SINCE was all that changed.
|
||||||
|
// fast check
|
||||||
|
if (filter1.authors?.size != filter2.authors?.size ||
|
||||||
|
filter1.ids?.size != filter2.ids?.size ||
|
||||||
|
filter1.tags?.size != filter2.tags?.size ||
|
||||||
|
filter1.kinds?.size != filter2.kinds?.size ||
|
||||||
|
filter1.limit != filter2.limit ||
|
||||||
|
filter1.search?.length != filter2.search?.length ||
|
||||||
|
filter1.until != filter2.until
|
||||||
|
) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// deep check
|
||||||
|
if (filter1.ids != filter2.ids ||
|
||||||
|
filter1.authors != filter2.authors ||
|
||||||
|
filter1.tags != filter2.tags ||
|
||||||
|
filter1.kinds != filter2.kinds ||
|
||||||
|
filter1.search != filter2.search
|
||||||
|
) {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.ammolite.relays
|
package com.vitorpamplona.ammolite.relays
|
||||||
|
|
||||||
import com.vitorpamplona.ammolite.relays.filters.PerRelayFilter
|
import com.vitorpamplona.ammolite.relays.filters.IPerRelayFilter
|
||||||
|
|
||||||
class TypedFilter(
|
class TypedFilter(
|
||||||
val types: Set<FeedType>,
|
val types: Set<FeedType>,
|
||||||
val filter: PerRelayFilter,
|
val filter: IPerRelayFilter,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2024 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.ammolite.relays.filters
|
||||||
|
|
||||||
|
import com.vitorpamplona.quartz.events.Event
|
||||||
|
|
||||||
|
interface IPerRelayFilter {
|
||||||
|
fun toJson(forRelay: String): String
|
||||||
|
|
||||||
|
fun match(
|
||||||
|
event: Event,
|
||||||
|
forRelay: String,
|
||||||
|
): Boolean
|
||||||
|
|
||||||
|
fun toDebugJson(): String
|
||||||
|
}
|
||||||
@@ -22,7 +22,10 @@ package com.vitorpamplona.ammolite.relays.filters
|
|||||||
|
|
||||||
import com.vitorpamplona.quartz.events.Event
|
import com.vitorpamplona.quartz.events.Event
|
||||||
|
|
||||||
class PerRelayFilter(
|
/**
|
||||||
|
* This is a nostr filter with per-relay authors list and since parameters
|
||||||
|
*/
|
||||||
|
class SincePerRelayFilter(
|
||||||
val ids: List<String>? = null,
|
val ids: List<String>? = null,
|
||||||
val authors: List<String>? = null,
|
val authors: List<String>? = null,
|
||||||
val kinds: List<Int>? = null,
|
val kinds: List<Int>? = null,
|
||||||
@@ -31,17 +34,18 @@ class PerRelayFilter(
|
|||||||
val until: Long? = null,
|
val until: Long? = null,
|
||||||
val limit: Int? = null,
|
val limit: Int? = null,
|
||||||
val search: String? = null,
|
val search: String? = null,
|
||||||
) {
|
) : IPerRelayFilter {
|
||||||
fun toJson(forRelay: String) = FilterSerializer.toJson(ids, authors, kinds, tags, since?.get(forRelay)?.time, until, limit, search)
|
override fun toJson(forRelay: String) = FilterSerializer.toJson(ids, authors, kinds, tags, since?.get(forRelay)?.time, until, limit, search)
|
||||||
|
|
||||||
fun match(
|
override fun match(
|
||||||
event: Event,
|
event: Event,
|
||||||
forRelay: String? = null,
|
forRelay: String,
|
||||||
) = FilterMatcher.match(event, ids, authors, kinds, tags, since?.get(forRelay)?.time, until)
|
) = FilterMatcher.match(event, ids, authors, kinds, tags, since?.get(forRelay)?.time, until)
|
||||||
|
|
||||||
fun toDebugJson(): String {
|
override fun toDebugJson(): String {
|
||||||
val factory = Event.mapper.nodeFactory
|
val factory = Event.mapper.nodeFactory
|
||||||
val obj = FilterSerializer.toJsonObject(ids, authors, kinds, tags, null, until, limit, search)
|
val obj = FilterSerializer.toJsonObject(ids, authors, kinds, tags, null, until, limit, search)
|
||||||
|
|
||||||
since?.run {
|
since?.run {
|
||||||
if (isNotEmpty()) {
|
if (isNotEmpty()) {
|
||||||
val jsonObjectSince = factory.objectNode()
|
val jsonObjectSince = factory.objectNode()
|
||||||
Reference in New Issue
Block a user