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

@@ -304,7 +304,21 @@ function msgbox(type, title, content, link="", callback=null, height=180, width=
return;
}
};
}
} else if (type === "multiple-sessions") {
var parts = content.split("-");
var ids = parts[0].split(",");
var names = parts[1].split(",");
var sessionData = [];
for (var i = 0; i < ids.length; i++) {
sessionData.push({ id: ids[i], name: names[i] });
}
content = <MultipleSessionComponent sessions={sessionData} />;
callback = function () {
retryConnect();
return;
};
height += 50;
}
last_msgbox_tag = type + "-" + title + "-" + content + "-" + link;
$(#msgbox).content(<MsgboxComponent width={width} height={height} autoLogin={autoLogin} type={type} title={title} content={content} link={link} remember={remember} callback={callback} contentStyle={contentStyle} hasRetry={hasRetry} />);
}
@@ -339,7 +353,7 @@ handler.msgbox_retry = function(type, title, text, link, hasRetry) {
function retryConnect(cancelTimer=false) {
if (cancelTimer) self.timer(0, retryConnect);
if (!is_port_forward) connecting();
handler.reconnect(false);
handler.reconnect(false, "");
}
/******************** end of msgbox ****************************************/
@@ -458,3 +472,37 @@ function awake() {
view.focus = self;
}
class MultipleSessionComponent extends Reactor.Component {
this var sessions = [];
this var selectedSessionId = null;
this var sessionlength = 0;
this var messageText = translate("Please select the user you want to connect to");
function this(params) {
if (params && params.sessions) {
this.sessions = params.sessions;
this.selectedSessionId = params.sessions[0].id;
this.sessions.map(session => {
this.sessionlength += session.name.length;
});
}
handler.set_selected_user_session_id(this.selectedSessionId);
}
function render() {
return <div .user-session>
<div .title>{this.messageText}</div>
<select>
{this.sessions.map(session =>
<option value={session.id}>{session.name}</option>
)}
</select>
</div>;
}
event change {
var selectedSessionName = this.value.substr(this.messageText.length + this.sessionlength);
this.selectedSessionId = this.sessions.find(session => session.name == selectedSessionName).id;
handler.set_selected_user_session_id(this.selectedSessionId);
}
}