Implement the permissions system for password based rc requests

This commit is contained in:
Kovid Goyal
2022-08-10 15:49:50 +05:30
parent fe07825ad9
commit 2c83b9902e
5 changed files with 126 additions and 35 deletions

View File

@@ -610,7 +610,7 @@ class Options:
kitten_alias: typing.Dict[str, str] = {}
modify_font: typing.Dict[str, kitty.fonts.FontModification] = {}
narrow_symbols: typing.Dict[typing.Tuple[int, int], int] = {}
remote_control_password: typing.Dict[str, typing.Tuple[str, ...]] = {}
remote_control_password: typing.Dict[str, typing.FrozenSet[str]] = {}
symbol_map: typing.Dict[typing.Tuple[int, int], str] = {}
watcher: typing.Dict[str, str] = {}
map: typing.List[kitty.options.utils.KeyDefinition] = []

View File

@@ -675,14 +675,14 @@ def config_or_absolute_path(x: str, env: Optional[Dict[str, str]] = None) -> Opt
return resolve_abs_or_config_path(x, env)
def remote_control_password(val: str, current_val: Dict[str, str]) -> Iterable[Tuple[str, Tuple[str, ...]]]:
def remote_control_password(val: str, current_val: Dict[str, str]) -> Iterable[Tuple[str, FrozenSet[str]]]:
val = val.strip()
if val:
parts = to_cmdline(val, expand=False)
if len(parts) == 1:
yield parts[0], ()
yield parts[0], frozenset()
else:
yield parts[0], tuple(parts[1:])
yield parts[0], frozenset(parts[1:])
def allow_remote_control(x: str) -> str: