20 lines
544 B
JavaScript
20 lines
544 B
JavaScript
export class ServerAuth {
|
|
constructor (address, port, tlsEnabled) {
|
|
this.address = address;
|
|
this.port = port;
|
|
this.isTLSenabled = !!tlsEnabled;
|
|
}
|
|
|
|
getAuth () {
|
|
const serverdata = JSON.parse(localStorage.getItem(`server:${
|
|
!!this.isTLSenabled ? "wss" : "ws"
|
|
}:${address}:${port}`) ?? "null");
|
|
if (!serverdata) return null;
|
|
|
|
}
|
|
}
|
|
|
|
ServerAuth.authForm = document.createElement("div");
|
|
["auth-window"].forEach(c =>
|
|
ServerAuth.authForm.classList.add(c));
|
|
ServerAuth.authForm.innerHTML = `<center><h1>Log-In</h1></center><hr/>`; |