diff --git a/moonraker/app.py b/moonraker/app.py index 1798c03..1b40dc3 100644 --- a/moonraker/app.py +++ b/moonraker/app.py @@ -55,12 +55,6 @@ if TYPE_CHECKING: AuthComp = Optional[components.authorization.Authorization] APICallback = Callable[[WebRequest], Coroutine] -# These endpoints are reserved for klippy/server communication only and are -# not exposed via http or the websocket -RESERVED_ENDPOINTS = [ - "list_endpoints", "gcode/subscribe_output", - "register_remote_method" -] # 50 MiB Max Standard Body Size MAX_BODY_SIZE = 50 * 1024 * 1024 @@ -321,8 +315,6 @@ class MoonrakerApp: return self.api_cache def register_remote_handler(self, endpoint: str) -> None: - if endpoint in RESERVED_ENDPOINTS: - return api_def = self._create_api_definition(endpoint) if api_def.uri in self.registered_base_handlers: # reserved handler or already registered diff --git a/moonraker/klippy_connection.py b/moonraker/klippy_connection.py index f43d2dd..b05cddb 100644 --- a/moonraker/klippy_connection.py +++ b/moonraker/klippy_connection.py @@ -37,6 +37,14 @@ if TYPE_CHECKING: from components.machine import Machine FlexCallback = Callable[..., Optional[Coroutine]] +# These endpoints are reserved for klippy/moonraker communication only and are +# not exposed via http or the websocket +RESERVED_ENDPOINTS = [ + "list_endpoints", + "gcode/subscribe_output", + "register_remote_method", +] + INIT_TIME = .25 LOG_ATTEMPT_INTERVAL = int(2. / INIT_TIME + .5) MAX_LOG_ATTEMPTS = 10 * LOG_ATTEMPT_INTERVAL @@ -318,7 +326,8 @@ class KlippyConnection: endpoints = result.get('endpoints', []) app: MoonrakerApp = self.server.lookup_component("application") for ep in endpoints: - app.register_remote_handler(ep) + if ep not in RESERVED_ENDPOINTS: + app.register_remote_handler(ep) async def _check_ready(self) -> None: send_id = "identified" not in self.init_list