Update Actor name.

This commit is contained in:
Naoki Kosaka
2019-04-07 23:42:37 +09:00
parent bf1f91c24e
commit 9ddeb2353e
8 changed files with 87 additions and 7 deletions

View File

@ -31,6 +31,7 @@ type Actor struct {
Context interface{} `json:"@context"`
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
PreferredUsername string `json:"preferredUsername"`
Inbox string `json:"inbox"`
Endpoints *Endpoints `json:"endpoints"`
@ -38,11 +39,12 @@ type Actor struct {
}
// GenerateSelfKey : Generate relay Actor from Publickey.
func (actor *Actor) GenerateSelfKey(hostname *url.URL, publickey *rsa.PublicKey) {
func (actor *Actor) GenerateSelfKey(hostname *url.URL, username string, publickey *rsa.PublicKey) {
actor.Context = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}
actor.ID = hostname.String() + "/actor"
actor.Type = "Service"
actor.PreferredUsername = "relay"
actor.Name = username
actor.Inbox = hostname.String() + "/inbox"
actor.PublicKey = PublicKey{
hostname.String() + "/actor#main-key",
@ -150,6 +152,16 @@ func (activity *Activity) NestedActivity() (*Activity, error) {
return nil, errors.New("Can't assart id")
}
// ActivityObject : ActivityPub Activity.
type ActivityObject struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
Content string `json:"content"`
To []string `json:"to"`
Cc []string `json:"cc"`
}
// Signature : ActivityPub Header Signature.
type Signature struct {
Type string `json:"type"`