mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 06:44:22 +01:00
hardcode relays for the sitemap, just a few "safe" relays.
This commit is contained in:
28
routines.go
28
routines.go
@@ -18,7 +18,6 @@ func updateArchives(ctx context.Context) {
|
||||
|
||||
for {
|
||||
loadNpubsArchive(ctx)
|
||||
loadRelaysArchive(ctx)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
@@ -83,30 +82,3 @@ func loadNpubsArchive(ctx context.Context) {
|
||||
cache.SetWithTTL("pa:"+contact, nil, time.Hour*24*90)
|
||||
}
|
||||
}
|
||||
|
||||
func loadRelaysArchive(ctx context.Context) {
|
||||
log.Debug().Msg("refreshing the relays archive")
|
||||
|
||||
relaysArchive := make([]string, 0, 500)
|
||||
|
||||
for _, pubkey := range s.TrustedPubKeys {
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second*4)
|
||||
pubkeyContacts := relaysForPubkey(ctx, pubkey, relayConfig.Profiles...)
|
||||
relaysArchive = append(relaysArchive, pubkeyContacts...)
|
||||
cancel()
|
||||
}
|
||||
|
||||
for _, relay := range unique(relaysArchive) {
|
||||
for _, excluded := range relayConfig.ExcludedRelays {
|
||||
if strings.Contains(relay, excluded) {
|
||||
log.Debug().Msgf("skipping relay %s", relay)
|
||||
continue
|
||||
}
|
||||
}
|
||||
if strings.Contains(relay, "/npub1") {
|
||||
continue // skip relays with personalyzed query like filter.nostr.wine
|
||||
}
|
||||
log.Debug().Msgf("adding relay %s", relay)
|
||||
cache.SetWithTTL("ra:"+relay, nil, time.Hour*24*7)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user