get rid of shouldUseRelayForNip19(), use isntRealRelay().

This commit is contained in:
fiatjaf
2023-12-23 18:28:23 -03:00
parent d24cbc8e81
commit f79cb1e9a2
2 changed files with 7 additions and 24 deletions

View File

@@ -203,13 +203,15 @@ func grabData(ctx context.Context, code string, isProfileSitemap bool) (*Data, e
relaysForNip19 := make([]string, 0, 3)
c := 0
for _, relayUrl := range relays {
if shouldUseRelayForNip19(relayUrl) {
if isntRealRelay(relayUrl) {
continue
}
relaysForNip19 = append(relaysForNip19, relayUrl)
if c == 2 {
break
}
}
}
data := &Data{
event: event,

View File

@@ -484,25 +484,6 @@ func humanDate(createdAt nostr.Timestamp) string {
}
}
func shouldUseRelayForNip19(relayUrl string) bool {
for _, excluded := range excludedRelays {
if strings.Contains(relayUrl, excluded) {
return false
}
}
urlp, err := url.Parse(relayUrl)
if err != nil {
return false
}
if urlp.Scheme != "wss" && urlp.Scheme != "ws" {
return false
}
if urlp.Path != "" && urlp.Path != "/" {
return false
}
return true
}
func getRandomRelay() string {
if serial == 0 {
serial = rand.Intn(len(everything))