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

@@ -26,7 +26,6 @@ var (
_ Pointer = (*ProfilePointer)(nil)
_ Pointer = (*EventPointer)(nil)
_ Pointer = (*EntityPointer)(nil)
_ Pointer = (*ExternalPointer)(nil)
)
// ProfilePointer represents a pointer to a Nostr profile.
@@ -174,21 +173,3 @@ func (ep EntityPointer) AsTag() Tag {
}
return Tag{"a", ep.AsTagReference()}
}
// ExternalPointer represents a pointer to a Nostr profile.
type ExternalPointer struct {
Thing string
}
// ExternalPointerFromTag creates a ExternalPointer from an "i" tag
func ExternalPointerFromTag(refTag Tag) (ExternalPointer, error) {
return ExternalPointer{refTag[1]}, nil
}
func (ep ExternalPointer) MatchesEvent(_ Event) bool { return false }
func (ep ExternalPointer) AsTagReference() string { return ep.Thing }
func (ep ExternalPointer) AsFilter() Filter { return Filter{} }
func (ep ExternalPointer) AsTag() Tag {
return Tag{"i", ep.Thing}
}