46 lines
1.3 KiB
Diff
46 lines
1.3 KiB
Diff
--- 9.0.3 2024-12-12 08:06:13.000000000 +0100
|
|
+++ aneksajo 2024-12-16 08:23:15.000000000 +0100
|
|
@@ -356,6 +356,20 @@
|
|
}
|
|
}
|
|
|
|
+ annexEnabled := func(ctx *context.Context) {
|
|
+ if !setting.Annex.Enabled {
|
|
+ ctx.Error(http.StatusNotFound)
|
|
+ return
|
|
+ }
|
|
+ }
|
|
+
|
|
+ annexP2PHTTPEnabled := func(ctx *context.Context) {
|
|
+ if setting.Annex.DisableP2PHTTP {
|
|
+ ctx.Error(http.StatusNotFound)
|
|
+ return
|
|
+ }
|
|
+ }
|
|
+
|
|
federationEnabled := func(ctx *context.Context) {
|
|
if !setting.Federation.Enabled {
|
|
ctx.Error(http.StatusNotFound)
|
|
@@ -955,6 +969,9 @@
|
|
// ***** END: Organization *****
|
|
|
|
// ***** START: Repository *****
|
|
+ m.Group("", func() {
|
|
+ m.Methods("GET,POST", "/git-annex-p2phttp/git-annex/{uuid}/*", repo.AnnexP2PHTTP)
|
|
+ }, ignSignInAndCsrf, annexEnabled, annexP2PHTTPEnabled)
|
|
m.Group("/repo", func() {
|
|
m.Get("/create", repo.Create)
|
|
m.Post("/create", web.Bind(forms.CreateRepoForm{}), repo.CreatePost)
|
|
@@ -1628,6 +1645,12 @@
|
|
})
|
|
}, ignSignInAndCsrf, lfsServerEnabled)
|
|
|
|
+ m.Group("", func() {
|
|
+ // for git-annex
|
|
+ m.Methods("GET,OPTIONS", "/config", repo.GetConfig) // needed by clients reading annex.uuid during `git annex initremote`
|
|
+ m.Methods("GET,OPTIONS", "/annex/objects/{hash1}/{hash2}/{keyDir}/{key}", repo.GetAnnexObject)
|
|
+ }, ignSignInAndCsrf, annexEnabled, context.UserAssignmentWeb())
|
|
+
|
|
gitHTTPRouters(m)
|
|
})
|
|
})
|