diff options
author | Maxim Devaev <[email protected]> | 2025-01-05 15:19:04 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2025-01-05 15:19:04 +0200 |
commit | 4488365dfbbf7b35cd7b27f0392768e273cd271d (patch) | |
tree | fc91746f67bcfed4b62e10738ae07d6a08547db1 /kvmd | |
parent | 5a61ddecd3a6fadb71464cc32823e63a8009fb2b (diff) |
removed _state suffix from all ws events
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/server.py | 18 | ||||
-rw-r--r-- | kvmd/apps/pst/server.py | 2 | ||||
-rw-r--r-- | kvmd/apps/pstrun/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/apps/vnc/server.py | 4 | ||||
-rw-r--r-- | kvmd/clients/pst.py | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index 17fd85d0..858ba1b6 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -131,15 +131,15 @@ class _Subsystem: class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-instance-attributes - __EV_GPIO_STATE = "gpio_state" - __EV_HID_STATE = "hid_state" - __EV_HID_KEYMAPS_STATE = "hid_keymaps_state" # FIXME - __EV_ATX_STATE = "atx_state" - __EV_MSD_STATE = "msd_state" - __EV_STREAMER_STATE = "streamer_state" - __EV_OCR_STATE = "ocr_state" - __EV_INFO_STATE = "info_state" - __EV_SWITCH_STATE = "switch_state" + __EV_GPIO_STATE = "gpio" + __EV_HID_STATE = "hid" + __EV_HID_KEYMAPS_STATE = "hid_keymaps" # FIXME + __EV_ATX_STATE = "atx" + __EV_MSD_STATE = "msd" + __EV_STREAMER_STATE = "streamer" + __EV_OCR_STATE = "ocr" + __EV_INFO_STATE = "info" + __EV_SWITCH_STATE = "switch" def __init__( # pylint: disable=too-many-arguments,too-many-locals self, diff --git a/kvmd/apps/pst/server.py b/kvmd/apps/pst/server.py index d96043b3..ddeccc41 100644 --- a/kvmd/apps/pst/server.py +++ b/kvmd/apps/pst/server.py @@ -129,7 +129,7 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst await self.__notifier.wait() async def __broadcast_storage_state(self, clients: int, write_allowed: bool) -> None: - await self._broadcast_ws_event("storage_state", { + await self._broadcast_ws_event("storage", { "clients": clients, "data": { "path": self.__data_path, diff --git a/kvmd/apps/pstrun/__init__.py b/kvmd/apps/pstrun/__init__.py index 33e1396e..d55835fd 100644 --- a/kvmd/apps/pstrun/__init__.py +++ b/kvmd/apps/pstrun/__init__.py @@ -84,7 +84,7 @@ async def _run_cmd_ws(cmd: list[str], ws: aiohttp.ClientWebSocketResponse) -> in msg = receive_task.result() if msg.type == aiohttp.WSMsgType.TEXT: (event_type, event) = htserver.parse_ws_event(msg.data) - if event_type == "storage_state": + if event_type == "storage": if event["data"]["write_allowed"] and proc is None: logger.info("PST write is allowed: %s", event["data"]["path"]) logger.info("Running the process ...") diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py index 6bb7caed..b2ae71fa 100644 --- a/kvmd/apps/vnc/server.py +++ b/kvmd/apps/vnc/server.py @@ -177,7 +177,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes self.__kvmd_ws = None async def __process_ws_event(self, event_type: str, event: dict) -> None: - if event_type == "info_state": + if event_type == "info": if "meta" in event: try: host = event["meta"]["server"]["host"] @@ -190,7 +190,7 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes await self._send_rename(name) self.__shared_params.name = name - elif event_type == "hid_state": + elif event_type == "hid": if ( self._encodings.has_leds_state and ("keyboard" in event) diff --git a/kvmd/clients/pst.py b/kvmd/clients/pst.py index 6b9f5234..868f388c 100644 --- a/kvmd/clients/pst.py +++ b/kvmd/clients/pst.py @@ -75,7 +75,7 @@ class PstClient: if msg.type != aiohttp.WSMsgType.TEXT: raise PstError(f"Unexpected message type: {msg!r}") (event_type, event) = htserver.parse_ws_event(msg.data) - if event_type == "storage_state": + if event_type == "storage": if not event["data"]["write_allowed"]: raise PstError("Write is not allowed") path = event["data"]["path"] |