Add a login loop when the password is wrong
This commit is contained in:
parent
103eb7835a
commit
d36274cd33
@ -20,23 +20,25 @@ extern "C" {
|
||||
}
|
||||
|
||||
fn run() -> Result<(), JsValue> {
|
||||
spawn_local(async move {
|
||||
let vnc = loop {
|
||||
// connect
|
||||
let url = format!(
|
||||
"{scheme}://{host}/websockify",
|
||||
scheme = if web_sys::window()
|
||||
.unwrap()
|
||||
.location()
|
||||
.protocol()?
|
||||
.protocol()
|
||||
.unwrap()
|
||||
.starts_with("https")
|
||||
{
|
||||
"wss"
|
||||
} else {
|
||||
"ws"
|
||||
},
|
||||
host = web_sys::window().unwrap().location().host()?
|
||||
host = web_sys::window().unwrap().location().host().unwrap()
|
||||
);
|
||||
|
||||
spawn_local(async move {
|
||||
// start websocket
|
||||
let (_ws, wsio) = WsMeta::connect(url, vec!["binary"]).await.unwrap();
|
||||
|
||||
@ -59,11 +61,13 @@ fn run() -> Result<(), JsValue> {
|
||||
|
||||
if vnc.is_err() {
|
||||
if let Err(e) = vnc {
|
||||
let msg = format!("connect error {:?}\nRe log in", e);
|
||||
let msg = format!("connect error {:?}\nRelog in please", e);
|
||||
alert(&msg);
|
||||
panic!("{}", msg);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break vnc;
|
||||
};
|
||||
|
||||
let vnc = vnc.unwrap().finish().unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user