自定义页面增加是否“启用系统自定义页面”选项

This commit is contained in:
GoEdgeLab
2024-05-03 09:35:12 +08:00
parent f34cb4ef37
commit 3d5b5603bd
6 changed files with 844 additions and 697 deletions

View File

@@ -7,16 +7,17 @@ import (
)
type HTTPWebConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Locations []*HTTPLocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO
LocationRefs []*HTTPLocationRef `yaml:"locationRefs" json:"locationRefs"` // 路径规则应用
Compression *HTTPCompressionConfig `yaml:"compression" json:"compression"` // 压缩配置
Optimization *HTTPPageOptimizationConfig `yaml:"optimization" json:"optimization"` // 页面优化配置
WebP *WebPImageConfig `yaml:"webp" json:"webp"` // WebP配置
Charset *HTTPCharsetConfig `yaml:"charset" json:"charset"` // 字符编码
Shutdown *HTTPShutdownConfig `yaml:"shutdown" json:"shutdown"` // 临时关闭配置
Pages []*HTTPPageConfig `yaml:"pages" json:"pages"` // 特殊页面配置
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Locations []*HTTPLocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO
LocationRefs []*HTTPLocationRef `yaml:"locationRefs" json:"locationRefs"` // 路径规则应用
Compression *HTTPCompressionConfig `yaml:"compression" json:"compression"` // 压缩配置
Optimization *HTTPPageOptimizationConfig `yaml:"optimization" json:"optimization"` // 页面优化配置
WebP *WebPImageConfig `yaml:"webp" json:"webp"` // WebP配置
Charset *HTTPCharsetConfig `yaml:"charset" json:"charset"` // 字符编码
Shutdown *HTTPShutdownConfig `yaml:"shutdown" json:"shutdown"` // 临时关闭配置
Pages []*HTTPPageConfig `yaml:"pages" json:"pages"` // 特殊页面配置
EnableGlobalPages bool `yaml:"enableGlobalPages" json:"enableGlobalPages"` // 启用系统配置的自定义页面
RedirectToHttps *HTTPRedirectToHTTPSConfig `yaml:"redirectToHTTPS" json:"redirectToHTTPS"` // 是否自动跳转到Https
Root *HTTPRootConfig `yaml:"root" json:"root"` // 资源根目录

View File

@@ -173,6 +173,7 @@ func (this *ServerConfig) Init(ctx context.Context) (results []error) {
// pages
if len(groupWeb.Pages) > 0 || (groupWeb.Shutdown != nil && groupWeb.Shutdown.IsOn) {
this.Web.EnableGlobalPages = groupWeb.EnableGlobalPages
this.Web.Pages = groupWeb.Pages
this.Web.Shutdown = groupWeb.Shutdown
}