move ExternalPointer to nip73 and write nip27.Parse() that gets all the parts of the text including URLs, Nostr URIs and just raw text.

This commit is contained in:
fiatjaf
2025-03-21 23:43:23 -03:00
parent 3ebfc7812b
commit e18528c043
6 changed files with 232 additions and 22 deletions

View File

@@ -1,6 +1,9 @@
package nip22
import "github.com/nbd-wtf/go-nostr"
import (
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip73"
)
func GetThreadRoot(tags nostr.Tags) nostr.Pointer {
for _, tag := range tags {
@@ -15,7 +18,7 @@ func GetThreadRoot(tags nostr.Tags) nostr.Pointer {
ep, _ := nostr.EntityPointerFromTag(tag)
return ep
case "I":
ep, _ := nostr.ExternalPointerFromTag(tag)
ep, _ := nip73.ExternalPointerFromTag(tag)
return ep
}
}
@@ -35,7 +38,7 @@ func GetImmediateParent(tags nostr.Tags) nostr.Pointer {
ep, _ := nostr.EntityPointerFromTag(tag)
return ep
case "i":
ep, _ := nostr.ExternalPointerFromTag(tag)
ep, _ := nip73.ExternalPointerFromTag(tag)
return ep
}
}