wip: oci image management
This commit is contained in:
33
handler/registry_catalog.go
Normal file
33
handler/registry_catalog.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/rerr"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
|
||||
func handleCatalog(c fiber.Ctx) error {
|
||||
if c.Method() != "GET" {
|
||||
return rerr.Error(c, &rerr.RepositoryError{
|
||||
Status: http.StatusBadRequest,
|
||||
Code: "METHOD_UNKNOWN",
|
||||
Message: "We don't understand your method + url",
|
||||
})
|
||||
}
|
||||
|
||||
nStr := c.Query("n")
|
||||
n := 10000
|
||||
if nStr != "" {
|
||||
n, _ = strconv.Atoi(nStr)
|
||||
}
|
||||
|
||||
list, re := m.Catalog(c.Context(), n, 0, "")
|
||||
if re != nil {
|
||||
return rerr.Error(c, re)
|
||||
}
|
||||
|
||||
return c.JSON(list)
|
||||
}
|
||||
Reference in New Issue
Block a user