1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Merge pull request #112 from MinusGix/patch-3

Fix auto-reconnect
This commit is contained in:
marzavec 2020-08-12 08:08:27 -05:00 committed by GitHub
commit bba812a266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,6 +316,7 @@ function join(channel) {
var wasConnected = false;
ws.onopen = function () {
var shouldConnect = true;
if (!wasConnected) {
if (location.hash) {
myNick = location.hash.substr(1);
@ -323,11 +324,14 @@ function join(channel) {
var newNick = prompt('Nickname:', myNick);
if (newNick !== null) {
myNick = newNick;
} else {
// The user cancelled the prompt in some manner
shouldConnect = false;
}
}
}
if (myNick) {
if (myNick && shouldConnect) {
localStorageSet('my-nick', myNick);
send({ cmd: 'join', channel: channel, nick: myNick });
}