mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-01 01:29:02 +08:00
fix new msgbox when wrong password
This commit is contained in:
parent
cd62d7024b
commit
3112792b7b
@ -304,12 +304,10 @@ class MultipleSessions: Reactor.Component {
|
||||
var nEle = 0;
|
||||
for (var el in this.$$(#sessions-type span)) {
|
||||
nEle += 1;
|
||||
var n = el.text.length;
|
||||
totalChars += n;
|
||||
totalChars += el.text.length;
|
||||
}
|
||||
for (var el in this.$$(#sessions-type span)) {
|
||||
var n = el.text.length;
|
||||
var maxWidth = (w - nEle * 2 * 8) * n / totalChars;
|
||||
var maxWidth = (w - nEle * 2 * 8) * el.text.length / totalChars;
|
||||
if (maxWidth < 0) maxWidth = 36;
|
||||
el.style.set{
|
||||
"max-width": maxWidth + "px",
|
||||
|
@ -234,14 +234,14 @@ function msgbox(type, title, content, callback=null, height=180, width=500, hasR
|
||||
width += is_xfce ? 50 : 0;
|
||||
height += is_xfce ? 50 : 0;
|
||||
|
||||
if (type == "input-password") {
|
||||
if (type.indexOf("input-password") >= 0) {
|
||||
callback = function (res) {
|
||||
if (!res) {
|
||||
view.close();
|
||||
return;
|
||||
}
|
||||
handler.login(res.password, res.remember);
|
||||
if (!is_port_forward) msgbox("connecting", "Connecting...", "Logging in...");
|
||||
if (!is_port_forward) handler.msgbox("connecting", "Connecting...", "Logging in...");
|
||||
};
|
||||
} else if (type.indexOf("custom") < 0 && !is_port_forward && !callback) {
|
||||
callback = function() { view.close(); }
|
||||
@ -254,16 +254,16 @@ function connecting() {
|
||||
}
|
||||
|
||||
handler.msgbox = function(type, title, text, hasRetry=false) {
|
||||
msgbox(type, title, text, null, 180, 500, hasRetry);
|
||||
// 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); });
|
||||
}
|
||||
|
||||
var reconnectTimeout = 1000;
|
||||
var activeTimer = function() {};
|
||||
handler.msgbox_retry = function(type, title, text, hasRetry) {
|
||||
handler.msgbox(type, title, text, hasRetry);
|
||||
if (hasRetry) {
|
||||
self.timer(0, activeTimer);
|
||||
activeTimer = self.timer(reconnectTimeout, retryConnect);
|
||||
self.timer(0, retryConnect);
|
||||
self.timer(reconnectTimeout, retryConnect);
|
||||
reconnectTimeout *= 2;
|
||||
} else {
|
||||
reconnectTimeout = 1000;
|
||||
@ -271,9 +271,9 @@ handler.msgbox_retry = function(type, title, text, hasRetry) {
|
||||
}
|
||||
|
||||
function retryConnect(cancelTimer=false) {
|
||||
if (cancelTimer) self.timer(0, retryConnect);
|
||||
if (!is_port_forward) connecting();
|
||||
handler.reconnect();
|
||||
if (cancelTimer) self.timer(0, activeTimer);
|
||||
}
|
||||
/******************** end of msgbox ****************************************/
|
||||
|
||||
|
@ -9,7 +9,9 @@ function translate_text(text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var msgboxTimerFunc = function() {}
|
||||
function closeMsgbox() {
|
||||
self.timer(0, msgboxTimerFunc);
|
||||
$(#msgbox).content(<span />);
|
||||
}
|
||||
|
||||
@ -86,12 +88,14 @@ class MsgboxComponent: Reactor.Component {
|
||||
var hasClose = this.type.indexOf("hasclose") >= 0;
|
||||
var show_progress = this.type == "connecting";
|
||||
var me = this;
|
||||
self.timer(1ms, function() {
|
||||
self.timer(0, msgboxTimerFunc);
|
||||
msgboxTimerFunc = function() {
|
||||
if (typeof content == "string")
|
||||
me.$(#content).html = translate(content);
|
||||
else
|
||||
me.$(#content).content(content);
|
||||
});
|
||||
};
|
||||
self.timer(3ms, msgboxTimerFunc);
|
||||
return (<div><div style="position: absolute; size:*; background:black; opacity:0.5;" />
|
||||
<div style="size: *; position: absolute;">
|
||||
<div style={"border: " + color + " solid 1px; background: white; margin: *; width:" + (this.width) + "px; height:" + (this.height) + "px"}>
|
||||
@ -152,7 +156,7 @@ class MsgboxComponent: Reactor.Component {
|
||||
}
|
||||
if (this.type == "re-input-password") {
|
||||
this.type = "input-password";
|
||||
body.update();
|
||||
this.update();
|
||||
return;
|
||||
}
|
||||
var values = this.getValues();
|
||||
@ -221,7 +225,6 @@ class MsgboxComponent: Reactor.Component {
|
||||
el = me.$(#submit);
|
||||
if (el) {
|
||||
view.focus = el;
|
||||
stdout.println(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user