diff --git a/bolt/config.go b/bolt/config.go index 1f1d0662..2a715610 100644 --- a/bolt/config.go +++ b/bolt/config.go @@ -9,6 +9,7 @@ import ( // ConfigStore is a configuration store. type ConfigStore struct { DB *storm.DB + Users types.UsersStore } // Get gets a configuration from the database to an interface. @@ -68,7 +69,7 @@ func (c ConfigStore) GetAuther(t types.AuthMethod) (types.Auther, error) { } if t == auth.MethodNoAuth { - auther := auth.NoAuth{} + auther := auth.NoAuth{Store: c.Users} if err := c.Get("auther", &auther); err != nil { return nil, err } diff --git a/cmd/root.go b/cmd/root.go index aa667f81..81f4f772 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -68,7 +68,7 @@ listening on loalhost on a random port. Use the flags to change it.`, env := &fhttp.Env{ Store: &types.Store{ Users: bolt.UsersStore{DB: db}, - Config: bolt.ConfigStore{DB: db}, + Config: bolt.ConfigStore{DB: db, Users: bolt.UsersStore{DB: db}}, Share: bolt.ShareStore{DB: db}, }, } diff --git a/frontend b/frontend index daaf341b..358f3bf7 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit daaf341bc3b6a973a9b32dbeb6b02331cedb6b05 +Subproject commit 358f3bf714200c6b2e8cafb95ea012e1ef69d3a2 diff --git a/http/static.go b/http/static.go index 653e88d5..2693baf0 100644 --- a/http/static.go +++ b/http/static.go @@ -14,7 +14,7 @@ import ( "github.com/filebrowser/filebrowser/types" ) -func (e *Env) getStaticData () map[string]interface{} { +func (e *Env) getStaticData() map[string]interface{} { baseURL := strings.TrimSuffix(e.Settings.BaseURL, "/") staticURL := strings.TrimPrefix(baseURL+"/static", "/") @@ -26,6 +26,7 @@ func (e *Env) getStaticData () map[string]interface{} { "Version": types.Version, "StaticURL": staticURL, "Signup": e.Settings.Signup, + "NoAuth": e.Settings.AuthMethod == auth.MethodNoAuth, "CSS": false, "ReCaptcha": false, } @@ -63,7 +64,6 @@ func (e *Env) getStaticHandlers() (http.Handler, http.Handler) { box := rice.MustFindBox("../frontend/dist") handler := http.FileServer(box.HTTPBox()) - handleWithData := func(w http.ResponseWriter, r *http.Request, file string, contentType string) { w.Header().Set("Content-Type", contentType) index := template.Must(template.New("index").Delims("[{[", "]}]").Parse(box.MustString(file)))