mirror of
https://github.com/aljazceru/crawler_v2.git
synced 2025-12-17 07:24:21 +01:00
increased and organized event kinds
Archiver stopped saving regular events
This commit is contained in:
@@ -89,7 +89,7 @@ func Archiver(
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case nostr.IsRegularKind(event.Kind):
|
case nostr.IsRegularKind(event.Kind):
|
||||||
return store.Save(opctx, event)
|
return nil // do nothing
|
||||||
|
|
||||||
case nostr.IsReplaceableKind(event.Kind):
|
case nostr.IsReplaceableKind(event.Kind):
|
||||||
replaced, err := store.Replace(opctx, event)
|
replaced, err := store.Replace(opctx, event)
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ type FetcherConfig struct {
|
|||||||
|
|
||||||
func NewFetcherConfig() FetcherConfig {
|
func NewFetcherConfig() FetcherConfig {
|
||||||
return FetcherConfig{
|
return FetcherConfig{
|
||||||
Kinds: []int{
|
Kinds: profileKinds,
|
||||||
nostr.KindProfileMetadata,
|
|
||||||
nostr.KindFollowList,
|
|
||||||
},
|
|
||||||
Relays: defaultRelays,
|
Relays: defaultRelays,
|
||||||
Batch: 100,
|
Batch: 100,
|
||||||
Interval: time.Minute,
|
Interval: time.Minute,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nbd-wtf/go-nostr"
|
"github.com/nbd-wtf/go-nostr"
|
||||||
@@ -40,6 +41,37 @@ var (
|
|||||||
"wss://zap.watch",
|
"wss://zap.watch",
|
||||||
"wss://satsage.xyz",
|
"wss://satsage.xyz",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentKinds = []int{
|
||||||
|
nostr.KindTextNote,
|
||||||
|
nostr.KindComment,
|
||||||
|
nostr.KindArticle,
|
||||||
|
20, // Picture Event
|
||||||
|
21, // Video Event
|
||||||
|
22, // "Tik-Tok" Video Event
|
||||||
|
}
|
||||||
|
|
||||||
|
engagementKinds = []int{
|
||||||
|
nostr.KindReaction,
|
||||||
|
nostr.KindRepost,
|
||||||
|
nostr.KindGenericRepost,
|
||||||
|
nostr.KindZap,
|
||||||
|
nostr.KindNutZap,
|
||||||
|
}
|
||||||
|
|
||||||
|
profileKinds = []int{
|
||||||
|
nostr.KindProfileMetadata,
|
||||||
|
nostr.KindFollowList,
|
||||||
|
nostr.KindMuteList,
|
||||||
|
nostr.KindRelayListMetadata,
|
||||||
|
nostr.KindUserServerList,
|
||||||
|
}
|
||||||
|
|
||||||
|
allKinds = slices.Concat(
|
||||||
|
contentKinds,
|
||||||
|
engagementKinds,
|
||||||
|
profileKinds,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
type FirehoseConfig struct {
|
type FirehoseConfig struct {
|
||||||
@@ -50,10 +82,7 @@ type FirehoseConfig struct {
|
|||||||
|
|
||||||
func NewFirehoseConfig() FirehoseConfig {
|
func NewFirehoseConfig() FirehoseConfig {
|
||||||
return FirehoseConfig{
|
return FirehoseConfig{
|
||||||
Kinds: []int{
|
Kinds: allKinds,
|
||||||
nostr.KindProfileMetadata,
|
|
||||||
nostr.KindFollowList,
|
|
||||||
},
|
|
||||||
Relays: defaultRelays,
|
Relays: defaultRelays,
|
||||||
Offset: time.Minute,
|
Offset: time.Minute,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user