This handler provides consistent error reporting in the event that the client attempts to access an unknown endpoint. If the request is unauthorized, an 401 will be returned. Otherwise a 404 will be returned, however if CORS is available the CORS headers will be set.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Pass GIT_HTTP_LOW_SPEED_LIMIT and GIT_HTTP_LOW_SPEED_TIME environment variables to the "git fetch" and "git pull" commands. If the remote is unreachable this should force the command to timeout before Moonraker forcefully terminates it.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This brings consistency to the "run" methods. It also removes potential confusion between the previous "quiet" argument and the "verbose" argument in "run()".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
A consumer of shell command can achieve "fire and forget" by scheduling the future returned by "run()" to execute on the event loop.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is now possible to redirect stderr to a callback for asynchronous message transfer. Also added is the env option, allowing custom environment variables to be passed to the subprocess.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Rather than use terminate to pre-emptively exit a shell command, attempt to exit with SIGINT, SIGTERM, and finally SIGKILL.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Moving log level init to the app module and have it explicitly set the level. This allows the logging level to be toggled with a server restart. Default debug logging to False.
When debug logging is disabled do not log HTTP requests.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Only report extruder and bed temperatures. Use dict "get()" methods to make sure that the fields are available.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This error is an indication that a JSON body was sent without the content type set to "application/json".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The prior implementations assumed that uploaded files would be buffered in memory.
This is no longer the case, so UFP extraction is more efficient when done straight to disk.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This PR is a minimal implementation of the Octoprint REST API that is required
for Cura to be able to establish a connection and send gcode/UFP files to
moonraker without errors.
Currently it only supports the "global apikey authentication" method.
Signed-off-by: Nickolas Grigoriadis <nagrigoriadis@gmail.com>
When a websocket is closed, set "is_closed" to True in the on_closed handler. When closing all websockets, iterate through a list of values.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This allows gcode file metadata to persist through restarts, reducing the time spent parsing. The gcode file path also persists, so it is available even when Klippy is not.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
At times a subprocess created by shell command fails. Attempt to mitigate this by using asyncio's version of subprocess, which should be more stable when running via the event loop.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Instead, look up klippy_apis after all plugins are loaded. This allows the "CORE_PLUGINS" list to determine the exact order in which core plugins are loaded.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>