Files

23 lines
496 B
Go
Raw Permalink Normal View History

2024-07-19 19:04:11 +08:00
package middleware
import (
"github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
2024-07-19 19:04:11 +08:00
"github.com/1Panel-dev/1Panel/core/app/repo"
"github.com/gin-gonic/gin"
)
func GlobalLoading() gin.HandlerFunc {
return func(c *gin.Context) {
settingRepo := repo.NewISettingRepo()
status, err := settingRepo.GetValueByKey("SystemStatus")
2024-07-19 19:04:11 +08:00
if err != nil {
helper.InternalServer(c, err)
2024-07-19 19:04:11 +08:00
return
}
if status != "Free" {
helper.ErrorWithDetail(c, 407, status, err)
2024-07-19 19:04:11 +08:00
return
}
c.Next()
}
}