summaryrefslogtreecommitdiffstats
path: root/modules/templates
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
parent21ed4fd8da4c8992518dcfb01aa7306f7406f735 (diff)
downloadgitea-a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd.tar.gz
gitea-a1c12fb0b3a88e21e4c8c8f29c13e63cf4bc38dd.zip
Don't store assets modified time into generated files (#18193)
Diffstat (limited to 'modules/templates')
-rw-r--r--modules/templates/static.go7
-rw-r--r--modules/templates/templates_bindata.go2
2 files changed, 8 insertions, 1 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))
diff --git a/modules/templates/templates_bindata.go b/modules/templates/templates_bindata.go
index 887f9eeba2..95f71d0042 100644
--- a/modules/templates/templates_bindata.go
+++ b/modules/templates/templates_bindata.go
@@ -7,4 +7,4 @@
package templates
-//go:generate go run -mod=vendor ../../build/generate-bindata.go ../../templates templates bindata.go
+//go:generate go run -mod=vendor ../../build/generate-bindata.go ../../templates templates bindata.go true