Improve relay validation and add sort function

This commit is contained in:
Jon Staab
2024-05-24 08:53:36 -07:00
parent c5e3f6d5a4
commit 5ec54e3204
4 changed files with 7 additions and 3 deletions
+2
View File
@@ -19,6 +19,8 @@ export const isShareableRelayUrl = (url: string) =>
!url.match(/\s|%/) &&
// Don't match stuff with a port number
!url.slice(6).match(/:\d+/) &&
// Don't match stuff with a numeric tld
!url.slice(6).match(/\.\d+\b/) &&
// Don't match raw ip addresses
!url.slice(6).match(/\d+\.\d+\.\d+\.\d+/) &&
// Skip nostr.wine's virtual relays