Changes
6 changed files (+24/-34)
-
-
@@ -29,6 +29,7 @@ github.com/ethantkoenig/rupture v1.0.1github.com/felixge/fgprof v0.9.2 github.com/gliderlabs/ssh v0.3.4 github.com/go-ap/activitypub v0.0.0-20220615144428-48208c70483b github.com/go-ap/jsonld v0.0.0-20220615144122-1d862b15410d github.com/go-chi/chi/v5 v5.0.7 github.com/go-chi/cors v1.2.1 github.com/go-enry/go-enry/v2 v2.8.2
-
@@ -84,6 +85,7 @@ github.com/syndtr/goleveldb v1.0.0github.com/tstranex/u2f v1.0.0 github.com/unrolled/render v1.4.1 github.com/urfave/cli v1.22.9 github.com/valyala/fastjson v1.6.3 github.com/xanzy/go-gitlab v0.64.0 github.com/yohcop/openid-go v1.0.0 github.com/yuin/goldmark v1.4.12
-
@@ -163,7 +165,6 @@ github.com/fsnotify/fsnotify v1.5.4 // indirectgithub.com/fullstorydev/grpcurl v1.8.1 // indirect github.com/fxamacker/cbor/v2 v2.4.0 // indirect github.com/go-ap/errors v0.0.0-20220615144307-e8bc4a40ae9f // indirect github.com/go-ap/jsonld v0.0.0-20220615144122-1d862b15410d // indirect github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect github.com/go-enry/go-oniguruma v1.2.1 // indirect github.com/go-git/gcfg v1.5.0 // indirect
-
@@ -256,7 +257,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirectgithub.com/toqueteos/webbrowser v1.2.0 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/unknwon/com v1.0.1 // indirect github.com/valyala/fastjson v1.6.3 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xanzy/ssh-agent v0.3.1 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
-
-
-
@@ -22,15 +22,15 @@ type Type int// Note: new type must append to the end of list to maintain compatibility. const ( NoType Type = iota Plain // 1 LDAP // 2 SMTP // 3 PAM // 4 DLDAP // 5 OAuth2 // 6 SSPI // 7 Federated // 8 NoType Type = iota Plain // 1 LDAP // 2 SMTP // 3 PAM // 4 DLDAP // 5 OAuth2 // 6 SSPI // 7 Federated // 8 ) // String returns the string name of the LoginType
-
-
-
@@ -5,9 +5,8 @@package forgefed import ( ap "github.com/go-ap/activitypub" "github.com/valyala/fastjson" ap "github.com/go-ap/activitypub" ) const (
-
-
-
@@ -20,7 +20,6 @@ "code.gitea.io/gitea/modules/setting""code.gitea.io/gitea/routers/api/v1/utils" ap "github.com/go-ap/activitypub" "github.com/go-ap/jsonld" ) // Person function returns the Person actor for a user
-
@@ -257,10 +256,10 @@ // "$ref": "#/responses/ActivityPub"link := strings.TrimSuffix(setting.AppURL, "/") + strings.TrimSuffix(ctx.Req.URL.EscapedPath(), "/") repos, count, err := repo_model.SearchRepository(&repo_model.SearchRepoOptions{ Actor: ctx.Doer, Private: ctx.IsSigned, StarredByID: ctx.ContextUser.ID, repos, count, err := repo_model.SearchRepository(&repo_model.SearchRepoOptions{ Actor: ctx.Doer, Private: ctx.IsSigned, StarredByID: ctx.ContextUser.ID, }) if err != nil { ctx.Error(http.StatusInternalServerError, "GetUserStarred", err)
-
-
-
@@ -11,7 +11,6 @@ "strings""code.gitea.io/gitea/models" "code.gitea.io/gitea/models/forgefed" //repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log"
-
@@ -66,7 +65,7 @@ repo.Inbox = ap.IRI(link + "/inbox")repo.Outbox = ap.IRI(link + "/outbox") repo.Followers = ap.IRI(link + "/followers") repo.Team = ap.IRI(link + "/team") response(ctx, repo) }
-
@@ -100,7 +99,7 @@var activity ap.Activity activity.UnmarshalJSON(body) if activity.Type == ap.FollowType { //activitypub.Follow(ctx, activity) // activitypub.Follow(ctx, activity) } else { log.Warn("ActivityStreams type not supported", activity) }
-
-
-
@@ -9,27 +9,20 @@ "net/http""code.gitea.io/gitea/modules/activitypub" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" ap "github.com/go-ap/activitypub" "github.com/go-ap/jsonld" ) func response(ctx *context.APIContext, binary []byte) { var jsonmap map[string]interface{} err := json.Unmarshal(binary, &jsonmap) 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, "Unmarshal", err) ctx.Error(http.StatusInternalServerError, "Marshal", err) return } jsonmap["@context"] = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"} ctx.Resp.Header().Add("Content-Type", activitypub.ActivityStreamsContentType) ctx.Resp.WriteHeader(http.StatusOK) binary, err = json.Marshal(jsonmap) if err != nil { ctx.Error(http.StatusInternalServerError, "Marshal", err) return } if _, err = ctx.Resp.Write(binary); err != nil { log.Error("write to resp err: %v", err) }
-