mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
relay pages at /r/... and nip05 pages at /p/...
This commit is contained in:
16
utils.go
16
utils.go
@@ -92,7 +92,7 @@ var kindNIPS = map[int]string{
|
||||
30078: "78",
|
||||
}
|
||||
|
||||
var urlMatcher = regexp.MustCompile(`^(wss?:\/\/)?[\w-_.]+\.[\w-_.]+(\/[\/\w]*)?$`)
|
||||
var urlSuffixMatcher = regexp.MustCompile(`[\w-_.]+\.[\w-_.]+(\/[\/\w]*)?$`)
|
||||
|
||||
type ClientReference struct {
|
||||
Name string
|
||||
@@ -327,13 +327,13 @@ func mdToHTML(md string) string {
|
||||
|
||||
func unique(strSlice []string) []string {
|
||||
keys := make(map[string]bool)
|
||||
list := []string{}
|
||||
list := []string{}
|
||||
for _, entry := range strSlice {
|
||||
if _, ok := keys[entry]; !ok {
|
||||
keys[entry] = true
|
||||
list = append(list, entry)
|
||||
}
|
||||
}
|
||||
if _, ok := keys[entry]; !ok {
|
||||
keys[entry] = true
|
||||
list = append(list, entry)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
@@ -343,4 +343,4 @@ func trimProtocol(relay string) string {
|
||||
relay = strings.TrimPrefix(relay, "wss:/") // Some browsers replace upfront '//' with '/'
|
||||
relay = strings.TrimPrefix(relay, "ws:/") // Some browsers replace upfront '//' with '/'
|
||||
return relay
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user