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
Former-commit-id: e2a84ea45e19a6c34c2a89fa2804ce63c35cbf53 [formerly d995af7874f5ee0ee22442357ebd4e160bed2786] [formerly ee876a568e127817caae55506ab128246237b5a8 [formerly 729064ffc8]]
Former-commit-id: 64554cfd503eab2e5daf0b33971fea1924ac8249 [formerly 8b6fa3f88083530ceeab62d52fbc381b1ac6c335]
Former-commit-id: 3df08dbb64f46dee8c4ceebfcac273038960eec1
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