Correctly merge feature-activitypub branch

This commit is contained in:
Anthony Wang 2022-06-18 17:16:37 -05:00
parent 4cbc831ce6
commit 10e15019aa
Signed by: a
GPG key ID: BC96B00AEC5F2D76
4 changed files with 12 additions and 11 deletions

View file

@ -104,7 +104,7 @@ func PersonInbox(ctx *context.APIContext) {
body, err := io.ReadAll(io.LimitReader(ctx.Req.Body, setting.Federation.MaxSize))
if err != nil {
ctx.Error(http.StatusInternalServerError, "Error reading request body", err)
ctx.ServerError("Error reading request body", err)
}
var activity ap.Activity
@ -148,7 +148,7 @@ func PersonOutbox(ctx *context.APIContext) {
Date: ctx.FormString("date"),
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "Couldn't fetch outbox", err)
ctx.ServerError("Couldn't fetch outbox", err)
}
outbox := ap.OrderedCollectionNew(ap.IRI(link))
@ -185,7 +185,7 @@ func PersonFollowing(ctx *context.APIContext) {
users, err := user_model.GetUserFollowing(ctx.ContextUser, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserFollowing", err)
ctx.ServerError("GetUserFollowing", err)
return
}
@ -222,7 +222,7 @@ func PersonFollowers(ctx *context.APIContext) {
users, err := user_model.GetUserFollowers(ctx.ContextUser, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserFollowers", err)
ctx.ServerError("GetUserFollowers", err)
return
}
@ -262,7 +262,7 @@ func PersonLiked(ctx *context.APIContext) {
StarredByID: ctx.ContextUser.ID,
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserStarred", err)
ctx.ServerError("GetUserStarred", err)
return
}

View file

@ -48,7 +48,7 @@ func Repo(ctx *context.APIContext) {
repo.Name = ap.NaturalLanguageValuesNew()
err := repo.Name.Set("en", ap.Content(ctx.Repo.Repository.Name))
if err != nil {
ctx.Error(http.StatusInternalServerError, "Set Name", err)
ctx.ServerError("Set Name", err)
return
}
@ -57,7 +57,7 @@ func Repo(ctx *context.APIContext) {
repo.Summary = ap.NaturalLanguageValuesNew()
err = repo.Summary.Set("en", ap.Content(ctx.Repo.Repository.Description))
if err != nil {
ctx.Error(http.StatusInternalServerError, "Set Description", err)
ctx.ServerError("Set Description", err)
return
}
@ -93,7 +93,7 @@ func RepoInbox(ctx *context.APIContext) {
body, err := io.ReadAll(ctx.Req.Body)
if err != nil {
ctx.Error(http.StatusInternalServerError, "Error reading request body", err)
ctx.ServerError("Error reading request body", err)
}
var activity ap.Activity
@ -140,7 +140,7 @@ func RepoOutbox(ctx *context.APIContext) {
Date: ctx.FormString("date"),
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "Couldn't fetch outbox", err)
ctx.ServerError("Couldn't fetch outbox", err)
}
outbox := ap.OrderedCollectionNew(ap.IRI(link))
@ -182,7 +182,7 @@ func RepoFollowers(ctx *context.APIContext) {
users, err := user_model.GetUserFollowers(ctx.ContextUser, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserFollowers", err)
ctx.ServerError("GetUserFollowers", err)
return
}

View file

@ -18,7 +18,7 @@ import (
func response(ctx *context.APIContext, v interface{}) {
binary, err := jsonld.WithContext(jsonld.IRI(ap.ActivityBaseURI), jsonld.IRI(ap.SecurityContextURI)).Marshal(v)
if err != nil {
ctx.Error(http.StatusInternalServerError, "Marshal", err)
ctx.ServerError("Marshal", err)
return
}
ctx.Resp.Header().Add("Content-Type", activitypub.ActivityStreamsContentType)

View file

@ -29,6 +29,7 @@ type webfingerLink struct {
Rel string `json:"rel,omitempty"`
Type string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
Template string `json:"template,omitempty"`
Titles map[string]string `json:"titles,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
}