kopia lustrzana https://github.com/reiver/greatape
refactor(activitypub): 🎨 improve structure
rodzic
9f1a7b3d43
commit
e2ec053ce3
|
@ -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"`
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue