mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-10 08:55:43 +00:00
Lint error fixed #126[WIP]
This commit is contained in:
@@ -68,13 +68,12 @@ function serverError(targetURL) {
|
||||
});
|
||||
req.on('error', e => {
|
||||
if (e.toString().indexOf('Error: self signed certificate') >= 0) {
|
||||
var url = targetURL.replace(/^https?:\/\//, '');
|
||||
const url = targetURL.replace(/^https?:\/\//, '');
|
||||
console.log('Server StatusCode:', 200);
|
||||
console.log('You are connected to:', url);
|
||||
} else {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
});
|
||||
req.end();
|
||||
} else if (data.domain) {
|
||||
@@ -256,27 +255,26 @@ function createMainWindow() {
|
||||
|
||||
// For self-signed certificate
|
||||
ipc.on('certificate-err', (e, domain) => {
|
||||
var detail = `URL: ${domain} \n Error: Self-Signed Certificate`;
|
||||
const detail = `URL: ${domain} \n Error: Self-Signed Certificate`;
|
||||
dialog.showMessageBox(mainWindow, {
|
||||
title: 'Certificate error',
|
||||
message: `Do you trust certificate from ${domain}?`,
|
||||
// eslint-disable-next-line object-shorthand
|
||||
detail: detail,
|
||||
type: 'warning',
|
||||
buttons: [
|
||||
'Yes',
|
||||
'No'
|
||||
],
|
||||
buttons: ['Yes', 'No'],
|
||||
cancelId: 1
|
||||
}, (response) => {
|
||||
// eslint-disable-next-line object-shorthand
|
||||
}, response => {
|
||||
if (response === 0) {
|
||||
db.push("/certifiedURL", [{domain:domain}], false);
|
||||
// eslint-disable-next-line object-shorthand
|
||||
db.push('/certifiedURL', [{domain: domain}], false);
|
||||
db.push('/domain', domain);
|
||||
mainWindow.loadURL(domain);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line max-params
|
||||
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
|
||||
event.preventDefault();
|
||||
callback(true);
|
||||
|
||||
@@ -7,25 +7,21 @@ const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
|
||||
const data = db.getData('/');
|
||||
|
||||
if (!data.certifiedURL) {
|
||||
db.push("/certifiedURL",[]);
|
||||
db.push('/certifiedURL', []);
|
||||
}
|
||||
|
||||
let URL_List = db.getData('/certifiedURL');
|
||||
let URL_Length = URL_List.length;
|
||||
|
||||
const UrlList = db.getData('/certifiedURL');
|
||||
const UrlLength = UrlList.length;
|
||||
|
||||
const checkURL = domain => {
|
||||
|
||||
for ( var i = 0; i < URL_Length; i++) {
|
||||
if (URL_List[i].domain === domain);
|
||||
for (let i = 0; i < UrlLength; i++) {
|
||||
if (UrlList[i].domain === domain) {
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
window.addDomain = function () {
|
||||
const el = sel => {
|
||||
return document.querySelector(sel);
|
||||
|
||||
@@ -20,25 +20,21 @@ window.prefDomain = function () {
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
const JsonDB = require('node-json-db');
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const {
|
||||
app
|
||||
} = require('electron').remote;
|
||||
const {app} = require('electron').remote;
|
||||
|
||||
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
|
||||
|
||||
let URL_List = db.getData('/certifiedURL');
|
||||
const UrlList = db.getData('/certifiedURL');
|
||||
|
||||
let URL_Length = URL_List.length;
|
||||
const UrlLength = UrlList.length;
|
||||
|
||||
const checkURL = domain => {
|
||||
|
||||
for ( var i = 0; i < URL_Length; i++) {
|
||||
if (URL_List[i].domain === domain);
|
||||
for (let i = 0; i < UrlLength; i++) {
|
||||
if (UrlList[i].domain === domain) {
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
let newDomain = document.getElementById('url').value;
|
||||
@@ -82,9 +78,7 @@ window.prefDomain = function () {
|
||||
document.getElementById('main').innerHTML = 'Switch';
|
||||
ipcRenderer.send('certificate-err', domain);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
document.getElementById('main').innerHTML = 'Switch';
|
||||
document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user