Feat: Windows connect to a specific user session (#6825)

* feat windows connect to specific user session

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix import

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix multiple user session fields

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix build

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix build

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix file transfer

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix text color on light theme

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* feat windows connect to specific user session code changes and sciter support

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* update texts

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix sciter selected user session

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* add translations

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* Use Y,N options

* feat windows specific user code changes

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* Update dialog.dart

* Update connection.rs

* Update connection.rs

* feat windows specific user code changes

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix sciter

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* use lr.union

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* remove unused peer options

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* select user only when authorised and no existing connection

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* check for multiple users only once

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* optimise and add check for client version

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* use misc option message

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* update rdp user session proto

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix show cm on user session

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* Update pl.rs

* update on_message

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix cm

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* remove user_session_id

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix cm

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

* fix multiple connections

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>

---------

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
Sahil Yeole
2024-02-14 21:29:17 +05:30
committed by GitHub
parent 236687ae53
commit 4bf3764b5d
55 changed files with 607 additions and 22 deletions

View File

@@ -259,6 +259,15 @@ impl InvokeUiSession for SciterHandler {
// Ignore for sciter version.
}
fn set_multiple_user_session(&self, sessions: Vec<hbb_common::message_proto::RdpUserSession>) {
let formatted_sessions: Vec<String> = sessions.iter()
.map(|session| format!("{}-{}", session.user_session_id, session.user_name))
.collect();
let u_sids: String = formatted_sessions.iter().map(|s| s.split("-").next().unwrap().to_string()).collect::<Vec<String>>().join(",");
let u_names:String = formatted_sessions.iter().map(|s| s.split("-").nth(1).unwrap().to_string()).collect::<Vec<String>>().join(",");
self.call("setMultipleUserSession", &make_args!(u_sids, u_names));
}
fn on_connected(&self, conn_type: ConnType) {
match conn_type {
ConnType::RDP => {}
@@ -346,6 +355,7 @@ impl sciter::EventHandler for SciterSession {
}
fn detached(&mut self, _root: HELEMENT) {
self.set_selected_user_session_id("".to_string());
*self.element.lock().unwrap() = None;
self.sender.write().unwrap().take().map(|sender| {
sender.send(Data::Close).ok();
@@ -376,7 +386,7 @@ impl sciter::EventHandler for SciterSession {
let site = AssetPtr::adopt(ptr as *mut video_destination);
log::debug!("[video] start video");
*VIDEO.lock().unwrap() = Some(site);
self.reconnect(false);
self.reconnect(false, "".to_string());
}
}
BEHAVIOR_EVENTS::VIDEO_INITIALIZED => {
@@ -426,7 +436,7 @@ impl sciter::EventHandler for SciterSession {
fn transfer_file();
fn tunnel();
fn lock_screen();
fn reconnect(bool);
fn reconnect(bool, String);
fn get_chatbox();
fn get_icon();
fn get_home_dir();
@@ -477,6 +487,7 @@ impl sciter::EventHandler for SciterSession {
fn request_voice_call();
fn close_voice_call();
fn version_cmp(String, String);
fn set_selected_user_session_id(String);
}
}
@@ -580,6 +591,10 @@ impl SciterSession {
log::info!("size saved");
}
fn set_selected_user_session_id(&mut self, u_sid: String) {
self.lc.write().unwrap().selected_user_session_id = u_sid;
}
fn get_port_forwards(&mut self) -> Value {
let port_forwards = self.lc.read().unwrap().port_forwards.clone();
let mut v = Value::array(0);