fix file transfer hanging if disabled, and add trans

This commit is contained in:
rustdesk 2022-03-22 17:09:45 +08:00
parent 9136b3e3f8
commit 0dd4087408
11 changed files with 41 additions and 13 deletions

View File

@ -208,5 +208,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Download new version", "下载新版本"),
("Touch mode", "触屏模式"),
("Reset canvas", "重置画布"),
("No permission of file transfer", "没有文件传输权限"),
("Note", "备注"),
].iter().cloned().collect();
}
}

View File

@ -208,5 +208,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Download new version", "Neue Version herunterladen."),
("Touch mode", "Berührungsmodus."),
("Reset canvas", "Anzeige zurücksetzen."),
("No permission of file transfer", "Keine Erlaubnis zur Dateiübertragung"),
("Note", "Notiz"),
].iter().cloned().collect();
}

View File

@ -209,7 +209,9 @@ lazy_static::lazy_static! {
("Socks5 Proxy", "Socks5 prokura servilo"),
("Add to Favorites", "Aldoni al la favorataj"),
("Remove from Favorites", "Forigi el la favorataj"),
("Unremember Password", "Forgesi pasvorton")
("Unremember Password", "Forgesi pasvorton"),
("No permission of file transfer", "Neniu permeso de dosiertransigo"),
("Note", "Notu"),
].iter().cloned().collect();
}

View File

@ -202,5 +202,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Download new version", "Télécharger la nouvelle version"),
("Touch mode", "Mode tactile"),
("Reset canvas", "Réinitialiser le canevas"),
("No permission of file transfer", "Aucune autorisation de transfert de fichiers"),
("Note", "Noter"),
].iter().cloned().collect();
}

View File

@ -201,5 +201,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Download new version", "Scarica nuova versione"),
("Touch mode", "Modalità tocco"),
("Reset canvas", "Ripristina tela"),
("No permission of file transfer", "Nessun permesso di trasferimento di file"),
("Note", "Nota"),
].iter().cloned().collect();
}

View File

@ -208,5 +208,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Download new version", "Загрузить новую версию"),
("Touch mode", "Сенсорный режим"),
("Reset canvas", "Сбросить холст"),
("No permission of file transfer", "Нет разрешения на передачу файлов"),
("Note", "Примечание"),
].iter().cloned().collect();
}

View File

@ -201,5 +201,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Download new version", "下載新版本"),
("Touch mode", "觸控模式"),
("Reset canvas", "重置畫布"),
("No permission of file transfer", "無文件傳輸權限"),
("Note", "備註"),
].iter().cloned().collect();
}

View File

@ -14,6 +14,7 @@ function getSessionsStyle(type) {
}
var searchPatterns = {};
var current_menu_peer_id = '';
class SearchBar: Reactor.Component {
this var type = "";
@ -177,7 +178,7 @@ class SessionList: Reactor.Component {
}
// https://sciter.com/forums/topic/replacecustomize-context-menu/
var menu = this.$(menu#remote-context);
menu.attributes["remote-id"] = id;
current_menu_peer_id = id;
var conn = this.$(menu #connect);
if (conn) {
var alias = me.parent.parent.$(#alias);
@ -195,7 +196,7 @@ class SessionList: Reactor.Component {
event click $(menu#remote-context li) (evt, me) {
var action = me.id;
var id = me.parent.attributes["remote-id"];
var id = current_menu_peer_id;
if (action == "connect") {
createNewConnect(id, "connect");
} else if (action == "transfer") {

View File

@ -247,7 +247,7 @@ function connecting() {
handler.msgbox = function(type, title, text, hasRetry=false) {
// crash somehow (when input wrong password), even with small time, for example, 1ms
self.timer(30ms, function() { msgbox(type, title, text, null, 180, 500, hasRetry); });
self.timer(60ms, function() { msgbox(type, title, text, null, 180, 500, hasRetry); });
}
var reconnectTimeout = 1000;

View File

@ -1162,6 +1162,14 @@ impl Handler {
#[inline]
fn call(&self, func: &str, args: &[Value]) {
let r = self.read().unwrap();
if let Some(ref e) = r.element {
allow_err!(e.call_method(func, args));
}
}
#[inline]
fn call2(&self, func: &str, args: &[Value]) {
let r = self.read().unwrap();
if let Some(ref e) = r.element {
allow_err!(e.call_method(func, &super::value_crash_workaround(args)[..]));
@ -1712,7 +1720,7 @@ impl Remote {
Some(message::Union::video_frame(vf)) => {
if !self.first_frame {
self.first_frame = true;
self.handler.call("closeSuccess", &make_args!());
self.handler.call2("closeSuccess", &make_args!());
self.handler.call("adaptSize", &make_args!());
}
self.video_sender.send(MediaData::VideoFrame(vf)).ok();
@ -1822,26 +1830,29 @@ impl Remote {
SERVER_KEYBOARD_ENABLED = p.enabled;
}
self.handler
.call("setPermission", &make_args!("keyboard", p.enabled));
.call2("setPermission", &make_args!("keyboard", p.enabled));
}
Permission::Clipboard => {
unsafe {
SERVER_CLIPBOARD_ENABLED = p.enabled;
}
self.handler
.call("setPermission", &make_args!("clipboard", p.enabled));
.call2("setPermission", &make_args!("clipboard", p.enabled));
}
Permission::Audio => {
self.handler
.call("setPermission", &make_args!("audio", p.enabled));
.call2("setPermission", &make_args!("audio", p.enabled));
}
Permission::File => {
unsafe {
SERVER_FILE_TRANSFER_ENABLED = p.enabled;
}
if !p.enabled && self.handler.is_file_transfer() {
return true;
}
self.check_clipboard_file_context();
self.handler
.call("setPermission", &make_args!("file", p.enabled));
.call2("setPermission", &make_args!("file", p.enabled));
}
}
}
@ -1945,7 +1956,7 @@ fn make_fd(id: i32, entries: &Vec<FileEntry>, only_count: bool) -> Value {
impl Interface for Handler {
fn msgbox(&self, msgtype: &str, title: &str, text: &str) {
let retry = check_if_retry(msgtype, title, text);
self.call("msgbox_retry", &make_args!(msgtype, title, text, retry));
self.call2("msgbox_retry", &make_args!(msgtype, title, text, retry));
}
fn handle_login_error(&mut self, err: &str) -> bool {
@ -2003,7 +2014,7 @@ impl Interface for Handler {
self.lc.write().unwrap().handle_peer_info(username, pi);
self.call("updatePi", &make_args!(pi_sciter));
if self.is_file_transfer() {
self.call("closeSuccess", &make_args!());
self.call2("closeSuccess", &make_args!());
} else if !self.is_port_forward() {
self.msgbox("success", "Successful", "Connected, waiting for image...");
}

View File

@ -444,12 +444,14 @@ function self.closing() {
}
handler.setPermission = function(name, enabled) {
self.timer(60ms, function() {
if (name == "keyboard") keyboard_enabled = enabled;
if (name == "audio") audio_enabled = enabled;
if (name == "file") file_enabled = enabled;
if (name == "clipboard") clipboard_enabled = enabled;
input_blocked = false;
header.update();
});
}
handler.closeSuccess = function() {