Style cleanup
This commit is contained in:
		
							parent
							
								
									61cc4a19f3
								
							
						
					
					
						commit
						2ff43ea801
					
				
					 1 changed files with 9 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -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,11 @@ class Form extends ElemJS {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	async findHomeserver(address, maxDepth = 5) {
 | 
			
		||||
	
 | 
			
		||||
		// Protects us from servers sending us on a redirect loop
 | 
			
		||||
		maxDepth--
 | 
			
		||||
		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
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +137,7 @@ class Form extends ElemJS {
 | 
			
		|||
			}
 | 
			
		||||
		} catch(e) {}
 | 
			
		||||
 | 
			
		||||
		// 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 +153,6 @@ class Form extends ElemJS {
 | 
			
		|||
		return this.findHomeserver(nextAddress, maxDepth)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	status(message) {
 | 
			
		||||
		feedback.setLoading(true)
 | 
			
		||||
		feedback.message(message)
 | 
			
		||||
| 
						 | 
				
			
			@ -169,6 +166,3 @@ class Form extends ElemJS {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
const form = new Form()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue