27 lines
629 B
Go
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
|
|
}
|