moved arch package routes to the same scope with other packages

This commit is contained in:
dancheg97 2023-06-22 09:29:08 +03:00
parent b354f027ff
commit af99efb0a0
3 changed files with 5 additions and 16 deletions

View File

@ -123,6 +123,10 @@ func CommonRoutes() *web.Route {
})
})
}, reqPackageAccess(perm.AccessModeRead))
r.Group("/arch", func() {
r.Put("/push", arch.Push)
r.Get("/{distro}/{arch}/{file}", arch.Get)
})
r.Group("/cargo", func() {
r.Group("/api/v1/crates", func() {
r.Get("", cargo.SearchPackages)
@ -753,16 +757,3 @@ func ContainerRoutes() *web.Route {
return r
}
// Routes for arch packages.
func ArchRoutes() *web.Route {
r := web.NewRoute()
r.Use(context.PackageContexter())
r.Put("/push", arch.Push)
r.Get("/{distro}/{arch}/{owner}/{file}", arch.Get)
r.Get("/{distro}/{arch}/{file}", arch.Get)
return r
}

View File

@ -19,10 +19,10 @@ import (
// Push new package to arch package registry.
func Push(ctx *context.Context) {
var (
owner = ctx.Params("username")
filename = ctx.Req.Header.Get("filename")
email = ctx.Req.Header.Get("email")
sign = ctx.Req.Header.Get("sign")
owner = ctx.Req.Header.Get("owner")
distro = ctx.Req.Header.Get("distro")
)

View File

@ -190,8 +190,6 @@ func NormalRoutes() *web.Route {
r.Mount("/api/packages", packages_router.CommonRoutes())
// This implements the OCI API (Note this is not preceded by /api but is instead /v2)
r.Mount("/v2", packages_router.ContainerRoutes())
// Arch package routes
r.Mount("/api/packages/arch", packages_router.ArchRoutes())
}
if setting.Actions.Enabled {