feat: add disable exec flag (#1090)

This commit is contained in:
Keagan McClelland
2020-10-01 08:45:24 -06:00
committed by GitHub
parent 1529e796df
commit 97693cc611
14 changed files with 53 additions and 28 deletions

View File

@@ -59,7 +59,7 @@ var commandsHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *d
}
}
if !d.user.CanExecute(strings.Split(raw, " ")[0]) {
if !d.server.EnableExec || !d.user.CanExecute(strings.Split(raw, " ")[0]) {
if err := conn.WriteMessage(websocket.TextMessage, cmdNotAllowed); err != nil { //nolint:shadow
wsErr(conn, r, http.StatusInternalServerError, err)
}

View File

@@ -51,7 +51,7 @@ func handle(fn handleFunc, prefix string, store *storage.Storage, server *settin
}
status, err := fn(w, r, &data{
Runner: &runner.Runner{Settings: settings},
Runner: &runner.Runner{Enabled: server.EnableExec, Settings: settings},
store: store,
settings: settings,
server: server,

View File

@@ -41,6 +41,7 @@ func handleWithStaticData(w http.ResponseWriter, _ *http.Request, d *data, box *
"Theme": d.settings.Branding.Theme,
"EnableThumbs": d.server.EnableThumbnails,
"ResizePreview": d.server.ResizePreview,
"EnableExec": d.server.EnableExec,
}
if d.settings.Branding.Files != "" {