From cda32a083faf3e7326cfe317336e473c905c6dfd Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Mon, 21 Oct 2024 17:46:59 +0300 Subject: new events model --- kvmd/apps/vnc/server.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'kvmd/apps/vnc/server.py') diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py index f8e97050..a6e89311 100644 --- a/kvmd/apps/vnc/server.py +++ b/kvmd/apps/vnc/server.py @@ -175,17 +175,18 @@ 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_meta_state": - try: - host = event["server"]["host"] - except Exception: - host = None - else: - if isinstance(host, str): - name = f"PiKVM: {host}" - if self._encodings.has_rename: - await self._send_rename(name) - self.__shared_params.name = name + if event_type == "info_state": + if "meta" in event: + try: + host = event["meta"]["server"]["host"] + except Exception: + host = None + else: + if isinstance(host, str): + name = f"PiKVM: {host}" + if self._encodings.has_rename: + await self._send_rename(name) + self.__shared_params.name = name elif event_type == "hid_state": if self._encodings.has_leds_state: -- cgit v1.2.3