mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Add current user
This commit is contained in:
parent
256bdd2f95
commit
9b39fe78ba
@ -170,6 +170,17 @@ func (i *Info) serveSingleFile(w http.ResponseWriter, r *http.Request, c *config
|
||||
},
|
||||
}
|
||||
|
||||
// Set the current User
|
||||
user, _, ok := r.BasicAuth()
|
||||
|
||||
if !ok {
|
||||
page.Info.User = c.UserConfig
|
||||
}
|
||||
|
||||
if _, ok := c.Users[user]; ok {
|
||||
page.Info.User = c.Users[user]
|
||||
}
|
||||
|
||||
if CanBeEdited(i.Name) {
|
||||
editor, err := i.GetEditor()
|
||||
|
||||
@ -250,6 +261,17 @@ func (i *Info) serveListing(w http.ResponseWriter, r *http.Request, c *config.Co
|
||||
},
|
||||
}
|
||||
|
||||
// Set the current User
|
||||
user, _, ok := r.BasicAuth()
|
||||
|
||||
if !ok {
|
||||
page.Info.User = c.UserConfig
|
||||
}
|
||||
|
||||
if _, ok := c.Users[user]; ok {
|
||||
page.Info.User = c.Users[user]
|
||||
}
|
||||
|
||||
if r.Header.Get("Minimal") == "true" {
|
||||
page.Minimal = true
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ type Info struct {
|
||||
Path string
|
||||
IsDir bool
|
||||
Config *config.Config
|
||||
User *config.UserConfig
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user