diff --git a/go.mod b/go.mod index 9a824f891f..bf7c5d37c8 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/felixge/fgprof v0.9.3 github.com/fsnotify/fsnotify v1.6.0 github.com/gliderlabs/ssh v0.3.5 - github.com/go-ap/activitypub v0.0.0-20221209114049-1ceafda50f9f + github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799 github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 github.com/go-chi/chi/v5 v5.0.8 github.com/go-chi/cors v1.2.1 @@ -284,8 +284,6 @@ replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1 replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0 -replace github.com/go-ap/activitypub => gitea.com/xy/activitypub v0.0.0-20221126171442-81405e14ea3b - replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix replace github.com/nektos/act => gitea.com/gitea/act v0.234.2-0.20230131074955-e46ede1b1744 diff --git a/go.sum b/go.sum index 28ba3d8eed..04a912f08c 100644 --- a/go.sum +++ b/go.sum @@ -87,8 +87,6 @@ gitea.com/lunny/levelqueue v0.4.2-0.20220729054728-f020868cc2f7 h1:Zc3RQWC2xOVgl gitea.com/lunny/levelqueue v0.4.2-0.20220729054728-f020868cc2f7/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= -gitea.com/xy/activitypub v0.0.0-20221126171442-81405e14ea3b h1:z5zmwZVoKEu2c3+lGiLlTDxQZpcKlZoWz4wjCtcyfxU= -gitea.com/xy/activitypub v0.0.0-20221126171442-81405e14ea3b/go.mod h1:1jG7QyKCGx/FO63p/xWO0h9ytVSJmkjcQSYPj6zWpGs= gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE= github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121 h1:r3qt8PCHnfjOv9PN3H+XXKmDA1dfFMIN1AislhlA/ps= github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121/go.mod h1:Ock8XgA7pvULhIaHGAk/cDnRfNrF9Jey81nPcc403iU= @@ -381,6 +379,8 @@ github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799 h1:zVZaYt1h4yWL7uRHvq2StewCu4ObtS+ws9gGgoZJ+2s= +github.com/go-ap/activitypub v0.0.0-20230218112952-bfb607b04799/go.mod h1:1oVD0h0aPT3OEE1ZoSUoym/UGKzxe+e0y8K2AkQ1Hqs= github.com/go-ap/errors v0.0.0-20221205040414-01c1adfc98ea h1:ywGtLGVjJjMrq4mu35Qmu+NtlhlTk/gTayE6Bb4tQZk= github.com/go-ap/errors v0.0.0-20221205040414-01c1adfc98ea/go.mod h1:SaTNjEEkp0q+w3pUS1ccyEL/lUrHteORlDq/e21mCc8= github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 h1:GMKIYXyXPGIp+hYiWOhfqK4A023HdgisDT4YGgf99mw= diff --git a/modules/forgefed/branch.go b/modules/forgefed/branch.go index 5e20b6ef45..9e122d60c5 100644 --- a/modules/forgefed/branch.go +++ b/modules/forgefed/branch.go @@ -36,7 +36,7 @@ func (b Branch) MarshalJSON() ([]byte, error) { bin = bin[:len(bin)-1] if b.Ref != nil { - ap.JSONWriteItemJSONProp(&bin, "ref", b.Ref) + ap.JSONWriteItemProp(&bin, "ref", b.Ref) } ap.JSONWrite(&bin, '}') return bin, nil diff --git a/modules/forgefed/commit.go b/modules/forgefed/commit.go index b8c0bf3eb7..f1234b7961 100644 --- a/modules/forgefed/commit.go +++ b/modules/forgefed/commit.go @@ -39,10 +39,10 @@ func (c Commit) MarshalJSON() ([]byte, error) { b = b[:len(b)-1] if !c.Created.IsZero() { - ap.JSONWriteTimeJSONProp(&b, "created", c.Created) + ap.JSONWriteTimeProp(&b, "created", c.Created) } if !c.Committed.IsZero() { - ap.JSONWriteTimeJSONProp(&b, "committed", c.Committed) + ap.JSONWriteTimeProp(&b, "committed", c.Committed) } ap.JSONWrite(&b, '}') return b, nil diff --git a/modules/forgefed/push.go b/modules/forgefed/push.go index 9881aac494..74acdd3aeb 100644 --- a/modules/forgefed/push.go +++ b/modules/forgefed/push.go @@ -40,13 +40,13 @@ func (p Push) MarshalJSON() ([]byte, error) { b = b[:len(b)-1] if p.Target != nil { - ap.JSONWriteItemJSONProp(&b, "target", p.Target) + ap.JSONWriteItemProp(&b, "target", p.Target) } if p.HashBefore != nil { - ap.JSONWriteItemJSONProp(&b, "hashBefore", p.HashBefore) + ap.JSONWriteItemProp(&b, "hashBefore", p.HashBefore) } if p.HashAfter != nil { - ap.JSONWriteItemJSONProp(&b, "hashAfter", p.HashAfter) + ap.JSONWriteItemProp(&b, "hashAfter", p.HashAfter) } ap.JSONWrite(&b, '}') return b, nil diff --git a/modules/forgefed/repository.go b/modules/forgefed/repository.go index 71701d9f3b..63680ccd35 100644 --- a/modules/forgefed/repository.go +++ b/modules/forgefed/repository.go @@ -41,13 +41,13 @@ func (r Repository) MarshalJSON() ([]byte, error) { b = b[:len(b)-1] if r.Team != nil { - ap.JSONWriteItemJSONProp(&b, "team", r.Team) + ap.JSONWriteItemProp(&b, "team", r.Team) } if r.Forks != nil { - ap.JSONWriteItemJSONProp(&b, "forks", r.Forks) + ap.JSONWriteItemProp(&b, "forks", r.Forks) } if r.ForkedFrom != nil { - ap.JSONWriteItemJSONProp(&b, "forkedFrom", r.ForkedFrom) + ap.JSONWriteItemProp(&b, "forkedFrom", r.ForkedFrom) } ap.JSONWrite(&b, '}') return b, nil diff --git a/modules/forgefed/ticket.go b/modules/forgefed/ticket.go index be2607001b..1759de547f 100644 --- a/modules/forgefed/ticket.go +++ b/modules/forgefed/ticket.go @@ -49,23 +49,23 @@ func (t Ticket) MarshalJSON() ([]byte, error) { b = b[:len(b)-1] if t.Dependants != nil { - ap.JSONWriteItemCollectionJSONProp(&b, "dependants", t.Dependants) + ap.JSONWriteItemCollectionProp(&b, "dependants", t.Dependants) } if t.Dependencies != nil { - ap.JSONWriteItemCollectionJSONProp(&b, "dependencies", t.Dependencies) + ap.JSONWriteItemCollectionProp(&b, "dependencies", t.Dependencies) } - ap.JSONWriteBoolJSONProp(&b, "isResolved", t.IsResolved) + ap.JSONWriteBoolProp(&b, "isResolved", t.IsResolved) if t.ResolvedBy != nil { - ap.JSONWriteItemJSONProp(&b, "resolvedBy", t.ResolvedBy) + ap.JSONWriteItemProp(&b, "resolvedBy", t.ResolvedBy) } if !t.Resolved.IsZero() { - ap.JSONWriteTimeJSONProp(&b, "resolved", t.Resolved) + ap.JSONWriteTimeProp(&b, "resolved", t.Resolved) } if t.Origin != nil { - ap.JSONWriteItemJSONProp(&b, "origin", t.Origin) + ap.JSONWriteItemProp(&b, "origin", t.Origin) } if t.Target != nil { - ap.JSONWriteItemJSONProp(&b, "target", t.Target) + ap.JSONWriteItemProp(&b, "target", t.Target) } ap.JSONWrite(&b, '}') return b, nil diff --git a/routers/api/v1/activitypub/authorize_interaction.go b/routers/api/v1/activitypub/authorize_interaction.go index 66b8f967ba..b416e5ae8e 100644 --- a/routers/api/v1/activitypub/authorize_interaction.go +++ b/routers/api/v1/activitypub/authorize_interaction.go @@ -27,7 +27,7 @@ func AuthorizeInteraction(ctx *context.Context) { ap.ItemTyperFunc = forgefed.GetItemByType ap.JSONItemUnmarshal = forgefed.JSONUnmarshalerFn - ap.NotEmptyChecker = forgefed.NotEmpty + ap.IsNotEmpty = forgefed.NotEmpty object, err := ap.UnmarshalJSON(resp) if err != nil { ctx.ServerError("UnmarshalJSON", err) diff --git a/routers/api/v1/activitypub/repo.go b/routers/api/v1/activitypub/repo.go index eb9a7930c8..a05b62cb4c 100644 --- a/routers/api/v1/activitypub/repo.go +++ b/routers/api/v1/activitypub/repo.go @@ -94,7 +94,7 @@ func RepoInbox(ctx *context.APIContext) { ap.ItemTyperFunc = forgefed.GetItemByType ap.JSONItemUnmarshal = forgefed.JSONUnmarshalerFn - ap.NotEmptyChecker = forgefed.NotEmpty + ap.IsNotEmpty = forgefed.NotEmpty var activity ap.Activity err = activity.UnmarshalJSON(body) if err != nil { diff --git a/services/activitypub/transport.go b/services/activitypub/transport.go index a7621e2f10..934852ac7d 100644 --- a/services/activitypub/transport.go +++ b/services/activitypub/transport.go @@ -48,7 +48,7 @@ func FetchObject(iri string) (ap.ObjectOrLink, error) { } ap.ItemTyperFunc = forgefed.GetItemByType ap.JSONItemUnmarshal = forgefed.JSONUnmarshalerFn - ap.NotEmptyChecker = forgefed.NotEmpty + ap.IsNotEmpty = forgefed.NotEmpty return ap.UnmarshalJSON(resp) }