[sub] url support for reverse proxy #607

This commit is contained in:
Alireza Ahmadi
2023-11-26 18:37:45 +01:00
parent b41aef37e5
commit a8878bc1dc
12 changed files with 89 additions and 50 deletions

View File

@@ -44,6 +44,7 @@ type AllSetting struct {
SubUpdates int `json:"subUpdates" form:"subUpdates"`
SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"`
SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"`
SubURI string `json:"subURI" form:"subURI"`
}
func (s *AllSetting) CheckValid() error {
@@ -94,6 +95,13 @@ func (s *AllSetting) CheckValid() error {
s.WebBasePath += "/"
}
if !strings.HasPrefix(s.SubPath, "/") {
s.SubPath = "/" + s.SubPath
}
if !strings.HasSuffix(s.SubPath, "/") {
s.SubPath += "/"
}
_, err := time.LoadLocation(s.TimeLocation)
if err != nil {
return common.NewError("time location not exist:", s.TimeLocation)