make client init failures spit out valuable error messages

This commit is contained in:
ari melody 2024-06-21 03:02:18 +01:00
parent ffecd51fd2
commit 893ee804c1
Signed by: ari
GPG key ID: CF99829C92678188
2 changed files with 22 additions and 12 deletions

View file

@ -18,14 +18,8 @@
event.preventDefault();
const host = event.target.host.value;
client.init(host).then(() => {
if (client.instance.type === server_types.INCOMPATIBLE) {
console.error("Server " + client.instance.host + " is not supported - " + client.instance.version);
alert("Sorry, this app is not compatible with " + client.instance.host + "!");
return;
}
console.log("Server is \"" + client.instance.type + "\" (or compatible).");
client.save();
client.init(host).then(res => {
if (!res) return;
let oauth_url = client.getOAuthUrl();
location = oauth_url;
});