app: move reserved endpoints to klippy_connection
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
225ec588eb
commit
019c5fc416
|
@ -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
|
||||
|
|
|
@ -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,6 +326,7 @@ class KlippyConnection:
|
|||
endpoints = result.get('endpoints', [])
|
||||
app: MoonrakerApp = self.server.lookup_component("application")
|
||||
for ep in endpoints:
|
||||
if ep not in RESERVED_ENDPOINTS:
|
||||
app.register_remote_handler(ep)
|
||||
|
||||
async def _check_ready(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue