Style fixes
This commit is contained in:
		
							parent
							
								
									0113024be6
								
							
						
					
					
						commit
						16de7edd19
					
				
					 1 changed files with 6 additions and 11 deletions
				
			
		| 
						 | 
					@ -71,7 +71,6 @@ class Form extends ElemJS {
 | 
				
			||||||
		this.on("submit", this.submit.bind(this))
 | 
							this.on("submit", this.submit.bind(this))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	async submit() {
 | 
						async submit() {
 | 
				
			||||||
		if (this.processing) return
 | 
							if (this.processing) return
 | 
				
			||||||
		this.processing = true
 | 
							this.processing = true
 | 
				
			||||||
| 
						 | 
					@ -115,11 +114,11 @@ class Form extends ElemJS {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	async findHomeserver(address, maxDepth = 5) {
 | 
						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--
 | 
							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?:\/\//)) {
 | 
							if (!address.match(/^https?:\/\//)) {
 | 
				
			||||||
			console.warn(`${address} doesn't specify the protocol, assuming https`)
 | 
								console.warn(`${address} doesn't specify the protocol, assuming https`)
 | 
				
			||||||
			address = "https://" + address
 | 
								address = "https://" + address
 | 
				
			||||||
| 
						 | 
					@ -133,13 +132,13 @@ class Form extends ElemJS {
 | 
				
			||||||
		/* jshint ignore:start */
 | 
							/* jshint ignore:start */
 | 
				
			||||||
		//JsHint doesn't support optional chaining
 | 
							//JsHint doesn't support optional chaining
 | 
				
			||||||
		// https://github.com/jshint/jshint/issues/3448
 | 
							// https://github.com/jshint/jshint/issues/3448
 | 
				
			||||||
		if(versionsReq?.ok) {
 | 
							if (versionsReq?.ok) {
 | 
				
			||||||
			const versions = await versionsReq.json().catch(()=>{})
 | 
								const versions = await versionsReq.json().catch(()=>{})
 | 
				
			||||||
			if (Array.isArray(versions?.versions)) return address
 | 
								if (Array.isArray(versions?.versions)) return address
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		/* jshint ignore:end */
 | 
							/* 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 => {
 | 
							const root = await fetch(`${address}/.well-known/matrix/client`).then(res => res.json()).catch(e => {
 | 
				
			||||||
 			console.error(e)
 | 
					 			console.error(e)
 | 
				
			||||||
			throw new Error(`Failed to look up server ${address}`)
 | 
								throw new Error(`Failed to look up server ${address}`)
 | 
				
			||||||
| 
						 | 
					@ -155,7 +154,6 @@ class Form extends ElemJS {
 | 
				
			||||||
		return this.findHomeserver(nextAddress, maxDepth)
 | 
							return this.findHomeserver(nextAddress, maxDepth)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	status(message) {
 | 
						status(message) {
 | 
				
			||||||
		feedback.setLoading(true)
 | 
							feedback.setLoading(true)
 | 
				
			||||||
		feedback.message(message)
 | 
							feedback.message(message)
 | 
				
			||||||
| 
						 | 
					@ -169,6 +167,3 @@ class Form extends ElemJS {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const form = new Form()
 | 
					const form = new Form()
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue