mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-01 21:54:04 +01:00
Introduce validation against source
This commit is contained in:
parent
78fc75135f
commit
b1f3706575
1 changed files with 12 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
||||||
package forgefed
|
package forgefed
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
ap "github.com/go-ap/activitypub"
|
ap "github.com/go-ap/activitypub"
|
||||||
"github.com/valyala/fastjson"
|
"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
|
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) {
|
func (a Star) MarshalJSON() ([]byte, error) {
|
||||||
b := make([]byte, 0)
|
b := make([]byte, 0)
|
||||||
ap.JSONWrite(&b, '{')
|
ap.JSONWrite(&b, '{')
|
||||||
|
|
Loading…
Reference in a new issue