Federated via graft
0

Configure Feed

Select the types of activity you want to include in your feed.

1package activitypub 2 3// Actor is the ActivityPub actor object for one series. Field set kept 4// intentionally minimal: what Mastodon needs to resolve, display, and 5// verify signed requests from this actor. 6type Actor struct { 7 Context []string `json:"@context"` 8 ID string `json:"id"` 9 Type string `json:"type"` 10 PreferredUsername string `json:"preferredUsername"` 11 Name string `json:"name"` 12 Summary string `json:"summary,omitempty"` 13 URL string `json:"url,omitempty"` 14 Inbox string `json:"inbox"` 15 Outbox string `json:"outbox"` 16 Followers string `json:"followers"` 17 PublicKey PublicKey `json:"publicKey"` 18 Attachment []Attachment `json:"attachment,omitempty"` 19} 20 21type PublicKey struct { 22 ID string `json:"id"` 23 Owner string `json:"owner"` 24 PublicKeyPem string `json:"publicKeyPem"` 25} 26 27// Attachment is one profile field, rendered by Mastodon as a labeled value 28// on the actor's profile page — used to surface a series' Radicle DID. 29type Attachment struct { 30 Type string `json:"type"` 31 Name string `json:"name"` 32 Value string `json:"value"` 33} 34 35// ActorURI returns the canonical actor URI for a series on host. 36func ActorURI(host, series string) string { 37 return "https://" + host + "/actors/" + series 38} 39 40// BuildActor constructs the actor object for a series. repoURL links to 41// the underlying repo (its Forgejo or Radicle explorer page); publicKeyPEM 42// is that series' stored public key; radicleDID is that series' Radicle 43// node identity (did:key:..., empty to omit), shown as a verifiable 44// profile field so anyone following from the fediverse can confirm which 45// Radicle node actually signs this repo's history. 46func BuildActor(host, series, repoURL, publicKeyPEM, radicleDID string) Actor { 47 base := ActorURI(host, series) 48 a := Actor{ 49 Context: []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}, 50 ID: base, 51 Type: "Service", 52 PreferredUsername: series, 53 Name: series, 54 Summary: "Mirrored by graft — commits, issues, and patches for " + series + ".", 55 URL: repoURL, 56 Inbox: base + "/inbox", 57 Outbox: base + "/outbox", 58 Followers: base + "/followers", 59 PublicKey: PublicKey{ 60 ID: base + "#main-key", 61 Owner: base, 62 PublicKeyPem: publicKeyPEM, 63 }, 64 } 65 if radicleDID != "" { 66 a.Attachment = []Attachment{ 67 {Type: "PropertyValue", Name: "Radicle DID", Value: radicleDID}, 68 } 69 } 70 return a 71}