fixed homepage not respecting homepage.show field, disabled schema validation for included file

This commit is contained in:
yusing
2024-10-04 08:36:32 +08:00
parent 6211ddcdf0
commit e566fd9b57
6 changed files with 33 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"strings"
"github.com/sirupsen/logrus"
"github.com/yusing/go-proxy/internal/common"
H "github.com/yusing/go-proxy/internal/homepage"
M "github.com/yusing/go-proxy/internal/models"
@@ -48,10 +49,18 @@ func (cfg *Config) HomepageConfig() H.HomePageConfig {
}
entry := r.Entry()
if entry.Homepage == nil {
entry.Homepage = &H.HomePageItem{
Show: r.Entry().IsExplicit || !p.IsExplicitOnly(),
}
}
logrus.Debugf("%s isexplicit: %v, explicitonly: %v", r, r.Entry().IsExplicit, p.IsExplicitOnly())
item := entry.Homepage
if !item.Initialized {
item.Show = r.Entry().IsExplicit || !p.IsExplicitOnly()
if !item.Show && !item.IsEmpty() {
item.Show = true
}
if !item.Show || r.Type() != R.RouteTypeReverseProxy {
@@ -86,7 +95,7 @@ func (cfg *Config) HomepageConfig() H.HomePageConfig {
}
item.AltURL = r.URL().String()
hpCfg.Add(&item)
hpCfg.Add(item)
})
return hpCfg
}