diff options
author | Xinyu Zhou <i@sourcehut.net> | 2022-11-21 13:14:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 13:14:58 +0800 |
commit | b4802b9b2eae044e35f022dc7116986e4762a944 (patch) | |
tree | 797be6fa1bff09a869c03344d4d01cb5710b9973 /modules | |
parent | 9380bb6d0c7fb8d2652d19a9aec87994a6e99f8c (diff) | |
download | gitea-b4802b9b2eae044e35f022dc7116986e4762a944.tar.gz gitea-b4802b9b2eae044e35f022dc7116986e4762a944.zip |
Allow disable RSS/Atom feed (#21622)
This patch provide a mechanism to disable RSS/Atom feed.
Signed-off-by: Xinyu Zhou <i@sourcehut.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/repo.go | 6 | ||||
-rw-r--r-- | modules/setting/setting.go | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 1a0263a330..c363c36994 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -441,8 +441,10 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { userName := ctx.Params(":username") repoName := ctx.Params(":reponame") repoName = strings.TrimSuffix(repoName, ".git") - repoName = strings.TrimSuffix(repoName, ".rss") - repoName = strings.TrimSuffix(repoName, ".atom") + if setting.EnableFeed { + repoName = strings.TrimSuffix(repoName, ".rss") + repoName = strings.TrimSuffix(repoName, ".atom") + } // Check if the user is the same as the repository owner if ctx.IsSigned && ctx.Doer.LowerName == strings.ToLower(userName) { diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 12558da494..fb425c8717 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -440,6 +440,7 @@ var ( ShowFooterBranding bool ShowFooterVersion bool ShowFooterTemplateLoadTime bool + EnableFeed bool // Global setting objects Cfg *ini.File @@ -1102,6 +1103,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) { ShowFooterVersion = Cfg.Section("other").Key("SHOW_FOOTER_VERSION").MustBool(true) ShowFooterTemplateLoadTime = Cfg.Section("other").Key("SHOW_FOOTER_TEMPLATE_LOAD_TIME").MustBool(true) EnableSitemap = Cfg.Section("other").Key("ENABLE_SITEMAP").MustBool(true) + EnableFeed = Cfg.Section("other").Key("ENABLE_FEED").MustBool(true) UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool(true) UI.DefaultShowFullName = Cfg.Section("ui").Key("DEFAULT_SHOW_FULL_NAME").MustBool(false) |