fix gitea workflow path and runner label
Build docker and publish / build (20.15.1) (push) Failing after 7m57s

This commit is contained in:
2026-03-04 07:02:51 -08:00
parent a01570b59d
commit 149dfe1ac3
11 changed files with 303 additions and 53 deletions
@@ -0,0 +1,23 @@
package middleware
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/perfect-panel/server/pkg/constant"
)
func ApiVersionSwitchHandler(legacyHandler gin.HandlerFunc, latestHandler gin.HandlerFunc) gin.HandlerFunc {
return func(c *gin.Context) {
useLatest, _ := c.Request.Context().Value(constant.CtxKeyAPIVersionUseLatest).(bool)
if useLatest && latestHandler != nil {
latestHandler(c)
return
}
if legacyHandler != nil {
legacyHandler(c)
return
}
c.AbortWithStatus(http.StatusNotFound)
}
}