You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
Commands and such
This commit is contained in:
32
settings.go
32
settings.go
@@ -49,3 +49,35 @@ func commandsPutHandler(c *RequestContext, w http.ResponseWriter, r *http.Reques
|
||||
c.FM.Commands = commands
|
||||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
func pluginsHandler(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
return pluginsGetHandler(c, w, r)
|
||||
case http.MethodPut:
|
||||
return pluginsPutHandler(c, w, r)
|
||||
}
|
||||
|
||||
return http.StatusMethodNotAllowed, nil
|
||||
}
|
||||
|
||||
func pluginsGetHandler(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
if !c.User.Admin {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
return renderJSON(w, c.FM.Plugins)
|
||||
}
|
||||
|
||||
func pluginsPutHandler(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
if !c.User.Admin {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
if r.Body == nil {
|
||||
return http.StatusBadGateway, errors.New("Empty request body")
|
||||
}
|
||||
|
||||
// TODO
|
||||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user