Files
waf-platform/EdgeUser/internal/web/actions/default/portal/helper.go
2026-02-04 20:27:13 +08:00

27 lines
629 B
Go

// Copyright 2024 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn .
package portal
import (
"github.com/TeaOSLab/EdgeUser/internal/configloaders"
"github.com/iwind/TeaGo/actions"
"net/http"
)
type Helper struct {
}
func (this *Helper) BeforeAction(action *actions.ActionObject) (goNext bool) {
uiConfig, _ := configloaders.LoadUIConfig()
if uiConfig != nil {
goNext = uiConfig.Portal.IsOn
}
if !goNext {
action.ResponseWriter.WriteHeader(http.StatusNotFound)
_, _ = action.ResponseWriter.Write([]byte("page not found '" + action.Request.URL.String() + "'"))
}
return
}