Initial commit (code only without large binaries)
This commit is contained in:
26
EdgeUser/internal/web/actions/default/portal/helper.go
Normal file
26
EdgeUser/internal/web/actions/default/portal/helper.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user