wip: oci image management
This commit is contained in:
32
handler/registry_referrers.go
Normal file
32
handler/registry_referrers.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/rerr"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
|
||||
func handleReferrers(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",
|
||||
})
|
||||
}
|
||||
|
||||
elem := strings.Split(c.Path(), "/")
|
||||
elem = elem[1:]
|
||||
repo := strings.Join(elem[1:len(elem)-2], "/")
|
||||
target := elem[len(elem)-1]
|
||||
|
||||
index, re := m.Referrers(c.Context(), repo, target)
|
||||
if re != nil {
|
||||
return rerr.Error(c, re)
|
||||
}
|
||||
|
||||
return c.JSON(index)
|
||||
}
|
||||
Reference in New Issue
Block a user