permisson block input

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-11-05 21:53:21 +08:00
parent 663d355a48
commit d528fd3762
49 changed files with 157 additions and 13 deletions

View File

@ -191,6 +191,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
} }
// blockUserInput // blockUserInput
if (ffi.ffiModel.keyboard && if (ffi.ffiModel.keyboard &&
ffi.ffiModel.permissions['block_input'] != false &&
pi.platform == kPeerPlatformWindows) // privacy-mode != true ?? pi.platform == kPeerPlatformWindows) // privacy-mode != true ??
{ {
v.add(TTextMenu( v.add(TTextMenu(

View File

@ -649,6 +649,10 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
_OptionCheckBox( _OptionCheckBox(
context, 'Enable Recording Session', 'enable-record-session', context, 'Enable Recording Session', 'enable-record-session',
enabled: enabled, fakeValue: fakeValue), enabled: enabled, fakeValue: fakeValue),
if (Platform.isWindows)
_OptionCheckBox(
context, 'Enable Block User Input', 'enable-block-input',
enabled: enabled, fakeValue: fakeValue),
_OptionCheckBox(context, 'Enable remote configuration modification', _OptionCheckBox(context, 'Enable remote configuration modification',
'allow-remote-config-modification', 'allow-remote-config-modification',
enabled: enabled, fakeValue: fakeValue), enabled: enabled, fakeValue: fakeValue),

View File

@ -536,7 +536,6 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
child: Icon( child: Icon(
iconData, iconData,
color: Colors.white, color: Colors.white,
size: 32,
), ),
), ),
], ],
@ -548,9 +547,11 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final crossAxisCount = 4;
final spacing = 10.0;
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 200.0, height: 160.0,
margin: EdgeInsets.all(5.0), margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(5.0), padding: EdgeInsets.all(5.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -575,10 +576,10 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
).marginOnly(left: 4.0, bottom: 8.0), ).marginOnly(left: 4.0, bottom: 8.0),
Expanded( Expanded(
child: GridView.count( child: GridView.count(
crossAxisCount: 3, crossAxisCount: crossAxisCount,
padding: EdgeInsets.symmetric(horizontal: 20.0), padding: EdgeInsets.symmetric(horizontal: spacing),
mainAxisSpacing: 20.0, mainAxisSpacing: spacing,
crossAxisSpacing: 20.0, crossAxisSpacing: spacing,
children: [ children: [
buildPermissionIcon( buildPermissionIcon(
client.keyboard, client.keyboard,
@ -651,6 +652,22 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
}); });
}, },
translate('Allow recording session'), translate('Allow recording session'),
),
// only windows support block input
if (Platform.isWindows)
buildPermissionIcon(
client.blockInput,
Icons.block,
(enabled) {
bind.cmSwitchPermission(
connId: client.id,
name: "block_input",
enabled: enabled);
setState(() {
client.blockInput = enabled;
});
},
translate('Allow block user input'),
) )
], ],
), ),

View File

@ -690,6 +690,7 @@ class Client {
bool file = false; bool file = false;
bool restart = false; bool restart = false;
bool recording = false; bool recording = false;
bool blockInput = false;
bool disconnected = false; bool disconnected = false;
bool fromSwitch = false; bool fromSwitch = false;
bool inVoiceCall = false; bool inVoiceCall = false;
@ -713,6 +714,7 @@ class Client {
file = json['file']; file = json['file'];
restart = json['restart']; restart = json['restart'];
recording = json['recording']; recording = json['recording'];
blockInput = json['block_input'];
disconnected = json['disconnected']; disconnected = json['disconnected'];
fromSwitch = json['from_switch']; fromSwitch = json['from_switch'];
inVoiceCall = json['in_voice_call']; inVoiceCall = json['in_voice_call'];
@ -733,6 +735,7 @@ class Client {
data['file'] = file; data['file'] = file;
data['restart'] = restart; data['restart'] = restart;
data['recording'] = recording; data['recording'] = recording;
data['block_input'] = blockInput;
data['disconnected'] = disconnected; data['disconnected'] = disconnected;
data['from_switch'] = fromSwitch; data['from_switch'] = fromSwitch;
return data; return data;

View File

@ -526,6 +526,7 @@ message PermissionInfo {
File = 4; File = 4;
Restart = 5; Restart = 5;
Recording = 6; Recording = 6;
BlockInput = 7;
} }
Permission permission = 1; Permission permission = 1;

View File

@ -1347,6 +1347,9 @@ impl<T: InvokeUiSession> Remote<T> {
Ok(Permission::Recording) => { Ok(Permission::Recording) => {
self.handler.set_permission("recording", p.enabled); self.handler.set_permission("recording", p.enabled);
} }
Ok(Permission::BlockInput) => {
self.handler.set_permission("block_input", p.enabled);
}
_ => {} _ => {}
} }
} }

View File

@ -177,6 +177,7 @@ pub enum Data {
file_transfer_enabled: bool, file_transfer_enabled: bool,
restart: bool, restart: bool,
recording: bool, recording: bool,
block_input: bool,
from_switch: bool, from_switch: bool,
}, },
ChatMessage { ChatMessage {

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "虚拟显示器"), ("Virtual display", "虚拟显示器"),
("Plug out all", "拔出所有"), ("Plug out all", "拔出所有"),
("True color (4:4:4)", "真彩模式4:4:4"), ("True color (4:4:4)", "真彩模式4:4:4"),
("Enable Block User Input", "允许阻止用户输入"),
("Allow block user input", "允许阻止用户输入"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Virtuální obrazovka"), ("Virtual display", "Virtuální obrazovka"),
("Plug out all", "Odpojit všechny"), ("Plug out all", "Odpojit všechny"),
("True color (4:4:4)", "Skutečné barvy (4:4:4)"), ("True color (4:4:4)", "Skutečné barvy (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Virtueller Bildschirm"), ("Virtual display", "Virtueller Bildschirm"),
("Plug out all", "Alle ausschalten"), ("Plug out all", "Alle ausschalten"),
("True color (4:4:4)", "True Color (4:4:4)"), ("True color (4:4:4)", "True Color (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Pantalla virtual"), ("Virtual display", "Pantalla virtual"),
("Plug out all", "Desconectar todo"), ("Plug out all", "Desconectar todo"),
("True color (4:4:4)", "Color real (4:4:4)"), ("True color (4:4:4)", "Color real (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Tampilan virtual"), ("Virtual display", "Tampilan virtual"),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Scehrmo virtuale"), ("Virtual display", "Scehrmo virtuale"),
("Plug out all", "Scollega tutto"), ("Plug out all", "Scollega tutto"),
("True color (4:4:4)", "Colore reale (4:4:4)"), ("True color (4:4:4)", "Colore reale (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "가상 디스플레이"), ("Virtual display", "가상 디스플레이"),
("Plug out all", "모두 플러그 아웃"), ("Plug out all", "모두 플러그 아웃"),
("True color (4:4:4)", "트루컬러(4:4:4)"), ("True color (4:4:4)", "트루컬러(4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Virtuālais displejs"), ("Virtual display", "Virtuālais displejs"),
("Plug out all", "Atvienot visu"), ("Plug out all", "Atvienot visu"),
("True color (4:4:4)", "Īstā krāsa (4:4:4)"), ("True color (4:4:4)", "Īstā krāsa (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Witualne ekrany"), ("Virtual display", "Witualne ekrany"),
("Plug out all", "Odłącz wszystko"), ("Plug out all", "Odłącz wszystko"),
("True color (4:4:4)", "True color (4:4:4)"), ("True color (4:4:4)", "True color (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Виртуальный дисплей"), ("Virtual display", "Виртуальный дисплей"),
("Plug out all", "Отключить все"), ("Plug out all", "Отключить все"),
("True color (4:4:4)", "Истинный цвет (4:4:4)"), ("True color (4:4:4)", "Истинный цвет (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Virtuálny displej"), ("Virtual display", "Virtuálny displej"),
("Plug out all", "Odpojiť všetky"), ("Plug out all", "Odpojiť všetky"),
("True color (4:4:4)", "Skutočná farba (4:4:4)"), ("True color (4:4:4)", "Skutočná farba (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", "Віртуальний дисплей"), ("Virtual display", "Віртуальний дисплей"),
("Plug out all", "Відключити все"), ("Plug out all", "Відключити все"),
("True color (4:4:4)", "Спражній колір (4:4:4)"), ("True color (4:4:4)", "Спражній колір (4:4:4)"),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -573,5 +573,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Virtual display", ""), ("Virtual display", ""),
("Plug out all", ""), ("Plug out all", ""),
("True color (4:4:4)", ""), ("True color (4:4:4)", ""),
("Enable Block User Input", ""),
("Allow block user input", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -180,6 +180,7 @@ pub struct Connection {
file: bool, file: bool,
restart: bool, restart: bool,
recording: bool, recording: bool,
block_input: bool,
last_test_delay: i64, last_test_delay: i64,
network_delay: Option<u32>, network_delay: Option<u32>,
lock_after_session_end: bool, lock_after_session_end: bool,
@ -326,6 +327,7 @@ impl Connection {
file: Connection::permission("enable-file-transfer"), file: Connection::permission("enable-file-transfer"),
restart: Connection::permission("enable-remote-restart"), restart: Connection::permission("enable-remote-restart"),
recording: Connection::permission("enable-record-session"), recording: Connection::permission("enable-record-session"),
block_input: Connection::permission("enable-block-input"),
last_test_delay: 0, last_test_delay: 0,
network_delay: None, network_delay: None,
lock_after_session_end: false, lock_after_session_end: false,
@ -396,6 +398,9 @@ impl Connection {
if !conn.recording { if !conn.recording {
conn.send_permission(Permission::Recording, false).await; conn.send_permission(Permission::Recording, false).await;
} }
if !conn.block_input {
conn.send_permission(Permission::BlockInput, false).await;
}
let mut test_delay_timer = let mut test_delay_timer =
time::interval_at(Instant::now() + TEST_DELAY_TIMEOUT, TEST_DELAY_TIMEOUT); time::interval_at(Instant::now() + TEST_DELAY_TIMEOUT, TEST_DELAY_TIMEOUT);
let mut last_recv_time = Instant::now(); let mut last_recv_time = Instant::now();
@ -477,6 +482,9 @@ impl Connection {
} else if &name == "recording" { } else if &name == "recording" {
conn.recording = enabled; conn.recording = enabled;
conn.send_permission(Permission::Recording, enabled).await; conn.send_permission(Permission::Recording, enabled).await;
} else if &name == "block_input" {
conn.block_input = enabled;
conn.send_permission(Permission::BlockInput, enabled).await;
} }
} }
ipc::Data::RawMessage(bytes) => { ipc::Data::RawMessage(bytes) => {
@ -1271,6 +1279,7 @@ impl Connection {
file_transfer_enabled: self.file, file_transfer_enabled: self.file,
restart: self.restart, restart: self.restart,
recording: self.recording, recording: self.recording,
block_input: self.block_input,
from_switch: self.from_switch, from_switch: self.from_switch,
}); });
} }
@ -2525,8 +2534,8 @@ impl Connection {
} }
} }
} }
if self.keyboard {
if let Ok(q) = o.block_input.enum_value() { if let Ok(q) = o.block_input.enum_value() {
if self.keyboard && self.block_input {
match q { match q {
BoolOption::Yes => { BoolOption::Yes => {
self.tx_input.send(MessageInput::BlockOn).ok(); self.tx_input.send(MessageInput::BlockOn).ok();
@ -2536,6 +2545,17 @@ impl Connection {
} }
_ => {} _ => {}
} }
} else {
if q != BoolOption::NotSet {
let state = if q == BoolOption::Yes {
back_notification::BlockInputState::BlkOnFailed
} else {
back_notification::BlockInputState::BlkOffFailed
};
if let Some(tx) = &self.inner.tx {
Self::send_block_input_error(tx, state, "No permission".to_string());
}
}
} }
} }
} }

View File

@ -112,6 +112,10 @@ icon.recording {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAANpJREFUWEftltENAiEMhtsJ1NcynG6gI+gGugEOR591gppeQoIYSDBILxEeydH/57u2FMF4obE+TAOTwLoIhBDOAHBExG2n6rgR0akW640AM0sn4SWMiDycc7s8JjN7Ijro/k8NqAAR5RoeAPZxv2ggP9hCJiWZxtGbq3hqbJiBVHy4gVx8qAER8Yi4JFy6huVAKXemgb8icI+1b5KEitq0DOO/Nm1EEX1TK27p/bVvv36MOhl4EtHHbFF7jq8AoG1z08OAiFycczrkFNe6RrIet26NMQlMAuYEXiayryF/QQktAAAAAElFTkSuQmCC'); background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAANpJREFUWEftltENAiEMhtsJ1NcynG6gI+gGugEOR591gppeQoIYSDBILxEeydH/57u2FMF4obE+TAOTwLoIhBDOAHBExG2n6rgR0akW640AM0sn4SWMiDycc7s8JjN7Ijro/k8NqAAR5RoeAPZxv2ggP9hCJiWZxtGbq3hqbJiBVHy4gVx8qAER8Yi4JFy6huVAKXemgb8icI+1b5KEitq0DOO/Nm1EEX1TK27p/bVvv36MOhl4EtHHbFF7jq8AoG1z08OAiFycczrkFNe6RrIet26NMQlMAuYEXiayryF/QQktAAAAAElFTkSuQmCC');
} }
icon.block_input {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjdJREFUWEe1V8tNAzEQfXOHAx2QG0UgQSqBFIIgHdABoQqOhBq4cCMlcMh90FvZq/HEXtvJxlKUZNceP783no+gY6jqNYBHAHcA+JufXTDBb37eRWTbalZqE82mz7W55v0ABMBGRCLA7PJJAKr6AiC3sT11NHyf2SEyQjvtAMKp3wBYo9VTGbYegjxxU65d5tg4YEBVbwF8ALgw2lLX4in80QqyZUEkAMLCb7P5n4hcdWifTA32Pg0bByA8AE4+oL3n9A1s7ERkEeeNAJzD/QC4OVaCAgjrU7wdK86zAHREJSKqyvvORRxVb67JFOT4NfYGpxwAqCo34oYcKxHZhOdzg7D2BhYigHj6RJ+5QbjrPezlqR61sZTOKYfztSUBWPoXpdA5FwjnC2sCGK+eiNRC8yw+oap0RiayLQHEPwf65zx7DibMoXcEEB0wq/85QJQAbEVkWbvP8f0pTFi/65ZgjtuRyJ7QYWL0OZnwTmiLDobH5nLqGDlUlcmON49jQwnsg/Wxma/VJ1zcGQIR7+OYJGyqbJWhhwlDPxh3JpNRL4Ba7nAsJckoYaFUv7UCyslBvQ3TNDWEfVsPJGH2FCkKTPAxD8ox+poFwJfZqqX15H6eYyK+TgJeriidLCJ7wAQHZ4Udy7u9iFxaG7mynEx4EF1leZDANzV7AE8i8joJICz2cvBxbExIYTZYTTQmxTxTzP+VnvC8rZlLOLEj7m5OW6JqtTs2US6247Hvy7XnX0OV05FP/gHde5fLZaGS8AAAAABJRU5ErkJggg==');
}
div.outer_buttons { div.outer_buttons {
flow:vertical; flow:vertical;
border-spacing:8; border-spacing:8;

View File

@ -28,7 +28,8 @@ impl InvokeUiCM for SciterHandler {
client.audio, client.audio,
client.file, client.file,
client.restart, client.restart,
client.recording client.recording,
client.block_input
), ),
); );
} }

View File

@ -57,6 +57,7 @@ class Body: Reactor.Component
<div class={!c.restart ? "disabled" : ""} title={translate('Allow remote restart')}><icon .restart /></div> <div class={!c.restart ? "disabled" : ""} title={translate('Allow remote restart')}><icon .restart /></div>
</div> <div .permissions style="margin-top:8px;" > </div> <div .permissions style="margin-top:8px;" >
<div class={!c.recording ? "disabled" : ""} title={translate('Allow recording session')}><icon .recording /></div> <div class={!c.recording ? "disabled" : ""} title={translate('Allow recording session')}><icon .recording /></div>
<div class={!c.block_input ? "disabled" : ""} title={translate('Allow block input')} style={is_win ? "" : "display:none;"}><icon .block_input /></div>
</div></div> </div></div>
} }
{c.port_forward ? <div>Port Forwarding: {c.port_forward}</div> : ""} {c.port_forward ? <div>Port Forwarding: {c.port_forward}</div> : ""}
@ -143,6 +144,15 @@ class Body: Reactor.Component
}); });
} }
event click $(icon.block_input) {
var { cid, connection } = this;
checkClickTime(function() {
connection.block_input = !connection.block_input;
body.update();
handler.switch_permission(cid, "block_input", connection.block_input);
});
}
event click $(button#accept) { event click $(button#accept) {
var { cid, connection } = this; var { cid, connection } = this;
checkClickTime(function() { checkClickTime(function() {
@ -346,7 +356,7 @@ function bring_to_top(idx=-1) {
} }
} }
handler.addConnection = function(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording) { handler.addConnection = function(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, block_input) {
stdout.println("new connection #" + id + ": " + peer_id); stdout.println("new connection #" + id + ": " + peer_id);
var conn; var conn;
connections.map(function(c) { connections.map(function(c) {
@ -368,6 +378,7 @@ handler.addConnection = function(id, is_file_transfer, port_forward, peer_id, na
name: name, authorized: authorized, time: new Date(), now: new Date(), name: name, authorized: authorized, time: new Date(), now: new Date(),
keyboard: keyboard, clipboard: clipboard, msgs: [], unreaded: 0, keyboard: keyboard, clipboard: clipboard, msgs: [], unreaded: 0,
audio: audio, file: file, restart: restart, recording: recording, audio: audio, file: file, restart: restart, recording: recording,
block_input:block_input,
disconnected: false disconnected: false
}; };
if (idx < 0) { if (idx < 0) {

View File

@ -306,6 +306,7 @@ class MyIdMenu: Reactor.Component {
<li #enable-file-transfer><span>{svg_checkmark}</span>{translate('Enable File Transfer')}</li> <li #enable-file-transfer><span>{svg_checkmark}</span>{translate('Enable File Transfer')}</li>
<li #enable-remote-restart><span>{svg_checkmark}</span>{translate('Enable Remote Restart')}</li> <li #enable-remote-restart><span>{svg_checkmark}</span>{translate('Enable Remote Restart')}</li>
<li #enable-tunnel><span>{svg_checkmark}</span>{translate('Enable TCP Tunneling')}</li> <li #enable-tunnel><span>{svg_checkmark}</span>{translate('Enable TCP Tunneling')}</li>
{is_win ? <li #enable-block-input><span>{svg_checkmark}</span>{translate('Enable Block User Input')}</li> : ""}
<li #enable-lan-discovery><span>{svg_checkmark}</span>{translate('Enable LAN Discovery')}</li> <li #enable-lan-discovery><span>{svg_checkmark}</span>{translate('Enable LAN Discovery')}</li>
<AudioInputs /> <AudioInputs />
<Enhancements /> <Enhancements />

View File

@ -53,6 +53,7 @@ pub struct Client {
pub file: bool, pub file: bool,
pub restart: bool, pub restart: bool,
pub recording: bool, pub recording: bool,
pub block_input: bool,
pub from_switch: bool, pub from_switch: bool,
pub in_voice_call: bool, pub in_voice_call: bool,
pub incoming_voice_call: bool, pub incoming_voice_call: bool,
@ -133,6 +134,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
file: bool, file: bool,
restart: bool, restart: bool,
recording: bool, recording: bool,
block_input: bool,
from_switch: bool, from_switch: bool,
#[cfg(not(any(target_os = "ios")))] tx: mpsc::UnboundedSender<Data>, #[cfg(not(any(target_os = "ios")))] tx: mpsc::UnboundedSender<Data>,
) { ) {
@ -150,6 +152,7 @@ impl<T: InvokeUiCM> ConnectionManager<T> {
file, file,
restart, restart,
recording, recording,
block_input,
from_switch, from_switch,
#[cfg(not(any(target_os = "ios")))] #[cfg(not(any(target_os = "ios")))]
tx, tx,
@ -378,9 +381,9 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
} }
Ok(Some(data)) => { Ok(Some(data)) => {
match data { match data {
Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled: _file_transfer_enabled, restart, recording, from_switch} => { Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled: _file_transfer_enabled, restart, recording, block_input, from_switch} => {
log::debug!("conn_id: {}", id); log::debug!("conn_id: {}", id);
self.cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, from_switch,self.tx.clone()); self.cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, block_input, from_switch, self.tx.clone());
self.conn_id = id; self.conn_id = id;
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))] #[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
{ {
@ -632,6 +635,7 @@ pub async fn start_listen<T: InvokeUiCM>(
file, file,
restart, restart,
recording, recording,
block_input,
from_switch, from_switch,
.. ..
}) => { }) => {
@ -649,6 +653,7 @@ pub async fn start_listen<T: InvokeUiCM>(
file, file,
restart, restart,
recording, recording,
block_input,
from_switch, from_switch,
tx.clone(), tx.clone(),
); );