mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	Fix linting errors.
This commit is contained in:
		@@ -1,10 +1,10 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const {app} = require('electron').remote;
 | 
					const {app} = require('electron').remote;
 | 
				
			||||||
const JsonDB = require('node-json-db');
 | 
					 | 
				
			||||||
const request = require('request');
 | 
					 | 
				
			||||||
const fs = require('fs');
 | 
					const fs = require('fs');
 | 
				
			||||||
const path = require('path');
 | 
					const path = require('path');
 | 
				
			||||||
 | 
					const JsonDB = require('node-json-db');
 | 
				
			||||||
 | 
					const request = require('request');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let instance = null;
 | 
					let instance = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,17 +44,17 @@ class DomainUtil {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	addDomain(server) {
 | 
						addDomain(server) {
 | 
				
			||||||
		return new Promise((res, rej) => {
 | 
							return new Promise(resolve => {
 | 
				
			||||||
			if (server.icon) {
 | 
								if (server.icon) {
 | 
				
			||||||
				this.saveServerIcon(server.icon).then((localIconUrl) => {
 | 
									this.saveServerIcon(server.icon).then(localIconUrl => {
 | 
				
			||||||
					server.icon = localIconUrl;
 | 
										server.icon = localIconUrl;
 | 
				
			||||||
					this.db.push('/domains[]', server, true);
 | 
										this.db.push('/domains[]', server, true);
 | 
				
			||||||
					res();
 | 
										resolve();
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				server.icon = defaultIconUrl;
 | 
									server.icon = defaultIconUrl;
 | 
				
			||||||
				this.db.push('/domains[]', server, true);
 | 
									this.db.push('/domains[]', server, true);
 | 
				
			||||||
				res();
 | 
									resolve();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -96,23 +96,22 @@ class DomainUtil {
 | 
				
			|||||||
		// The save will always succeed. If url is invalid, downgrade to default icon.
 | 
							// The save will always succeed. If url is invalid, downgrade to default icon.
 | 
				
			||||||
		const dir = `${app.getPath('userData')}/server-icons`;
 | 
							const dir = `${app.getPath('userData')}/server-icons`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!fs.existsSync(dir)){
 | 
							if (!fs.existsSync(dir)) {
 | 
				
			||||||
			fs.mkdirSync(dir);
 | 
								fs.mkdirSync(dir);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return new Promise((res, rej) => {
 | 
							return new Promise(resolve => {
 | 
				
			||||||
			const filePath = `${dir}/${new Date().getMilliseconds()}${path.extname(url)}`;
 | 
								const filePath = `${dir}/${new Date().getMilliseconds()}${path.extname(url)}`;
 | 
				
			||||||
			let file = fs.createWriteStream(filePath);
 | 
								const file = fs.createWriteStream(filePath);
 | 
				
			||||||
			console.log(filePath);
 | 
								console.log(filePath);
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				let req = request(url);
 | 
									request(url).on('response', response => {
 | 
				
			||||||
				req.on('response', response => {
 | 
					 | 
				
			||||||
					response.pipe(file);
 | 
										response.pipe(file);
 | 
				
			||||||
					res(filePath);
 | 
										resolve(filePath);
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			} catch (error) {
 | 
								} catch (err) {
 | 
				
			||||||
				console.log(error);
 | 
									console.log(err);
 | 
				
			||||||
				res(defaultIconUrl);
 | 
									resolve(defaultIconUrl);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user