Address stale css on restart automatically
This commit is contained in:
parent
377fcd0230
commit
96d0f7ea4b
|
@ -26,6 +26,7 @@ type SnapContent struct {
|
||||||
Theme string
|
Theme string
|
||||||
Meta map[string]string
|
Meta map[string]string
|
||||||
Content interface{}
|
Content interface{}
|
||||||
|
Version int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) GetRequest() *http.Request {
|
func (c *Context) GetRequest() *http.Request {
|
||||||
|
@ -106,6 +107,7 @@ func (c *Context) RenderEx(tmpl string, content interface{}) {
|
||||||
Theme: c.srv.theme,
|
Theme: c.srv.theme,
|
||||||
Meta: c.srv.meta,
|
Meta: c.srv.meta,
|
||||||
Content: content,
|
Content: content,
|
||||||
|
Version: c.srv.version,
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.auth != nil {
|
if c.auth != nil {
|
||||||
|
@ -132,6 +134,7 @@ func (c *Context) RenderWithMeta(tmpl string, meta map[string]string, content in
|
||||||
Theme: c.srv.theme,
|
Theme: c.srv.theme,
|
||||||
Meta: meta,
|
Meta: meta,
|
||||||
Content: content,
|
Content: content,
|
||||||
|
Version: c.srv.version,
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.auth != nil {
|
if c.auth != nil {
|
||||||
|
|
|
@ -40,6 +40,7 @@ type Server struct {
|
||||||
// testModeEnabled if test mode is enabled we will not render the template but jsut return the
|
// testModeEnabled if test mode is enabled we will not render the template but jsut return the
|
||||||
// json object
|
// json object
|
||||||
testModeEnabled bool
|
testModeEnabled bool
|
||||||
|
version int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type SnapBaseContent struct {
|
type SnapBaseContent struct {
|
||||||
|
@ -401,6 +402,11 @@ func (s *Server) WithAuth(auth auth.Authenticator) *Server {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) WithVersion(version int64) *Server {
|
||||||
|
s.version = version
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) WithHealthCheck(version, date string, status func() (bool, string)) {
|
func (s *Server) WithHealthCheck(version, date string, status func() (bool, string)) {
|
||||||
s.HandleFunc("/_health", func(c *Context) {
|
s.HandleFunc("/_health", func(c *Context) {
|
||||||
ok, msg := status()
|
ok, msg := status()
|
||||||
|
@ -449,6 +455,7 @@ func New(address string, path string, auth auth.Authenticator) *Server {
|
||||||
theme: "/static/css/default.css",
|
theme: "/static/css/default.css",
|
||||||
meta: make(map[string]string),
|
meta: make(map[string]string),
|
||||||
log: log.WithName("SNAP"),
|
log: log.WithName("SNAP"),
|
||||||
|
version: time.Now().Unix(),
|
||||||
}
|
}
|
||||||
return &s
|
return &s
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue