app: refactor upload handler registration
Move upload handler registration out of the file manager. Register the primary hander in the app module, and the Octoprint Comptaiblity handler in octoprint_compat. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
ac9eaa7681
commit
b369173f94
|
@ -176,6 +176,7 @@ class MoonrakerApp:
|
|||
"moonraker.log", logfile, force=True)
|
||||
self.register_static_file_handler(
|
||||
"klippy.log", DEFAULT_KLIPPY_LOG_PATH, force=True)
|
||||
self.register_upload_handler("/server/files/upload")
|
||||
|
||||
def _get_path_option(self, config: ConfigHelper, option: str) -> str:
|
||||
path: Optional[str] = config.get(option, None)
|
||||
|
|
|
@ -87,9 +87,6 @@ class FileManager:
|
|||
transports=["websocket"])
|
||||
# register client notificaitons
|
||||
self.server.register_notification("file_manager:filelist_changed")
|
||||
# Register APIs to handle file uploads
|
||||
self.server.register_upload_handler("/server/files/upload")
|
||||
self.server.register_upload_handler("/api/files/local")
|
||||
|
||||
self.server.register_event_handler(
|
||||
"server:klippy_identified", self._update_fixed_paths)
|
||||
|
|
|
@ -95,6 +95,10 @@ class OctoprintCompat:
|
|||
'/api/printerprofiles', ['GET'], self._get_printerprofiles,
|
||||
transports=['http'], wrap_result=False)
|
||||
|
||||
# Upload Handlers
|
||||
self.server.register_upload_handler(
|
||||
"/api/files/local", location_prefix="api/moonraker/files/")
|
||||
|
||||
# System
|
||||
# TODO: shutdown/reboot/restart operations
|
||||
|
||||
|
|
Loading…
Reference in New Issue