option to enable force-always-relay

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-08-24 16:23:36 +08:00
parent 0649a49d17
commit a7c87a5f57
3 changed files with 16 additions and 16 deletions

View File

@ -841,7 +841,7 @@ impl LoginConfigHandler {
self.session_id = rand::random(); self.session_id = rand::random();
self.supported_encoding = None; self.supported_encoding = None;
self.restarting_remote_device = false; self.restarting_remote_device = false;
self.force_relay = false; self.force_relay = !self.get_option("force-always-relay").is_empty();
} }
pub fn should_auto_login(&self) -> String { pub fn should_auto_login(&self) -> String {

View File

@ -316,7 +316,7 @@ class SessionList: Reactor.Component {
<li #connect>{translate('Connect')}</li> <li #connect>{translate('Connect')}</li>
<li #transfer>{translate('Transfer File')}</li> <li #transfer>{translate('Transfer File')}</li>
<li #tunnel>{translate('TCP Tunneling')}</li> <li #tunnel>{translate('TCP Tunneling')}</li>
{false && !handler.using_public_server() && <li #force-always-relay><span>{svg_checkmark}</span>{translate('Always connect via relay')}</li>} <li #force-always-relay><span>{svg_checkmark}</span>{translate('Always connect via relay')}</li>
<li #rdp>RDP<EditRdpPort /></li> <li #rdp>RDP<EditRdpPort /></li>
<li #wol>{translate('WOL')}</li> <li #wol>{translate('WOL')}</li>
<div .separator /> <div .separator />
@ -396,7 +396,6 @@ class SessionList: Reactor.Component {
if (el) { if (el) {
var force = handler.get_peer_option(id, "force-always-relay"); var force = handler.get_peer_option(id, "force-always-relay");
el.attributes.toggleClass("selected", force == "Y"); el.attributes.toggleClass("selected", force == "Y");
el.attributes.toggleClass("line-through", force != "Y");
} }
var conn = this.$(menu #connect); var conn = this.$(menu #connect);
if (conn) { if (conn) {

View File

@ -2714,9 +2714,10 @@ impl Interface for Handler {
if direct && !received { if direct && !received {
let errno = errno::errno().0; let errno = errno::errno().0;
log::info!("errno is {}", errno); log::info!("errno is {}", errno);
// TODO // TODO: check mac and ios
if cfg!(windows) && errno == 10054 || !cfg!(windows) && errno == 104 { if cfg!(windows) && errno == 10054 || !cfg!(windows) && errno == 104 {
lc.force_relay = true; lc.force_relay = true;
lc.set_option("force-always-relay".to_owned(), "Y".to_owned());
} }
} }
} }