瀏覽代碼

Upgrade esc generated templates.go

Ask Bjørn Hansen 9 年之前
父節點
當前提交
8fa571425f
共有 1 個文件被更改,包括 43 次插入15 次删除
  1. 43 15
      templates.go

+ 43 - 15
templates.go

@@ -3,6 +3,7 @@ package main
 import (
 import (
 	"bytes"
 	"bytes"
 	"compress/gzip"
 	"compress/gzip"
+	"encoding/base64"
 	"io/ioutil"
 	"io/ioutil"
 	"net/http"
 	"net/http"
 	"os"
 	"os"
@@ -19,14 +20,20 @@ type _escStaticFS struct{}
 
 
 var _escStatic _escStaticFS
 var _escStatic _escStaticFS
 
 
+type _escDirectory struct {
+	fs   http.FileSystem
+	name string
+}
+
 type _escFile struct {
 type _escFile struct {
 	compressed string
 	compressed string
 	size       int64
 	size       int64
+	modtime    int64
 	local      string
 	local      string
 	isDir      bool
 	isDir      bool
 
 
-	data []byte
 	once sync.Once
 	once sync.Once
+	data []byte
 	name string
 	name string
 }
 }
 
 
@@ -50,7 +57,8 @@ func (_escStaticFS) prepare(name string) (*_escFile, error) {
 			return
 			return
 		}
 		}
 		var gr *gzip.Reader
 		var gr *gzip.Reader
-		gr, err = gzip.NewReader(bytes.NewBufferString(f.compressed))
+		b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed))
+		gr, err = gzip.NewReader(b64)
 		if err != nil {
 		if err != nil {
 			return
 			return
 		}
 		}
@@ -70,6 +78,10 @@ func (fs _escStaticFS) Open(name string) (http.File, error) {
 	return f.File()
 	return f.File()
 }
 }
 
 
+func (dir _escDirectory) Open(name string) (http.File, error) {
+	return dir.fs.Open(dir.name + name)
+}
+
 func (f *_escFile) File() (http.File, error) {
 func (f *_escFile) File() (http.File, error) {
 	type httpFile struct {
 	type httpFile struct {
 		*bytes.Reader
 		*bytes.Reader
@@ -106,7 +118,7 @@ func (f *_escFile) Mode() os.FileMode {
 }
 }
 
 
 func (f *_escFile) ModTime() time.Time {
 func (f *_escFile) ModTime() time.Time {
-	return time.Time{}
+	return time.Unix(f.modtime, 0)
 }
 }
 
 
 func (f *_escFile) IsDir() bool {
 func (f *_escFile) IsDir() bool {
@@ -126,6 +138,15 @@ func FS(useLocal bool) http.FileSystem {
 	return _escStatic
 	return _escStatic
 }
 }
 
 
+// Dir returns a http.Filesystem for the embedded assets on a given prefix dir.
+// If useLocal is true, the filesystem's contents are instead used.
+func Dir(useLocal bool, name string) http.FileSystem {
+	if useLocal {
+		return _escDirectory{fs: _escLocal, name: name}
+	}
+	return _escDirectory{fs: _escStatic, name: name}
+}
+
 // FSByte returns the named file from the embedded assets. If useLocal is
 // FSByte returns the named file from the embedded assets. If useLocal is
 // true, the filesystem's contents are instead used.
 // true, the filesystem's contents are instead used.
 func FSByte(useLocal bool, name string) ([]byte, error) {
 func FSByte(useLocal bool, name string) ([]byte, error) {
@@ -166,18 +187,25 @@ func FSMustString(useLocal bool, name string) string {
 var _escData = map[string]*_escFile{
 var _escData = map[string]*_escFile{
 
 
 	"/templates/status.html": {
 	"/templates/status.html": {
-		local: "templates/status.html",
-		size:  3181,
-		compressed: "" +
-			"\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xb4WMS\xeb6\x14]'\xbfB\xe3)\xbb\"\x13Jf\x1a\xeax\x03\f]4\x14\x9a\xb6\x8b\xb7S\xac\x9b\xd8\xf3\x1c)OR\b\xbcL\xfe\xfb\xbb\x92?b;&\x04\xbfa\x83\xe5#\x9d+\x9d{O\xaeL\x10\x9be\x1a\x0610\x1e\x06&1)\x84\xf7 o\x1f\xa6d\xbb%\xf4\u007fP:\x91\x82" +
-			"\xecv\x81\x9fM\xf6\x834\x11_I\xac`>\xf6|_\x80\xe1\x82љ\x94F\x1b\xc5V\x11\x174\x92K\xdfl\x12c@\x9d\x97\x13\xfe%\xfd\x8d\x0e\xfcHk\xbf\xc4\xceq\xe5,\x11\xc0\xe92A\x9a\xd6\x1eQ\x90\x8e=m^S\xd01\x80\xf1N\xdd\xcf\x01\x1bf\xa2\xb8\xd8\b\xd4:\x05&\xf6\xbb\x1d\x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3\xe34G\xb2\x1a\xe2\xc5\xfd\x8b\x91\xab\xbf1kxu_\x8f\t\xfd\xb7x\xdb\xed" +
-			"\xec\xb4bb\x01\xe8%\xa7\x84X\xcc&\xb0\xdaV\xf2:a2ej\v>\x1e\x16\xb3\xc5\xed\xe8\xd9\x1c>\xe0\xa0\xcc_ᠠ(\xc9A\xa7o\xf5\xe6\x04\xb0\xa6\x91~\xabџ\xcc\x19v\xe0\f\xba\x90j\xfd\xa4E\xf4\x9d\xfdx\xfa\x88\xf2;.t\x17\xf5Mީb\x0e\xf6\xebJl̈́u_$\xd7\xc2hg\xbd\x82\xfb\x17\x9b" +
-			"A:\xb5\x9f\x1a֍7ق\x8aM\x9d\v\x91\x9b\xccK:B\xbdVc֝\x19\xbaк\xf9+.l^\x8bָG\xf3\x10W\xd6\xcb.J\xae&o\x11\xee\x94-\x17\xfav\v\x82\xdbx\xc5 W\x9d&Д}\xe3\xb0Su\xe7\x01N\x15\x9e\x05?\xa2\xbc\x1aﳤ\xf7\xcbѾo\xee\xdbf\xf6a\x8c\xdd\xd2\xfe\x97\xd1" +
-			"\xff\x11\x00\x00\xff\xff\xb0\x9dR\xc9m\f\x00\x00",
+		local:   "templates/status.html",
+		size:    3181,
+		modtime: 1442049075,
+		compressed: `
+H4sIAAAJbogA/7RXTVPrNhRdJ79C4ym7IhNKZhrqeAMMXTQUmraLt1Osm9jzHClPUgi8TP77u5I/Yjsm
+BL9hg+UjnSude0+uTBCbZRoGMTAeBiYxKYT3IG8fpmS7JfR/UDqRgux2gZ9N9oM0EV9JrGA+9nxfgOGC
+0ZmURhvFVhEXNJJL32wSY0CdlxP+Jf2NDvxIa7/EznHlLBHA6TJBmtYeUZCOPW1eU9AxgPFO3c8BG2ai
+uNgI1DoFJva7Hd3EvYX9nuH0uxQg2BJ+xbFNCyiyJXMpzPkGkkVsrslMpvwPsusHfk4LZpK/hv1+wJNn
+EqVM67EXIYOhOOXZiXgQ3qdyxtLAx2F9pZIbu6ZXxfSKid8d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