summaryrefslogtreecommitdiffstats
path: root/modules/templates
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2022-08-23 14:58:04 +0200
committerGitHub <noreply@github.com>2022-08-23 20:58:04 +0800
commit56220515fc882943e366fafbce4d5b2b3ccee702 (patch)
treed64bffc3a9d13ce01bf56aedc896923aa4af0acf /modules/templates
parent0a9ed54abbe8b6837dcb22a35b744c11f410421f (diff)
downloadgitea-56220515fc882943e366fafbce4d5b2b3ccee702.tar.gz
gitea-56220515fc882943e366fafbce4d5b2b3ccee702.zip
Enable contenthash in filename for dynamic assets (#20813)
This should solve the main problem of dynamic assets getting stale after a version upgrade. Everything not affected will use query-string based cache busting, which includes files loaded via HTML or worker scripts.
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/helper.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 410857f37e..10b7022ea6 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -81,6 +81,9 @@ func NewFuncMap() []template.FuncMap {
"AppDomain": func() string {
return setting.Domain
},
+ "AssetVersion": func() string {
+ return setting.AssetVersion
+ },
"DisableGravatar": func() bool {
return setting.DisableGravatar
},
@@ -150,7 +153,6 @@ func NewFuncMap() []template.FuncMap {
"DiffTypeToStr": DiffTypeToStr,
"DiffLineTypeToStr": DiffLineTypeToStr,
"ShortSha": base.ShortSha,
- "MD5": base.EncodeMD5,
"ActionContent2Commits": ActionContent2Commits,
"PathEscape": url.PathEscape,
"PathEscapeSegments": util.PathEscapeSegments,