Introduce validation against source

forgejo-federated-star
erik 6 months ago
parent 4de3f080fb
commit 33b63b21fe

@ -4,6 +4,8 @@
package forgefed
import (
"fmt"
ap "github.com/go-ap/activitypub"
"github.com/valyala/fastjson"
)
@ -42,6 +44,16 @@ func StarNew(id ap.ID, ob ap.ID) *Star { // ToDo: May be used later in creating
return &o
}
func (a Star) ValidateStar() error {
if a.Source != "forgejo" {
return fmt.Errorf("currently, only a forgejo source is supported")
}
return nil
}
func (a Star) MarshalJSON() ([]byte, error) {
b := make([]byte, 0)
ap.JSONWrite(&b, '{')

Loading…
Cancel
Save