@@ -8,42 +8,39 @@ import (
88 "github.com/drduh/gone/templates"
99)
1010
11- // Index handles requests for the main index page
12- // with all available application features.
11+ const templateData = "data/*.tmpl"
12+
13+ // Index handles requests to load and render the index page.
1314func Index (app * config.App ) http.HandlerFunc {
1415 return func (w http.ResponseWriter , r * http.Request ) {
1516 req := authRequest (w , r , app )
1617 if req == nil {
1718 return
1819 }
19-
2020 app .Log .Info ("serving index" , "user" , req )
2121
2222 theme := getDefaultTheme (app .Style .Theme )
23- app .Log .Debug ("got theme" , "default" , theme )
2423 if app .Style .AllowPick {
2524 theme = getTheme (w , r , theme ,
2625 app .Cookie .Id ,
2726 app .Cookie .Time .GetDuration (),
2827 app .Style .Available )
29- app .Log .Debug ("got theme" , "selected" , theme )
3028 }
3129
32- tmpl , err := template .New ("index" ).ParseFS (templates .All , "data/*.tmpl" )
30+ tmpl , err := template .New ("index" ).ParseFS (templates .All , templateData )
3331 if err != nil {
3432 writeJSON (w , http .StatusInternalServerError , errorJSON (app .TmplParse ))
3533 app .Log .Error (app .TmplParse , "error" , err .Error (), "user" , req )
3634 return
3735 }
3836
3937 app .UpdateTimeRemaining ()
40-
4138 response := templates.Index {
4239 Auth : app .Auth ,
40+ Default : app .Default ,
4341 DefaultDuration : app .Expiration .String (),
4442 Hostname : app .Hostname ,
4543 Index : app .Index ,
46- Default : app .Default ,
4744 Limit : app .Limit ,
4845 NoFiles : app .NoFiles ,
4946 Paths : app .Paths ,
0 commit comments