fix: no auth
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
parent
bf054c6379
commit
bc7464d3f5
@ -9,6 +9,7 @@ import (
|
|||||||
// ConfigStore is a configuration store.
|
// ConfigStore is a configuration store.
|
||||||
type ConfigStore struct {
|
type ConfigStore struct {
|
||||||
DB *storm.DB
|
DB *storm.DB
|
||||||
|
Users types.UsersStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get gets a configuration from the database to an interface.
|
// 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 {
|
if t == auth.MethodNoAuth {
|
||||||
auther := auth.NoAuth{}
|
auther := auth.NoAuth{Store: c.Users}
|
||||||
if err := c.Get("auther", &auther); err != nil {
|
if err := c.Get("auther", &auther); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ listening on loalhost on a random port. Use the flags to change it.`,
|
|||||||
env := &fhttp.Env{
|
env := &fhttp.Env{
|
||||||
Store: &types.Store{
|
Store: &types.Store{
|
||||||
Users: bolt.UsersStore{DB: db},
|
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},
|
Share: bolt.ShareStore{DB: db},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
2
frontend
2
frontend
@ -1 +1 @@
|
|||||||
Subproject commit daaf341bc3b6a973a9b32dbeb6b02331cedb6b05
|
Subproject commit 358f3bf714200c6b2e8cafb95ea012e1ef69d3a2
|
||||||
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/filebrowser/filebrowser/types"
|
"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, "/")
|
baseURL := strings.TrimSuffix(e.Settings.BaseURL, "/")
|
||||||
staticURL := strings.TrimPrefix(baseURL+"/static", "/")
|
staticURL := strings.TrimPrefix(baseURL+"/static", "/")
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ func (e *Env) getStaticData () map[string]interface{} {
|
|||||||
"Version": types.Version,
|
"Version": types.Version,
|
||||||
"StaticURL": staticURL,
|
"StaticURL": staticURL,
|
||||||
"Signup": e.Settings.Signup,
|
"Signup": e.Settings.Signup,
|
||||||
|
"NoAuth": e.Settings.AuthMethod == auth.MethodNoAuth,
|
||||||
"CSS": false,
|
"CSS": false,
|
||||||
"ReCaptcha": false,
|
"ReCaptcha": false,
|
||||||
}
|
}
|
||||||
@ -63,7 +64,6 @@ func (e *Env) getStaticHandlers() (http.Handler, http.Handler) {
|
|||||||
box := rice.MustFindBox("../frontend/dist")
|
box := rice.MustFindBox("../frontend/dist")
|
||||||
handler := http.FileServer(box.HTTPBox())
|
handler := http.FileServer(box.HTTPBox())
|
||||||
|
|
||||||
|
|
||||||
handleWithData := func(w http.ResponseWriter, r *http.Request, file string, contentType string) {
|
handleWithData := func(w http.ResponseWriter, r *http.Request, file string, contentType string) {
|
||||||
w.Header().Set("Content-Type", contentType)
|
w.Header().Set("Content-Type", contentType)
|
||||||
index := template.Must(template.New("index").Delims("[{[", "]}]").Parse(box.MustString(file)))
|
index := template.Must(template.New("index").Delims("[{[", "]}]").Parse(box.MustString(file)))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user