diff --git a/app/activitypub/actor.go b/app/activitypub/actor.go index adba98d..f4b4d51 100644 --- a/app/activitypub/actor.go +++ b/app/activitypub/actor.go @@ -9,7 +9,7 @@ type Actor struct { Context []interface{} `json:"@context"` Followers string `json:"followers"` Following string `json:"following"` - ID string `json:"id"` + Id string `json:"id"` Type string `json:"type"` PreferredUsername string `json:"preferredUsername"` Inbox string `json:"inbox"` diff --git a/app/activitypub/follow.go b/app/activitypub/follow.go index 19cd304..7c33a73 100644 --- a/app/activitypub/follow.go +++ b/app/activitypub/follow.go @@ -3,23 +3,28 @@ package activitypub import ( "encoding/json" "fmt" + + "github.com/xeronith/diamante/utility" ) type Follow struct { - Context string `json:"@context" validate:"activitystream"` - Id string `json:"id"` - Type string `json:"type"` - Actor string `json:"actor"` - Object string `json:"object"` + Context string `json:"@context" validate:"activitystream"` + UniqueIdentifier string `json:"-"` + Id string `json:"id"` + Type string `json:"type"` + Actor string `json:"actor"` + Object string `json:"object"` } -func NewFollow(follower, followee, uuid string) *Follow { +func NewFollow(follower, followee string) *Follow { + uuid := utility.GenerateUUID() return &Follow{ - Context: ActivityStreams, - Id: fmt.Sprintf("%s#follow/%s", follower, uuid), - Type: TypeFollow, - Actor: follower, - Object: followee, + Context: ActivityStreams, + UniqueIdentifier: uuid, + Id: fmt.Sprintf("%s#follow/%s", follower, uuid), + Type: TypeFollow, + Actor: follower, + Object: followee, } }