mirror of https://github.com/1Panel-dev/1Panel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
655 B
25 lines
655 B
package middleware
|
|
|
|
import (
|
|
"github.com/1Panel-dev/1Panel/core/app/api/v2/helper"
|
|
"github.com/1Panel-dev/1Panel/core/app/repo"
|
|
"github.com/1Panel-dev/1Panel/core/constant"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func GlobalLoading() gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
settingRepo := repo.NewISettingRepo()
|
|
status, err := settingRepo.Get(settingRepo.WithByKey("SystemStatus"))
|
|
if err != nil {
|
|
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
|
return
|
|
}
|
|
if status.Value != "Free" {
|
|
helper.ErrorWithDetail(c, constant.CodeGlobalLoading, status.Value, err)
|
|
return
|
|
}
|
|
c.Next()
|
|
}
|
|
}
|