file config, avator, header image. (#18)

This commit is contained in:
Naoki Kosaka
2019-04-10 17:23:25 +09:00
committed by GitHub
parent d3d03544fa
commit 97f4655e9c
8 changed files with 85 additions and 19 deletions

View File

@ -26,6 +26,11 @@ type Endpoints struct {
SharedInbox string `json:"sharedInbox"`
}
// Image : Image Object.
type Image struct {
URL string `json:"url"`
}
// Actor : ActivityPub Actor.
type Actor struct {
Context interface{} `json:"@context"`
@ -33,18 +38,20 @@ type Actor struct {
Type string `json:"type"`
Name string `json:"name"`
PreferredUsername string `json:"preferredUsername"`
Summary string `json:"summary"`
Inbox string `json:"inbox"`
Endpoints *Endpoints `json:"endpoints"`
PublicKey PublicKey `json:"publicKey"`
Icon Image `json:"icon"`
Image Image `json:"image"`
}
// GenerateSelfKey : Generate relay Actor from Publickey.
func (actor *Actor) GenerateSelfKey(hostname *url.URL, username string, publickey *rsa.PublicKey) {
func (actor *Actor) GenerateSelfKey(hostname *url.URL, 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",