Skip to content

Commit

Permalink
use local js
Browse files Browse the repository at this point in the history
support reconnect with token
  • Loading branch information
956237586 committed Oct 5, 2024
1 parent caeb44c commit 79d10dd
Show file tree
Hide file tree
Showing 6 changed files with 591 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,23 @@ object OnScreenMessenger : LafListener {
}

private val reload = (document.createElement("div") as HTMLDivElement).apply {
innerHTML = "<p>If you wish, you can try to <a onclick='location.reload();' href=''>reconnect</a>.</p>"

if(text.contains("Reason: Bad handshake token")){
innerHTML = """
<p>If you wish, you can reconnect with token:
<input id='customToken' type='text'/>
<a href='' onclick='
let token = document.getElementById("customToken").value;
let searchParams = new URLSearchParams(location.search);
searchParams.set("token", token);
let url = `${location.protocol}//${location.host}${location.pathname}?${searchParams.toString()}`;
console.log("reconnect with token", token);
location.href = url;
return false;
'>Submit</a></p>
""".trimIndent()
} else {
innerHTML = "<p>If you wish, you can try to <a onclick='location.reload();' href=''>reconnect</a>.</p>"
}
div.appendChild(this)
}

Expand Down
Loading

0 comments on commit 79d10dd

Please sign in to comment.