Move methods from mainWindow.webContents (index.js) to WebView (main.js).

This commit is contained in:
Zhongyi Tong
2017-04-27 00:07:22 +08:00
committed by akashnimare
parent 865553fa45
commit de34a22740
8 changed files with 59 additions and 189 deletions

View File

@@ -13,6 +13,10 @@ class DomainUtil {
return this.db.getData('/domains');
}
getDomain(index) {
return this.db.getData(`/domains[${index}]`);
}
addDomain(server) {
server.icon = server.icon || 'https://chat.zulip.org/static/images/logo/zulip-icon-128x128.271d0f6a0ca2.png';
this.db.push("/domains[]", server, true);
@@ -38,7 +42,13 @@ class DomainUtil {
request(checkDomain, (error, response) => {
if (!error && response.statusCode !== 404) {
res(domain);
} else {
} else if (error.toString().indexOf('Error: self signed certificate') >= 0) {
if (window.confirm(`Do you trust certificate from ${domain}?`)) {
res(domain);
} else {
rej('Untrusted Certificate.');
}
} else {
rej('Not a valid Zulip server');
}
});