mirror of
https://github.com/nkanaev/yarr.git
synced 2026-07-15 11:06:31 +00:00
frontend: simplify assets filesystem
This commit is contained in:
@@ -44,7 +44,7 @@ func (m *Middleware) Handler(c *router.Context) {
|
||||
c.Redirect(rootUrl)
|
||||
return
|
||||
} else {
|
||||
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]any{
|
||||
c.HTML(http.StatusOK, assets.Templates().Lookup("login.html"), map[string]any{
|
||||
"username": username,
|
||||
"hasError": true,
|
||||
"settings": m.DB.GetSettings().Map(),
|
||||
@@ -52,7 +52,7 @@ func (m *Middleware) Handler(c *router.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]any{
|
||||
c.HTML(http.StatusOK, assets.Templates().Lookup("login.html"), map[string]any{
|
||||
"hasError": false,
|
||||
"settings": m.DB.GetSettings().Map(),
|
||||
})
|
||||
|
||||
@@ -64,7 +64,7 @@ func (s *Server) handler() http.Handler {
|
||||
}
|
||||
|
||||
func (s *Server) handleIndex(c *router.Context) {
|
||||
c.HTML(http.StatusOK, assets.Template("index.html"), map[string]any{
|
||||
c.HTML(http.StatusOK, assets.Templates().Lookup("index.html"), map[string]any{
|
||||
"settings": s.db.GetSettings().Map(),
|
||||
"authenticated": s.Username != "" && s.Password != "",
|
||||
})
|
||||
@@ -77,7 +77,7 @@ func (s *Server) handleStatic(c *router.Context) {
|
||||
c.Out.WriteHeader(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
http.StripPrefix(s.BasePath+"/static/", http.FileServer(http.FS(assets.FS))).
|
||||
http.StripPrefix(s.BasePath+"/static/", http.FileServer(http.FS(assets.StaticFS()))).
|
||||
ServeHTTP(c.Out, c.Req)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user