From 16de7edd19d864045b5af9f2e5195edd86ad7bfd Mon Sep 17 00:00:00 2001 From: Bad Date: Thu, 22 Oct 2020 09:14:58 +0200 Subject: [PATCH] Style fixes --- src/js/login.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/js/login.js b/src/js/login.js index 83353cd..68d4683 100644 --- a/src/js/login.js +++ b/src/js/login.js @@ -71,7 +71,6 @@ class Form extends ElemJS { this.on("submit", this.submit.bind(this)) } - async submit() { if (this.processing) return this.processing = true @@ -114,12 +113,12 @@ class Form extends ElemJS { } async findHomeserver(address, maxDepth = 5) { - - //Protects us from servers sending us on a redirect loop + + //Protects from servers sending us on a redirect loop maxDepth-- - if(maxDepth<=0) throw new Error(`Failed to look up homeserver, maximum search depth reached`) + if (maxDepth <= 0) throw new Error(`Failed to look up homeserver, maximum search depth reached`) - //Preprocess the address + //Normalise the address if (!address.match(/^https?:\/\//)) { console.warn(`${address} doesn't specify the protocol, assuming https`) address = "https://" + address @@ -133,13 +132,13 @@ class Form extends ElemJS { /* jshint ignore:start */ //JsHint doesn't support optional chaining // https://github.com/jshint/jshint/issues/3448 - if(versionsReq?.ok) { + if (versionsReq?.ok) { const versions = await versionsReq.json().catch(()=>{}) if (Array.isArray(versions?.versions)) return address } /* jshint ignore:end */ - // find the next matrix server in the chain + // Find the next matrix server in the chain const root = await fetch(`${address}/.well-known/matrix/client`).then(res => res.json()).catch(e => { console.error(e) throw new Error(`Failed to look up server ${address}`) @@ -155,7 +154,6 @@ class Form extends ElemJS { return this.findHomeserver(nextAddress, maxDepth) } - status(message) { feedback.setLoading(true) feedback.message(message) @@ -169,6 +167,3 @@ class Form extends ElemJS { } const form = new Form() - - -