Custom process accordions
There is a half-implemented feature that should enable the admin to add custom processes to the control server to be launched from within the dashboard.
Idea
The idea is to configure custom accordion panels inside Server -> config -> ui-config.json with the folloing syntax:
[
{
"title": <your title>,
"body": <panel description>,
"command": <command to execute>,
"args": [<array of args as strings>]
}
]
The control server server.js should read this file and send it to the frontend. The frontend should interpret the incoming list and render the necessary accordion modules accordingly. Each module should have a text field to show the process' output and a button to start/stop the process. On clicking 'start', the frontend calls localhost:7273/api/start-custom-process with the correct custom-process-id. On clicking stop, localhost:7273/api/stop-custom-process is called in the same way.
Important
The custom commands to be executed are only(!) specified control-server-side inside
ui-config.jsonand must not be forwarded to the frontend. The frontend should only callstart-custom-processandstop-custom-processby sending an id. This is to ensure there is no way of remote code execution on the server via the dashboard web page.
Alread implemented
The following is already implemented:
-
The control server already validates
ui-config.jsonon startup. If the file is missing or incorrect, a warning is displayed in the cmd window after runningstart.bat -
The control server sends the list of specified modules when
http://localhost:7273/api/get-additional-panelsis called with GET -
The frontend calls
http://localhost:7273/api/get-additional-panelson startup, saves the incoming modules indata.additionalPanelsand renders them correctly
ToDo
-
In the frontend, the start/stop button is missing currently. Add a button to the procedually rendered accordion modules and add a function to that button, that calls
start-custom-processorstop-custom-processtogether with the right ID depending on the state of the process (start if stopped, stop if currently running) -
Implement
start-custom-processandstop-custom-processinserver.js. Expect an id and start/stop the defined process corresponding to that id. Throw an error, if the id is unknown. Remember to use authentification to ensure no unauthorized code execution is possible. -
Once the frontend features are fully implemented and thoroughly tested, bundle the frontend and move the bundled output to
Server/wwwto make the control server use the new frontend