mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Added support for gopher URLs. (#14749)
* Added support for gopher URLs. * Add setting and make this user settable instead Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
1a1ce9b721
commit
9b33d18899
6 changed files with 54 additions and 1 deletions
|
@ -6,6 +6,7 @@ package setting
|
|||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -55,6 +56,7 @@ var Service struct {
|
|||
AutoWatchOnChanges bool
|
||||
DefaultOrgMemberVisible bool
|
||||
UserDeleteWithCommentsMaxTime time.Duration
|
||||
ValidSiteURLSchemes []string
|
||||
|
||||
// OpenID settings
|
||||
EnableOpenIDSignIn bool
|
||||
|
@ -120,6 +122,16 @@ func newService() {
|
|||
Service.DefaultOrgVisibilityMode = structs.VisibilityModes[Service.DefaultOrgVisibility]
|
||||
Service.DefaultOrgMemberVisible = sec.Key("DEFAULT_ORG_MEMBER_VISIBLE").MustBool()
|
||||
Service.UserDeleteWithCommentsMaxTime = sec.Key("USER_DELETE_WITH_COMMENTS_MAX_TIME").MustDuration(0)
|
||||
sec.Key("VALID_SITE_URL_SCHEMES").MustString("http,https")
|
||||
Service.ValidSiteURLSchemes = sec.Key("VALID_SITE_URL_SCHEMES").Strings(",")
|
||||
schemes := make([]string, len(Service.ValidSiteURLSchemes))
|
||||
for _, scheme := range Service.ValidSiteURLSchemes {
|
||||
scheme = strings.ToLower(strings.TrimSpace(scheme))
|
||||
if scheme != "" {
|
||||
schemes = append(schemes, scheme)
|
||||
}
|
||||
}
|
||||
Service.ValidSiteURLSchemes = schemes
|
||||
|
||||
if err := Cfg.Section("service.explore").MapTo(&Service.Explore); err != nil {
|
||||
log.Fatal("Failed to map service.explore settings: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue