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

This commit is contained in:
2026-03-04 06:33:14 -08:00
parent 6c8f22adc8
commit a01570b59d
22 changed files with 1153 additions and 92 deletions
@@ -0,0 +1,25 @@
package middleware
import (
"context"
"strings"
"github.com/gin-gonic/gin"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/pkg/apiversion"
"github.com/perfect-panel/server/pkg/constant"
)
func ApiVersionMiddleware(_ *svc.ServiceContext) func(c *gin.Context) {
return func(c *gin.Context) {
rawVersion := strings.TrimSpace(c.GetHeader("api-header"))
useLatest := apiversion.UseLatest(rawVersion, apiversion.DefaultThreshold)
ctx := context.WithValue(c.Request.Context(), constant.CtxKeyAPIVersionUseLatest, useLatest)
ctx = context.WithValue(ctx, constant.CtxKeyAPIHeaderRaw, rawVersion)
c.Request = c.Request.WithContext(ctx)
c.Set("api_header", rawVersion)
c.Next()
}
}