Changes
3 changed files (+15/-3)
-
-
@@ -42,6 +42,7 @@accept := ap.AcceptNew(objectIRI, activity) accept.Actor = ap.Person{ID: objectIRI} accept.To = ap.ItemCollection{ap.IRI(actorIRI.String() + "/inbox")} accept.Object = activity Send(objectUser, accept) }
-
-
-
@@ -14,6 +14,7 @@ "time"user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/httplib" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/setting" ap "github.com/go-ap/activitypub"
-
@@ -43,9 +44,19 @@ body, err := activity.MarshalJSON()if err != nil { return } var jsonmap map[string]interface{} err = json.Unmarshal(body, &jsonmap) if err != nil { return } jsonmap["@context"] = "https://www.w3.org/ns/activitystreams" body, _ = json.Marshal(jsonmap) for _, to := range activity.To { client, _ := NewClient(user, setting.AppURL+"api/v1/activitypub/user/"+user.Name+"#main-key") client.Post(body, to.GetID().String()) resp, _ := client.Post(body, to.GetID().String()) fmt.Println(resp.StatusCode) debug, _ := io.ReadAll(resp.Body) fmt.Println(string(debug)) } }
-
-
-
@@ -199,7 +199,7 @@ following.TotalItems = uint(len(users))for _, user := range users { // TODO: handle non-Federated users person := ap.PersonNew(ap.IRI(user.LoginName)) person := ap.PersonNew(ap.IRI(user.Website)) following.OrderedItems.Append(person) }
-
@@ -239,7 +239,7 @@ followers := ap.OrderedCollectionNew(ap.IRI(link))followers.TotalItems = uint(len(users)) for _, user := range users { person := ap.PersonNew(ap.IRI(user.LoginName)) person := ap.PersonNew(ap.IRI(user.Website)) followers.OrderedItems.Append(person) }
-