Fix --allow-remote-control not working with allow_remote_control=no

This commit is contained in:
Kovid Goyal 2022-08-16 11:42:39 +05:30
parent 5ffc4c6498
commit e8de2def96
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -453,10 +453,12 @@ class Boss:
from .remote_control import is_cmd_allowed, parse_cmd
response = None
window = window or None
if self.allow_remote_control == 'n':
return {'ok': False, 'error': 'Remote control is disabled'}
if self.allow_remote_control == 'socket-only' and peer_id == 0:
return {'ok': False, 'error': 'Remote control is allowed over a socket only'}
window_has_remote_control = bool(window and window.allow_remote_control)
if not window_has_remote_control:
if self.allow_remote_control == 'n':
return {'ok': False, 'error': 'Remote control is disabled'}
if self.allow_remote_control == 'socket-only' and peer_id == 0:
return {'ok': False, 'error': 'Remote control is allowed over a socket only'}
try:
pcmd = parse_cmd(cmd, self.encryption_key)
except Exception as e: