summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-02-10 00:31:30 +0800
committerGitHub <noreply@github.com>2023-02-09 11:31:30 -0500
commit24a9caa2f33db2664510e79f184892c8cb266b62 (patch)
tree8be9d1541d92606f85ee72111752dad5dc3fea03 /modules/templates
parent0c190e396df7025683b56f0e6f64356c907a8512 (diff)
downloadgitea-24a9caa2f33db2664510e79f184892c8cb266b62.tar.gz
gitea-24a9caa2f33db2664510e79f184892c8cb266b62.zip
Fix more HTMLURL in templates (#22831)
I haven't tested `runs_list.tmpl` but I think it could be right. After this PR, besides the `<meta .. HTMLURL>` in html head, the only explicit HTMLURL usage is in `pull_merge_instruction.tmpl`, which doesn't affect users too much and it's difficult to fix at the moment. There are still many usages of `AppUrl` in the templates (eg: the package help manual), they are similar problems as the HTMLURL in pull_merge_instruction, and they might be fixed together in the future. Diff without space: https://github.com/go-gitea/gitea/pull/22831/files?diff=unified&w=1
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/helper.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index a390d94592..7afc3aa59b 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -72,6 +72,10 @@ func NewFuncMap() []template.FuncMap {
return setting.StaticURLPrefix + "/assets"
},
"AppUrl": func() string {
+ // The usage of AppUrl should be avoided as much as possible,
+ // because the AppURL(ROOT_URL) may not match user's visiting site and the ROOT_URL in app.ini may be incorrect.
+ // And it's difficult for Gitea to guess absolute URL correctly with zero configuration,
+ // because Gitea doesn't know whether the scheme is HTTP or HTTPS unless the reverse proxy could tell Gitea.
return setting.AppURL
},
"AppVer": func() string {