hardcode relays for the sitemap, just a few "safe" relays.

This commit is contained in:
fiatjaf
2024-06-12 16:06:43 -03:00
parent 82f08498c2
commit bd1dfb8d50
2 changed files with 10 additions and 51 deletions

View File

@@ -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)
}
}