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) {
|
if CanBeEdited(i.Name) {
|
||||||
editor, err := i.GetEditor()
|
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" {
|
if r.Header.Get("Minimal") == "true" {
|
||||||
page.Minimal = true
|
page.Minimal = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ type Info struct {
|
||||||
Path string
|
Path string
|
||||||
IsDir bool
|
IsDir bool
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
|
User *config.UserConfig
|
||||||
Data interface{}
|
Data interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue