From e7e3494dc9e196d548f5c42f6ac7add6e756f828 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 22 Sep 2022 09:55:34 +0800 Subject: [PATCH] record permission Signed-off-by: 21pages --- flutter/lib/common.dart | 2 ++ .../desktop/pages/desktop_setting_page.dart | 3 ++ flutter/lib/desktop/pages/server_page.dart | 7 ++++ .../lib/desktop/widgets/remote_menubar.dart | 32 +++++++++++-------- flutter/lib/models/server_model.dart | 2 ++ libs/hbb_common/protos/message.proto | 1 + src/client/io_loop.rs | 3 ++ src/ipc.rs | 1 + src/lang/cn.rs | 2 ++ src/lang/cs.rs | 2 ++ src/lang/da.rs | 2 ++ src/lang/de.rs | 2 ++ src/lang/eo.rs | 2 ++ src/lang/es.rs | 2 ++ src/lang/fr.rs | 2 ++ src/lang/hu.rs | 2 ++ src/lang/id.rs | 2 ++ src/lang/it.rs | 2 ++ src/lang/ja.rs | 2 ++ src/lang/ko.rs | 2 ++ src/lang/kz.rs | 2 ++ src/lang/pl.rs | 2 ++ src/lang/pt_PT.rs | 2 ++ src/lang/ptbr.rs | 2 ++ src/lang/ru.rs | 2 ++ src/lang/sk.rs | 2 ++ src/lang/template.rs | 2 ++ src/lang/tr.rs | 2 ++ src/lang/tw.rs | 2 ++ src/lang/vn.rs | 2 ++ src/server/connection.rs | 9 ++++++ src/ui/cm.css | 4 +++ src/ui/cm.rs | 3 +- src/ui/cm.tis | 20 +++++++++--- src/ui/header.tis | 2 +- src/ui/index.tis | 3 ++ src/ui/remote.tis | 2 ++ src/ui_cm_interface.rs | 9 ++++-- 38 files changed, 126 insertions(+), 21 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 365ce3dd5..6166f8121 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -48,6 +48,8 @@ late final iconFile = MemoryImage(Uint8List.fromList(base64Decode( 'iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAMAAADVRocKAAAAUVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////8IN+deAAAAGnRSTlMAH+CAESEN8jyZkcIb5N/ONy3vmHhmiGjUm7UwS+YAAAHZSURBVGje7dnbboMwDIBhBwgQoFAO7Ta//4NOqCAXYZQstatq4r+r5ubrgQSpg8iyC4ZURa+PlIpQYGiwrzyeHtYZjAL8T05O4H8BbbKvFgRa4NoBU8pXeYEkDDgaaLQBcwJrmeErJQB/7wes3QBWGnCIX0+AQycL1PO6BMwPa0nA4ZxbgTvOjUYMGPHRnZkQAY4mxPZBjmy53E7ukSkFKYB/D4XsWZQx64sCeYebOogGsoOBYvv6/UCb8F0IOBZ0TlP6lEYdANY350AJqB9/qPVuOI5evw4A1hgLigAlepnyxW80bcCcwN++A2s82Vcu02ta+ceq9BoL5KGTTRwQPlpqA3gCnwWU2kCDgeWRQPj2jAPCDxgCMjhI6uZnToDpvd/BJeFrJQB/fsAa02gCt3mi1wNuy8GgBNDZlysBNNSrADVSjcJl6vCpUn6jOdx0kz0q6PMhQRa4465SFKhx35cgUCBTwj2/NHwZAb71qR8GEP2H1XcmAtBPTEO67GP6FUUAIKGABbDLQ0EArhN2sAIGesRO+iyy+RMAjckVTlMCKFVAbh/4Af9OPgG61SkDVco3BQGT3GXaDAnTIAcYZDuBTwGsAGDxuBFeAQqIqwoFMlAVLrHr/wId5MPt0nilGgAAAABJRU5ErkJggg=='))); late final iconRestart = MemoryImage(Uint8List.fromList(base64Decode( 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAB7BAAAewQHDaVRTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbhJREFUWIXVlrFqFGEUhb+7UYxaWCQKlrKKxaZSQVGDJih2tj6MD2DnMwiWvoAIRnENIpZiYxEro6IooiS7SPwsMgNLkk3mjmYmnmb45/73nMNwz/x/qH3gMu2gH6rAU+Blw+Lngau4jpmGxVF7qp1iPWjaQKnZ2WnXbuP/NqAeUPc3ZkA9XDwvqc+BVWCgPlJ7tRwUKThZce819b46VH+pfXVRXVO/q2cSul3VOgZUl0ejq86r39TXI8mqZKDuDEwCw3IREQvAbWAGmMsQZQ0sAl3gHPB1Q+0e8BuYzRDuy2yOiFVgaUxtRf0ETGc4syk4rc6PqU0Cx9j8Zf6dAeAK8Fi9sUXtFjABvEgxJlNwRP2svlNPjbw/q35U36oTFbnyMSwabxb/gB/qA3VBHagrauV7RW0DRfP1IvMlXqkXkhz1DYyQTKtHa/Z2VVMx3IiI+PI3/bCHjuOpFrSnAMpL6QfgTcMGesDx0kBr2BMzsNyi/vtQu8CJlgwsRbZDnWP90NkKaxHxJMOXMqAeAn5u0ydwMCKGY+qbkB3C2W3EKWoXk5zVoHbUZ+6Mh7tl4G4F8RJ3qvL+AfV3r5Vdpj70AAAAAElFTkSuQmCC'))); +late final iconRecording = MemoryImage(Uint8List.fromList(base64Decode( + 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAANpJREFUWEftltENAiEMhtsJ1NcynG6gI+gGugEOR591gppeQoIYSDBILxEeydH/57u2FMF4obE+TAOTwLoIhBDOAHBExG2n6rgR0akW640AM0sn4SWMiDycc7s8JjN7Ijro/k8NqAAR5RoeAPZxv2ggP9hCJiWZxtGbq3hqbJiBVHy4gVx8qAER8Yi4JFy6huVAKXemgb8icI+1b5KEitq0DOO/Nm1EEX1TK27p/bVvv36MOhl4EtHHbFF7jq8AoG1z08OAiFycczrkFNe6RrIet26NMQlMAuYEXiayryF/QQktAAAAAElFTkSuQmCC'))); enum DesktopType { main, diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 231e001a2..119abda08 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -436,6 +436,9 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin { enabled: enabled), _OptionCheckBox(context, 'Enable Remote Restart', 'enable-remote-restart', enabled: enabled), + _OptionCheckBox( + context, 'Enable Recording Session', 'enable-record-session', + enabled: enabled), _OptionCheckBox(context, 'Enable remote configuration modification', 'allow-remote-config-modification', enabled: enabled), diff --git a/flutter/lib/desktop/pages/server_page.dart b/flutter/lib/desktop/pages/server_page.dart index 9ca446dcb..400def7f0 100644 --- a/flutter/lib/desktop/pages/server_page.dart +++ b/flutter/lib/desktop/pages/server_page.dart @@ -411,6 +411,13 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> { client.restart = enabled; }); }, null), + buildPermissionIcon(client.recording, iconRecording, (enabled) { + bind.cmSwitchPermission( + connId: client.id, name: "recording", enabled: enabled); + setState(() { + client.recording = enabled; + }); + }, null), ], )), ], diff --git a/flutter/lib/desktop/widgets/remote_menubar.dart b/flutter/lib/desktop/widgets/remote_menubar.dart index 785471740..6e137fa6e 100644 --- a/flutter/lib/desktop/widgets/remote_menubar.dart +++ b/flutter/lib/desktop/widgets/remote_menubar.dart @@ -354,19 +354,25 @@ class _RemoteMenubarState extends State { } Widget _buildRecording(BuildContext context) { - return Consumer( - builder: (context, value, child) => IconButton( - tooltip: value.start - ? translate('Stop session recording') - : translate('Start session recording'), - onPressed: () => value.toggle(), - icon: Icon( - value.start - ? Icons.pause_circle_filled - : Icons.videocam_outlined, - color: _MenubarTheme.commonColor, - ), - )); + return Consumer(builder: ((context, value, child) { + if (value.permissions['recording'] != false) { + return Consumer( + builder: (context, value, child) => IconButton( + tooltip: value.start + ? translate('Stop session recording') + : translate('Start session recording'), + onPressed: () => value.toggle(), + icon: Icon( + value.start + ? Icons.pause_circle_filled + : Icons.videocam_outlined, + color: _MenubarTheme.commonColor, + ), + )); + } else { + return Offstage(); + } + })); } Widget _buildClose(BuildContext context) { diff --git a/flutter/lib/models/server_model.dart b/flutter/lib/models/server_model.dart index a26fe5062..10cc8e0b1 100644 --- a/flutter/lib/models/server_model.dart +++ b/flutter/lib/models/server_model.dart @@ -544,6 +544,7 @@ class Client { bool audio = false; bool file = false; bool restart = false; + bool recording = false; Client(this.id, this.authorized, this.isFileTransfer, this.name, this.peerId, this.keyboard, this.clipboard, this.audio); @@ -559,6 +560,7 @@ class Client { audio = json['audio']; file = json['file']; restart = json['restart']; + recording = json['recording']; } Map toJson() { diff --git a/libs/hbb_common/protos/message.proto b/libs/hbb_common/protos/message.proto index e711f5826..8fb67e5c1 100644 --- a/libs/hbb_common/protos/message.proto +++ b/libs/hbb_common/protos/message.proto @@ -436,6 +436,7 @@ message PermissionInfo { Audio = 3; File = 4; Restart = 5; + Recording = 6; } Permission permission = 1; diff --git a/src/client/io_loop.rs b/src/client/io_loop.rs index 1cf89f173..cf6168834 100644 --- a/src/client/io_loop.rs +++ b/src/client/io_loop.rs @@ -958,6 +958,9 @@ impl Remote { Permission::Restart => { self.handler.set_permission("restart", p.enabled); } + Permission::Recording => { + self.handler.set_permission("recording", p.enabled); + } } } Some(misc::Union::SwitchDisplay(s)) => { diff --git a/src/ipc.rs b/src/ipc.rs index 36f6b9c1f..709384bb6 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -146,6 +146,7 @@ pub enum Data { file: bool, file_transfer_enabled: bool, restart: bool, + recording: bool, }, ChatMessage { text: String, diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 65c7b529d..cd534858b 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", "更改"), ("Start session recording", "开始录屏"), ("Stop session recording", "结束录屏"), + ("Enable Recording Session", "允许录制会话"), + ("Allow recording session", "允许录制会话"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index a271e2446..ba6d20fab 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 77f585390..82cb403dc 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 27e04717e..16e625927 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index a3add20f9..dee425de2 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 049a8c428..211d7bb92 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -365,5 +365,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 033e08c4c..694131ddd 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 4cff53b2d..d5d6cb1f2 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index dd4adf2bc..992a03ac2 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -365,5 +365,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index dd941b30b..98730c8d1 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -351,5 +351,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 2d76c93db..e25207ce8 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -349,5 +349,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 5897dc690..0a8a6555c 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -346,5 +346,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index c2f5f2cf0..b24708933 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -327,5 +327,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index b54218d56..d6a3ee01f 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -350,5 +350,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 7b386c3bf..b27da9a29 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -346,5 +346,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 099ecb2bb..a7b4fa51a 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index c001b8770..fbe49d9e0 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 2a1de16aa..b075af3a8 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 5896d4336..1aa7009c7 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 9e9475ead..e8ac92743 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -365,5 +365,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index dc7ab8a59..190beca3c 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", "變更"), ("Start session recording", "開始錄屏"), ("Stop session recording", "結束錄屏"), + ("Enable Recording Session", "允許錄製會話"), + ("Allow recording session", "允許錄製會話"), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index ebd44d8d5..394b97c2b 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -352,5 +352,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Change", ""), ("Start session recording", ""), ("Stop session recording", ""), + ("Enable Recording Session", ""), + ("Allow recording session", ""), ].iter().cloned().collect(); } diff --git a/src/server/connection.rs b/src/server/connection.rs index 161c058f8..15d313fbe 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -81,6 +81,7 @@ pub struct Connection { audio: bool, file: bool, restart: bool, + recording: bool, last_test_delay: i64, lock_after_session_end: bool, show_remote_cursor: bool, // by peer @@ -169,6 +170,7 @@ impl Connection { audio: Config::get_option("enable-audio").is_empty(), file: Config::get_option("enable-file-transfer").is_empty(), restart: Config::get_option("enable-remote-restart").is_empty(), + recording: Config::get_option("enable-record-session").is_empty(), last_test_delay: 0, lock_after_session_end: false, show_remote_cursor: false, @@ -210,6 +212,9 @@ impl Connection { if !conn.restart { conn.send_permission(Permission::Restart, false).await; } + if !conn.recording { + conn.send_permission(Permission::Recording, false).await; + } let mut test_delay_timer = time::interval_at(Instant::now() + TEST_DELAY_TIMEOUT, TEST_DELAY_TIMEOUT); let mut last_recv_time = Instant::now(); @@ -290,6 +295,9 @@ impl Connection { } else if &name == "restart" { conn.restart = enabled; conn.send_permission(Permission::Restart, enabled).await; + } else if &name == "recording" { + conn.recording = enabled; + conn.send_permission(Permission::Recording, enabled).await; } } ipc::Data::RawMessage(bytes) => { @@ -777,6 +785,7 @@ impl Connection { file: self.file, file_transfer_enabled: self.file_transfer_enabled(), restart: self.restart, + recording: self.recording, }); } diff --git a/src/ui/cm.css b/src/ui/cm.css index 0832c6251..fbbd58961 100644 --- a/src/ui/cm.css +++ b/src/ui/cm.css @@ -108,6 +108,10 @@ icon.restart { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAB7BAAAewQHDaVRTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbhJREFUWIXVlrFqFGEUhb+7UYxaWCQKlrKKxaZSQVGDJih2tj6MD2DnMwiWvoAIRnENIpZiYxEro6IooiS7SPwsMgNLkk3mjmYmnmb45/73nMNwz/x/qH3gMu2gH6rAU+Blw+Lngau4jpmGxVF7qp1iPWjaQKnZ2WnXbuP/NqAeUPc3ZkA9XDwvqc+BVWCgPlJ7tRwUKThZce819b46VH+pfXVRXVO/q2cSul3VOgZUl0ejq86r39TXI8mqZKDuDEwCw3IREQvAbWAGmMsQZQ0sAl3gHPB1Q+0e8BuYzRDuy2yOiFVgaUxtRf0ETGc4syk4rc6PqU0Cx9j8Zf6dAeAK8Fi9sUXtFjABvEgxJlNwRP2svlNPjbw/q35U36oTFbnyMSwabxb/gB/qA3VBHagrauV7RW0DRfP1IvMlXqkXkhz1DYyQTKtHa/Z2VVMx3IiI+PI3/bCHjuOpFrSnAMpL6QfgTcMGesDx0kBr2BMzsNyi/vtQu8CJlgwsRbZDnWP90NkKaxHxJMOXMqAeAn5u0ydwMCKGY+qbkB3C2W3EKWoXk5zVoHbUZ+6Mh7tl4G4F8RJ3qvL+AfV3r5Vdpj70AAAAAElFTkSuQmCC'); } +icon.recording { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAANpJREFUWEftltENAiEMhtsJ1NcynG6gI+gGugEOR591gppeQoIYSDBILxEeydH/57u2FMF4obE+TAOTwLoIhBDOAHBExG2n6rgR0akW640AM0sn4SWMiDycc7s8JjN7Ijro/k8NqAAR5RoeAPZxv2ggP9hCJiWZxtGbq3hqbJiBVHy4gVx8qAER8Yi4JFy6huVAKXemgb8icI+1b5KEitq0DOO/Nm1EEX1TK27p/bVvv36MOhl4EtHHbFF7jq8AoG1z08OAiFycczrkFNe6RrIet26NMQlMAuYEXiayryF/QQktAAAAAElFTkSuQmCC'); +} + div.buttons { width: *; border-spacing: 0.5em; diff --git a/src/ui/cm.rs b/src/ui/cm.rs index 959141da6..e0fea8bf3 100644 --- a/src/ui/cm.rs +++ b/src/ui/cm.rs @@ -32,7 +32,8 @@ impl InvokeUiCM for SciterHandler { client.clipboard, client.audio, client.file, - client.restart + client.restart, + client.recording ), ); } diff --git a/src/ui/cm.tis b/src/ui/cm.tis index 4708acea5..c6664b50b 100644 --- a/src/ui/cm.tis +++ b/src/ui/cm.tis @@ -41,13 +41,16 @@ class Body: Reactor.Component
{c.is_file_transfer || c.port_forward ? "" :
{translate('Permissions')}
} - {c.is_file_transfer || c.port_forward ? "" :
+ {c.is_file_transfer || c.port_forward ? "" :
-
} +
+
+
+ } {c.port_forward ?
Port Forwarding: {c.port_forward}
: ""}
@@ -118,6 +121,15 @@ class Body: Reactor.Component }); } + event click $(icon.recording) { + var { cid, connection } = this; + checkClickTime(function() { + connection.recording = !connection.recording; + body.update(); + handler.switch_permission(cid, "recording", connection.recording); + }); + } + event click $(button#accept) { var { cid, connection } = this; checkClickTime(function() { @@ -276,7 +288,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) { +handler.addConnection = function(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording) { stdout.println("new connection #" + id + ": " + peer_id); var conn; connections.map(function(c) { @@ -293,7 +305,7 @@ handler.addConnection = function(id, is_file_transfer, port_forward, peer_id, na port_forward: port_forward, name: name, authorized: authorized, time: new Date(), keyboard: keyboard, clipboard: clipboard, msgs: [], unreaded: 0, - audio: audio, file: file, restart: restart + audio: audio, file: file, restart: restart, recording: recording }); body.cur = connections.length - 1; bring_to_top(); diff --git a/src/ui/header.tis b/src/ui/header.tis index b8f1bdfd8..8f9fa8a32 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -144,7 +144,7 @@ class Header: Reactor.Component { {svg_action} {svg_display} {svg_keyboard} - {recording ? svg_recording_on : svg_recording_off} + {recording_enabled ? {recording ? svg_recording_on : svg_recording_off} : ""} {this.renderKeyboardPop()} {this.renderDisplayPop()} {this.renderActionPop()} diff --git a/src/ui/index.tis b/src/ui/index.tis index dc2f403fc..af69b450e 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -236,9 +236,11 @@ class Enhancements: Reactor.Component { } else if (v == 'screen-recording') { var dir = handler.get_option("video-save-directory"); if (!dir) dir = handler.default_video_save_directory(); + var ts0 = handler.get_option("enable-record-session") == '' ? { checked: true } : {}; var ts1 = handler.get_option("allow-auto-record-incoming") == 'Y' ? { checked: true } : {}; msgbox("custom-recording", translate('Recording'),
+
{translate('Enable Recording Session')}
{translate('Automatically record incoming sessions')}
{translate("Directory")}:  {dir}
@@ -247,6 +249,7 @@ class Enhancements: Reactor.Component {
, function(res=null) { if (!res) return; + handler.set_option("enable-record-session", res.enable_record_session ? '' : 'N'); handler.set_option("allow-auto-record-incoming", res.auto_record_incoming ? 'Y' : ''); handler.set_option("video-save-directory", $(#folderPath).text); }); diff --git a/src/ui/remote.tis b/src/ui/remote.tis index dc9d60d54..02f0de270 100644 --- a/src/ui/remote.tis +++ b/src/ui/remote.tis @@ -12,6 +12,7 @@ var clipboard_enabled = true; // server side var audio_enabled = true; // server side var file_enabled = true; // server side var restart_enabled = true; // server side +var recording_enabled = true; // server side var scroll_body = $(body); handler.setDisplay = function(x, y, w, h) { @@ -521,6 +522,7 @@ handler.setPermission = function(name, enabled) { if (name == "file") file_enabled = enabled; if (name == "clipboard") clipboard_enabled = enabled; if (name == "restart") restart_enabled = enabled; + if (name == "recording") recording_enabled = enabled; input_blocked = false; header.update(); }); diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs index e4dbf80fb..3813760a0 100644 --- a/src/ui_cm_interface.rs +++ b/src/ui_cm_interface.rs @@ -40,6 +40,7 @@ pub struct Client { pub audio: bool, pub file: bool, pub restart: bool, + pub recording: bool, #[serde(skip)] tx: UnboundedSender, } @@ -94,6 +95,7 @@ impl ConnectionManager { audio: bool, file: bool, restart: bool, + recording: bool, tx: mpsc::UnboundedSender, ) { let client = Client { @@ -108,6 +110,7 @@ impl ConnectionManager { audio, file, restart, + recording, tx, }; self.ui_handler.add_connection(&client); @@ -250,11 +253,11 @@ pub async fn start_ipc(cm: ConnectionManager) { } Ok(Some(data)) => { match data { - Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled, restart} => { + Data::Login{id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, file_transfer_enabled, restart, recording} => { log::debug!("conn_id: {}", id); conn_id = id; tx_file.send(ClipboardFileData::Enable((id, file_transfer_enabled))).ok(); - cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, tx.clone()); + cm.add_connection(id, is_file_transfer, port_forward, peer_id, name, authorized, keyboard, clipboard, audio, file, restart, recording, tx.clone()); } Data::Close => { tx_file.send(ClipboardFileData::Enable((conn_id, false))).ok(); @@ -349,6 +352,7 @@ pub async fn start_listen( audio, file, restart, + recording, .. }) => { current_id = id; @@ -364,6 +368,7 @@ pub async fn start_listen( audio, file, restart, + recording, tx.clone(), ); }