aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go3
-rw-r--r--modules/templates/helper.go4
2 files changed, 6 insertions, 1 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index f5e6249467..d304811c92 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -91,6 +91,8 @@ var (
// LocalURL is the url for locally running applications to contact Gitea. It always has a '/' suffix
// It maps to ini:"LOCAL_ROOT_URL"
LocalURL string
+ // AssetVersion holds a opaque value that is used for cache-busting assets
+ AssetVersion string
// Server settings
Protocol Scheme
@@ -749,6 +751,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
}
AbsoluteAssetURL = MakeAbsoluteAssetURL(AppURL, StaticURLPrefix)
+ AssetVersion = strings.ReplaceAll(AppVer, "+", "~") // make sure the version string is clear (no real escaping is needed)
manifestBytes := MakeManifestData(AppName, AppURL, AbsoluteAssetURL)
ManifestData = `application/json;base64,` + base64.StdEncoding.EncodeToString(manifestBytes)
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index ad39baecb9..e78dcb61cf 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
},
@@ -151,7 +154,6 @@ func NewFuncMap() []template.FuncMap {
"DiffTypeToStr": DiffTypeToStr,
"DiffLineTypeToStr": DiffLineTypeToStr,
"ShortSha": base.ShortSha,
- "MD5": base.EncodeMD5,
"ActionContent2Commits": ActionContent2Commits,
"PathEscape": url.PathEscape,
"PathEscapeSegments": util.PathEscapeSegments,