Changes
10 changed files (+16/-13)
-
-
@@ -29,7 +29,7 @@ func BranchNew() *Branch {func (br Branch) MarshalJSON() ([]byte, error) { b, err := br.Object.MarshalJSON() if len(b) == 0 || err != nil { return make([]byte, 0), err return nil, err } b = b[:len(b)-1]
-
-
-
@@ -33,7 +33,7 @@ func CommitNew() *Commit {func (c Commit) MarshalJSON() ([]byte, error) { b, err := c.Object.MarshalJSON() if len(b) == 0 || err != nil { return make([]byte, 0), err return nil, err } b = b[:len(b)-1]
-
-
-
@@ -13,15 +13,16 @@ const ForgeFedNamespaceURI = "https://forgefed.org/ns"// GetItemByType instantiates a new ForgeFed object if the type matches // otherwise it defaults to existing activitypub package typer function. func GetItemByType(typ ap.ActivityVocabularyType) (ap.Item, error) { if typ == CommitType { switch typ { case CommitType: return CommitNew(), nil } else if typ == BranchType { case BranchType: return BranchNew(), nil } else if typ == RepositoryType { case RepositoryType: return RepositoryNew(""), nil } else if typ == PushType { case PushType: return PushNew(), nil } else if typ == TicketType { case TicketType: return TicketNew(), nil } return ap.GetItemByType(typ)
-
-
-
@@ -33,7 +33,7 @@ func PushNew() *Push {func (p Push) MarshalJSON() ([]byte, error) { b, err := p.Object.MarshalJSON() if len(b) == 0 || err != nil { return make([]byte, 0), err return nil, err } b = b[:len(b)-1]
-
-
-
@@ -34,7 +34,7 @@ func RepositoryNew(id ap.ID) *Repository {func (r Repository) MarshalJSON() ([]byte, error) { b, err := r.Actor.MarshalJSON() if len(b) == 0 || err != nil { return make([]byte, 0), err return nil, err } b = b[:len(b)-1]
-
-
-
@@ -43,7 +43,7 @@ func TicketNew() *Ticket {func (t Ticket) MarshalJSON() ([]byte, error) { b, err := t.Object.MarshalJSON() if len(b) == 0 || err != nil { return make([]byte, 0), err return nil, err } b = b[:len(b)-1]
-
-
-
@@ -21,6 +21,7 @@ func Comment(ctx context.Context, note ap.Note) {actorUser, err := personIRIToUser(ctx, note.AttributedTo.GetLink()) if err != nil { log.Warn("Couldn't find actor", err) return } // TODO: Move IRI processing stuff to iri.go
-
-
-
@@ -55,6 +55,6 @@ func Send(user *user_model.User, activity *ap.Activity) {client, _ := NewClient(user, setting.AppURL+"api/v1/activitypub/user/"+user.Name+"#main-key") resp, _ := client.Post(binary, to.GetID().String()) respBody, _ := io.ReadAll(io.LimitReader(resp.Body, setting.Federation.MaxSize)) log.Debug(string(respBody)) log.Trace("Response from sending activity", string(respBody)) } }
-
-
-
@@ -102,6 +102,7 @@ func PersonInbox(ctx *context.APIContext) {body, err := io.ReadAll(io.LimitReader(ctx.Req.Body, setting.Federation.MaxSize)) if err != nil { ctx.ServerError("Error reading request body", err) return } var activity ap.Activity
-
@@ -112,7 +113,7 @@ func PersonInbox(ctx *context.APIContext) {case ap.UndoType: activitypub.Unfollow(ctx, activity) default: log.Debug("ActivityStreams type not supported", activity) log.Info("Incoming unsupported ActivityStreams type: %s", activity.GetType()) ctx.PlainText(http.StatusNotImplemented, "ActivityStreams type not supported") return }
-
-
-
@@ -140,7 +140,7 @@ func RepoInbox(ctx *context.APIContext) {activitypub.Comment(ctx, note) } default: log.Warn("ActivityStreams type not supported", activity) log.Info("Incoming unsupported ActivityStreams type: %s", activity["type"]) ctx.PlainText(http.StatusNotImplemented, "ActivityStreams type not supported") return }
-