mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-02 21:13:32 +00:00
fixed linting
This commit is contained in:
@@ -70,8 +70,8 @@ function createMainWindow() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
win.on('focus', () => {
|
win.on('focus', () => {
|
||||||
win.webContents.send('focus')
|
win.webContents.send('focus');
|
||||||
})
|
});
|
||||||
|
|
||||||
win.once('ready-to-show', () => {
|
win.once('ready-to-show', () => {
|
||||||
win.show();
|
win.show();
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ require(__dirname + '/js/tray.js');
|
|||||||
|
|
||||||
const DomainUtil = require(__dirname + '/js/utils/domain-util.js');
|
const DomainUtil = require(__dirname + '/js/utils/domain-util.js');
|
||||||
const SystemUtil = require(__dirname + '/js/utils/system-util.js');
|
const SystemUtil = require(__dirname + '/js/utils/system-util.js');
|
||||||
const { linkIsInternal, skipImages } = require(__dirname + '/../main/link-helper');
|
const {linkIsInternal, skipImages} = require(__dirname + '/../main/link-helper');
|
||||||
const { shell, ipcRenderer } = require('electron');
|
const {shell, ipcRenderer} = require('electron');
|
||||||
const { app, dialog } = require('electron').remote;
|
const {app, dialog} = require('electron').remote;
|
||||||
|
|
||||||
class ServerManagerView {
|
class ServerManagerView {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -168,7 +168,7 @@ class ServerManagerView {
|
|||||||
|
|
||||||
registerListeners($webView, index) {
|
registerListeners($webView, index) {
|
||||||
$webView.addEventListener('new-window', event => {
|
$webView.addEventListener('new-window', event => {
|
||||||
const { url } = event;
|
const {url} = event;
|
||||||
const domainPrefix = this.domainUtil.getDomain(this.activeTabIndex).url;
|
const domainPrefix = this.domainUtil.getDomain(this.activeTabIndex).url;
|
||||||
if (linkIsInternal(domainPrefix, url) && url.match(skipImages) === null) {
|
if (linkIsInternal(domainPrefix, url) && url.match(skipImages) === null) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -189,9 +189,10 @@ class ServerManagerView {
|
|||||||
$webView.addEventListener('did-start-loading', () => {
|
$webView.addEventListener('did-start-loading', () => {
|
||||||
$webView.setUserAgent(this.systemUtil.getUserAgent() + $webView.getUserAgent());
|
$webView.setUserAgent(this.systemUtil.getUserAgent() + $webView.getUserAgent());
|
||||||
});
|
});
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line arrow-parens
|
||||||
$webView.addEventListener('did-fail-load', (event) => {
|
$webView.addEventListener('did-fail-load', (event) => {
|
||||||
const { errorCode, errorDescription, validatedURL } = event;
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const {errorCode, errorDescription, validatedURL} = event;
|
||||||
const hasConnectivityErr = (this.systemUtil.connectivityERR.indexOf(errorDescription) >= 0);
|
const hasConnectivityErr = (this.systemUtil.connectivityERR.indexOf(errorDescription) >= 0);
|
||||||
if (hasConnectivityErr) {
|
if (hasConnectivityErr) {
|
||||||
console.error('error', errorDescription);
|
console.error('error', errorDescription);
|
||||||
@@ -235,7 +236,7 @@ class ServerManagerView {
|
|||||||
|
|
||||||
ipcRenderer.on('focus', () => {
|
ipcRenderer.on('focus', () => {
|
||||||
const activeWebview = document.getElementById(`webview-${this.activeTabIndex}`);
|
const activeWebview = document.getElementById(`webview-${this.activeTabIndex}`);
|
||||||
activeWebview.focus()
|
activeWebview.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('forward', () => {
|
ipcRenderer.on('forward', () => {
|
||||||
|
|||||||
@@ -5,36 +5,36 @@ const {app} = require('electron').remote;
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
||||||
class SystemUtil {
|
class SystemUtil {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.connectivityERR = [
|
this.connectivityERR = [
|
||||||
'ERR_INTERNET_DISCONNECTED',
|
'ERR_INTERNET_DISCONNECTED',
|
||||||
'ERR_PROXY_CONNECTION_FAILED',
|
'ERR_PROXY_CONNECTION_FAILED',
|
||||||
'ERR_CONNECTION_RESET',
|
'ERR_CONNECTION_RESET',
|
||||||
'ERR_NOT_CONNECTED',
|
'ERR_NOT_CONNECTED',
|
||||||
'ERR_NAME_NOT_RESOLVED',
|
'ERR_NAME_NOT_RESOLVED',
|
||||||
'ERR_NETWORK_CHANGED'
|
'ERR_NETWORK_CHANGED'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
getOS() {
|
|
||||||
if (os.platform() === 'darwin') {
|
|
||||||
return 'Mac';
|
|
||||||
}
|
|
||||||
if (os.platform() === 'linux') {
|
|
||||||
return 'Linux';
|
|
||||||
}
|
|
||||||
if (os.platform() === 'win32' || os.platform() === 'win64') {
|
|
||||||
if (parseFloat(os.release()) < 6.2) {
|
|
||||||
return 'Windows 7';
|
|
||||||
} else {
|
|
||||||
return 'Windows 10';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getUserAgent() {
|
getOS() {
|
||||||
return 'ZulipElectron/' + app.getVersion() + ' ' + this.getOS();
|
if (os.platform() === 'darwin') {
|
||||||
}
|
return 'Mac';
|
||||||
|
}
|
||||||
|
if (os.platform() === 'linux') {
|
||||||
|
return 'Linux';
|
||||||
|
}
|
||||||
|
if (os.platform() === 'win32' || os.platform() === 'win64') {
|
||||||
|
if (parseFloat(os.release()) < 6.2) {
|
||||||
|
return 'Windows 7';
|
||||||
|
} else {
|
||||||
|
return 'Windows 10';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getUserAgent() {
|
||||||
|
return 'ZulipElectron/' + app.getVersion() + ' ' + this.getOS();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SystemUtil;
|
module.exports = SystemUtil;
|
||||||
|
|||||||
Reference in New Issue
Block a user