vnc: removed allow_cut_after for a future hotkey paste

This commit is contained in:
Maxim Devaev 2025-05-07 04:41:32 +03:00
parent d630e24aa0
commit a65cd7feb5
4 changed files with 1 additions and 18 deletions

View File

@ -747,7 +747,6 @@ def _get_config_scheme() -> dict:
"mouse_output": Option("usb", type=valid_hid_mouse_output),
"keymap": Option("/usr/share/kvmd/keymaps/en-us", type=valid_abs_file),
"scroll_rate": Option(4, type=functools.partial(valid_number, min=1, max=30)),
"allow_cut_after": Option(3.0, type=valid_float_f0),
"server": {
"host": Option("", type=valid_ip_or_host, if_empty=""),

View File

@ -71,7 +71,6 @@ def main(argv: (list[str] | None)=None) -> None:
mouse_output=config.mouse_output,
keymap_path=config.keymap,
scroll_rate=config.scroll_rate,
allow_cut_after=config.allow_cut_after,
kvmd=KvmdClient(user_agent=user_agent, **config.kvmd._unpack()),
streamers=streamers,

View File

@ -22,7 +22,6 @@
import asyncio
import ssl
import time
from typing import Callable
from typing import Coroutine
@ -66,7 +65,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
height: int,
name: str,
scroll_rate: int,
allow_cut_after: float,
vncpasses: set[str],
vencrypt: bool,
@ -84,7 +82,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
self._height = height
self.__name = name
self.__scroll_rate = scroll_rate
self.__allow_cut_after = allow_cut_after
self.__vncpasses = vncpasses
self.__vencrypt = vencrypt
@ -97,8 +94,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
self.__fb_cont_updates = False
self.__fb_reset_h264 = False
self.__allow_cut_since_ts = 0.0
self.__lock = asyncio.Lock()
# =====
@ -422,7 +417,6 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
# =====
async def __main_loop(self) -> None:
self.__allow_cut_since_ts = time.monotonic() + self.__allow_cut_after
handlers = {
0: self.__handle_set_pixel_format,
2: self.__handle_set_encodings,
@ -518,12 +512,7 @@ class RfbClient(RfbClientStream): # pylint: disable=too-many-instance-attribute
async def __handle_client_cut_text(self) -> None:
length = (await self._read_struct("cut text length", "xxx L"))[0]
text = await self._read_text("cut text data", length)
if self.__allow_cut_since_ts > 0 and time.monotonic() >= self.__allow_cut_since_ts:
# We should ignore cut event a few seconds after handshake
# because bVNC, AVNC and maybe some other clients perform
# it right after the connection automatically.
# - https://github.com/pikvm/pikvm/issues/1420
await self._on_cut_event(text)
await self._on_cut_event(text)
async def __handle_enable_cont_updates(self) -> None:
enabled = bool((await self._read_struct("enabled ContUpdates", "B HH HH"))[0])

View File

@ -82,7 +82,6 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
keymap_name: str,
symmap: dict[int, dict[int, int]],
scroll_rate: int,
allow_cut_after: float,
kvmd: KvmdClient,
streamers: list[BaseStreamerClient],
@ -102,7 +101,6 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes
x509_cert_path=x509_cert_path,
x509_key_path=x509_key_path,
scroll_rate=scroll_rate,
allow_cut_after=allow_cut_after,
vncpasses=vncpasses,
vencrypt=vencrypt,
none_auth_only=none_auth_only,
@ -464,7 +462,6 @@ class VncServer: # pylint: disable=too-many-instance-attributes
mouse_output: str,
keymap_path: str,
scroll_rate: int,
allow_cut_after: float,
kvmd: KvmdClient,
streamers: list[BaseStreamerClient],
@ -523,7 +520,6 @@ class VncServer: # pylint: disable=too-many-instance-attributes
keymap_name=keymap_name,
symmap=symmap,
scroll_rate=scroll_rate,
allow_cut_after=allow_cut_after,
kvmd=kvmd,
streamers=streamers,
vncpasses=(await self.__read_vncpasses()),