Skip to content
/ gitea Public
  • Sponsor go-gitea/gitea

  • Notifications You must be signed in to change notification settings
  • Fork 5.8k
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ec1a00

Browse files
committedSep 19, 2024
routers/private: add private equivalents of public lfs API
1 parent b837c33 commit 8ec1a00

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎routers/private/internal.go

+22
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import (
1212
"code.gitea.io/gitea/modules/private"
1313
"code.gitea.io/gitea/modules/setting"
1414
"code.gitea.io/gitea/modules/web"
15+
"code.gitea.io/gitea/routers/common"
1516
"code.gitea.io/gitea/services/context"
17+
"code.gitea.io/gitea/services/lfs"
1618

1719
"gitea.com/go-chi/binding"
1820
chi_middleware "github.com/go-chi/chi/v5/middleware"
@@ -80,5 +82,25 @@ func Routes() *web.Router {
8082
r.Post("/restore_repo", RestoreRepo)
8183
r.Post("/actions/generate_actions_runner_token", GenerateActionsRunnerToken)
8284

85+
r.Group("/repo/{username}/{reponame}", func() {
86+
r.Group("/info/lfs", func() {
87+
r.Post("/objects/batch", lfs.CheckAcceptMediaType, lfs.BatchHandler)
88+
r.Put("/objects/{oid}/{size}", lfs.UploadHandler)
89+
r.Get("/objects/{oid}/{filename}", lfs.DownloadHandler)
90+
r.Get("/objects/{oid}", lfs.DownloadHandler)
91+
r.Post("/verify", lfs.CheckAcceptMediaType, lfs.VerifyHandler)
92+
r.Group("/locks", func() {
93+
r.Get("/", lfs.GetListLockHandler)
94+
r.Post("/", lfs.PostLockHandler)
95+
r.Post("/verify", lfs.VerifyLockHandler)
96+
r.Post("/{lid}/unlock", lfs.UnLockHandler)
97+
}, lfs.CheckAcceptMediaType)
98+
r.Any("/*", func(ctx *context.Context) {
99+
ctx.NotFound("", nil)
100+
})
101+
})
102+
}, common.Sessioner(), context.Contexter())
103+
// end "/repo/{username}/{reponame}": git (LFS) API mirror
104+
83105
return r
84106
}

0 commit comments

Comments
 (0)
Please sign in to comment.