octoprint_compat: Compatibility with Cura Octoprint plugin to upload UFP files.

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>
This commit is contained in:
Grigi
2021-02-28 13:44:21 +02:00
committed by Arksine
parent 228ed34eb1
commit 39ab419c1f
2 changed files with 279 additions and 10 deletions

View File

@@ -92,8 +92,7 @@ class MoonrakerApp:
self.mutable_router = MutableRouter(self)
app_handlers = [
(AnyMatches(), self.mutable_router),
(r"/websocket", WebSocket),
(r"/api/version", EmulateOctoprintHandler)]
(r"/websocket", WebSocket)]
self.app = tornado.web.Application(
app_handlers,
@@ -368,11 +367,3 @@ class FileUploadHandler(AuthorizedRequestHandler):
raise tornado.web.HTTPError(
e.status_code, str(e))
self.finish(result)
class EmulateOctoprintHandler(AuthorizedRequestHandler):
def get(self):
self.finish({
'server': "1.1.1",
'api': "0.1",
'text': "OctoPrint Upload Emulator"})