mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-22 12:07:37 +01:00
0aedb03996
1. move "internal-lfs" route mock to "common-lfs" 2. fine tune tests 3. fix "realm" strings, according to RFC: https://datatracker.ietf.org/doc/html/rfc2617: * realm = "realm" "=" realm-value * realm-value = quoted-string 4. clarify some names of the middlewares, rename `ignXxx` to `optXxx` to match `reqXxx`, and rename ambiguous `requireSignIn` to `reqGitSignIn`
32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package common
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"code.gitea.io/gitea/modules/web"
|
|
"code.gitea.io/gitea/services/lfs"
|
|
)
|
|
|
|
const RouterMockPointCommonLFS = "common-lfs"
|
|
|
|
func AddOwnerRepoGitLFSRoutes(m *web.Router, middlewares ...any) {
|
|
// shared by web and internal routers
|
|
m.Group("/{username}/{reponame}/info/lfs", func() {
|
|
m.Post("/objects/batch", lfs.CheckAcceptMediaType, lfs.BatchHandler)
|
|
m.Put("/objects/{oid}/{size}", lfs.UploadHandler)
|
|
m.Get("/objects/{oid}/{filename}", lfs.DownloadHandler)
|
|
m.Get("/objects/{oid}", lfs.DownloadHandler)
|
|
m.Post("/verify", lfs.CheckAcceptMediaType, lfs.VerifyHandler)
|
|
m.Group("/locks", func() {
|
|
m.Get("/", lfs.GetListLockHandler)
|
|
m.Post("/", lfs.PostLockHandler)
|
|
m.Post("/verify", lfs.VerifyLockHandler)
|
|
m.Post("/{lid}/unlock", lfs.UnLockHandler)
|
|
}, lfs.CheckAcceptMediaType)
|
|
m.Any("/*", http.NotFound)
|
|
}, append([]any{web.RouterMockPoint(RouterMockPointCommonLFS)}, middlewares...)...)
|
|
}
|