aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/static.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-01-07 10:33:17 +0800
committerGitHub <noreply@github.com>2022-01-06 21:33:17 -0500
commita1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd (patch)
tree7add88555600d96deecbc9f97217d183f83f3edc /modules/templates/static.go
parent21ed4fd8da4c8992518dcfb01aa7306f7406f735 (diff)
downloadgitea-a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd.tar.gz
gitea-a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd.zip
Don't store assets modified time into generated files (#18193)
Diffstat (limited to 'modules/templates/static.go')
-rw-r--r--modules/templates/static.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/templates/static.go b/modules/templates/static.go
index fdd68c1e6a..c2295b2bd8 100644
--- a/modules/templates/static.go
+++ b/modules/templates/static.go
@@ -15,9 +15,11 @@ import (
"path/filepath"
"strings"
texttmpl "text/template"
+ "time"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
)
@@ -26,6 +28,11 @@ var (
bodyTemplates = template.New("")
)
+// GlobalModTime provide a gloabl mod time for embedded asset files
+func GlobalModTime(filename string) time.Time {
+ return timeutil.GetExecutableModTime()
+}
+
// GetAsset get a special asset, only for chi
func GetAsset(name string) ([]byte, error) {
bs, err := os.ReadFile(filepath.Join(setting.CustomPath, name))