Compare commits
	
		
			140 Commits
		
	
	
		
			tray-icon
			...
			dock-bounc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3091bd5be8 | ||
| 
						 | 
					5d113c611f | ||
| 
						 | 
					acf7c5a238 | ||
| 
						 | 
					da22f75300 | ||
| 
						 | 
					df35ffc3b0 | ||
| 
						 | 
					eeb0b4a666 | ||
| 
						 | 
					0a893c97c7 | ||
| 
						 | 
					99a1711bb0 | ||
| 
						 | 
					a27cf9e0e7 | ||
| 
						 | 
					22d6c6a2f3 | ||
| 
						 | 
					c742591471 | ||
| 
						 | 
					339a415d60 | ||
| 
						 | 
					f7696cc04d | ||
| 
						 | 
					1eabf5c5a2 | ||
| 
						 | 
					4d020c639b | ||
| 
						 | 
					85a6cf6890 | ||
| 
						 | 
					ef1ad820aa | ||
| 
						 | 
					10f6d80e5f | ||
| 
						 | 
					50ef02c324 | ||
| 
						 | 
					deed18d75f | ||
| 
						 | 
					0e3c6bceeb | ||
| 
						 | 
					c2e138c16a | ||
| 
						 | 
					8d1b027b0e | ||
| 
						 | 
					7bb8d78973 | ||
| 
						 | 
					a7c7791bf8 | ||
| 
						 | 
					5d120b4416 | ||
| 
						 | 
					ceaf13dee2 | ||
| 
						 | 
					f81381dfec | ||
| 
						 | 
					dbe89cdd09 | ||
| 
						 | 
					14c59bdae1 | ||
| 
						 | 
					0ac3e3f6d3 | ||
| 
						 | 
					d69c1339e6 | ||
| 
						 | 
					fe56a20334 | ||
| 
						 | 
					cfc97c9b73 | ||
| 
						 | 
					2e70b515da | ||
| 
						 | 
					51e414a508 | ||
| 
						 | 
					8e7a9bf230 | ||
| 
						 | 
					6493ddb8ec | ||
| 
						 | 
					31edbe0d67 | ||
| 
						 | 
					9980fee785 | ||
| 
						 | 
					ff9986ec6b | ||
| 
						 | 
					f3423d394c | ||
| 
						 | 
					a1da199627 | ||
| 
						 | 
					537fbe8f9e | ||
| 
						 | 
					3fccb33fca | ||
| 
						 | 
					5638590c8b | ||
| 
						 | 
					29ed00981d | ||
| 
						 | 
					d7638c0b95 | ||
| 
						 | 
					7fadbe877b | ||
| 
						 | 
					32a21889fb | ||
| 
						 | 
					c4a961f9da | ||
| 
						 | 
					ceaa898570 | ||
| 
						 | 
					73fe17041d | ||
| 
						 | 
					9f756cad3e | ||
| 
						 | 
					6db6b7c482 | ||
| 
						 | 
					09c45e75e8 | ||
| 
						 | 
					120b80cf65 | ||
| 
						 | 
					22f705960d | ||
| 
						 | 
					ca8ce1deaa | ||
| 
						 | 
					f70432f4e3 | ||
| 
						 | 
					60d693700e | ||
| 
						 | 
					6e7333eab6 | ||
| 
						 | 
					0d8dd1cd90 | ||
| 
						 | 
					0ee3757774 | ||
| 
						 | 
					811df9f381 | ||
| 
						 | 
					8bd02cc7e4 | ||
| 
						 | 
					9d5d221371 | ||
| 
						 | 
					6006f1a3f8 | ||
| 
						 | 
					4f96df4a34 | ||
| 
						 | 
					a13558fa16 | ||
| 
						 | 
					a1d19a385c | ||
| 
						 | 
					c98667236e | ||
| 
						 | 
					b80c3d007b | ||
| 
						 | 
					70fb198a0b | ||
| 
						 | 
					7276bfeaa7 | ||
| 
						 | 
					abd71330ba | ||
| 
						 | 
					e776222d6b | ||
| 
						 | 
					30b05571e7 | ||
| 
						 | 
					0a155c63e7 | ||
| 
						 | 
					13c750ac6c | ||
| 
						 | 
					48799f75d1 | ||
| 
						 | 
					29f4e702ad | ||
| 
						 | 
					3eb4cf4f64 | ||
| 
						 | 
					1a97d8a5b0 | ||
| 
						 | 
					2f96ec6199 | ||
| 
						 | 
					52de465457 | ||
| 
						 | 
					e3039cf5a9 | ||
| 
						 | 
					6c120269eb | ||
| 
						 | 
					b31fc6b66d | ||
| 
						 | 
					435e5f086e | ||
| 
						 | 
					603ad7dfcd | ||
| 
						 | 
					a47a0e3e90 | ||
| 
						 | 
					8e04920f54 | ||
| 
						 | 
					4a7b84e483 | ||
| 
						 | 
					ffd2ee36fa | ||
| 
						 | 
					c11fa93642 | ||
| 
						 | 
					a90dc0c82f | ||
| 
						 | 
					028bc02d0a | ||
| 
						 | 
					d673d5b76c | ||
| 
						 | 
					2bf88aa912 | ||
| 
						 | 
					c9f179a2ae | ||
| 
						 | 
					c11089027c | ||
| 
						 | 
					5c45ab7b66 | ||
| 
						 | 
					6205ca0aca | ||
| 
						 | 
					b83e2dd428 | ||
| 
						 | 
					fd421a62d2 | ||
| 
						 | 
					fa85241c79 | ||
| 
						 | 
					b163c237b6 | ||
| 
						 | 
					5351ee10fa | ||
| 
						 | 
					d48b6ae80d | ||
| 
						 | 
					2d07d40c92 | ||
| 
						 | 
					55ae71c00c | ||
| 
						 | 
					0c18bb5226 | ||
| 
						 | 
					6d213c86a8 | ||
| 
						 | 
					0c1cd96ed7 | ||
| 
						 | 
					d77b1b5960 | ||
| 
						 | 
					2c6c0c8c8d | ||
| 
						 | 
					84bf59d32f | ||
| 
						 | 
					256c352fb9 | ||
| 
						 | 
					da28589c17 | ||
| 
						 | 
					c452ee2ef6 | ||
| 
						 | 
					3582aa4694 | ||
| 
						 | 
					7f7eee2455 | ||
| 
						 | 
					c716b8f233 | ||
| 
						 | 
					4a40c75127 | ||
| 
						 | 
					239631a2b6 | ||
| 
						 | 
					89d1344e2f | ||
| 
						 | 
					1948ba2cc3 | ||
| 
						 | 
					b8da7dd6ee | ||
| 
						 | 
					4a0efb7301 | ||
| 
						 | 
					aedd95259d | ||
| 
						 | 
					c8d7a79877 | ||
| 
						 | 
					6e6db42b54 | ||
| 
						 | 
					db79284fbb | ||
| 
						 | 
					2434f06655 | ||
| 
						 | 
					1d611d3382 | ||
| 
						 | 
					a746194e9e | ||
| 
						 | 
					7cc13f7a26 | ||
| 
						 | 
					6a9bb152a0 | ||
| 
						 | 
					8b6dcd355f | 
							
								
								
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -7,6 +7,13 @@ node_modules/
 | 
				
			|||||||
# Compiled binary build directory
 | 
					# Compiled binary build directory
 | 
				
			||||||
dist/
 | 
					dist/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#snap generated files
 | 
				
			||||||
 | 
					snap/parts
 | 
				
			||||||
 | 
					snap/prime
 | 
				
			||||||
 | 
					snap/snap
 | 
				
			||||||
 | 
					snap/stage
 | 
				
			||||||
 | 
					snap/*.snap
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Logs
 | 
					# Logs
 | 
				
			||||||
logs
 | 
					logs
 | 
				
			||||||
*.log
 | 
					*.log
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ addons:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
language: node_js
 | 
					language: node_js
 | 
				
			||||||
node_js:
 | 
					node_js:
 | 
				
			||||||
- '6'
 | 
					- '8'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
before_install:
 | 
					before_install:
 | 
				
			||||||
  - ./scripts/travis-xvfb.sh
 | 
					  - ./scripts/travis-xvfb.sh
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ Zulip-Desktop app is built on top of [Electron](http://electron.atom.io/). If yo
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
* The whole Zulip documentation, such as setting up a development environment, setting up with the Zulip webapp project, and testing, can be read [here](https://zulip.readthedocs.io).
 | 
					* The whole Zulip documentation, such as setting up a development environment, setting up with the Zulip webapp project, and testing, can be read [here](https://zulip.readthedocs.io).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* If you have any questions regarding zulip-electron, open an [issue](https://github.com/zulip/zulip-electron/issues/new/) or ask it on [chat.zulip.org](https://chat.zulip.org/#narrow/stream/electron).
 | 
					* If you have any questions regarding zulip-electron, open an [issue](https://github.com/zulip/zulip-electron/issues/new/) or ask it on [chat.zulip.org](https://chat.zulip.org/#narrow/stream/16-desktop).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Issue
 | 
					## Issue
 | 
				
			||||||
Ensure the bug was not already reported by searching on GitHub under [issues](https://github.com/zulip/zulip-electron/issues). If you're unable to find an open issue addressing the bug, open a [new issue](https://github.com/zulip/zulip-electron/issues/new).
 | 
					Ensure the bug was not already reported by searching on GitHub under [issues](https://github.com/zulip/zulip-electron/issues). If you're unable to find an open issue addressing the bug, open a [new issue](https://github.com/zulip/zulip-electron/issues/new).
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						@@ -12,19 +12,12 @@ Please see [installation guide](https://zulipchat.com/help/desktop-app-install-g
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Features
 | 
					# Features
 | 
				
			||||||
* Sign in to multiple teams
 | 
					* Sign in to multiple teams
 | 
				
			||||||
* Native desktop Notifications
 | 
					* Desktop Notifications with inline reply support
 | 
				
			||||||
* SpellChecker
 | 
					* Multilanguage SpellChecker
 | 
				
			||||||
* OSX/Win/Linux installers
 | 
					* OSX/Win/Linux installers
 | 
				
			||||||
* Automatic Updates (macOS/Windows)
 | 
					* Automatic Updates (macOS/Windows/Linux)
 | 
				
			||||||
* Keyboard shortcuts
 | 
					* Keyboard shortcuts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Description            | Keys
 | 
					 | 
				
			||||||
-----------------------| -----------------------
 | 
					 | 
				
			||||||
Default shortcuts      | <kbd>Cmd/Ctrl</kbd> <kbd>k</kbd>
 | 
					 | 
				
			||||||
Manage Zulip Servers    | <kbd>Cmd/Ctrl</kbd> <kbd>,</kbd>
 | 
					 | 
				
			||||||
Back                   | <kbd>Cmd/Ctrl</kbd> <kbd>[</kbd>
 | 
					 | 
				
			||||||
Forward                | <kbd>Cmd/Ctrl</kbd> <kbd>]</kbd>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Development
 | 
					# Development
 | 
				
			||||||
Please see our [development guide](./development.md) to get started and run app locally.
 | 
					Please see our [development guide](./development.md) to get started and run app locally.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,24 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
const { app, dialog } = require('electron');
 | 
					const { app, dialog, shell } = require('electron');
 | 
				
			||||||
const { autoUpdater } = require('electron-updater');
 | 
					const { autoUpdater } = require('electron-updater');
 | 
				
			||||||
const isDev = require('electron-is-dev');
 | 
					const isDev = require('electron-is-dev');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ConfigUtil = require('./../renderer/js/utils/config-util.js');
 | 
					const ConfigUtil = require('./../renderer/js/utils/config-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function appUpdater() {
 | 
					function appUpdater(updateFromMenu = false) {
 | 
				
			||||||
	// Don't initiate auto-updates in development
 | 
						// Don't initiate auto-updates in development
 | 
				
			||||||
	if (isDev) {
 | 
						if (isDev) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (process.platform === 'linux' && !process.env.APPIMAGE) {
 | 
				
			||||||
 | 
							const { linuxUpdateNotification } = require('./linuxupdater');
 | 
				
			||||||
 | 
							linuxUpdateNotification();
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let updateAvailable = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Create Logs directory
 | 
						// Create Logs directory
 | 
				
			||||||
	const LogsDir = `${app.getPath('userData')}/Logs`;
 | 
						const LogsDir = `${app.getPath('userData')}/Logs`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -22,7 +30,58 @@ function appUpdater() {
 | 
				
			|||||||
	autoUpdater.logger = log;
 | 
						autoUpdater.logger = log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Handle auto updates for beta/pre releases
 | 
						// Handle auto updates for beta/pre releases
 | 
				
			||||||
	autoUpdater.allowPrerelease = ConfigUtil.getConfigItem('betaUpdate') || false;
 | 
						const isBetaUpdate = ConfigUtil.getConfigItem('betaUpdate');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						autoUpdater.allowPrerelease = isBetaUpdate || false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const eventsListenerRemove = ['update-available', 'update-not-available'];
 | 
				
			||||||
 | 
						autoUpdater.on('update-available', info => {
 | 
				
			||||||
 | 
							if (updateFromMenu) {
 | 
				
			||||||
 | 
								dialog.showMessageBox({
 | 
				
			||||||
 | 
									message: `A new version ${info.version}, of Zulip Desktop is available`,
 | 
				
			||||||
 | 
									detail: 'The update will be downloaded in the background. You will be notified when it is ready to be installed.'
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								updateAvailable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// This is to prevent removal of 'update-downloaded' and 'error' event listener.
 | 
				
			||||||
 | 
								eventsListenerRemove.forEach(event => {
 | 
				
			||||||
 | 
									autoUpdater.removeAllListeners(event);
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						autoUpdater.on('update-not-available', () => {
 | 
				
			||||||
 | 
							if (updateFromMenu) {
 | 
				
			||||||
 | 
								dialog.showMessageBox({
 | 
				
			||||||
 | 
									message: 'No updates available',
 | 
				
			||||||
 | 
									detail: `You are running the latest version of Zulip Desktop.\nVersion: ${app.getVersion()}`
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
								// Remove all autoUpdator listeners so that next time autoUpdator is manually called these
 | 
				
			||||||
 | 
								// listeners don't trigger multiple times.
 | 
				
			||||||
 | 
								autoUpdater.removeAllListeners();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						autoUpdater.on('error', error => {
 | 
				
			||||||
 | 
							if (updateFromMenu) {
 | 
				
			||||||
 | 
								const messageText = (updateAvailable) ? ('Unable to download the updates') : ('Unable to check for updates');
 | 
				
			||||||
 | 
								dialog.showMessageBox({
 | 
				
			||||||
 | 
									type: 'error',
 | 
				
			||||||
 | 
									buttons: ['Manual Download', 'Cancel'],
 | 
				
			||||||
 | 
									message: messageText,
 | 
				
			||||||
 | 
									detail: (error).toString() + `\n\nThe latest version of Zulip Desktop is available at -\nhttps://zulipchat.com/apps/.\n
 | 
				
			||||||
 | 
					Current Version: ${app.getVersion()}`
 | 
				
			||||||
 | 
								}, response => {
 | 
				
			||||||
 | 
									if (response === 0) {
 | 
				
			||||||
 | 
										shell.openExternal('https://zulipchat.com/apps/');
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
								// Remove all autoUpdator listeners so that next time autoUpdator is manually called these
 | 
				
			||||||
 | 
								// listeners don't trigger multiple times.
 | 
				
			||||||
 | 
								autoUpdater.removeAllListeners();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Ask the user if update is available
 | 
						// Ask the user if update is available
 | 
				
			||||||
	// eslint-disable-next-line no-unused-vars
 | 
						// eslint-disable-next-line no-unused-vars
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ const crashHandler = () => {
 | 
				
			|||||||
		productName: 'zulip-electron',
 | 
							productName: 'zulip-electron',
 | 
				
			||||||
		companyName: 'Kandra Labs, Inc.',
 | 
							companyName: 'Kandra Labs, Inc.',
 | 
				
			||||||
		submitURL: 'https://zulip-sentry.herokuapp.com/crashreport',
 | 
							submitURL: 'https://zulip-sentry.herokuapp.com/crashreport',
 | 
				
			||||||
		autoSubmit: true
 | 
							uploadToServer: true
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@ const { app, ipcMain } = electron;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const BadgeSettings = require('./../renderer/js/pages/preference/badge-settings.js');
 | 
					const BadgeSettings = require('./../renderer/js/pages/preference/badge-settings.js');
 | 
				
			||||||
const ConfigUtil = require('./../renderer/js/utils/config-util.js');
 | 
					const ConfigUtil = require('./../renderer/js/utils/config-util.js');
 | 
				
			||||||
 | 
					const ProxyUtil = require('./../renderer/js/utils/proxy-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Adds debug features like hotkeys for triggering dev tools and reload
 | 
					// Adds debug features like hotkeys for triggering dev tools and reload
 | 
				
			||||||
// in development mode
 | 
					// in development mode
 | 
				
			||||||
@@ -52,8 +53,9 @@ const iconPath = () => {
 | 
				
			|||||||
function createMainWindow() {
 | 
					function createMainWindow() {
 | 
				
			||||||
	// Load the previous state with fallback to defaults
 | 
						// Load the previous state with fallback to defaults
 | 
				
			||||||
	const mainWindowState = windowStateKeeper({
 | 
						const mainWindowState = windowStateKeeper({
 | 
				
			||||||
		defaultWidth: 1000,
 | 
							defaultWidth: 1100,
 | 
				
			||||||
		defaultHeight: 600
 | 
							defaultHeight: 720,
 | 
				
			||||||
 | 
							path: `${app.getPath('userData')}/config`
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Let's keep the window position global so that we can access it in other process
 | 
						// Let's keep the window position global so that we can access it in other process
 | 
				
			||||||
@@ -71,7 +73,6 @@ function createMainWindow() {
 | 
				
			|||||||
		minHeight: 400,
 | 
							minHeight: 400,
 | 
				
			||||||
		webPreferences: {
 | 
							webPreferences: {
 | 
				
			||||||
			plugins: true,
 | 
								plugins: true,
 | 
				
			||||||
			allowDisplayingInsecureContent: true,
 | 
					 | 
				
			||||||
			nodeIntegration: true
 | 
								nodeIntegration: true
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		show: false
 | 
							show: false
 | 
				
			||||||
@@ -132,6 +133,10 @@ function createMainWindow() {
 | 
				
			|||||||
// Decrease load on GPU (experimental)
 | 
					// Decrease load on GPU (experimental)
 | 
				
			||||||
app.disableHardwareAcceleration();
 | 
					app.disableHardwareAcceleration();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Temporary fix for Electron render colors differently
 | 
				
			||||||
 | 
					// More info here - https://github.com/electron/electron/issues/10732
 | 
				
			||||||
 | 
					app.commandLine.appendSwitch('force-color-profile', 'srgb');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line max-params
 | 
					// eslint-disable-next-line max-params
 | 
				
			||||||
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
 | 
					app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
 | 
				
			||||||
	event.preventDefault();
 | 
						event.preventDefault();
 | 
				
			||||||
@@ -150,6 +155,12 @@ app.on('ready', () => {
 | 
				
			|||||||
	});
 | 
						});
 | 
				
			||||||
	mainWindow = createMainWindow();
 | 
						mainWindow = createMainWindow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const isSystemProxy = ConfigUtil.getConfigItem('useSystemProxy');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (isSystemProxy) {
 | 
				
			||||||
 | 
							ProxyUtil.resolveSystemProxy(mainWindow);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const page = mainWindow.webContents;
 | 
						const page = mainWindow.webContents;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	page.on('dom-ready', () => {
 | 
						page.on('dom-ready', () => {
 | 
				
			||||||
@@ -162,14 +173,17 @@ app.on('ready', () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	page.once('did-frame-finish-load', () => {
 | 
						page.once('did-frame-finish-load', () => {
 | 
				
			||||||
		// Initate auto-updates on MacOS and Windows
 | 
							// Initate auto-updates on MacOS and Windows
 | 
				
			||||||
		appUpdater();
 | 
							if (ConfigUtil.getConfigItem('autoUpdate')) {
 | 
				
			||||||
 | 
								appUpdater();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		crashHandler();
 | 
							crashHandler();
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	electron.powerMonitor.on('resume', () => {
 | 
						// Temporarily remove this event
 | 
				
			||||||
		mainWindow.reload();
 | 
						// electron.powerMonitor.on('resume', () => {
 | 
				
			||||||
		page.send('destroytray');
 | 
						// 	mainWindow.reload();
 | 
				
			||||||
	});
 | 
						// 	page.send('destroytray');
 | 
				
			||||||
 | 
						// });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ipcMain.on('focus-app', () => {
 | 
						ipcMain.on('focus-app', () => {
 | 
				
			||||||
		mainWindow.show();
 | 
							mainWindow.show();
 | 
				
			||||||
@@ -221,11 +235,6 @@ app.on('ready', () => {
 | 
				
			|||||||
		appMenu.setMenu(props);
 | 
							appMenu.setMenu(props);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ipcMain.on('register-server-tab-shortcut', (event, index) => {
 | 
					 | 
				
			||||||
		// Array index == Shown index - 1
 | 
					 | 
				
			||||||
		page.send('switch-server-tab', index - 1);
 | 
					 | 
				
			||||||
	});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ipcMain.on('toggleAutoLauncher', (event, AutoLaunchValue) => {
 | 
						ipcMain.on('toggleAutoLauncher', (event, AutoLaunchValue) => {
 | 
				
			||||||
		setAutoLaunch(AutoLaunchValue);
 | 
							setAutoLaunch(AutoLaunchValue);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										49
									
								
								app/main/linuxupdater.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					const { app } = require('electron');
 | 
				
			||||||
 | 
					const { Notification } = require('electron');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const request = require('request');
 | 
				
			||||||
 | 
					const semver = require('semver');
 | 
				
			||||||
 | 
					const ConfigUtil = require('../renderer/js/utils/config-util');
 | 
				
			||||||
 | 
					const LinuxUpdateUtil = require('../renderer/js/utils/linux-update-util');
 | 
				
			||||||
 | 
					const Logger = require('../renderer/js/utils/logger-util');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: 'linux-update-util.log',
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function linuxUpdateNotification() {
 | 
				
			||||||
 | 
						let	url = 'https://api.github.com/repos/zulip/zulip-electron/releases';
 | 
				
			||||||
 | 
						url = ConfigUtil.getConfigItem('betaUpdate') ? url : url + '/latest';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const options = {
 | 
				
			||||||
 | 
							url,
 | 
				
			||||||
 | 
							headers: {'User-Agent': 'request'}
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						request(options, (error, response, body) => {
 | 
				
			||||||
 | 
							if (error) {
 | 
				
			||||||
 | 
								logger.error('Linux update error.');
 | 
				
			||||||
 | 
								logger.error(error);
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (response.statusCode < 400) {
 | 
				
			||||||
 | 
								const data = JSON.parse(body);
 | 
				
			||||||
 | 
								const latestVersion = ConfigUtil.getConfigItem('betaUpdate') ? data[0].tag_name : data.tag_name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (semver.gt(latestVersion, app.getVersion())) {
 | 
				
			||||||
 | 
									const notified = LinuxUpdateUtil.getUpdateItem(latestVersion);
 | 
				
			||||||
 | 
									if (notified === null) {
 | 
				
			||||||
 | 
										new Notification({title: 'Zulip Update', body: 'A new version ' + latestVersion + ' is available. Please update using your package manager.'}).show();
 | 
				
			||||||
 | 
										LinuxUpdateUtil.setUpdateItem(latestVersion, true);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								logger.log('Linux update response status: ', response.statusCode);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
						linuxUpdateNotification
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										159
									
								
								app/main/menu.js
									
									
									
									
									
								
							
							
						
						@@ -1,15 +1,23 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
const os = require('os');
 | 
					 | 
				
			||||||
const path = require('path');
 | 
					const path = require('path');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { app, shell, BrowserWindow, Menu } = require('electron');
 | 
					const { app, shell, BrowserWindow, Menu, dialog } = require('electron');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const fs = require('fs-extra');
 | 
					const fs = require('fs-extra');
 | 
				
			||||||
 | 
					const AdmZip = require('adm-zip');
 | 
				
			||||||
 | 
					const { appUpdater } = require('./autoupdater');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ConfigUtil = require(__dirname + '/../renderer/js/utils/config-util.js');
 | 
					const ConfigUtil = require(__dirname + '/../renderer/js/utils/config-util.js');
 | 
				
			||||||
 | 
					const DNDUtil = require(__dirname + '/../renderer/js/utils/dnd-util.js');
 | 
				
			||||||
 | 
					const Logger = require(__dirname + '/../renderer/js/utils/logger-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const appName = app.getName();
 | 
					const appName = app.getName();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: 'errors.log',
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AppMenu {
 | 
					class AppMenu {
 | 
				
			||||||
	getHistorySubmenu() {
 | 
						getHistorySubmenu() {
 | 
				
			||||||
		return [{
 | 
							return [{
 | 
				
			||||||
@@ -54,7 +62,7 @@ class AppMenu {
 | 
				
			|||||||
			role: 'togglefullscreen'
 | 
								role: 'togglefullscreen'
 | 
				
			||||||
		}, {
 | 
							}, {
 | 
				
			||||||
			label: 'Zoom In',
 | 
								label: 'Zoom In',
 | 
				
			||||||
			accelerator: 'CommandOrControl+Plus',
 | 
								accelerator: process.platform === 'darwin' ? 'Command+Plus' : 'Control+=',
 | 
				
			||||||
			click(item, focusedWindow) {
 | 
								click(item, focusedWindow) {
 | 
				
			||||||
				if (focusedWindow) {
 | 
									if (focusedWindow) {
 | 
				
			||||||
					AppMenu.sendAction('zoomIn');
 | 
										AppMenu.sendAction('zoomIn');
 | 
				
			||||||
@@ -87,7 +95,7 @@ class AppMenu {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}, {
 | 
							}, {
 | 
				
			||||||
			label: 'Toggle Sidebar',
 | 
								label: 'Toggle Sidebar',
 | 
				
			||||||
			accelerator: 'CommandOrControl+S',
 | 
								accelerator: 'CommandOrControl+Shift+S',
 | 
				
			||||||
			click(item, focusedWindow) {
 | 
								click(item, focusedWindow) {
 | 
				
			||||||
				if (focusedWindow) {
 | 
									if (focusedWindow) {
 | 
				
			||||||
					const newValue = !ConfigUtil.getConfigItem('showSidebar');
 | 
										const newValue = !ConfigUtil.getConfigItem('showSidebar');
 | 
				
			||||||
@@ -115,26 +123,50 @@ class AppMenu {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	getHelpSubmenu() {
 | 
						getHelpSubmenu() {
 | 
				
			||||||
		return [{
 | 
							return [
 | 
				
			||||||
			label: `${appName} Website`,
 | 
								{
 | 
				
			||||||
			click() {
 | 
									label: `${appName + ' Desktop-'} v${app.getVersion()}`,
 | 
				
			||||||
				shell.openExternal('https://zulipchat.com/help/');
 | 
									enabled: false
 | 
				
			||||||
			}
 | 
								},
 | 
				
			||||||
		}, {
 | 
								{
 | 
				
			||||||
			label: `${appName + 'Desktop'} - ${app.getVersion()}`,
 | 
									label: `What's New...`,
 | 
				
			||||||
			enabled: false
 | 
									click() {
 | 
				
			||||||
		}, {
 | 
										shell.openExternal(`https://github.com/zulip/zulip-electron/releases/tag/v${app.getVersion()}`);
 | 
				
			||||||
			label: 'Report an Issue...',
 | 
									}
 | 
				
			||||||
			click() {
 | 
								},
 | 
				
			||||||
				const body = `
 | 
								{
 | 
				
			||||||
					<!-- Please succinctly describe your issue and steps to reproduce it. -->
 | 
									label: `${appName} Help`,
 | 
				
			||||||
					-
 | 
									click() {
 | 
				
			||||||
					${app.getName()} ${app.getVersion()}
 | 
										shell.openExternal('https://zulipchat.com/help/');
 | 
				
			||||||
					Electron ${process.versions.electron}
 | 
									}
 | 
				
			||||||
					${process.platform} ${process.arch} ${os.release()}`;
 | 
								}, {
 | 
				
			||||||
				shell.openExternal(`https://github.com/zulip/zulip-electron/issues/new?body=${encodeURIComponent(body)}`);
 | 
									label: 'Show App Logs',
 | 
				
			||||||
			}
 | 
									click() {
 | 
				
			||||||
		}];
 | 
										const zip = new AdmZip();
 | 
				
			||||||
 | 
										let date = new Date();
 | 
				
			||||||
 | 
										date = date.toLocaleDateString().replace(/\//g, '-');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										// Create a zip file of all the logs and config data
 | 
				
			||||||
 | 
										zip.addLocalFolder(`${app.getPath('appData')}/${appName}/Logs`);
 | 
				
			||||||
 | 
										zip.addLocalFolder(`${app.getPath('appData')}/${appName}/config`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										// Put the log file in downloads folder
 | 
				
			||||||
 | 
										const logFilePath = `${app.getPath('downloads')}/Zulip-logs-${date}.zip`;
 | 
				
			||||||
 | 
										zip.writeZip(logFilePath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										// Open and select the log file
 | 
				
			||||||
 | 
										shell.showItemInFolder(logFilePath);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}, {
 | 
				
			||||||
 | 
									label: 'Report an Issue...',
 | 
				
			||||||
 | 
									click() {
 | 
				
			||||||
 | 
										// the goal is to notify the main.html BrowserWindow
 | 
				
			||||||
 | 
										// which may not be the focused window.
 | 
				
			||||||
 | 
										BrowserWindow.getAllWindows().forEach(window => {
 | 
				
			||||||
 | 
											window.webContents.send('open-feedback-modal');
 | 
				
			||||||
 | 
										});
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	getWindowSubmenu(tabs, activeTabIndex) {
 | 
						getWindowSubmenu(tabs, activeTabIndex) {
 | 
				
			||||||
@@ -150,6 +182,11 @@ class AppMenu {
 | 
				
			|||||||
				type: 'separator'
 | 
									type: 'separator'
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
			for (let i = 0; i < tabs.length; i++) {
 | 
								for (let i = 0; i < tabs.length; i++) {
 | 
				
			||||||
 | 
									// Do not add functional tab settings to list of windows in menu bar
 | 
				
			||||||
 | 
									if (tabs[i].props.role === 'function' && tabs[i].webview.props.name === 'Settings') {
 | 
				
			||||||
 | 
										continue;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				initialSubmenu.push({
 | 
									initialSubmenu.push({
 | 
				
			||||||
					label: tabs[i].webview.props.name,
 | 
										label: tabs[i].webview.props.name,
 | 
				
			||||||
					accelerator: tabs[i].props.role === 'function' ? '' : `${ShortcutKey} + ${tabs[i].props.index + 1}`,
 | 
										accelerator: tabs[i].props.role === 'function' ? '' : `${ShortcutKey} + ${tabs[i].props.index + 1}`,
 | 
				
			||||||
@@ -159,7 +196,7 @@ class AppMenu {
 | 
				
			|||||||
							AppMenu.sendAction('switch-server-tab', tabs[i].props.index);
 | 
												AppMenu.sendAction('switch-server-tab', tabs[i].props.index);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					},
 | 
										},
 | 
				
			||||||
					type: 'radio'
 | 
										type: 'checkbox'
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -179,10 +216,15 @@ class AppMenu {
 | 
				
			|||||||
						AppMenu.sendAction('open-about');
 | 
											AppMenu.sendAction('open-about');
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
								}, {
 | 
				
			||||||
 | 
									label: `Check for Update`,
 | 
				
			||||||
 | 
									click() {
 | 
				
			||||||
 | 
										AppMenu.checkForUpdate();
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				type: 'separator'
 | 
									type: 'separator'
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				label: 'Settings',
 | 
									label: 'Desktop App Settings',
 | 
				
			||||||
				accelerator: 'Cmd+,',
 | 
									accelerator: 'Cmd+,',
 | 
				
			||||||
				click(item, focusedWindow) {
 | 
									click(item, focusedWindow) {
 | 
				
			||||||
					if (focusedWindow) {
 | 
										if (focusedWindow) {
 | 
				
			||||||
@@ -191,7 +233,7 @@ class AppMenu {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				label: 'Keyboard Shortcuts',
 | 
									label: 'Keyboard Shortcuts',
 | 
				
			||||||
				accelerator: 'Cmd+K',
 | 
									accelerator: 'Cmd+Shift+K',
 | 
				
			||||||
				click(item, focusedWindow) {
 | 
									click(item, focusedWindow) {
 | 
				
			||||||
					if (focusedWindow) {
 | 
										if (focusedWindow) {
 | 
				
			||||||
						AppMenu.sendAction('shortcut');
 | 
											AppMenu.sendAction('shortcut');
 | 
				
			||||||
@@ -199,6 +241,13 @@ class AppMenu {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				type: 'separator'
 | 
									type: 'separator'
 | 
				
			||||||
 | 
								}, {
 | 
				
			||||||
 | 
									label: 'Toggle Do Not Disturb',
 | 
				
			||||||
 | 
									accelerator: 'Command+Shift+M',
 | 
				
			||||||
 | 
									click() {
 | 
				
			||||||
 | 
										const dndUtil = DNDUtil.toggle();
 | 
				
			||||||
 | 
										AppMenu.sendAction('toggle-dnd', dndUtil.dnd, dndUtil.newSettings);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				label: 'Reset App Settings',
 | 
									label: 'Reset App Settings',
 | 
				
			||||||
				accelerator: 'Command+Shift+D',
 | 
									accelerator: 'Command+Shift+D',
 | 
				
			||||||
@@ -279,10 +328,15 @@ class AppMenu {
 | 
				
			|||||||
						AppMenu.sendAction('open-about');
 | 
											AppMenu.sendAction('open-about');
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
								}, {
 | 
				
			||||||
 | 
									label: `Check for Update`,
 | 
				
			||||||
 | 
									click() {
 | 
				
			||||||
 | 
										AppMenu.checkForUpdate();
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				type: 'separator'
 | 
									type: 'separator'
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				label: 'Settings',
 | 
									label: 'Desktop App Settings',
 | 
				
			||||||
				accelerator: 'Ctrl+,',
 | 
									accelerator: 'Ctrl+,',
 | 
				
			||||||
				click(item, focusedWindow) {
 | 
									click(item, focusedWindow) {
 | 
				
			||||||
					if (focusedWindow) {
 | 
										if (focusedWindow) {
 | 
				
			||||||
@@ -293,7 +347,7 @@ class AppMenu {
 | 
				
			|||||||
				type: 'separator'
 | 
									type: 'separator'
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				label: 'Keyboard Shortcuts',
 | 
									label: 'Keyboard Shortcuts',
 | 
				
			||||||
				accelerator: 'Ctrl+K',
 | 
									accelerator: 'Ctrl+Shift+K',
 | 
				
			||||||
				click(item, focusedWindow) {
 | 
									click(item, focusedWindow) {
 | 
				
			||||||
					if (focusedWindow) {
 | 
										if (focusedWindow) {
 | 
				
			||||||
						AppMenu.sendAction('shortcut');
 | 
											AppMenu.sendAction('shortcut');
 | 
				
			||||||
@@ -301,6 +355,13 @@ class AppMenu {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				type: 'separator'
 | 
									type: 'separator'
 | 
				
			||||||
 | 
								}, {
 | 
				
			||||||
 | 
									label: 'Toggle Do Not Disturb',
 | 
				
			||||||
 | 
									accelerator: 'Ctrl+Shift+M',
 | 
				
			||||||
 | 
									click() {
 | 
				
			||||||
 | 
										const dndUtil = DNDUtil.toggle();
 | 
				
			||||||
 | 
										AppMenu.sendAction('toggle-dnd', dndUtil.dnd, dndUtil.newSettings);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}, {
 | 
								}, {
 | 
				
			||||||
				label: 'Reset App Settings',
 | 
									label: 'Reset App Settings',
 | 
				
			||||||
				accelerator: 'Ctrl+Shift+D',
 | 
									accelerator: 'Ctrl+Shift+D',
 | 
				
			||||||
@@ -369,21 +430,37 @@ class AppMenu {
 | 
				
			|||||||
		win.webContents.send(action, ...params);
 | 
							win.webContents.send(action, ...params);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static checkForUpdate() {
 | 
				
			||||||
 | 
							appUpdater(true);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	static resetAppSettings() {
 | 
						static resetAppSettings() {
 | 
				
			||||||
		// We save App's settings/configurations in following files
 | 
							const resetAppSettingsMessage = 'By proceeding you will be removing all connected organizations and preferences from Zulip.';
 | 
				
			||||||
		const settingFiles = ['window-state.json', 'domain.json', 'settings.json'];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		settingFiles.forEach(settingFileName => {
 | 
							// We save App's settings/configurations in following files
 | 
				
			||||||
			const getSettingFilesPath = path.join(app.getPath('appData'), appName, settingFileName);
 | 
							const settingFiles = ['config/window-state.json', 'config/domain.json', 'config/settings.json', 'config/certificates.json'];
 | 
				
			||||||
			fs.access(getSettingFilesPath, error => {
 | 
					
 | 
				
			||||||
				if (error) {
 | 
							dialog.showMessageBox({
 | 
				
			||||||
					console.log(error);
 | 
								type: 'warning',
 | 
				
			||||||
				} else {
 | 
								buttons: ['YES', 'NO'],
 | 
				
			||||||
					fs.unlink(getSettingFilesPath, () => {
 | 
								defaultId: 0,
 | 
				
			||||||
						AppMenu.sendAction('clear-app-data');
 | 
								message: 'Are you sure?',
 | 
				
			||||||
 | 
								detail: resetAppSettingsMessage
 | 
				
			||||||
 | 
							}, response => {
 | 
				
			||||||
 | 
								if (response === 0) {
 | 
				
			||||||
 | 
									settingFiles.forEach(settingFileName => {
 | 
				
			||||||
 | 
										const getSettingFilesPath = path.join(app.getPath('appData'), appName, settingFileName);
 | 
				
			||||||
 | 
										fs.access(getSettingFilesPath, error => {
 | 
				
			||||||
 | 
											if (error) {
 | 
				
			||||||
 | 
												logger.error('Error while resetting app settings.');
 | 
				
			||||||
 | 
												logger.error(error);
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												fs.unlink(getSettingFilesPath, () => {
 | 
				
			||||||
 | 
													AppMenu.sendAction('clear-app-data');
 | 
				
			||||||
 | 
												});
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
				}
 | 
									});
 | 
				
			||||||
			});
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1135
									
								
								app/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						@@ -1,7 +1,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "zulip",
 | 
					  "name": "zulip",
 | 
				
			||||||
  "productName": "Zulip",
 | 
					  "productName": "Zulip",
 | 
				
			||||||
  "version": "1.7.0",
 | 
					  "version": "2.3.2",
 | 
				
			||||||
  "description": "Zulip Desktop App",
 | 
					  "description": "Zulip Desktop App",
 | 
				
			||||||
  "license": "Apache-2.0",
 | 
					  "license": "Apache-2.0",
 | 
				
			||||||
  "copyright": "Kandra Labs, Inc.",
 | 
					  "copyright": "Kandra Labs, Inc.",
 | 
				
			||||||
@@ -26,14 +26,21 @@
 | 
				
			|||||||
    "InstantMessaging"
 | 
					    "InstantMessaging"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "auto-launch": "5.0.1",
 | 
					    "@electron-elements/send-feedback": "1.0.7",
 | 
				
			||||||
 | 
					    "escape-html": "1.0.3",
 | 
				
			||||||
 | 
					    "auto-launch": "5.0.5",
 | 
				
			||||||
    "electron-is-dev": "0.3.0",
 | 
					    "electron-is-dev": "0.3.0",
 | 
				
			||||||
    "electron-log": "2.2.7",
 | 
					    "electron-log": "2.2.14",
 | 
				
			||||||
    "electron-spellchecker": "1.1.2",
 | 
					    "electron-spellchecker": "1.1.2",
 | 
				
			||||||
 | 
					    "electron-updater": "2.23.3",
 | 
				
			||||||
    "electron-window-state": "4.1.1",
 | 
					    "electron-window-state": "4.1.1",
 | 
				
			||||||
    "electron-updater": "2.16.2",
 | 
					    "is-online": "7.0.0",
 | 
				
			||||||
    "node-json-db": "0.7.3",
 | 
					    "node-json-db": "0.7.3",
 | 
				
			||||||
    "request": "2.81.0",
 | 
					    "request": "2.85.0",
 | 
				
			||||||
 | 
					    "semver": "5.4.1",
 | 
				
			||||||
    "wurl": "2.5.0"
 | 
					    "wurl": "2.5.0"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "optionalDependencies": {
 | 
				
			||||||
 | 
					    "node-mac-notifier": "0.1.0"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,45 +1,50 @@
 | 
				
			|||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html lang="en">
 | 
					<html lang="en">
 | 
				
			||||||
	<head>
 | 
					
 | 
				
			||||||
		<meta charset="UTF-8">
 | 
					<head>
 | 
				
			||||||
		<link rel="stylesheet" href="css/about.css">
 | 
						<meta charset="UTF-8">
 | 
				
			||||||
	</head>
 | 
						<link rel="stylesheet" href="css/about.css">
 | 
				
			||||||
	<body>
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
	<div class="about">
 | 
						<div class="about">
 | 
				
			||||||
		<img class="logo" src="../resources/zulip.png" />
 | 
							<img class="logo" src="../resources/zulip.png" />
 | 
				
			||||||
		<p class="detail" id="version">v?.?.?</p>
 | 
							<p class="detail" id="version">v?.?.?</p>
 | 
				
			||||||
		<div class="maintenance-info">
 | 
							<div class="maintenance-info">
 | 
				
			||||||
			<p class="detail maintainer">
 | 
								<p class="detail maintainer">
 | 
				
			||||||
				Maintained by <a onclick="linkInBrowser('website')">Zulip</a>
 | 
									Maintained by
 | 
				
			||||||
 | 
									<a onclick="linkInBrowser('website')">Zulip</a>
 | 
				
			||||||
			</p>
 | 
								</p>
 | 
				
			||||||
			<p class="detail license">
 | 
								<p class="detail license">
 | 
				
			||||||
				Available under the <a onclick="linkInBrowser('license')">Apache 2.0 License</a>
 | 
									Available under the
 | 
				
			||||||
 | 
									<a onclick="linkInBrowser('license')">Apache 2.0 License</a>
 | 
				
			||||||
			</p>
 | 
								</p>
 | 
				
			||||||
			<a class="bug" onclick="linkInBrowser('bug')" href="#">Found bug?</a>
 | 
								<a class="bug" onclick="linkInBrowser('bug')" href="#">Found bug?</a>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
	<script>
 | 
						<script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const { app } = require('electron').remote;
 | 
							const { app } = require('electron').remote;
 | 
				
			||||||
	const { shell } = require('electron');
 | 
							const { shell } = require('electron');
 | 
				
			||||||
	const version_tag = document.querySelector('#version');
 | 
							const version_tag = document.querySelector('#version');
 | 
				
			||||||
	version_tag.innerHTML = 'v' + app.getVersion();
 | 
							version_tag.innerHTML = 'v' + app.getVersion();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function linkInBrowser(type) {
 | 
							function linkInBrowser(type) {
 | 
				
			||||||
		let url;
 | 
								let url;
 | 
				
			||||||
		switch (type) {
 | 
								switch (type) {
 | 
				
			||||||
			case 'website': 
 | 
									case 'website':
 | 
				
			||||||
				url = "https://zulipchat.com";
 | 
										url = "https://zulipchat.com";
 | 
				
			||||||
				break;
 | 
										break;
 | 
				
			||||||
			case 'license': 
 | 
									case 'license':
 | 
				
			||||||
				url = "https://github.com/zulip/zulip-electron/blob/master/LICENSE";
 | 
										url = "https://github.com/zulip/zulip-electron/blob/master/LICENSE";
 | 
				
			||||||
				break;
 | 
										break;
 | 
				
			||||||
			default:
 | 
									default:
 | 
				
			||||||
				url = 'https://github.com/zulip/zulip-electron/issues/new?body=' + 
 | 
										url = 'https://github.com/zulip/zulip-electron/issues/new?body=' +
 | 
				
			||||||
				      '%3C!--Please%20describe%20your%20issue%20and%20steps%20to%20reproduce%20it.--%3E';
 | 
											'%3C!--Please%20describe%20your%20issue%20and%20steps%20to%20reproduce%20it.--%3E';
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								shell.openExternal(url);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		shell.openExternal(url);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	</script>
 | 
						</script>
 | 
				
			||||||
	</body>
 | 
						<script>require('./js/shared/preventdrag.js')</script>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,9 +13,6 @@ body {
 | 
				
			|||||||
#content {
 | 
					#content {
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    height: 100%;
 | 
					    height: 100%;
 | 
				
			||||||
    background: #eee url(../img/ic_loading.gif) no-repeat;
 | 
					 | 
				
			||||||
    background-size: 60px 60px;
 | 
					 | 
				
			||||||
    background-position: center;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.toggle-sidebar {
 | 
					.toggle-sidebar {
 | 
				
			||||||
@@ -28,6 +25,7 @@ body {
 | 
				
			|||||||
    -webkit-app-region: drag;
 | 
					    -webkit-app-region: drag;
 | 
				
			||||||
    overflow: hidden;
 | 
					    overflow: hidden;
 | 
				
			||||||
    transition: all 0.5s ease;
 | 
					    transition: all 0.5s ease;
 | 
				
			||||||
 | 
					    z-index: 2;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.toggle-sidebar div {
 | 
					.toggle-sidebar div {
 | 
				
			||||||
@@ -44,6 +42,28 @@ body {
 | 
				
			|||||||
    transition: all 0.6s ease-out;
 | 
					    transition: all 0.6s ease-out;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#view-controls-container {
 | 
				
			||||||
 | 
						height: calc(100% - 208px);
 | 
				
			||||||
 | 
						overflow-y: hidden;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#view-controls-container:hover {
 | 
				
			||||||
 | 
						overflow-y: overlay;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#view-controls-container::-webkit-scrollbar {
 | 
				
			||||||
 | 
						width: 4px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#view-controls-container::-webkit-scrollbar-track {
 | 
				
			||||||
 | 
					    box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#view-controls-container::-webkit-scrollbar-thumb {
 | 
				
			||||||
 | 
					  background-color: darkgrey;
 | 
				
			||||||
 | 
					  outline: 1px solid slategrey;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@font-face {
 | 
					@font-face {
 | 
				
			||||||
    font-family: 'Material Icons';
 | 
					    font-family: 'Material Icons';
 | 
				
			||||||
    font-style: normal;
 | 
					    font-style: normal;
 | 
				
			||||||
@@ -81,11 +101,17 @@ body {
 | 
				
			|||||||
    text-rendering: optimizeLegibility;
 | 
					    text-rendering: optimizeLegibility;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#actions-container {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    flex-direction: column;
 | 
				
			||||||
 | 
					    position: fixed;
 | 
				
			||||||
 | 
					    bottom: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.action-button {
 | 
					.action-button {
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    flex-direction: column;
 | 
					    flex-direction: column;
 | 
				
			||||||
    align-items: center;
 | 
					    padding: 12px;
 | 
				
			||||||
    padding: 10px;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.action-button:hover {
 | 
					.action-button:hover {
 | 
				
			||||||
@@ -101,6 +127,29 @@ body {
 | 
				
			|||||||
    color: #98a9b3;
 | 
					    color: #98a9b3;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.action-button.disable {
 | 
				
			||||||
 | 
					    opacity: 0.6;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.action-button.disable:hover {
 | 
				
			||||||
 | 
					    cursor: not-allowed;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.action-button.disable:hover i {
 | 
				
			||||||
 | 
					    color: #6c8592;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.action-button.active {
 | 
				
			||||||
 | 
					    /* background-color: rgba(255, 255, 255, 0.25); */
 | 
				
			||||||
 | 
					    background-color: #efefef;
 | 
				
			||||||
 | 
					    opacity: 0.9;
 | 
				
			||||||
 | 
					    padding-right: 14px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.action-button.active i {
 | 
				
			||||||
 | 
					    color: #1c262b;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.tab:first-child {
 | 
					.tab:first-child {
 | 
				
			||||||
    margin-top: 8px;
 | 
					    margin-top: 8px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -221,36 +270,63 @@ body {
 | 
				
			|||||||
    width: 100%;
 | 
					    width: 100%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*Pseudo element for loading indicator*/
 | 
				
			||||||
 | 
					#webviews-container::before {
 | 
				
			||||||
 | 
					    content: "";
 | 
				
			||||||
 | 
					    position: absolute;
 | 
				
			||||||
 | 
					    z-index: 1;
 | 
				
			||||||
 | 
					    background: #fff url(../img/ic_loading.gif) no-repeat;
 | 
				
			||||||
 | 
					    background-size: 60px 60px;
 | 
				
			||||||
 | 
					    background-position: center;
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: 100%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*When the active webview is loaded*/
 | 
				
			||||||
 | 
					#webviews-container.loaded::before {
 | 
				
			||||||
 | 
					    opacity: 0;
 | 
				
			||||||
 | 
					    z-index: -1;
 | 
				
			||||||
 | 
					    visibility: hidden;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
webview {
 | 
					webview {
 | 
				
			||||||
    opacity: 1;
 | 
					    /* transition: opacity 0.3s ease-in; */
 | 
				
			||||||
    transition: opacity 0.3s ease-in;
 | 
					 | 
				
			||||||
    flex-grow: 1;
 | 
					    flex-grow: 1;
 | 
				
			||||||
 | 
					    position: absolute;
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: 100%;
 | 
				
			||||||
 | 
					    flex-grow: 1;
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    flex-direction: column;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
webview.onload {
 | 
					webview.onload {
 | 
				
			||||||
    transition: opacity 1s cubic-bezier(0.95, 0.05, 0.795, 0.035);
 | 
					    transition: opacity 1s cubic-bezier(0.95, 0.05, 0.795, 0.035);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
webview.disabled {
 | 
					webview.active {
 | 
				
			||||||
    flex: 0 1;
 | 
					    opacity: 1;
 | 
				
			||||||
    height: 0;
 | 
					    z-index: 1;
 | 
				
			||||||
    width: 0;
 | 
					    visibility: visible;
 | 
				
			||||||
    opacity: 0;
 | 
					 | 
				
			||||||
    transition: opacity 0.3s ease-out;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
webview:focus {
 | 
					webview.disabled {
 | 
				
			||||||
 | 
					    opacity: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					webview.focus {
 | 
				
			||||||
    outline: 0px solid transparent;
 | 
					    outline: 0px solid transparent;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Tooltip styling */
 | 
					/* Tooltip styling */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#dnd-tooltip,
 | 
				
			||||||
 | 
					#back-tooltip,
 | 
				
			||||||
#reload-tooltip,
 | 
					#reload-tooltip,
 | 
				
			||||||
#setting-tooltip {
 | 
					#setting-tooltip {
 | 
				
			||||||
    font-family: sans-serif;
 | 
					    font-family: sans-serif;
 | 
				
			||||||
    background: #222c31;
 | 
					    background: #222c31;
 | 
				
			||||||
    margin-left: 68px;
 | 
					    margin-left: 48px;
 | 
				
			||||||
    padding: 6px 8px;
 | 
					    padding: 6px 8px;
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    margin-top: 0px;
 | 
					    margin-top: 0px;
 | 
				
			||||||
@@ -262,6 +338,8 @@ webview:focus {
 | 
				
			|||||||
    font-size: 14px;
 | 
					    font-size: 14px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#dnd-tooltip:after,
 | 
				
			||||||
 | 
					#back-tooltip:after,
 | 
				
			||||||
#reload-tooltip:after,
 | 
					#reload-tooltip:after,
 | 
				
			||||||
#setting-tooltip:after {
 | 
					#setting-tooltip:after {
 | 
				
			||||||
    content: " ";
 | 
					    content: " ";
 | 
				
			||||||
@@ -321,6 +399,8 @@ webview:focus {
 | 
				
			|||||||
    height: 100%;
 | 
					    height: 100%;
 | 
				
			||||||
    width: 100%;
 | 
					    width: 100%;
 | 
				
			||||||
    position: relative;
 | 
					    position: relative;
 | 
				
			||||||
 | 
					    flex-grow: 1;
 | 
				
			||||||
 | 
					    flex-basis: 0px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.hidden {
 | 
					.hidden {
 | 
				
			||||||
@@ -362,4 +442,27 @@ webview:focus {
 | 
				
			|||||||
        overflow: hidden;
 | 
					        overflow: hidden;
 | 
				
			||||||
        opacity: 1;
 | 
					        opacity: 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					send-feedback {
 | 
				
			||||||
 | 
					  width: 60%;
 | 
				
			||||||
 | 
					  height: 85%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#feedback-modal {
 | 
				
			||||||
 | 
					  display: none;
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  top: 0;
 | 
				
			||||||
 | 
					  left: 0;
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  height: 100%;
 | 
				
			||||||
 | 
					  background-color: rgba(68, 67, 67, 0.81);
 | 
				
			||||||
 | 
					  align-items: center;
 | 
				
			||||||
 | 
					  justify-content: center;
 | 
				
			||||||
 | 
					  z-index: 2;
 | 
				
			||||||
 | 
					  transition: all 1s ease-out;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#feedback-modal.show {
 | 
				
			||||||
 | 
					  display: flex;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,16 +12,19 @@ body {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kbd {
 | 
					kbd {
 | 
				
			||||||
    padding: 0.3em 0.8em;
 | 
					    display: inline-block;
 | 
				
			||||||
    border: 1px solid #ccc;
 | 
					    border: 1px solid #ccc;
 | 
				
			||||||
 | 
					    border-radius: 3px;
 | 
				
			||||||
    font-size: 15px;
 | 
					    font-size: 15px;
 | 
				
			||||||
    font-family: Courier New, Courier, monospace;
 | 
					    font-family: Courier New, Courier, monospace;
 | 
				
			||||||
    background-color: #383430;
 | 
					 | 
				
			||||||
    color: #ededed;
 | 
					 | 
				
			||||||
    display: inline-block;
 | 
					 | 
				
			||||||
    margin: 0 0.1em;
 | 
					 | 
				
			||||||
    font-weight: bold;
 | 
					    font-weight: bold;
 | 
				
			||||||
    white-space: nowrap;
 | 
					    white-space: nowrap;
 | 
				
			||||||
 | 
					    background-color: #f7f7f7;
 | 
				
			||||||
 | 
					    color: #333;
 | 
				
			||||||
 | 
					    margin: 0 0.1em;
 | 
				
			||||||
 | 
					    padding: 0.3em 0.8em;
 | 
				
			||||||
 | 
					    text-shadow: 0 1px 0 #fff;
 | 
				
			||||||
 | 
					    line-height: 1.4;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
table,
 | 
					table,
 | 
				
			||||||
@@ -38,11 +41,11 @@ table {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
table tr:nth-child(even) {
 | 
					table tr:nth-child(even) {
 | 
				
			||||||
    background-color: #f7eee6;
 | 
					    background-color: #fafafa;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
table tr:nth-child(odd) {
 | 
					table tr:nth-child(odd) {
 | 
				
			||||||
    background-color: #fff8ef;
 | 
					    background-color: #fff;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
td {
 | 
					td {
 | 
				
			||||||
@@ -92,11 +95,13 @@ td:nth-child(odd) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#sidebar {
 | 
					#sidebar {
 | 
				
			||||||
    width: 80px;
 | 
					    width: 150px;
 | 
				
			||||||
    padding: 30px;
 | 
					    min-width: 100px;
 | 
				
			||||||
 | 
					    padding: 30px 30px 30px 35px;
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    flex-direction: column;
 | 
					    flex-direction: column;
 | 
				
			||||||
    font-size: 16px;
 | 
					    font-size: 16px;
 | 
				
			||||||
 | 
					    background: #f2f2f2;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#nav-container {
 | 
					#nav-container {
 | 
				
			||||||
@@ -110,7 +115,7 @@ td:nth-child(odd) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.nav.active {
 | 
					.nav.active {
 | 
				
			||||||
    color: #464e5a;
 | 
					    color: #4ebfac;
 | 
				
			||||||
    cursor: default;
 | 
					    cursor: default;
 | 
				
			||||||
    position: relative;
 | 
					    position: relative;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -118,12 +123,19 @@ td:nth-child(odd) {
 | 
				
			|||||||
.nav.active::before {
 | 
					.nav.active::before {
 | 
				
			||||||
    background: #464e5a;
 | 
					    background: #464e5a;
 | 
				
			||||||
    width: 3px;
 | 
					    width: 3px;
 | 
				
			||||||
    height: 16px;
 | 
					    height: 18px;
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    left: -8px;
 | 
					    left: -8px;
 | 
				
			||||||
    content: '';
 | 
					    content: '';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* We don't want to show this in nav item since we have the + button for adding an Organization */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#nav-AddServer {
 | 
				
			||||||
 | 
					    display: none;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#settings-header {
 | 
					#settings-header {
 | 
				
			||||||
    font-size: 22px;
 | 
					    font-size: 22px;
 | 
				
			||||||
    color: #222c31;
 | 
					    color: #222c31;
 | 
				
			||||||
@@ -139,12 +151,12 @@ td:nth-child(odd) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#new-server-container {
 | 
					#new-server-container {
 | 
				
			||||||
    opacity: 1;
 | 
					    padding-left: 42px;
 | 
				
			||||||
    transition: opacity 0.3s;
 | 
					    padding-top: 25px;
 | 
				
			||||||
 | 
					    margin-right: 16px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.title {
 | 
					.title {
 | 
				
			||||||
    padding: 4px 0 6px 0;
 | 
					 | 
				
			||||||
    font-weight: 500;
 | 
					    font-weight: 500;
 | 
				
			||||||
    color: #222c31;
 | 
					    color: #222c31;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -156,6 +168,16 @@ td:nth-child(odd) {
 | 
				
			|||||||
    padding: 4px 0 6px 0;
 | 
					    padding: 4px 0 6px 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.add-server-info-row {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    margin: 8px 0 0 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.add-server-info-right {
 | 
				
			||||||
 | 
					    flex-grow: 1;
 | 
				
			||||||
 | 
					    margin-top: 10px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.sub-title {
 | 
					.sub-title {
 | 
				
			||||||
    padding: 4px 0 6px 0;
 | 
					    padding: 4px 0 6px 0;
 | 
				
			||||||
    font-weight: bold;
 | 
					    font-weight: bold;
 | 
				
			||||||
@@ -166,20 +188,40 @@ img.server-info-icon {
 | 
				
			|||||||
    width: 36px;
 | 
					    width: 36px;
 | 
				
			||||||
    height: 36px;
 | 
					    height: 36px;
 | 
				
			||||||
    padding: 4px;
 | 
					    padding: 4px;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					    vertical-align: middle;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.server-info-left {
 | 
					.server-info-left {
 | 
				
			||||||
    margin: 10px 20px 0 0;
 | 
					    margin: 4px 20px 0 0;
 | 
				
			||||||
 | 
					    min-width: 40%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.server-info-right {
 | 
					.server-info-right {
 | 
				
			||||||
 | 
					    margin-top: 4px;
 | 
				
			||||||
 | 
					    width: 55%;
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    align-items: baseline;
 | 
				
			||||||
 | 
					    justify-content: space-between;
 | 
				
			||||||
    flex-grow: 1;
 | 
					    flex-grow: 1;
 | 
				
			||||||
    margin-right: 10px;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.server-info-row {
 | 
					.server-info-row {
 | 
				
			||||||
    display: flex;
 | 
					    display: inline-block;
 | 
				
			||||||
    margin: 8px 0 0 0;
 | 
					    margin: 5px 0 0 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-info-left .server-info-row {
 | 
				
			||||||
 | 
					    display: inline-flex;
 | 
				
			||||||
 | 
					    align-items: inherit;
 | 
				
			||||||
 | 
					    vertical-align: -2px;
 | 
				
			||||||
 | 
					    position: relative;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-url {
 | 
				
			||||||
 | 
					    overflow: hidden;
 | 
				
			||||||
 | 
					    white-space: nowrap;
 | 
				
			||||||
 | 
					    text-overflow: ellipsis;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.server-info-alias {
 | 
					.server-info-alias {
 | 
				
			||||||
@@ -187,6 +229,10 @@ img.server-info-icon {
 | 
				
			|||||||
    cursor: pointer;
 | 
					    cursor: pointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-url-info {
 | 
				
			||||||
 | 
					    margin-right: 10px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.setting-input-key {
 | 
					.setting-input-key {
 | 
				
			||||||
    font-size: 14px;
 | 
					    font-size: 14px;
 | 
				
			||||||
    height: 27px;
 | 
					    height: 27px;
 | 
				
			||||||
@@ -200,22 +246,20 @@ img.server-info-icon {
 | 
				
			|||||||
.setting-input-value {
 | 
					.setting-input-value {
 | 
				
			||||||
    flex-grow: 1;
 | 
					    flex-grow: 1;
 | 
				
			||||||
    font-size: 14px;
 | 
					    font-size: 14px;
 | 
				
			||||||
    height: 22px;
 | 
					 | 
				
			||||||
    border-radius: 3px;
 | 
					    border-radius: 3px;
 | 
				
			||||||
    padding: 7px;
 | 
					    padding: 13px;
 | 
				
			||||||
    border: #ededed 2px solid;
 | 
					    border: #ededed 2px solid;
 | 
				
			||||||
    outline-width: 0;
 | 
					    outline-width: 0;
 | 
				
			||||||
    background: transparent;
 | 
					    background: transparent;
 | 
				
			||||||
    max-width: 500px;
 | 
					    max-width: 450px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.setting-input-value:focus {
 | 
					.setting-input-value:focus {
 | 
				
			||||||
    border: #7cb980 2px solid;
 | 
					    border: #4EBFAC 2px solid;
 | 
				
			||||||
    border-radius: 3px;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.setting-block {
 | 
					.manual-proxy-block {
 | 
				
			||||||
    width: 100%;
 | 
					    width: 96%;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.actions-container {
 | 
					.actions-container {
 | 
				
			||||||
@@ -263,7 +307,11 @@ img.server-info-icon {
 | 
				
			|||||||
    margin: 10px 0 20px 0;
 | 
					    margin: 10px 0 20px 0;
 | 
				
			||||||
    background: #fff;
 | 
					    background: #fff;
 | 
				
			||||||
    width: 70%;
 | 
					    width: 70%;
 | 
				
			||||||
    border-left: 8px solid #bcbcbc;
 | 
					    transition: all 0.2s;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.settings-card:hover {
 | 
				
			||||||
 | 
					    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 0px 0px rgba(0, 0, 0, 0.12);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.hidden {
 | 
					.hidden {
 | 
				
			||||||
@@ -272,11 +320,15 @@ img.server-info-icon {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.red {
 | 
					.red {
 | 
				
			||||||
    color: #ffffff;
 | 
					    color: #ef5350;
 | 
				
			||||||
    background: #ef5350;
 | 
					    padding: 8px;
 | 
				
			||||||
    padding: 3px;
 | 
					    border: rgba(239, 83, 80, 0.5) solid 1px;
 | 
				
			||||||
    padding-right: 10px;
 | 
					}
 | 
				
			||||||
    padding-left: 10px;
 | 
					
 | 
				
			||||||
 | 
					.red:hover {
 | 
				
			||||||
 | 
					    color: #e63431;
 | 
				
			||||||
 | 
					    border: rgba(239, 83, 80, 0.7) solid 1px;
 | 
				
			||||||
 | 
					    ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.blue {
 | 
					.blue {
 | 
				
			||||||
@@ -306,12 +358,13 @@ img.server-info-icon {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
i.open-tab-button {
 | 
					i.open-tab-button {
 | 
				
			||||||
    padding: 0 5px;
 | 
					    padding-left: 2px;
 | 
				
			||||||
    font-size: 18px;
 | 
					    font-size: 19px;
 | 
				
			||||||
    cursor: pointer;
 | 
					    cursor: pointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.reset-data-button {
 | 
					.reset-data-button,
 | 
				
			||||||
 | 
					.custom-css-button {
 | 
				
			||||||
    display: inline-block;
 | 
					    display: inline-block;
 | 
				
			||||||
    border: none;
 | 
					    border: none;
 | 
				
			||||||
    padding: 10px;
 | 
					    padding: 10px;
 | 
				
			||||||
@@ -322,19 +375,35 @@ i.open-tab-button {
 | 
				
			|||||||
    text-decoration: none;
 | 
					    text-decoration: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.css-delete-action {
 | 
				
			||||||
 | 
					    margin-bottom: 10px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.reset-data-button:hover {
 | 
					.reset-data-button:hover {
 | 
				
			||||||
    background-color: #3c9f8d;
 | 
					    background-color: #3c9f8d;
 | 
				
			||||||
    color: #fff;
 | 
					    color: #fff;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.selected-css-path {
 | 
				
			||||||
 | 
					    background: #eeeeee;
 | 
				
			||||||
 | 
					    padding: 10px;
 | 
				
			||||||
 | 
					    margin-top: 10px;
 | 
				
			||||||
 | 
					    margin-right: 10px;
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    width: 90%;
 | 
				
			||||||
 | 
					    justify-content: space-between;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#remove-custom-css {
 | 
				
			||||||
 | 
					    align-items: flex-end;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#server-info-container {
 | 
					#server-info-container {
 | 
				
			||||||
    min-height: calc(100% - 235px);
 | 
					    min-height: calc(100% - 260px);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#create-organization-container {
 | 
					#create-organization-container {
 | 
				
			||||||
    font-size: 1.15em;
 | 
					    font-size: 1.15em;
 | 
				
			||||||
    position: fixed;
 | 
					 | 
				
			||||||
    bottom: 15px;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#create-organization-container i {
 | 
					#create-organization-container i {
 | 
				
			||||||
@@ -343,17 +412,10 @@ i.open-tab-button {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#open-create-org-link {
 | 
					#open-create-org-link {
 | 
				
			||||||
    color: #666;
 | 
					 | 
				
			||||||
    cursor: pointer;
 | 
					    cursor: pointer;
 | 
				
			||||||
    text-decoration: none;
 | 
					    text-decoration: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#open-create-org-link:hover {
 | 
					 | 
				
			||||||
    color: #005580;
 | 
					 | 
				
			||||||
    ;
 | 
					 | 
				
			||||||
    text-decoration: underline;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.toggle {
 | 
					.toggle {
 | 
				
			||||||
    position: absolute;
 | 
					    position: absolute;
 | 
				
			||||||
    margin-left: -9999px;
 | 
					    margin-left: -9999px;
 | 
				
			||||||
@@ -390,7 +452,6 @@ input.toggle-round+label:before {
 | 
				
			|||||||
    right: 2px;
 | 
					    right: 2px;
 | 
				
			||||||
    background-color: #f1f1f1;
 | 
					    background-color: #f1f1f1;
 | 
				
			||||||
    border-radius: 25px;
 | 
					    border-radius: 25px;
 | 
				
			||||||
    transition: background 0.4s;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
input.toggle-round+label:after {
 | 
					input.toggle-round+label:after {
 | 
				
			||||||
@@ -398,7 +459,6 @@ input.toggle-round+label:after {
 | 
				
			|||||||
    height: 25px;
 | 
					    height: 25px;
 | 
				
			||||||
    background-color: #fff;
 | 
					    background-color: #fff;
 | 
				
			||||||
    border-radius: 100%;
 | 
					    border-radius: 100%;
 | 
				
			||||||
    transition: margin 0.4s;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
input.toggle-round:checked+label:before {
 | 
					input.toggle-round:checked+label:before {
 | 
				
			||||||
@@ -407,4 +467,198 @@ input.toggle-round:checked+label:before {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
input.toggle-round:checked+label:after {
 | 
					input.toggle-round:checked+label:after {
 | 
				
			||||||
    margin-left: 25px;
 | 
					    margin-left: 25px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*  Add new server modal */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.add-server-modal {
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    position: fixed;
 | 
				
			||||||
 | 
					    z-index: 1;
 | 
				
			||||||
 | 
					    padding-top: 15vh;
 | 
				
			||||||
 | 
					    left: 0;
 | 
				
			||||||
 | 
					    top: 0;
 | 
				
			||||||
 | 
					    margin: auto;
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    height: 100%;
 | 
				
			||||||
 | 
					    /* background: rgba(61, 64, 67, 15); */
 | 
				
			||||||
 | 
					    background: linear-gradient(35deg, #003b52, #45b59b);
 | 
				
			||||||
 | 
					    overflow: auto;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Modal Content */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.modal-container {
 | 
				
			||||||
 | 
					    background-color: #f4f7f8;
 | 
				
			||||||
 | 
					    margin: auto;
 | 
				
			||||||
 | 
					    padding: 57px;
 | 
				
			||||||
 | 
					    border: #dae1e3 1px solid;
 | 
				
			||||||
 | 
					    width: 550px;
 | 
				
			||||||
 | 
					    height: 370px;
 | 
				
			||||||
 | 
					    border-radius: 4px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.add-server-modal .page-title {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    font-size: 1.6rem;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.divider {
 | 
				
			||||||
 | 
					    margin-bottom: 30px;
 | 
				
			||||||
 | 
					    margin-top: 30px;
 | 
				
			||||||
 | 
					    color: #7d878a;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.divider hr {
 | 
				
			||||||
 | 
					    margin-left: 8px;
 | 
				
			||||||
 | 
					    margin-right: 8px;
 | 
				
			||||||
 | 
					    width: 44%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.left {
 | 
				
			||||||
 | 
					    float: left;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.right {
 | 
				
			||||||
 | 
					    float: right;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-center {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    padding-top: 13px;
 | 
				
			||||||
 | 
					    margin-left: -5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-center button {
 | 
				
			||||||
 | 
					    font-weight: bold;
 | 
				
			||||||
 | 
					    font-size: 1.1rem;
 | 
				
			||||||
 | 
					    margin: auto;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    color: #fff;
 | 
				
			||||||
 | 
					    background: #4EBFAC;
 | 
				
			||||||
 | 
					    border-color: none;
 | 
				
			||||||
 | 
					    border: none;
 | 
				
			||||||
 | 
					    width: 98%;
 | 
				
			||||||
 | 
					    height: 46px;
 | 
				
			||||||
 | 
					    border-radius: 3px;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-center button:hover {
 | 
				
			||||||
 | 
					    background: #329588;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.server-center button:focus {
 | 
				
			||||||
 | 
					    background: #329588;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.certificates-card {
 | 
				
			||||||
 | 
					     width:70%
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.certificate-input {
 | 
				
			||||||
 | 
					     width:100%;
 | 
				
			||||||
 | 
					     margin-top: 10px; 
 | 
				
			||||||
 | 
					     display:inline-flex;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.certificate-input div {
 | 
				
			||||||
 | 
					    align-self:center;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.certificate-input .setting-input-value {
 | 
				
			||||||
 | 
					    margin-left:10px;
 | 
				
			||||||
 | 
					    max-width: 100%;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#add-certificate-button {
 | 
				
			||||||
 | 
					    width:20%;
 | 
				
			||||||
 | 
					    margin-right:0px;
 | 
				
			||||||
 | 
					    height: 35px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.tip {
 | 
				
			||||||
 | 
					    background-color: hsl(46,63%,95%);
 | 
				
			||||||
 | 
					    border: 1px solid hsl(46,63%,84%);
 | 
				
			||||||
 | 
					    border-radius: 4px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.md-14 {
 | 
				
			||||||
 | 
					    font-size: 14px;
 | 
				
			||||||
 | 
					    vertical-align: middle;
 | 
				
			||||||
 | 
					    padding-right: 6px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#open-hotkeys-link {
 | 
				
			||||||
 | 
					    text-decoration: underline;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* responsive grid */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@media (max-width: 650px) {
 | 
				
			||||||
 | 
					    .selected-css-path {
 | 
				
			||||||
 | 
					        margin-right: 15px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    #css-delete-action {
 | 
				
			||||||
 | 
					        margin-left: 10px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    #css-delete-action span {
 | 
				
			||||||
 | 
					        display: none;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@media (max-width: 720px) {
 | 
				
			||||||
 | 
					    .modal-container {
 | 
				
			||||||
 | 
					        width: 60vw;
 | 
				
			||||||
 | 
					        padding: 40px;
 | 
				
			||||||
 | 
					        min-width: 300px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    .server-center button {
 | 
				
			||||||
 | 
					        margin-right: -12px;
 | 
				
			||||||
 | 
					        width: 100%;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    .divider {
 | 
				
			||||||
 | 
					        margin-right: -8px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    .divider hr {
 | 
				
			||||||
 | 
					        margin-left: 6px;
 | 
				
			||||||
 | 
					        margin-right: 6px;
 | 
				
			||||||
 | 
					        width: 43%;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    #new-server-container {
 | 
				
			||||||
 | 
					        padding-left: 0px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@media (max-width: 600px) {
 | 
				
			||||||
 | 
					    .divider {
 | 
				
			||||||
 | 
					        margin-left: 4%;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    .divider hr {
 | 
				
			||||||
 | 
					        margin-left: 2px;
 | 
				
			||||||
 | 
					        margin-right: 2px;
 | 
				
			||||||
 | 
					        width: 40%;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@media (max-width: 900px) {
 | 
				
			||||||
 | 
					    .settings-card {
 | 
				
			||||||
 | 
					        flex-direction: column;
 | 
				
			||||||
 | 
					        align-items: center;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .server-info-right {
 | 
				
			||||||
 | 
					        flex-direction: column;
 | 
				
			||||||
 | 
					        align-items: center;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .action {
 | 
				
			||||||
 | 
					        margin-top: 10px;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ const Tab = require(__dirname + '/../components/tab.js');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class FunctionalTab extends Tab {
 | 
					class FunctionalTab extends Tab {
 | 
				
			||||||
	template() {
 | 
						template() {
 | 
				
			||||||
		return `<div class="tab functional-tab">
 | 
							return `<div class="tab functional-tab" data-tab-id="${this.props.tabIndex}">
 | 
				
			||||||
					<div class="server-tab-badge close-button">
 | 
										<div class="server-tab-badge close-button">
 | 
				
			||||||
						<i class="material-icons">close</i>
 | 
											<i class="material-icons">close</i>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
@@ -16,10 +16,11 @@ class FunctionalTab extends Tab {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	init() {
 | 
						init() {
 | 
				
			||||||
		this.$el = this.generateNodeFromTemplate(this.template());
 | 
							this.$el = this.generateNodeFromTemplate(this.template());
 | 
				
			||||||
		this.props.$root.appendChild(this.$el);
 | 
							if (this.props.name !== 'Settings') {
 | 
				
			||||||
 | 
								this.props.$root.appendChild(this.$el);
 | 
				
			||||||
		this.$closeButton = this.$el.getElementsByClassName('server-tab-badge')[0];
 | 
								this.$closeButton = this.$el.getElementsByClassName('server-tab-badge')[0];
 | 
				
			||||||
		this.registerListeners();
 | 
								this.registerListeners();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	registerListeners() {
 | 
						registerListeners() {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										35
									
								
								app/renderer/js/components/handle-external-link.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					const { shell } = require('electron').remote;
 | 
				
			||||||
 | 
					const LinkUtil = require('../utils/link-util');
 | 
				
			||||||
 | 
					const DomainUtil = require('../utils/domain-util');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function handleExternalLink(event) {
 | 
				
			||||||
 | 
						const { url } = event;
 | 
				
			||||||
 | 
						const domainPrefix = DomainUtil.getDomain(this.props.index).url;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Whitelist URLs which are allowed to be opened in the app
 | 
				
			||||||
 | 
						const {
 | 
				
			||||||
 | 
					    isInternalUrl: isWhiteListURL,
 | 
				
			||||||
 | 
					    isUploadsUrl: isUploadsURL
 | 
				
			||||||
 | 
					  } = LinkUtil.isInternal(domainPrefix, url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (isWhiteListURL) {
 | 
				
			||||||
 | 
							event.preventDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // download txt, pdf, mp3, mp4 etc.. by using downloadURL in the
 | 
				
			||||||
 | 
					    // main process which allows the user to save the files to their desktop
 | 
				
			||||||
 | 
					    // and not trigger webview reload while image in webview will
 | 
				
			||||||
 | 
					    // do nothing and will not save it
 | 
				
			||||||
 | 
							if (!LinkUtil.isImage(url) && isUploadsURL) {
 | 
				
			||||||
 | 
								this.$el.downloadURL(url);
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // open internal urls inside the current webview.
 | 
				
			||||||
 | 
							this.$el.loadURL(url);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							event.preventDefault();
 | 
				
			||||||
 | 
							shell.openExternal(url);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = handleExternalLink;
 | 
				
			||||||
@@ -7,7 +7,7 @@ const {ipcRenderer} = require('electron');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class ServerTab extends Tab {
 | 
					class ServerTab extends Tab {
 | 
				
			||||||
	template() {
 | 
						template() {
 | 
				
			||||||
		return `<div class="tab">
 | 
							return `<div class="tab" data-tab-id="${this.props.tabIndex}">
 | 
				
			||||||
					<div class="server-tooltip" style="display:none"></div>
 | 
										<div class="server-tooltip" style="display:none"></div>
 | 
				
			||||||
					<div class="server-tab-badge"></div>
 | 
										<div class="server-tab-badge"></div>
 | 
				
			||||||
					<div class="server-tab">
 | 
										<div class="server-tab">
 | 
				
			||||||
@@ -50,7 +50,8 @@ class ServerTab extends Tab {
 | 
				
			|||||||
			shortcutText = `Ctrl+${shownIndex}`;
 | 
								shortcutText = `Ctrl+${shownIndex}`;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.send('register-server-tab-shortcut', shownIndex);
 | 
							// Array index == Shown index - 1
 | 
				
			||||||
 | 
							ipcRenderer.send('switch-server-tab', shownIndex - 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return shortcutText;
 | 
							return shortcutText;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,13 +3,12 @@
 | 
				
			|||||||
const path = require('path');
 | 
					const path = require('path');
 | 
				
			||||||
const fs = require('fs');
 | 
					const fs = require('fs');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const DomainUtil = require(__dirname + '/../utils/domain-util.js');
 | 
					 | 
				
			||||||
const ConfigUtil = require(__dirname + '/../utils/config-util.js');
 | 
					const ConfigUtil = require(__dirname + '/../utils/config-util.js');
 | 
				
			||||||
const SystemUtil = require(__dirname + '/../utils/system-util.js');
 | 
					const SystemUtil = require(__dirname + '/../utils/system-util.js');
 | 
				
			||||||
const LinkUtil = require(__dirname + '/../utils/link-util.js');
 | 
					const { app, dialog } = require('electron').remote;
 | 
				
			||||||
const { shell, app } = require('electron').remote;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const BaseComponent = require(__dirname + '/../components/base.js');
 | 
					const BaseComponent = require(__dirname + '/../components/base.js');
 | 
				
			||||||
 | 
					const handleExternalLink = require(__dirname + '/../components/handle-external-link.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const shouldSilentWebview = ConfigUtil.getConfigItem('silent');
 | 
					const shouldSilentWebview = ConfigUtil.getConfigItem('silent');
 | 
				
			||||||
class WebView extends BaseComponent {
 | 
					class WebView extends BaseComponent {
 | 
				
			||||||
@@ -19,13 +18,16 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
		this.props = props;
 | 
							this.props = props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.zoomFactor = 1.0;
 | 
							this.zoomFactor = 1.0;
 | 
				
			||||||
		this.loading = false;
 | 
							this.loading = true;
 | 
				
			||||||
		this.badgeCount = 0;
 | 
							this.badgeCount = 0;
 | 
				
			||||||
 | 
							this.customCSS = ConfigUtil.getConfigItem('customCSS');
 | 
				
			||||||
 | 
							this.$webviewsContainer = document.querySelector('#webviews-container').classList;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	template() {
 | 
						template() {
 | 
				
			||||||
		return `<webview
 | 
							return `<webview
 | 
				
			||||||
					class="disabled"
 | 
										class="disabled"
 | 
				
			||||||
 | 
										data-tab-id="${this.props.tabIndex}"
 | 
				
			||||||
					src="${this.props.url}"
 | 
										src="${this.props.url}"
 | 
				
			||||||
					${this.props.nodeIntegration ? 'nodeIntegration' : ''}
 | 
										${this.props.nodeIntegration ? 'nodeIntegration' : ''}
 | 
				
			||||||
					disablewebsecurity
 | 
										disablewebsecurity
 | 
				
			||||||
@@ -44,16 +46,7 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	registerListeners() {
 | 
						registerListeners() {
 | 
				
			||||||
		this.$el.addEventListener('new-window', event => {
 | 
							this.$el.addEventListener('new-window', event => {
 | 
				
			||||||
			const { url } = event;
 | 
								handleExternalLink.call(this, event);
 | 
				
			||||||
			const domainPrefix = DomainUtil.getDomain(this.props.index).url;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (LinkUtil.isInternal(domainPrefix, url) || url === (domainPrefix + '/')) {
 | 
					 | 
				
			||||||
				event.preventDefault();
 | 
					 | 
				
			||||||
				this.$el.loadURL(url);
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				event.preventDefault();
 | 
					 | 
				
			||||||
				shell.openExternal(url);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (shouldSilentWebview) {
 | 
							if (shouldSilentWebview) {
 | 
				
			||||||
@@ -68,13 +61,30 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
			this.props.onTitleChange();
 | 
								this.props.onTitleChange();
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.$el.addEventListener('did-navigate-in-page', event => {
 | 
				
			||||||
 | 
								const isSettingPage = event.url.includes('renderer/preference.html');
 | 
				
			||||||
 | 
								if (isSettingPage) {
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								this.canGoBackButton();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.$el.addEventListener('did-navigate', () => {
 | 
				
			||||||
 | 
								this.canGoBackButton();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$el.addEventListener('page-favicon-updated', event => {
 | 
							this.$el.addEventListener('page-favicon-updated', event => {
 | 
				
			||||||
			const { favicons } = event;
 | 
								const { favicons } = event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// This returns a string of favicons URL. If there is a PM counts in unread messages then the URL would be like
 | 
								// This returns a string of favicons URL. If there is a PM counts in unread messages then the URL would be like
 | 
				
			||||||
			// https://chat.zulip.org/static/images/favicon/favicon-pms.png
 | 
								// https://chat.zulip.org/static/images/favicon/favicon-pms.png
 | 
				
			||||||
			if (favicons[0].indexOf('favicon-pms') > 0 && process.platform === 'darwin') {
 | 
								if (favicons[0].indexOf('favicon-pms') > 0 && process.platform === 'darwin') {
 | 
				
			||||||
				// This api is only supported on macOS
 | 
									// This api is only supported on macOS
 | 
				
			||||||
				app.dock.setBadge('●');
 | 
									app.dock.setBadge('●');
 | 
				
			||||||
 | 
									// bounce the dock
 | 
				
			||||||
 | 
									if (ConfigUtil.getConfigItem('dockBouncing')) {
 | 
				
			||||||
 | 
										app.dock.bounce();
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -82,6 +92,7 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
			if (this.props.role === 'server') {
 | 
								if (this.props.role === 'server') {
 | 
				
			||||||
				this.$el.classList.add('onload');
 | 
									this.$el.classList.add('onload');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								this.loading = false;
 | 
				
			||||||
			this.show();
 | 
								this.show();
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -115,17 +126,39 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// To show or hide the loading indicator in the the active tab
 | 
				
			||||||
 | 
							if (this.loading) {
 | 
				
			||||||
 | 
								this.$webviewsContainer.remove('loaded');
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								this.$webviewsContainer.add('loaded');
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$el.classList.remove('disabled');
 | 
							this.$el.classList.remove('disabled');
 | 
				
			||||||
 | 
							this.$el.classList.add('active');
 | 
				
			||||||
		setTimeout(() => {
 | 
							setTimeout(() => {
 | 
				
			||||||
			if (this.props.role === 'server') {
 | 
								if (this.props.role === 'server') {
 | 
				
			||||||
				this.$el.classList.remove('onload');
 | 
									this.$el.classList.remove('onload');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}, 1000);
 | 
							}, 1000);
 | 
				
			||||||
		this.focus();
 | 
							this.focus();
 | 
				
			||||||
		this.loading = false;
 | 
					 | 
				
			||||||
		this.props.onTitleChange();
 | 
							this.props.onTitleChange();
 | 
				
			||||||
		// Injecting preload css in webview to override some css rules
 | 
							// Injecting preload css in webview to override some css rules
 | 
				
			||||||
		this.$el.insertCSS(fs.readFileSync(path.join(__dirname, '/../../css/preload.css'), 'utf8'));
 | 
							this.$el.insertCSS(fs.readFileSync(path.join(__dirname, '/../../css/preload.css'), 'utf8'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// get customCSS again from config util to avoid warning user again
 | 
				
			||||||
 | 
							this.customCSS = ConfigUtil.getConfigItem('customCSS');
 | 
				
			||||||
 | 
							if (this.customCSS) {
 | 
				
			||||||
 | 
								if (!fs.existsSync(this.customCSS)) {
 | 
				
			||||||
 | 
									this.customCSS = null;
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('customCSS', null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									const errMsg = 'The custom css previously set is deleted!';
 | 
				
			||||||
 | 
									dialog.showErrorBox('custom css file deleted!', errMsg);
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								this.$el.insertCSS(fs.readFileSync(path.resolve(__dirname, this.customCSS), 'utf8'));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	focus() {
 | 
						focus() {
 | 
				
			||||||
@@ -139,6 +172,7 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	hide() {
 | 
						hide() {
 | 
				
			||||||
		this.$el.classList.add('disabled');
 | 
							this.$el.classList.add('disabled');
 | 
				
			||||||
 | 
							this.$el.classList.remove('active');
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	load() {
 | 
						load() {
 | 
				
			||||||
@@ -182,6 +216,15 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						canGoBackButton() {
 | 
				
			||||||
 | 
							const $backButton = document.querySelector('#actions-container #back-action');
 | 
				
			||||||
 | 
							if (this.$el.canGoBack()) {
 | 
				
			||||||
 | 
								$backButton.classList.remove('disable');
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								$backButton.classList.add('disable');
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	forward() {
 | 
						forward() {
 | 
				
			||||||
		if (this.$el.canGoForward()) {
 | 
							if (this.$el.canGoForward()) {
 | 
				
			||||||
			this.$el.goForward();
 | 
								this.$el.goForward();
 | 
				
			||||||
@@ -190,6 +233,9 @@ class WebView extends BaseComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	reload() {
 | 
						reload() {
 | 
				
			||||||
		this.hide();
 | 
							this.hide();
 | 
				
			||||||
 | 
							// Shows the loading indicator till the webview is reloaded
 | 
				
			||||||
 | 
							this.$webviewsContainer.remove('loaded');
 | 
				
			||||||
 | 
							this.loading = true;
 | 
				
			||||||
		this.$el.reload();
 | 
							this.$el.reload();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										62
									
								
								app/renderer/js/feedback.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					const { app } = require('electron').remote;
 | 
				
			||||||
 | 
					const path = require('path');
 | 
				
			||||||
 | 
					const fs = require('fs');
 | 
				
			||||||
 | 
					const SendFeedback = require('@electron-elements/send-feedback');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// make the button color match zulip app's theme
 | 
				
			||||||
 | 
					SendFeedback.customStyles = `
 | 
				
			||||||
 | 
					button:hover, button:focus {
 | 
				
			||||||
 | 
					  border-color: #4EBFAC;
 | 
				
			||||||
 | 
					  color: #4EBFAC;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					button:active {
 | 
				
			||||||
 | 
					  background-color: #f1f1f1;
 | 
				
			||||||
 | 
					  color: #4EBFAC;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					button {
 | 
				
			||||||
 | 
					  background-color: #4EBFAC;
 | 
				
			||||||
 | 
					  border-color: #4EBFAC;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					customElements.define('send-feedback', SendFeedback);
 | 
				
			||||||
 | 
					const sendFeedback = document.querySelector('send-feedback');
 | 
				
			||||||
 | 
					const feedbackHolder = sendFeedback.parentElement;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// customize the fields of custom elements
 | 
				
			||||||
 | 
					sendFeedback.title = 'Report Issue';
 | 
				
			||||||
 | 
					sendFeedback.titleLabel = 'Issue title:';
 | 
				
			||||||
 | 
					sendFeedback.titlePlaceholder = 'Enter issue title';
 | 
				
			||||||
 | 
					sendFeedback.textareaLabel = 'Describe the issue:';
 | 
				
			||||||
 | 
					sendFeedback.textareaPlaceholder = 'Succinctly describe your issue and steps to reproduce it...';
 | 
				
			||||||
 | 
					sendFeedback.buttonLabel = 'Report Issue';
 | 
				
			||||||
 | 
					sendFeedback.loaderSuccessText = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sendFeedback.useReporter('emailReporter', {
 | 
				
			||||||
 | 
						email: 'akash@zulipchat.com'
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					feedbackHolder.addEventListener('click', e => {
 | 
				
			||||||
 | 
					  // only remove the class if the grey out faded
 | 
				
			||||||
 | 
					  // part is clicked and not the feedback element itself
 | 
				
			||||||
 | 
						if (e.target === e.currentTarget) {
 | 
				
			||||||
 | 
							feedbackHolder.classList.remove('show');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sendFeedback.addEventListener('feedback-submitted', () => {
 | 
				
			||||||
 | 
						setTimeout(() => {
 | 
				
			||||||
 | 
							feedbackHolder.classList.remove('show');
 | 
				
			||||||
 | 
						}, 1000);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const dataDir = app.getPath('userData');
 | 
				
			||||||
 | 
					const logsDir = path.join(dataDir, '/Logs');
 | 
				
			||||||
 | 
					sendFeedback.logs.push(...fs.readdirSync(logsDir).map(file => path.join(logsDir, file)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
						feedbackHolder,
 | 
				
			||||||
 | 
						sendFeedback
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { ipcRenderer, remote } = require('electron');
 | 
					const { ipcRenderer, remote } = require('electron');
 | 
				
			||||||
 | 
					const isDev = require('electron-is-dev');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { session } = remote;
 | 
					const { session } = remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -10,6 +11,17 @@ const WebView = require(__dirname + '/js/components/webview.js');
 | 
				
			|||||||
const ServerTab = require(__dirname + '/js/components/server-tab.js');
 | 
					const ServerTab = require(__dirname + '/js/components/server-tab.js');
 | 
				
			||||||
const FunctionalTab = require(__dirname + '/js/components/functional-tab.js');
 | 
					const FunctionalTab = require(__dirname + '/js/components/functional-tab.js');
 | 
				
			||||||
const ConfigUtil = require(__dirname + '/js/utils/config-util.js');
 | 
					const ConfigUtil = require(__dirname + '/js/utils/config-util.js');
 | 
				
			||||||
 | 
					const DNDUtil = require(__dirname + '/js/utils/dnd-util.js');
 | 
				
			||||||
 | 
					const ReconnectUtil = require(__dirname + '/js/utils/reconnect-util.js');
 | 
				
			||||||
 | 
					const Logger = require(__dirname + '/js/utils/logger-util.js');
 | 
				
			||||||
 | 
					const { feedbackHolder } = require(__dirname + '/js/feedback.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const escape = require('escape-html');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: 'errors.log',
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ServerManagerView {
 | 
					class ServerManagerView {
 | 
				
			||||||
	constructor() {
 | 
						constructor() {
 | 
				
			||||||
@@ -20,11 +32,15 @@ class ServerManagerView {
 | 
				
			|||||||
		this.$reloadButton = $actionsContainer.querySelector('#reload-action');
 | 
							this.$reloadButton = $actionsContainer.querySelector('#reload-action');
 | 
				
			||||||
		this.$settingsButton = $actionsContainer.querySelector('#settings-action');
 | 
							this.$settingsButton = $actionsContainer.querySelector('#settings-action');
 | 
				
			||||||
		this.$webviewsContainer = document.getElementById('webviews-container');
 | 
							this.$webviewsContainer = document.getElementById('webviews-container');
 | 
				
			||||||
 | 
							this.$backButton = $actionsContainer.querySelector('#back-action');
 | 
				
			||||||
 | 
							this.$dndButton = $actionsContainer.querySelector('#dnd-action');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$addServerTooltip = document.getElementById('add-server-tooltip');
 | 
							this.$addServerTooltip = document.getElementById('add-server-tooltip');
 | 
				
			||||||
		this.$reloadTooltip = $actionsContainer.querySelector('#reload-tooltip');
 | 
							this.$reloadTooltip = $actionsContainer.querySelector('#reload-tooltip');
 | 
				
			||||||
		this.$settingsTooltip = $actionsContainer.querySelector('#setting-tooltip');
 | 
							this.$settingsTooltip = $actionsContainer.querySelector('#setting-tooltip');
 | 
				
			||||||
		this.$serverIconTooltip = document.getElementsByClassName('server-tooltip');
 | 
							this.$serverIconTooltip = document.getElementsByClassName('server-tooltip');
 | 
				
			||||||
 | 
							this.$backTooltip = $actionsContainer.querySelector('#back-tooltip');
 | 
				
			||||||
 | 
							this.$dndTooltip = $actionsContainer.querySelector('#dnd-tooltip');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$sidebar = document.getElementById('sidebar');
 | 
							this.$sidebar = document.getElementById('sidebar');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -35,6 +51,7 @@ class ServerManagerView {
 | 
				
			|||||||
		this.activeTabIndex = -1;
 | 
							this.activeTabIndex = -1;
 | 
				
			||||||
		this.tabs = [];
 | 
							this.tabs = [];
 | 
				
			||||||
		this.functionalTabs = {};
 | 
							this.functionalTabs = {};
 | 
				
			||||||
 | 
							this.tabIndex = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	init() {
 | 
						init() {
 | 
				
			||||||
@@ -49,7 +66,17 @@ class ServerManagerView {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	loadProxy() {
 | 
						loadProxy() {
 | 
				
			||||||
		return new Promise(resolve => {
 | 
							return new Promise(resolve => {
 | 
				
			||||||
			const proxyEnabled = ConfigUtil.getConfigItem('useProxy', false);
 | 
								// To change proxyEnable to useManualProxy in older versions
 | 
				
			||||||
 | 
								const proxyEnabledOld = ConfigUtil.isConfigItemExists('useProxy');
 | 
				
			||||||
 | 
								if (proxyEnabledOld) {
 | 
				
			||||||
 | 
									const proxyEnableOldState = ConfigUtil.getConfigItem('useProxy');
 | 
				
			||||||
 | 
									if (proxyEnableOldState) {
 | 
				
			||||||
 | 
										ConfigUtil.setConfigItem('useManualProxy', true);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ConfigUtil.removeConfigItem('useProxy');
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const proxyEnabled = ConfigUtil.getConfigItem('useManualProxy') || ConfigUtil.getConfigItem('useSystemProxy');
 | 
				
			||||||
			if (proxyEnabled) {
 | 
								if (proxyEnabled) {
 | 
				
			||||||
				session.fromPartition('persist:webviewsession').setProxy({
 | 
									session.fromPartition('persist:webviewsession').setProxy({
 | 
				
			||||||
					pacScript: ConfigUtil.getConfigItem('proxyPAC', ''),
 | 
										pacScript: ConfigUtil.getConfigItem('proxyPAC', ''),
 | 
				
			||||||
@@ -73,16 +100,23 @@ class ServerManagerView {
 | 
				
			|||||||
		// Default settings which should be respected
 | 
							// Default settings which should be respected
 | 
				
			||||||
		const settingOptions = {
 | 
							const settingOptions = {
 | 
				
			||||||
			trayIcon: true,
 | 
								trayIcon: true,
 | 
				
			||||||
			useProxy: false,
 | 
								useManualProxy: false,
 | 
				
			||||||
 | 
								useSystemProxy: false,
 | 
				
			||||||
			showSidebar: true,
 | 
								showSidebar: true,
 | 
				
			||||||
			badgeOption: true,
 | 
								badgeOption: true,
 | 
				
			||||||
			startAtLogin: false,
 | 
								startAtLogin: false,
 | 
				
			||||||
			startMinimized: false,
 | 
								startMinimized: false,
 | 
				
			||||||
			enableSpellchecker: true,
 | 
								enableSpellchecker: true,
 | 
				
			||||||
			showNotification: true,
 | 
								showNotification: true,
 | 
				
			||||||
 | 
								autoUpdate: true,
 | 
				
			||||||
			betaUpdate: false,
 | 
								betaUpdate: false,
 | 
				
			||||||
			silent: false,
 | 
								silent: false,
 | 
				
			||||||
			lastActiveTab: 0
 | 
								lastActiveTab: 0,
 | 
				
			||||||
 | 
								dnd: false,
 | 
				
			||||||
 | 
								dndPreviousSettings: {
 | 
				
			||||||
 | 
									showNotification: true,
 | 
				
			||||||
 | 
									silent: false
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Platform specific settings
 | 
							// Platform specific settings
 | 
				
			||||||
@@ -90,6 +124,12 @@ class ServerManagerView {
 | 
				
			|||||||
		if (process.platform === 'win32') {
 | 
							if (process.platform === 'win32') {
 | 
				
			||||||
			// Only available on Windows
 | 
								// Only available on Windows
 | 
				
			||||||
			settingOptions.flashTaskbarOnMessage = true;
 | 
								settingOptions.flashTaskbarOnMessage = true;
 | 
				
			||||||
 | 
								settingOptions.dndPreviousSettings.flashTaskbarOnMessage = true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (process.platform === 'darwin') {
 | 
				
			||||||
 | 
								// Only available on macOS
 | 
				
			||||||
 | 
								settingOptions.dockBouncing = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (const i in settingOptions) {
 | 
							for (const i in settingOptions) {
 | 
				
			||||||
@@ -114,23 +154,28 @@ class ServerManagerView {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			// Open last active tab
 | 
								// Open last active tab
 | 
				
			||||||
			this.activateTab(ConfigUtil.getConfigItem('lastActiveTab'));
 | 
								this.activateTab(ConfigUtil.getConfigItem('lastActiveTab'));
 | 
				
			||||||
 | 
								// Remove focus from the settings icon at sidebar bottom
 | 
				
			||||||
 | 
								this.$settingsButton.classList.remove('active');
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			this.openSettings('Servers');
 | 
								this.openSettings('AddServer');
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initServer(server, index) {
 | 
						initServer(server, index) {
 | 
				
			||||||
 | 
							const tabIndex = this.getTabIndex();
 | 
				
			||||||
		this.tabs.push(new ServerTab({
 | 
							this.tabs.push(new ServerTab({
 | 
				
			||||||
			role: 'server',
 | 
								role: 'server',
 | 
				
			||||||
			icon: server.icon,
 | 
								icon: server.icon,
 | 
				
			||||||
			$root: this.$tabsContainer,
 | 
								$root: this.$tabsContainer,
 | 
				
			||||||
			onClick: this.activateLastTab.bind(this, index),
 | 
								onClick: this.activateLastTab.bind(this, index),
 | 
				
			||||||
			index,
 | 
								index,
 | 
				
			||||||
 | 
								tabIndex,
 | 
				
			||||||
			onHover: this.onHover.bind(this, index, server.alias),
 | 
								onHover: this.onHover.bind(this, index, server.alias),
 | 
				
			||||||
			onHoverOut: this.onHoverOut.bind(this, index),
 | 
								onHoverOut: this.onHoverOut.bind(this, index),
 | 
				
			||||||
			webview: new WebView({
 | 
								webview: new WebView({
 | 
				
			||||||
				$root: this.$webviewsContainer,
 | 
									$root: this.$webviewsContainer,
 | 
				
			||||||
				index,
 | 
									index,
 | 
				
			||||||
 | 
									tabIndex,
 | 
				
			||||||
				url: server.url,
 | 
									url: server.url,
 | 
				
			||||||
				name: server.alias,
 | 
									name: server.alias,
 | 
				
			||||||
				isActive: () => {
 | 
									isActive: () => {
 | 
				
			||||||
@@ -145,15 +190,23 @@ class ServerManagerView {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initActions() {
 | 
						initActions() {
 | 
				
			||||||
 | 
							this.initDNDButton();
 | 
				
			||||||
 | 
							this.$dndButton.addEventListener('click', () => {
 | 
				
			||||||
 | 
								const dndUtil = DNDUtil.toggle();
 | 
				
			||||||
 | 
								ipcRenderer.send('forward-message', 'toggle-dnd', dndUtil.dnd, dndUtil.newSettings);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
		this.$reloadButton.addEventListener('click', () => {
 | 
							this.$reloadButton.addEventListener('click', () => {
 | 
				
			||||||
			this.tabs[this.activeTabIndex].webview.reload();
 | 
								this.tabs[this.activeTabIndex].webview.reload();
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		this.$addServerButton.addEventListener('click', () => {
 | 
							this.$addServerButton.addEventListener('click', () => {
 | 
				
			||||||
			this.openSettings('Servers');
 | 
								this.openSettings('AddServer');
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		this.$settingsButton.addEventListener('click', () => {
 | 
							this.$settingsButton.addEventListener('click', () => {
 | 
				
			||||||
			this.openSettings('General');
 | 
								this.openSettings('General');
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
							this.$backButton.addEventListener('click', () => {
 | 
				
			||||||
 | 
								this.tabs[this.activeTabIndex].webview.back();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const $serverImgs = document.querySelectorAll('.server-icons');
 | 
							const $serverImgs = document.querySelectorAll('.server-icons');
 | 
				
			||||||
		$serverImgs.forEach($serverImg => {
 | 
							$serverImgs.forEach($serverImg => {
 | 
				
			||||||
@@ -162,14 +215,35 @@ class ServerManagerView {
 | 
				
			|||||||
			});
 | 
								});
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.sidebarHoverEvent(this.$addServerButton, this.$addServerTooltip);
 | 
							this.sidebarHoverEvent(this.$addServerButton, this.$addServerTooltip, true);
 | 
				
			||||||
		this.sidebarHoverEvent(this.$settingsButton, this.$settingsTooltip);
 | 
							this.sidebarHoverEvent(this.$settingsButton, this.$settingsTooltip);
 | 
				
			||||||
		this.sidebarHoverEvent(this.$reloadButton, this.$reloadTooltip);
 | 
							this.sidebarHoverEvent(this.$reloadButton, this.$reloadTooltip);
 | 
				
			||||||
 | 
							this.sidebarHoverEvent(this.$backButton, this.$backTooltip);
 | 
				
			||||||
 | 
							this.sidebarHoverEvent(this.$dndButton, this.$dndTooltip);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sidebarHoverEvent(SidebarButton, SidebarTooltip) {
 | 
						initDNDButton() {
 | 
				
			||||||
 | 
							const dnd = ConfigUtil.getConfigItem('dnd', false);
 | 
				
			||||||
 | 
							this.toggleDNDButton(dnd);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						getTabIndex() {
 | 
				
			||||||
 | 
							const currentIndex = this.tabIndex;
 | 
				
			||||||
 | 
							this.tabIndex++;
 | 
				
			||||||
 | 
							return currentIndex;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sidebarHoverEvent(SidebarButton, SidebarTooltip, addServer = false) {
 | 
				
			||||||
		SidebarButton.addEventListener('mouseover', () => {
 | 
							SidebarButton.addEventListener('mouseover', () => {
 | 
				
			||||||
			SidebarTooltip.removeAttribute('style');
 | 
								SidebarTooltip.removeAttribute('style');
 | 
				
			||||||
 | 
								// To handle position of add server tooltip due to scrolling of list of organizations
 | 
				
			||||||
 | 
								// This could not be handled using CSS, hence the top of the tooltip is made same
 | 
				
			||||||
 | 
								// as that of its parent element.
 | 
				
			||||||
 | 
								// This needs to handled only for the add server tooltip and not others.
 | 
				
			||||||
 | 
								if (addServer) {
 | 
				
			||||||
 | 
									const { top } = SidebarButton.getBoundingClientRect();
 | 
				
			||||||
 | 
									SidebarTooltip.style.top = top + 'px';
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		SidebarButton.addEventListener('mouseout', () => {
 | 
							SidebarButton.addEventListener('mouseout', () => {
 | 
				
			||||||
			SidebarTooltip.style.display = 'none';
 | 
								SidebarTooltip.style.display = 'none';
 | 
				
			||||||
@@ -177,8 +251,13 @@ class ServerManagerView {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	onHover(index, serverName) {
 | 
						onHover(index, serverName) {
 | 
				
			||||||
		this.$serverIconTooltip[index].innerHTML = serverName;
 | 
							this.$serverIconTooltip[index].innerHTML = escape(serverName);
 | 
				
			||||||
		this.$serverIconTooltip[index].removeAttribute('style');
 | 
							this.$serverIconTooltip[index].removeAttribute('style');
 | 
				
			||||||
 | 
							// To handle position of servers' tooltip due to scrolling of list of organizations
 | 
				
			||||||
 | 
							// This could not be handled using CSS, hence the top of the tooltip is made same
 | 
				
			||||||
 | 
							// as that of its parent element.
 | 
				
			||||||
 | 
							const { top } = this.$serverIconTooltip[index].parentElement.getBoundingClientRect();
 | 
				
			||||||
 | 
							this.$serverIconTooltip[index].style.top = top + 'px';
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	onHoverOut(index) {
 | 
						onHoverOut(index) {
 | 
				
			||||||
@@ -193,16 +272,20 @@ class ServerManagerView {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		this.functionalTabs[tabProps.name] = this.tabs.length;
 | 
							this.functionalTabs[tabProps.name] = this.tabs.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							const tabIndex = this.getTabIndex();
 | 
				
			||||||
		this.tabs.push(new FunctionalTab({
 | 
							this.tabs.push(new FunctionalTab({
 | 
				
			||||||
			role: 'function',
 | 
								role: 'function',
 | 
				
			||||||
			materialIcon: tabProps.materialIcon,
 | 
								materialIcon: tabProps.materialIcon,
 | 
				
			||||||
 | 
								name: tabProps.name,
 | 
				
			||||||
			$root: this.$tabsContainer,
 | 
								$root: this.$tabsContainer,
 | 
				
			||||||
			index: this.functionalTabs[tabProps.name],
 | 
								index: this.functionalTabs[tabProps.name],
 | 
				
			||||||
 | 
								tabIndex,
 | 
				
			||||||
			onClick: this.activateTab.bind(this, this.functionalTabs[tabProps.name]),
 | 
								onClick: this.activateTab.bind(this, this.functionalTabs[tabProps.name]),
 | 
				
			||||||
			onDestroy: this.destroyTab.bind(this, tabProps.name, this.functionalTabs[tabProps.name]),
 | 
								onDestroy: this.destroyTab.bind(this, tabProps.name, this.functionalTabs[tabProps.name]),
 | 
				
			||||||
			webview: new WebView({
 | 
								webview: new WebView({
 | 
				
			||||||
				$root: this.$webviewsContainer,
 | 
									$root: this.$webviewsContainer,
 | 
				
			||||||
				index: this.functionalTabs[tabProps.name],
 | 
									index: this.functionalTabs[tabProps.name],
 | 
				
			||||||
 | 
									tabIndex,
 | 
				
			||||||
				url: tabProps.url,
 | 
									url: tabProps.url,
 | 
				
			||||||
				name: tabProps.name,
 | 
									name: tabProps.name,
 | 
				
			||||||
				isActive: () => {
 | 
									isActive: () => {
 | 
				
			||||||
@@ -214,7 +297,9 @@ class ServerManagerView {
 | 
				
			|||||||
				preload: false
 | 
									preload: false
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
		}));
 | 
							}));
 | 
				
			||||||
 | 
							// To show loading indicator the first time a functional tab is opened, indicator is
 | 
				
			||||||
 | 
							// closed when the functional tab DOM is ready, handled in webview.js
 | 
				
			||||||
 | 
							this.$webviewsContainer.classList.remove('loaded');
 | 
				
			||||||
		this.activateTab(this.functionalTabs[tabProps.name]);
 | 
							this.activateTab(this.functionalTabs[tabProps.name]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -224,6 +309,7 @@ class ServerManagerView {
 | 
				
			|||||||
			materialIcon: 'settings',
 | 
								materialIcon: 'settings',
 | 
				
			||||||
			url: `file://${__dirname}/preference.html#${nav}`
 | 
								url: `file://${__dirname}/preference.html#${nav}`
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
							this.$settingsButton.classList.add('active');
 | 
				
			||||||
		this.tabs[this.functionalTabs.Settings].webview.send('switch-settings-nav', nav);
 | 
							this.tabs[this.functionalTabs.Settings].webview.send('switch-settings-nav', nav);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -244,10 +330,10 @@ class ServerManagerView {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activateLastTab(index) {
 | 
						activateLastTab(index) {
 | 
				
			||||||
		// Open last active tab
 | 
							// Open all the tabs in background, also activate the tab based on the index
 | 
				
			||||||
		ConfigUtil.setConfigItem('lastActiveTab', index);
 | 
					 | 
				
			||||||
		// Open all the tabs in background
 | 
					 | 
				
			||||||
		this.activateTab(index);
 | 
							this.activateTab(index);
 | 
				
			||||||
 | 
							// Save last active tab
 | 
				
			||||||
 | 
							ConfigUtil.setConfigItem('lastActiveTab', index);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	activateTab(index, hideOldTab = true) {
 | 
						activateTab(index, hideOldTab = true) {
 | 
				
			||||||
@@ -259,10 +345,19 @@ class ServerManagerView {
 | 
				
			|||||||
			if (this.activeTabIndex === index) {
 | 
								if (this.activeTabIndex === index) {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			} else if (hideOldTab) {
 | 
								} else if (hideOldTab) {
 | 
				
			||||||
 | 
									// If old tab is functional tab Settings, remove focus from the settings icon at sidebar bottom
 | 
				
			||||||
 | 
									if (this.tabs[this.activeTabIndex].props.role === 'function' && this.tabs[this.activeTabIndex].props.name === 'Settings') {
 | 
				
			||||||
 | 
										this.$settingsButton.classList.remove('active');
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				this.tabs[this.activeTabIndex].deactivate();
 | 
									this.tabs[this.activeTabIndex].deactivate();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								this.tabs[index].webview.canGoBackButton();
 | 
				
			||||||
 | 
							} catch (err) {
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.activeTabIndex = index;
 | 
							this.activeTabIndex = index;
 | 
				
			||||||
		this.tabs[index].activate();
 | 
							this.tabs[index].activate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -278,7 +373,7 @@ class ServerManagerView {
 | 
				
			|||||||
			webContents.send('toggle-sidebar', state);
 | 
								webContents.send('toggle-sidebar', state);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('toogle-silent', (event, state) => {
 | 
							ipcRenderer.on('toggle-silent', (event, state) => {
 | 
				
			||||||
			const webviews = document.querySelectorAll('webview');
 | 
								const webviews = document.querySelectorAll('webview');
 | 
				
			||||||
			webviews.forEach(webview => {
 | 
								webviews.forEach(webview => {
 | 
				
			||||||
				try {
 | 
									try {
 | 
				
			||||||
@@ -291,6 +386,15 @@ class ServerManagerView {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ipcRenderer.on('toggle-dnd', (event, state, newSettings) => {
 | 
				
			||||||
 | 
								this.toggleDNDButton(state);
 | 
				
			||||||
 | 
								ipcRenderer.send('forward-message', 'toggle-silent', newSettings.silent);
 | 
				
			||||||
 | 
								const selector = 'webview:not([class*=disabled])';
 | 
				
			||||||
 | 
								const webview = document.querySelector(selector);
 | 
				
			||||||
 | 
								const webContents = webview.getWebContents();
 | 
				
			||||||
 | 
								webContents.send('toggle-dnd', state, newSettings);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	destroyTab(name, index) {
 | 
						destroyTab(name, index) {
 | 
				
			||||||
@@ -310,6 +414,9 @@ class ServerManagerView {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	destroyView() {
 | 
						destroyView() {
 | 
				
			||||||
 | 
							// Show loading indicator
 | 
				
			||||||
 | 
							this.$webviewsContainer.classList.remove('loaded');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Clear global variables
 | 
							// Clear global variables
 | 
				
			||||||
		this.activeTabIndex = -1;
 | 
							this.activeTabIndex = -1;
 | 
				
			||||||
		this.tabs = [];
 | 
							this.tabs = [];
 | 
				
			||||||
@@ -357,6 +464,12 @@ class ServerManagerView {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Toggles the dnd button icon.
 | 
				
			||||||
 | 
						toggleDNDButton(alert) {
 | 
				
			||||||
 | 
							this.$dndTooltip.textContent = (alert ? 'Turn Off' : 'Enable') + ' Do Not Disturb';
 | 
				
			||||||
 | 
							this.$dndButton.querySelector('i').textContent = alert ? 'notifications_off' : 'notifications';
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	registerIpcs() {
 | 
						registerIpcs() {
 | 
				
			||||||
		const webviewListeners = {
 | 
							const webviewListeners = {
 | 
				
			||||||
			'webview-reload': 'reload',
 | 
								'webview-reload': 'reload',
 | 
				
			||||||
@@ -399,13 +512,14 @@ class ServerManagerView {
 | 
				
			|||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('switch-server-tab', (event, index) => {
 | 
							ipcRenderer.on('switch-server-tab', (event, index) => {
 | 
				
			||||||
			this.activateTab(index);
 | 
								this.activateLastTab(index);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('reload-proxy', (event, showAlert) => {
 | 
							ipcRenderer.on('reload-proxy', (event, showAlert) => {
 | 
				
			||||||
			this.loadProxy().then(() => {
 | 
								this.loadProxy().then(() => {
 | 
				
			||||||
				if (showAlert) {
 | 
									if (showAlert) {
 | 
				
			||||||
					alert('Proxy settings saved!');
 | 
										alert('Proxy settings saved!');
 | 
				
			||||||
 | 
										ipcRenderer.send('reload-full-app');
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
@@ -423,6 +537,18 @@ class ServerManagerView {
 | 
				
			|||||||
			this.$fullscreenPopup.classList.remove('show');
 | 
								this.$fullscreenPopup.classList.remove('show');
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ipcRenderer.on('focus-webview-with-id', (event, webviewId) => {
 | 
				
			||||||
 | 
								const webviews = document.querySelectorAll('webview');
 | 
				
			||||||
 | 
								webviews.forEach(webview => {
 | 
				
			||||||
 | 
									const currentId = webview.getWebContents().id;
 | 
				
			||||||
 | 
									const tabId = webview.getAttribute('data-tab-id');
 | 
				
			||||||
 | 
									const concurrentTab = document.querySelector(`div[data-tab-id="${tabId}"]`);
 | 
				
			||||||
 | 
									if (currentId === webviewId) {
 | 
				
			||||||
 | 
										concurrentTab.click();
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('render-taskbar-icon', (event, messageCount) => {
 | 
							ipcRenderer.on('render-taskbar-icon', (event, messageCount) => {
 | 
				
			||||||
			// Create a canvas from unread messagecounts
 | 
								// Create a canvas from unread messagecounts
 | 
				
			||||||
			function createOverlayIcon(messageCount) {
 | 
								function createOverlayIcon(messageCount) {
 | 
				
			||||||
@@ -451,14 +577,33 @@ class ServerManagerView {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			ipcRenderer.send('update-taskbar-icon', createOverlayIcon(messageCount).toDataURL(), String(messageCount));
 | 
								ipcRenderer.send('update-taskbar-icon', createOverlayIcon(messageCount).toDataURL(), String(messageCount));
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ipcRenderer.on('open-feedback-modal', () => {
 | 
				
			||||||
 | 
								feedbackHolder.classList.add('show');
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
window.onload = () => {
 | 
					window.onload = () => {
 | 
				
			||||||
	const serverManagerView = new ServerManagerView();
 | 
						const serverManagerView = new ServerManagerView();
 | 
				
			||||||
 | 
						const reconnectUtil = new ReconnectUtil(serverManagerView);
 | 
				
			||||||
	serverManagerView.init();
 | 
						serverManagerView.init();
 | 
				
			||||||
 | 
					 | 
				
			||||||
	window.addEventListener('online', () => {
 | 
						window.addEventListener('online', () => {
 | 
				
			||||||
		serverManagerView.reloadView();
 | 
							reconnectUtil.pollInternetAndReload();
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						window.addEventListener('offline', () => {
 | 
				
			||||||
 | 
							reconnectUtil.clearState();
 | 
				
			||||||
 | 
							logger.log('No internet connection, you are offline.');
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// only start electron-connect (auto reload on change) when its ran
 | 
				
			||||||
 | 
						// from `npm run dev` or `gulp dev` and not from `npm start` when
 | 
				
			||||||
 | 
						// app is started `npm start` main process's proces.argv will have
 | 
				
			||||||
 | 
						// `--no-electron-connect`
 | 
				
			||||||
 | 
						const mainProcessArgv = remote.getGlobal('process').argv;
 | 
				
			||||||
 | 
						if (isDev && !mainProcessArgv.includes('--no-electron-connect')) {
 | 
				
			||||||
 | 
							const electronConnect = require('electron-connect');
 | 
				
			||||||
 | 
							electronConnect.client.create();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
'use strict';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const { remote, ipcRenderer } = require('electron');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const { app } = remote;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// From https://github.com/felixrieseberg/electron-windows-notifications#appusermodelid
 | 
					 | 
				
			||||||
// On windows 8 we have to explicitly set the appUserModelId otherwise notification won't work.
 | 
					 | 
				
			||||||
app.setAppUserModelId('org.zulip.zulip-electron');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const NativeNotification = window.Notification;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class baseNotification extends NativeNotification {
 | 
					 | 
				
			||||||
	constructor(title, opts) {
 | 
					 | 
				
			||||||
		opts.silent = ConfigUtil.getConfigItem('silent') || false;
 | 
					 | 
				
			||||||
		super(title, opts);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		this.addEventListener('click', () => {
 | 
					 | 
				
			||||||
			ipcRenderer.send('focus-app');
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	static requestPermission() {
 | 
					 | 
				
			||||||
		return; // eslint-disable-line no-useless-return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	// Override default Notification permission
 | 
					 | 
				
			||||||
	static get permission() {
 | 
					 | 
				
			||||||
		return ConfigUtil.getConfigItem('showNotification') ? 'granted' : 'denied';
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
window.Notification = baseNotification;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							
								
								
									
										100
									
								
								app/renderer/js/notification/darwin-notifications.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,100 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { ipcRenderer } = require('electron');
 | 
				
			||||||
 | 
					const url = require('url');
 | 
				
			||||||
 | 
					const MacNotifier = require('node-mac-notifier');
 | 
				
			||||||
 | 
					const ConfigUtil = require('../utils/config-util');
 | 
				
			||||||
 | 
					const {
 | 
				
			||||||
 | 
						appId, customReply, focusCurrentServer, parseReply, setupReply
 | 
				
			||||||
 | 
					} = require('./helpers');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let replyHandler;
 | 
				
			||||||
 | 
					let clickHandler;
 | 
				
			||||||
 | 
					class DarwinNotification {
 | 
				
			||||||
 | 
						constructor(title, opts) {
 | 
				
			||||||
 | 
							const silent = ConfigUtil.getConfigItem('silent') || false;
 | 
				
			||||||
 | 
							const { host, protocol } = location;
 | 
				
			||||||
 | 
							const { icon } = opts;
 | 
				
			||||||
 | 
							const profilePic = url.resolve(`${protocol}//${host}`, icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.tag = opts.tag;
 | 
				
			||||||
 | 
							const notification = new MacNotifier(title, Object.assign(opts, {
 | 
				
			||||||
 | 
								bundleId: appId,
 | 
				
			||||||
 | 
								canReply: true,
 | 
				
			||||||
 | 
								silent,
 | 
				
			||||||
 | 
								icon: profilePic
 | 
				
			||||||
 | 
							}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							notification.addEventListener('click', () => {
 | 
				
			||||||
 | 
								// focus to the server who sent the
 | 
				
			||||||
 | 
								// notification if not focused already
 | 
				
			||||||
 | 
								if (clickHandler) {
 | 
				
			||||||
 | 
									clickHandler();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								focusCurrentServer();
 | 
				
			||||||
 | 
								ipcRenderer.send('focus-app');
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							notification.addEventListener('reply', this.notificationHandler);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static requestPermission() {
 | 
				
			||||||
 | 
							return; // eslint-disable-line no-useless-return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Override default Notification permission
 | 
				
			||||||
 | 
						static get permission() {
 | 
				
			||||||
 | 
							return ConfigUtil.getConfigItem('showNotification') ? 'granted' : 'denied';
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set onreply(handler) {
 | 
				
			||||||
 | 
							replyHandler = handler;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						get onreply() {
 | 
				
			||||||
 | 
							return replyHandler;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set onclick(handler) {
 | 
				
			||||||
 | 
							clickHandler = handler;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						get onclick() {
 | 
				
			||||||
 | 
							return clickHandler;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// not something that is common or
 | 
				
			||||||
 | 
						// used by zulip server but added to be
 | 
				
			||||||
 | 
						// future proff.
 | 
				
			||||||
 | 
						addEventListener(event, handler) {
 | 
				
			||||||
 | 
							if (event === 'click') {
 | 
				
			||||||
 | 
								clickHandler = handler;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (event === 'reply') {
 | 
				
			||||||
 | 
								replyHandler = handler;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						notificationHandler({ response }) {
 | 
				
			||||||
 | 
							response = parseReply(response);
 | 
				
			||||||
 | 
							focusCurrentServer();
 | 
				
			||||||
 | 
							setupReply(this.tag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (replyHandler) {
 | 
				
			||||||
 | 
								replyHandler(response);
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							customReply(response);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// method specific to notification api
 | 
				
			||||||
 | 
						// used by zulip
 | 
				
			||||||
 | 
						close() {
 | 
				
			||||||
 | 
							return; // eslint-disable-line no-useless-return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = DarwinNotification;
 | 
				
			||||||
							
								
								
									
										31
									
								
								app/renderer/js/notification/default-notification.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { ipcRenderer } = require('electron');
 | 
				
			||||||
 | 
					const ConfigUtil = require('../utils/config-util');
 | 
				
			||||||
 | 
					const { focusCurrentServer } = require('./helpers');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const NativeNotification = window.Notification;
 | 
				
			||||||
 | 
					class BaseNotification extends NativeNotification {
 | 
				
			||||||
 | 
						constructor(title, opts) {
 | 
				
			||||||
 | 
							opts.silent = true;
 | 
				
			||||||
 | 
							super(title, opts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.addEventListener('click', () => {
 | 
				
			||||||
 | 
								// focus to the server who sent the
 | 
				
			||||||
 | 
								// notification if not focused already
 | 
				
			||||||
 | 
								focusCurrentServer();
 | 
				
			||||||
 | 
								ipcRenderer.send('focus-app');
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static requestPermission() {
 | 
				
			||||||
 | 
							return; // eslint-disable-line no-useless-return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Override default Notification permission
 | 
				
			||||||
 | 
						static get permission() {
 | 
				
			||||||
 | 
							return ConfigUtil.getConfigItem('showNotification') ? 'granted' : 'denied';
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = BaseNotification;
 | 
				
			||||||
							
								
								
									
										155
									
								
								app/renderer/js/notification/helpers.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,155 @@
 | 
				
			|||||||
 | 
					const { remote } = require('electron');
 | 
				
			||||||
 | 
					const Logger = require('../utils/logger-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: 'errors.log',
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Do not change this
 | 
				
			||||||
 | 
					const appId = 'org.zulip.zulip-electron';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const botsList = [];
 | 
				
			||||||
 | 
					let botsListLoaded = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// this function load list of bots from the server
 | 
				
			||||||
 | 
					// sync=True for a synchronous getJSON request
 | 
				
			||||||
 | 
					// in case botsList isn't already completely loaded when required in parseRely
 | 
				
			||||||
 | 
					function loadBots(sync = false) {
 | 
				
			||||||
 | 
						const { $ } = window;
 | 
				
			||||||
 | 
						botsList.length = 0;
 | 
				
			||||||
 | 
						if (sync) {
 | 
				
			||||||
 | 
							$.ajaxSetup({async: false});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						$.getJSON('/json/users')
 | 
				
			||||||
 | 
							.done(data => {
 | 
				
			||||||
 | 
								const members = data.members;
 | 
				
			||||||
 | 
								members.forEach(membersRow => {
 | 
				
			||||||
 | 
									if (membersRow.is_bot) {
 | 
				
			||||||
 | 
										const bot = `@${membersRow.full_name}`;
 | 
				
			||||||
 | 
										const mention = `@**${bot.replace(/^@/, '')}**`;
 | 
				
			||||||
 | 
										botsList.push([bot, mention]);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
								botsListLoaded = true;
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
							.fail(error => {
 | 
				
			||||||
 | 
								logger.log('Load bots request failed: ', error.responseText);
 | 
				
			||||||
 | 
								logger.log('Load bots request status: ', error.statusText);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						if (sync) {
 | 
				
			||||||
 | 
							$.ajaxSetup({async: true});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function checkElements(...elements) {
 | 
				
			||||||
 | 
						let status = true;
 | 
				
			||||||
 | 
						elements.forEach(element => {
 | 
				
			||||||
 | 
							if (element === null || element === undefined) {
 | 
				
			||||||
 | 
								status = false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
						return status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function customReply(reply) {
 | 
				
			||||||
 | 
						// server does not support notification reply yet.
 | 
				
			||||||
 | 
						const buttonSelector = '.messagebox #send_controls button[type=submit]';
 | 
				
			||||||
 | 
						const messageboxSelector = '.selected_message .messagebox .messagebox-border .messagebox-content';
 | 
				
			||||||
 | 
						const textarea = document.querySelector('#compose-textarea');
 | 
				
			||||||
 | 
						const messagebox = document.querySelector(messageboxSelector);
 | 
				
			||||||
 | 
						const sendButton = document.querySelector(buttonSelector);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// sanity check for old server versions
 | 
				
			||||||
 | 
						const elementsExists = checkElements(textarea, messagebox, sendButton);
 | 
				
			||||||
 | 
						if (!elementsExists) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						textarea.value = reply;
 | 
				
			||||||
 | 
						messagebox.click();
 | 
				
			||||||
 | 
						sendButton.click();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const currentWindow = remote.getCurrentWindow();
 | 
				
			||||||
 | 
					const webContents = remote.getCurrentWebContents();
 | 
				
			||||||
 | 
					const webContentsId = webContents.id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// this function will focus the server that sent
 | 
				
			||||||
 | 
					// the notification. Main function implemented in main.js
 | 
				
			||||||
 | 
					function focusCurrentServer() {
 | 
				
			||||||
 | 
						currentWindow.send('focus-webview-with-id', webContentsId);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					// this function parses the reply from to notification
 | 
				
			||||||
 | 
					// making it easier to reply from notification eg
 | 
				
			||||||
 | 
					// @username in reply will be converted to @**username**
 | 
				
			||||||
 | 
					// #stream in reply will be converted to #**stream**
 | 
				
			||||||
 | 
					// bot mentions are not yet supported
 | 
				
			||||||
 | 
					function parseReply(reply) {
 | 
				
			||||||
 | 
						const usersDiv = document.querySelectorAll('#user_presences li');
 | 
				
			||||||
 | 
						const streamHolder = document.querySelectorAll('#stream_filters li');
 | 
				
			||||||
 | 
						const users = [];
 | 
				
			||||||
 | 
						const streams = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						usersDiv.forEach(userRow => {
 | 
				
			||||||
 | 
							const anchor = userRow.querySelector('span a');
 | 
				
			||||||
 | 
							if (anchor !== null) {
 | 
				
			||||||
 | 
								const user = `@${anchor.textContent.trim()}`;
 | 
				
			||||||
 | 
								const mention = `@**${user.replace(/^@/, '')}**`;
 | 
				
			||||||
 | 
								users.push([user, mention]);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						streamHolder.forEach(stream => {
 | 
				
			||||||
 | 
							const streamAnchor = stream.querySelector('div a');
 | 
				
			||||||
 | 
							if (streamAnchor !== null) {
 | 
				
			||||||
 | 
								const streamName = `#${streamAnchor.textContent.trim()}`;
 | 
				
			||||||
 | 
								const streamMention = `#**${streamName.replace(/^#/, '')}**`;
 | 
				
			||||||
 | 
								streams.push([streamName, streamMention]);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						users.forEach(([user, mention]) => {
 | 
				
			||||||
 | 
							if (reply.includes(user)) {
 | 
				
			||||||
 | 
								const regex = new RegExp(user, 'g');
 | 
				
			||||||
 | 
								reply = reply.replace(regex, mention);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						streams.forEach(([stream, streamMention]) => {
 | 
				
			||||||
 | 
							const regex = new RegExp(stream, 'g');
 | 
				
			||||||
 | 
							reply = reply.replace(regex, streamMention);
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// If botsList isn't completely loaded yet, make a synchronous getJSON request for list
 | 
				
			||||||
 | 
						if (botsListLoaded === false) {
 | 
				
			||||||
 | 
							loadBots(true);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Iterate for every bot name and replace in reply
 | 
				
			||||||
 | 
						// @botname with @**botname**
 | 
				
			||||||
 | 
						botsList.forEach(([bot, mention]) => {
 | 
				
			||||||
 | 
							if (reply.includes(bot)) {
 | 
				
			||||||
 | 
								const regex = new RegExp(bot, 'g');
 | 
				
			||||||
 | 
								reply = reply.replace(regex, mention);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						reply = reply.replace(/\\n/, '\n');
 | 
				
			||||||
 | 
						return reply;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function setupReply(id) {
 | 
				
			||||||
 | 
						const { narrow } = window;
 | 
				
			||||||
 | 
						narrow.by_subject(id, { trigger: 'notification' });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
						appId,
 | 
				
			||||||
 | 
						checkElements,
 | 
				
			||||||
 | 
						customReply,
 | 
				
			||||||
 | 
						parseReply,
 | 
				
			||||||
 | 
						setupReply,
 | 
				
			||||||
 | 
						focusCurrentServer,
 | 
				
			||||||
 | 
						loadBots
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										27
									
								
								app/renderer/js/notification/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const {
 | 
				
			||||||
 | 
					  remote: { app }
 | 
				
			||||||
 | 
					} = require('electron');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const DefaultNotification = require('./default-notification');
 | 
				
			||||||
 | 
					const { appId, loadBots } = require('./helpers');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// From https://github.com/felixrieseberg/electron-windows-notifications#appusermodelid
 | 
				
			||||||
 | 
					// On windows 8 we have to explicitly set the appUserModelId otherwise notification won't work.
 | 
				
			||||||
 | 
					app.setAppUserModelId(appId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					window.Notification = DefaultNotification;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (process.platform === 'darwin') {
 | 
				
			||||||
 | 
						const DarwinNotification = require('./darwin-notifications');
 | 
				
			||||||
 | 
						window.Notification = DarwinNotification;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					window.addEventListener('load', () => {
 | 
				
			||||||
 | 
						// Call this function only when user is logged in
 | 
				
			||||||
 | 
						// eslint-disable-next-line no-undef, camelcase
 | 
				
			||||||
 | 
						if (page_params.realm_uri) {
 | 
				
			||||||
 | 
							loadBots();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
							
								
								
									
										91
									
								
								app/renderer/js/pages/preference/add-certificate.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,91 @@
 | 
				
			|||||||
 | 
					'use-strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { dialog } = require('electron').remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const BaseComponent = require(__dirname + '/../../components/base.js');
 | 
				
			||||||
 | 
					const CertificateUtil = require(__dirname + '/../../utils/certificate-util.js');
 | 
				
			||||||
 | 
					const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AddCertificate extends BaseComponent {
 | 
				
			||||||
 | 
						constructor(props) {
 | 
				
			||||||
 | 
							super();
 | 
				
			||||||
 | 
							this.props = props;
 | 
				
			||||||
 | 
							this._certFile = '';
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						template() {
 | 
				
			||||||
 | 
							return `			
 | 
				
			||||||
 | 
								<div class="settings-card server-center certificates-card">
 | 
				
			||||||
 | 
									<div class="certificate-input">
 | 
				
			||||||
 | 
										<div>Organization URL :</div> 
 | 
				
			||||||
 | 
										<input class="setting-input-value" autofocus placeholder="your-organization.zulipchat.com or zulip.your-organization.com"/>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
									<div class="certificate-input">
 | 
				
			||||||
 | 
										<div>Custom CA's certificate file :</div> 
 | 
				
			||||||
 | 
										<button id="add-certificate-button">Add</button>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
							`;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						init() {
 | 
				
			||||||
 | 
							this.$addCertificate = this.generateNodeFromTemplate(this.template());
 | 
				
			||||||
 | 
							this.props.$root.appendChild(this.$addCertificate);
 | 
				
			||||||
 | 
							this.addCertificateButton = this.$addCertificate.querySelector('#add-certificate-button');
 | 
				
			||||||
 | 
							this.serverUrl = this.$addCertificate.querySelectorAll('input.setting-input-value')[0];
 | 
				
			||||||
 | 
							this.initListeners();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						validateAndAdd() {
 | 
				
			||||||
 | 
							const certificate = this._certFile;
 | 
				
			||||||
 | 
							const serverUrl = this.serverUrl.value;
 | 
				
			||||||
 | 
							if (certificate !== '' && serverUrl !== '') {
 | 
				
			||||||
 | 
								const server = encodeURIComponent(DomainUtil.formatUrl(serverUrl));
 | 
				
			||||||
 | 
								const fileName = certificate.substring(certificate.lastIndexOf('/') + 1);
 | 
				
			||||||
 | 
								const copy = CertificateUtil.copyCertificate(server, certificate, fileName);
 | 
				
			||||||
 | 
								if (!copy) {
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								CertificateUtil.setCertificate(server, fileName);
 | 
				
			||||||
 | 
								dialog.showMessageBox({
 | 
				
			||||||
 | 
									title: 'Success',
 | 
				
			||||||
 | 
									message: `Certificate saved!`
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
								this.serverUrl.value = '';
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								dialog.showErrorBox('Error', `Please, ${serverUrl === '' ?
 | 
				
			||||||
 | 
					      'Enter an Organization URL' : 'Choose certificate file'}`);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						addHandler() {
 | 
				
			||||||
 | 
							const showDialogOptions = {
 | 
				
			||||||
 | 
								title: 'Select file',
 | 
				
			||||||
 | 
								defaultId: 1,
 | 
				
			||||||
 | 
								properties: ['openFile'],
 | 
				
			||||||
 | 
								filters: [{ name: 'crt, pem', extensions: ['crt', 'pem'] }]
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
							dialog.showOpenDialog(showDialogOptions, selectedFile => {
 | 
				
			||||||
 | 
								if (selectedFile) {
 | 
				
			||||||
 | 
									this._certFile = selectedFile[0] || '';
 | 
				
			||||||
 | 
									this.validateAndAdd();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						initListeners() {
 | 
				
			||||||
 | 
							this.addCertificateButton.addEventListener('click', () => {
 | 
				
			||||||
 | 
								this.addHandler();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.serverUrl.addEventListener('keypress', event => {
 | 
				
			||||||
 | 
								const EnterkeyCode = event.keyCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (EnterkeyCode === 13) {
 | 
				
			||||||
 | 
									this.addHandler();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = AddCertificate;
 | 
				
			||||||
							
								
								
									
										64
									
								
								app/renderer/js/pages/preference/connected-org-section.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const BaseSection = require(__dirname + '/base-section.js');
 | 
				
			||||||
 | 
					const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
				
			||||||
 | 
					const ServerInfoForm = require(__dirname + '/server-info-form.js');
 | 
				
			||||||
 | 
					const AddCertificate = require(__dirname + '/add-certificate.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ConnectedOrgSection extends BaseSection {
 | 
				
			||||||
 | 
						constructor(props) {
 | 
				
			||||||
 | 
							super();
 | 
				
			||||||
 | 
							this.props = props;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						template() {
 | 
				
			||||||
 | 
							return `
 | 
				
			||||||
 | 
								<div class="settings-pane" id="server-settings-pane">
 | 
				
			||||||
 | 
									<div class="page-title">Connected organizations</div>
 | 
				
			||||||
 | 
									<div class="title" id="existing-servers">All the connected orgnizations will appear here.</div>
 | 
				
			||||||
 | 
									<div id="server-info-container"></div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									<div class="page-title">Add Custom Certificates</div>
 | 
				
			||||||
 | 
									<div id="add-certificate-container"></div>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
							`;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						init() {
 | 
				
			||||||
 | 
							this.initServers();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						initServers() {
 | 
				
			||||||
 | 
							this.props.$root.innerHTML = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							const servers = DomainUtil.getDomains();
 | 
				
			||||||
 | 
							this.props.$root.innerHTML = this.template();
 | 
				
			||||||
 | 
							this.$serverInfoContainer = document.getElementById('server-info-container');
 | 
				
			||||||
 | 
							this.$existingServers = document.getElementById('existing-servers');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							const noServerText = 'All the connected orgnizations will appear here';
 | 
				
			||||||
 | 
							// Show noServerText if no servers are there otherwise hide it
 | 
				
			||||||
 | 
							this.$existingServers.innerHTML = servers.length === 0 ? noServerText : '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for (let i = 0; i < servers.length; i++) {
 | 
				
			||||||
 | 
								new ServerInfoForm({
 | 
				
			||||||
 | 
									$root: this.$serverInfoContainer,
 | 
				
			||||||
 | 
									server: servers[i],
 | 
				
			||||||
 | 
									index: i,
 | 
				
			||||||
 | 
									onChange: this.reloadApp
 | 
				
			||||||
 | 
								}).init();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.$addCertificateContainer = document.getElementById('add-certificate-container');
 | 
				
			||||||
 | 
							this.initAddCertificate();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						initAddCertificate() {
 | 
				
			||||||
 | 
							new AddCertificate({
 | 
				
			||||||
 | 
								$root: this.$addCertificateContainer
 | 
				
			||||||
 | 
							}).init();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = ConnectedOrgSection;
 | 
				
			||||||
@@ -1,37 +0,0 @@
 | 
				
			|||||||
'use strict';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const BaseComponent = require(__dirname + '/../../components/base.js');
 | 
					 | 
				
			||||||
const shell = require('electron').shell;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class CreateOrganziation extends BaseComponent {
 | 
					 | 
				
			||||||
	constructor(props) {
 | 
					 | 
				
			||||||
		super();
 | 
					 | 
				
			||||||
		this.props = props;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	template() {
 | 
					 | 
				
			||||||
		return `
 | 
					 | 
				
			||||||
			<div class="setting-row">
 | 
					 | 
				
			||||||
				<div class="setting-description">
 | 
					 | 
				
			||||||
					<span id="open-create-org-link">Or create a new organization on zulipchat.com<i class="material-icons open-tab-button">open_in_new</i></span>
 | 
					 | 
				
			||||||
				</div>
 | 
					 | 
				
			||||||
				<div class="setting-control"></div>
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
		`;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	init() {
 | 
					 | 
				
			||||||
		this.props.$root.innerHTML = this.template();
 | 
					 | 
				
			||||||
		this.openCreateNewOrgExternalLink();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	openCreateNewOrgExternalLink() {
 | 
					 | 
				
			||||||
		const link = 'https://zulipchat.com/beta/';
 | 
					 | 
				
			||||||
		const externalCreateNewOrgEl = document.getElementById('open-create-org-link');
 | 
					 | 
				
			||||||
		externalCreateNewOrgEl.addEventListener('click', () => {
 | 
					 | 
				
			||||||
			shell.openExternal(link);
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module.exports = CreateOrganziation;
 | 
					 | 
				
			||||||
@@ -31,6 +31,10 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
						<div class="setting-description">Show app unread badge</div>
 | 
											<div class="setting-description">Show app unread badge</div>
 | 
				
			||||||
						<div class="setting-control"></div>
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
 | 
										<div class="setting-row" id="dock-bounce-option" style= "display:${process.platform === 'darwin' ? '' : 'none'}">
 | 
				
			||||||
 | 
											<div class="setting-description">Bounce dock on new private message</div>
 | 
				
			||||||
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
					<div class="setting-row" id="flash-taskbar-option" style= "display:${process.platform === 'win32' ? '' : 'none'}">
 | 
										<div class="setting-row" id="flash-taskbar-option" style= "display:${process.platform === 'win32' ? '' : 'none'}">
 | 
				
			||||||
						<div class="setting-description">Flash taskbar on new message</div>
 | 
											<div class="setting-description">Flash taskbar on new message</div>
 | 
				
			||||||
						<div class="setting-control"></div>
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
@@ -48,7 +52,11 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
				<div class="title">App Updates</div>
 | 
									<div class="title">App Updates</div>
 | 
				
			||||||
                <div class="settings-card">
 | 
									<div class="settings-card">
 | 
				
			||||||
 | 
									<div class="setting-row" id="autoupdate-option">
 | 
				
			||||||
 | 
											<div class="setting-description">Enable auto updates</div>
 | 
				
			||||||
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
					<div class="setting-row" id="betaupdate-option">
 | 
										<div class="setting-row" id="betaupdate-option">
 | 
				
			||||||
						<div class="setting-description">Get beta updates</div>
 | 
											<div class="setting-description">Get beta updates</div>
 | 
				
			||||||
						<div class="setting-control"></div>
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
@@ -69,6 +77,24 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
						<div class="setting-control"></div>
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
									<div class="title">Add custom CSS</div>
 | 
				
			||||||
 | 
									<div class="settings-card">
 | 
				
			||||||
 | 
										<div class="setting-row" id="add-custom-css">
 | 
				
			||||||
 | 
											<div class="setting-description">
 | 
				
			||||||
 | 
												This will inject the selected css stylesheet in all the added accounts
 | 
				
			||||||
 | 
											</div>
 | 
				
			||||||
 | 
											<button class="custom-css-button blue">Add</button>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
 | 
										<div class="setting-row" id="remove-custom-css">
 | 
				
			||||||
 | 
											<div class="setting-description">
 | 
				
			||||||
 | 
												<div class="selected-css-path" id="custom-css-path">${ConfigUtil.getConfigItem('customCSS')}</div>
 | 
				
			||||||
 | 
											</div>
 | 
				
			||||||
 | 
											<div class="action red" id="css-delete-action">
 | 
				
			||||||
 | 
												<i class="material-icons">indeterminate_check_box</i>
 | 
				
			||||||
 | 
												<span>Delete</span>
 | 
				
			||||||
 | 
											</div>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
				<div class="title">Reset Application Data</div>
 | 
									<div class="title">Reset Application Data</div>
 | 
				
			||||||
                <div class="settings-card">
 | 
					                <div class="settings-card">
 | 
				
			||||||
					<div class="setting-row" id="resetdata-option">
 | 
										<div class="setting-row" id="resetdata-option">
 | 
				
			||||||
@@ -86,19 +112,28 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
		this.updateTrayOption();
 | 
							this.updateTrayOption();
 | 
				
			||||||
		this.updateBadgeOption();
 | 
							this.updateBadgeOption();
 | 
				
			||||||
		this.updateSilentOption();
 | 
							this.updateSilentOption();
 | 
				
			||||||
		this.updateUpdateOption();
 | 
							this.autoUpdateOption();
 | 
				
			||||||
 | 
							this.betaUpdateOption();
 | 
				
			||||||
		this.updateSidebarOption();
 | 
							this.updateSidebarOption();
 | 
				
			||||||
		this.updateStartAtLoginOption();
 | 
							this.updateStartAtLoginOption();
 | 
				
			||||||
		this.updateResetDataOption();
 | 
							this.updateResetDataOption();
 | 
				
			||||||
		this.showDesktopNotification();
 | 
							this.showDesktopNotification();
 | 
				
			||||||
		this.enableSpellchecker();
 | 
							this.enableSpellchecker();
 | 
				
			||||||
		this.minimizeOnStart();
 | 
							this.minimizeOnStart();
 | 
				
			||||||
 | 
							this.addCustomCSS();
 | 
				
			||||||
 | 
							this.showCustomCSSPath();
 | 
				
			||||||
 | 
							this.removeCustomCSS();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Platform specific settings
 | 
							// Platform specific settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Flashing taskbar on Windows
 | 
							// Flashing taskbar on Windows
 | 
				
			||||||
		if (process.platform === 'win32') {
 | 
							if (process.platform === 'win32') {
 | 
				
			||||||
			this.updateFlashTaskbar();
 | 
								this.updateFlashTaskbar();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							// Dock bounce on macOS
 | 
				
			||||||
 | 
							if (process.platform === 'darwin') {
 | 
				
			||||||
 | 
								this.updateDockBouncing();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	updateTrayOption() {
 | 
						updateTrayOption() {
 | 
				
			||||||
@@ -127,6 +162,18 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						updateDockBouncing() {
 | 
				
			||||||
 | 
							this.generateSettingOption({
 | 
				
			||||||
 | 
								$element: document.querySelector('#dock-bounce-option .setting-control'),
 | 
				
			||||||
 | 
								value: ConfigUtil.getConfigItem('dockBouncing', true),
 | 
				
			||||||
 | 
								clickHandler: () => {
 | 
				
			||||||
 | 
									const newValue = !ConfigUtil.getConfigItem('dockBouncing');
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('dockBouncing', newValue);
 | 
				
			||||||
 | 
									this.updateDockBouncing();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	updateFlashTaskbar() {
 | 
						updateFlashTaskbar() {
 | 
				
			||||||
		this.generateSettingOption({
 | 
							this.generateSettingOption({
 | 
				
			||||||
			$element: document.querySelector('#flash-taskbar-option .setting-control'),
 | 
								$element: document.querySelector('#flash-taskbar-option .setting-control'),
 | 
				
			||||||
@@ -139,14 +186,26 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	updateUpdateOption() {
 | 
						autoUpdateOption() {
 | 
				
			||||||
 | 
							this.generateSettingOption({
 | 
				
			||||||
 | 
								$element: document.querySelector('#autoupdate-option .setting-control'),
 | 
				
			||||||
 | 
								value: ConfigUtil.getConfigItem('autoUpdate', true),
 | 
				
			||||||
 | 
								clickHandler: () => {
 | 
				
			||||||
 | 
									const newValue = !ConfigUtil.getConfigItem('autoUpdate');
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('autoUpdate', newValue);
 | 
				
			||||||
 | 
									this.autoUpdateOption();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						betaUpdateOption() {
 | 
				
			||||||
		this.generateSettingOption({
 | 
							this.generateSettingOption({
 | 
				
			||||||
			$element: document.querySelector('#betaupdate-option .setting-control'),
 | 
								$element: document.querySelector('#betaupdate-option .setting-control'),
 | 
				
			||||||
			value: ConfigUtil.getConfigItem('betaUpdate', false),
 | 
								value: ConfigUtil.getConfigItem('betaUpdate', false),
 | 
				
			||||||
			clickHandler: () => {
 | 
								clickHandler: () => {
 | 
				
			||||||
				const newValue = !ConfigUtil.getConfigItem('betaUpdate');
 | 
									const newValue = !ConfigUtil.getConfigItem('betaUpdate');
 | 
				
			||||||
				ConfigUtil.setConfigItem('betaUpdate', newValue);
 | 
									ConfigUtil.setConfigItem('betaUpdate', newValue);
 | 
				
			||||||
				this.updateUpdateOption();
 | 
									this.betaUpdateOption();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -159,7 +218,7 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
				const newValue = !ConfigUtil.getConfigItem('silent', true);
 | 
									const newValue = !ConfigUtil.getConfigItem('silent', true);
 | 
				
			||||||
				ConfigUtil.setConfigItem('silent', newValue);
 | 
									ConfigUtil.setConfigItem('silent', newValue);
 | 
				
			||||||
				this.updateSilentOption();
 | 
									this.updateSilentOption();
 | 
				
			||||||
				currentBrowserWindow.send('toogle-silent', newValue);
 | 
									currentBrowserWindow.send('toggle-silent', newValue);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -232,6 +291,22 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						customCssDialog() {
 | 
				
			||||||
 | 
							const showDialogOptions = {
 | 
				
			||||||
 | 
								title: 'Select file',
 | 
				
			||||||
 | 
								defaultId: 1,
 | 
				
			||||||
 | 
								properties: ['openFile'],
 | 
				
			||||||
 | 
								filters: [{ name: 'CSS file', extensions: ['css'] }]
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							dialog.showOpenDialog(showDialogOptions, selectedFile => {
 | 
				
			||||||
 | 
								if (selectedFile) {
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('customCSS', selectedFile[0]);
 | 
				
			||||||
 | 
									ipcRenderer.send('forward-message', 'hard-reload');
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	updateResetDataOption() {
 | 
						updateResetDataOption() {
 | 
				
			||||||
		const resetDataButton = document.querySelector('#resetdata-option .reset-data-button');
 | 
							const resetDataButton = document.querySelector('#resetdata-option .reset-data-button');
 | 
				
			||||||
		resetDataButton.addEventListener('click', () => {
 | 
							resetDataButton.addEventListener('click', () => {
 | 
				
			||||||
@@ -251,6 +326,28 @@ class GeneralSection extends BaseSection {
 | 
				
			|||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						addCustomCSS() {
 | 
				
			||||||
 | 
							const customCSSButton = document.querySelector('#add-custom-css .custom-css-button');
 | 
				
			||||||
 | 
							customCSSButton.addEventListener('click', () => {
 | 
				
			||||||
 | 
								this.customCssDialog();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						showCustomCSSPath() {
 | 
				
			||||||
 | 
							if (!ConfigUtil.getConfigItem('customCSS')) {
 | 
				
			||||||
 | 
								const cssPATH = document.getElementById('remove-custom-css');
 | 
				
			||||||
 | 
								cssPATH.style.display = 'none';
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						removeCustomCSS() {
 | 
				
			||||||
 | 
							const removeCSSButton = document.getElementById('css-delete-action');
 | 
				
			||||||
 | 
							removeCSSButton.addEventListener('click', () => {
 | 
				
			||||||
 | 
								ConfigUtil.setConfigItem('customCSS');
 | 
				
			||||||
 | 
								ipcRenderer.send('forward-message', 'hard-reload');
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = GeneralSection;
 | 
					module.exports = GeneralSection;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ class PreferenceNav extends BaseComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		this.props = props;
 | 
							this.props = props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.navItems = ['General', 'Network', 'Servers', 'Shortcuts'];
 | 
							this.navItems = ['General', 'Network', 'AddServer', 'Organizations', 'Shortcuts'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.init();
 | 
							this.init();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,11 +16,15 @@ class NetworkSection extends BaseSection {
 | 
				
			|||||||
            <div class="settings-pane">
 | 
					            <div class="settings-pane">
 | 
				
			||||||
                <div class="title">Proxy</div>
 | 
					                <div class="title">Proxy</div>
 | 
				
			||||||
                <div id="appearance-option-settings" class="settings-card">
 | 
					                <div id="appearance-option-settings" class="settings-card">
 | 
				
			||||||
					<div class="setting-row" id="use-proxy-option">
 | 
										<div class="setting-row" id="use-system-settings">
 | 
				
			||||||
						<div class="setting-description">Connect servers through a proxy</div>
 | 
											<div class="setting-description">Use system proxy settings (requires restart)</div>
 | 
				
			||||||
						<div class="setting-control"></div>
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
					<div class="setting-block">
 | 
										<div class="setting-row" id="use-manual-settings">
 | 
				
			||||||
 | 
											<div class="setting-description">Manual proxy configuration</div>
 | 
				
			||||||
 | 
											<div class="setting-control"></div>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
 | 
										<div class="manual-proxy-block">
 | 
				
			||||||
						<div class="setting-row" id="proxy-pac-option">
 | 
											<div class="setting-row" id="proxy-pac-option">
 | 
				
			||||||
							<span class="setting-input-key">PAC script</span>
 | 
												<span class="setting-input-key">PAC script</span>
 | 
				
			||||||
							<input class="setting-input-value" placeholder="e.g. foobar.com/pacfile.js"/>
 | 
												<input class="setting-input-value" placeholder="e.g. foobar.com/pacfile.js"/>
 | 
				
			||||||
@@ -51,7 +55,7 @@ class NetworkSection extends BaseSection {
 | 
				
			|||||||
		this.$proxyRules = document.querySelector('#proxy-rules-option .setting-input-value');
 | 
							this.$proxyRules = document.querySelector('#proxy-rules-option .setting-input-value');
 | 
				
			||||||
		this.$proxyBypass = document.querySelector('#proxy-bypass-option .setting-input-value');
 | 
							this.$proxyBypass = document.querySelector('#proxy-bypass-option .setting-input-value');
 | 
				
			||||||
		this.$proxySaveAction = document.getElementById('proxy-save-action');
 | 
							this.$proxySaveAction = document.getElementById('proxy-save-action');
 | 
				
			||||||
		this.$settingBlock = this.props.$root.querySelector('.setting-block');
 | 
							this.$manualProxyBlock = this.props.$root.querySelector('.manual-proxy-block');
 | 
				
			||||||
		this.initProxyOption();
 | 
							this.initProxyOption();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$proxyPAC.value = ConfigUtil.getConfigItem('proxyPAC', '');
 | 
							this.$proxyPAC.value = ConfigUtil.getConfigItem('proxyPAC', '');
 | 
				
			||||||
@@ -68,31 +72,54 @@ class NetworkSection extends BaseSection {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initProxyOption() {
 | 
						initProxyOption() {
 | 
				
			||||||
		const proxyEnabled = ConfigUtil.getConfigItem('useProxy', false);
 | 
							const manualProxyEnabled = ConfigUtil.getConfigItem('useManualProxy', false);
 | 
				
			||||||
		this.toggleProxySettings(proxyEnabled);
 | 
							this.toggleManualProxySettings(manualProxyEnabled);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.updateProxyOption();
 | 
							this.updateProxyOption();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	toggleProxySettings(option) {
 | 
						toggleManualProxySettings(option) {
 | 
				
			||||||
		if (option) {
 | 
							if (option) {
 | 
				
			||||||
			this.$settingBlock.classList.remove('hidden');
 | 
								this.$manualProxyBlock.classList.remove('hidden');
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			this.$settingBlock.classList.add('hidden');
 | 
								this.$manualProxyBlock.classList.add('hidden');
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	updateProxyOption() {
 | 
						updateProxyOption() {
 | 
				
			||||||
		this.generateSettingOption({
 | 
							this.generateSettingOption({
 | 
				
			||||||
			$element: document.querySelector('#use-proxy-option .setting-control'),
 | 
								$element: document.querySelector('#use-system-settings .setting-control'),
 | 
				
			||||||
			value: ConfigUtil.getConfigItem('useProxy', false),
 | 
								value: ConfigUtil.getConfigItem('useSystemProxy', false),
 | 
				
			||||||
			clickHandler: () => {
 | 
								clickHandler: () => {
 | 
				
			||||||
				const newValue = !ConfigUtil.getConfigItem('useProxy');
 | 
									const newValue = !ConfigUtil.getConfigItem('useSystemProxy');
 | 
				
			||||||
				ConfigUtil.setConfigItem('useProxy', newValue);
 | 
									const manualProxyValue = ConfigUtil.getConfigItem('useManualProxy');
 | 
				
			||||||
				this.toggleProxySettings(newValue);
 | 
									if (manualProxyValue && newValue) {
 | 
				
			||||||
				if (newValue === false) {
 | 
										ConfigUtil.setConfigItem('useManualProxy', !manualProxyValue);
 | 
				
			||||||
					// Reload proxy if the proxy is turned off
 | 
										this.toggleManualProxySettings(!manualProxyValue);
 | 
				
			||||||
					ipcRenderer.send('forward-message', 'reload-proxy', false);
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									if (newValue === false) {
 | 
				
			||||||
 | 
										// Remove proxy system proxy settings
 | 
				
			||||||
 | 
										ConfigUtil.setConfigItem('proxyRules', '');
 | 
				
			||||||
 | 
										ipcRenderer.send('forward-message', 'reload-proxy', true);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('useSystemProxy', newValue);
 | 
				
			||||||
 | 
									this.updateProxyOption();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
							this.generateSettingOption({
 | 
				
			||||||
 | 
								$element: document.querySelector('#use-manual-settings .setting-control'),
 | 
				
			||||||
 | 
								value: ConfigUtil.getConfigItem('useManualProxy', false),
 | 
				
			||||||
 | 
								clickHandler: () => {
 | 
				
			||||||
 | 
									const newValue = !ConfigUtil.getConfigItem('useManualProxy');
 | 
				
			||||||
 | 
									const systemProxyValue = ConfigUtil.getConfigItem('useSystemProxy');
 | 
				
			||||||
 | 
									this.toggleManualProxySettings(newValue);
 | 
				
			||||||
 | 
									if (systemProxyValue && newValue) {
 | 
				
			||||||
 | 
										ConfigUtil.setConfigItem('useSystemProxy', !systemProxyValue);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('proxyRules', '');
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('useManualProxy', newValue);
 | 
				
			||||||
 | 
									// Reload app only when turning manual proxy off, hence !newValue
 | 
				
			||||||
 | 
									ipcRenderer.send('forward-message', 'reload-proxy', !newValue);
 | 
				
			||||||
				this.updateProxyOption();
 | 
									this.updateProxyOption();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const BaseComponent = require(__dirname + '/../../components/base.js');
 | 
					const BaseComponent = require(__dirname + '/../../components/base.js');
 | 
				
			||||||
const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
					const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
				
			||||||
 | 
					const shell = require('electron').shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NewServerForm extends BaseComponent {
 | 
					class NewServerForm extends BaseComponent {
 | 
				
			||||||
	constructor(props) {
 | 
						constructor(props) {
 | 
				
			||||||
@@ -11,19 +12,26 @@ class NewServerForm extends BaseComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	template() {
 | 
						template() {
 | 
				
			||||||
		return `
 | 
							return `
 | 
				
			||||||
			<div class="settings-card">
 | 
								<div class="server-input-container">
 | 
				
			||||||
				<div class="server-info-right">
 | 
									<div class="title">Organization URL</div>
 | 
				
			||||||
					<div class="title">URL of Zulip organization</div>
 | 
									<div class="add-server-info-row">
 | 
				
			||||||
					<div class="server-info-row">
 | 
										<input class="setting-input-value" autofocus placeholder="your-organization.zulipchat.com or zulip.your-organization.com"/>
 | 
				
			||||||
						<input class="setting-input-value" autofocus placeholder="acme.zulipchat.com or chat.acme.com"/>
 | 
									</div>
 | 
				
			||||||
					</div>
 | 
									<div class="server-center">
 | 
				
			||||||
					<div class="server-info-row">
 | 
										<div class="server-save-action">
 | 
				
			||||||
						<div class="action blue server-save-action">
 | 
											<button id="connect">Connect</button>
 | 
				
			||||||
							<i class="material-icons">add_box</i>
 | 
					 | 
				
			||||||
							<span>Add</span>
 | 
					 | 
				
			||||||
						</div>
 | 
					 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
									<div class="server-center">
 | 
				
			||||||
 | 
									<div class="divider">
 | 
				
			||||||
 | 
										<hr class="left"/>OR<hr class="right" />
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
									</div>
 | 
				
			||||||
 | 
									<div class="server-center">
 | 
				
			||||||
 | 
									<div class="server-save-action">
 | 
				
			||||||
 | 
										<button id="open-create-org-link">Create a new organization</button>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		`;
 | 
							`;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -43,15 +51,25 @@ class NewServerForm extends BaseComponent {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	submitFormHandler() {
 | 
						submitFormHandler() {
 | 
				
			||||||
 | 
							this.$saveServerButton.children[0].innerHTML = 'Connecting...';
 | 
				
			||||||
		DomainUtil.checkDomain(this.$newServerUrl.value).then(serverConf => {
 | 
							DomainUtil.checkDomain(this.$newServerUrl.value).then(serverConf => {
 | 
				
			||||||
			DomainUtil.addDomain(serverConf).then(() => {
 | 
								DomainUtil.addDomain(serverConf).then(() => {
 | 
				
			||||||
				this.props.onChange(this.props.index);
 | 
									this.props.onChange(this.props.index);
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		}, errorMessage => {
 | 
							}, errorMessage => {
 | 
				
			||||||
 | 
								this.$saveServerButton.children[0].innerHTML = 'Connect';
 | 
				
			||||||
			alert(errorMessage);
 | 
								alert(errorMessage);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						openCreateNewOrgExternalLink() {
 | 
				
			||||||
 | 
							const link = 'https://zulipchat.com/new/';
 | 
				
			||||||
 | 
							const externalCreateNewOrgEl = document.getElementById('open-create-org-link');
 | 
				
			||||||
 | 
							externalCreateNewOrgEl.addEventListener('click', () => {
 | 
				
			||||||
 | 
								shell.openExternal(link);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initActions() {
 | 
						initActions() {
 | 
				
			||||||
		this.$saveServerButton.addEventListener('click', () => {
 | 
							this.$saveServerButton.addEventListener('click', () => {
 | 
				
			||||||
			this.submitFormHandler();
 | 
								this.submitFormHandler();
 | 
				
			||||||
@@ -63,6 +81,8 @@ class NewServerForm extends BaseComponent {
 | 
				
			|||||||
				this.submitFormHandler();
 | 
									this.submitFormHandler();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
							// open create new org link in default browser
 | 
				
			||||||
 | 
							this.openCreateNewOrgExternalLink();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ const Nav = require(__dirname + '/js/pages/preference/nav.js');
 | 
				
			|||||||
const ServersSection = require(__dirname + '/js/pages/preference/servers-section.js');
 | 
					const ServersSection = require(__dirname + '/js/pages/preference/servers-section.js');
 | 
				
			||||||
const GeneralSection = require(__dirname + '/js/pages/preference/general-section.js');
 | 
					const GeneralSection = require(__dirname + '/js/pages/preference/general-section.js');
 | 
				
			||||||
const NetworkSection = require(__dirname + '/js/pages/preference/network-section.js');
 | 
					const NetworkSection = require(__dirname + '/js/pages/preference/network-section.js');
 | 
				
			||||||
 | 
					const ConnectedOrgSection = require(__dirname + '/js/pages/preference/connected-org-section.js');
 | 
				
			||||||
const ShortcutsSection = require(__dirname + '/js/pages/preference/shortcuts-section.js');
 | 
					const ShortcutsSection = require(__dirname + '/js/pages/preference/shortcuts-section.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PreferenceView extends BaseComponent {
 | 
					class PreferenceView extends BaseComponent {
 | 
				
			||||||
@@ -39,7 +40,7 @@ class PreferenceView extends BaseComponent {
 | 
				
			|||||||
	handleNavigation(navItem) {
 | 
						handleNavigation(navItem) {
 | 
				
			||||||
		this.nav.select(navItem);
 | 
							this.nav.select(navItem);
 | 
				
			||||||
		switch (navItem) {
 | 
							switch (navItem) {
 | 
				
			||||||
			case 'Servers': {
 | 
								case 'AddServer': {
 | 
				
			||||||
				this.section = new ServersSection({
 | 
									this.section = new ServersSection({
 | 
				
			||||||
					$root: this.$settingsContainer
 | 
										$root: this.$settingsContainer
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
@@ -51,6 +52,12 @@ class PreferenceView extends BaseComponent {
 | 
				
			|||||||
				});
 | 
									});
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								case 'Organizations': {
 | 
				
			||||||
 | 
									this.section = new ConnectedOrgSection({
 | 
				
			||||||
 | 
										$root: this.$settingsContainer
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			case 'Network': {
 | 
								case 'Network': {
 | 
				
			||||||
				this.section = new NetworkSection({
 | 
									this.section = new NetworkSection({
 | 
				
			||||||
					$root: this.$settingsContainer
 | 
										$root: this.$settingsContainer
 | 
				
			||||||
@@ -69,21 +76,35 @@ class PreferenceView extends BaseComponent {
 | 
				
			|||||||
		window.location.hash = `#${navItem}`;
 | 
							window.location.hash = `#${navItem}`;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Handle toggling and reflect changes in preference page
 | 
				
			||||||
 | 
						handleToggle(elementName, state) {
 | 
				
			||||||
 | 
							const inputSelector = `#${elementName} .action .switch input`;
 | 
				
			||||||
 | 
							const input = document.querySelector(inputSelector);
 | 
				
			||||||
 | 
							if (input) {
 | 
				
			||||||
 | 
								input.checked = state;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	registerIpcs() {
 | 
						registerIpcs() {
 | 
				
			||||||
		ipcRenderer.on('switch-settings-nav', (event, navItem) => {
 | 
							ipcRenderer.on('switch-settings-nav', (event, navItem) => {
 | 
				
			||||||
			this.handleNavigation(navItem);
 | 
								this.handleNavigation(navItem);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('toggle-sidebar', (event, state) => {
 | 
							ipcRenderer.on('toggle-sidebar', (event, state) => {
 | 
				
			||||||
			const inputSelector = '#sidebar-option .action .switch input';
 | 
								this.handleToggle('sidebar-option', state);
 | 
				
			||||||
			const input = document.querySelector(inputSelector);
 | 
					 | 
				
			||||||
			input.checked = state;
 | 
					 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ipcRenderer.on('toggletray', (event, state) => {
 | 
							ipcRenderer.on('toggletray', (event, state) => {
 | 
				
			||||||
			const inputSelector = '#tray-option .action .switch input';
 | 
								this.handleToggle('tray-option', state);
 | 
				
			||||||
			const input = document.querySelector(inputSelector);
 | 
							});
 | 
				
			||||||
			input.checked = state;
 | 
					
 | 
				
			||||||
 | 
							ipcRenderer.on('toggle-dnd', (event, state, newSettings) => {
 | 
				
			||||||
 | 
								this.handleToggle('show-notification-option', newSettings.showNotification);
 | 
				
			||||||
 | 
								this.handleToggle('silent-option', newSettings.silent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (process.platform === 'win32') {
 | 
				
			||||||
 | 
									this.handleToggle('flash-taskbar-option', newSettings.flashTaskbarOnMessage);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
const {dialog} = require('electron').remote;
 | 
					const { dialog } = require('electron').remote;
 | 
				
			||||||
const {ipcRenderer} = require('electron');
 | 
					const { ipcRenderer } = require('electron');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const BaseComponent = require(__dirname + '/../../components/base.js');
 | 
					const BaseComponent = require(__dirname + '/../../components/base.js');
 | 
				
			||||||
const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
					const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
				
			||||||
@@ -16,19 +16,18 @@ class ServerInfoForm extends BaseComponent {
 | 
				
			|||||||
			<div class="settings-card">
 | 
								<div class="settings-card">
 | 
				
			||||||
				<div class="server-info-left">
 | 
									<div class="server-info-left">
 | 
				
			||||||
					<img class="server-info-icon" src="${this.props.server.icon}"/>
 | 
										<img class="server-info-icon" src="${this.props.server.icon}"/>
 | 
				
			||||||
				</div>
 | 
					 | 
				
			||||||
				<div class="server-info-right">
 | 
					 | 
				
			||||||
					<div class="server-info-row">
 | 
										<div class="server-info-row">
 | 
				
			||||||
						<span class="server-info-alias">${this.props.server.alias}</span>
 | 
											<span class="server-info-alias">${this.props.server.alias}</span>
 | 
				
			||||||
						<i class="material-icons open-tab-button">open_in_new</i>
 | 
											<i class="material-icons open-tab-button">open_in_new</i>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
					<div class="server-info-row">
 | 
									</div>
 | 
				
			||||||
						<input class="setting-input-value" disabled value="${this.props.server.url}"/>
 | 
									<div class="server-info-right">
 | 
				
			||||||
 | 
										<div class="server-info-row server-url">
 | 
				
			||||||
 | 
											<span class="server-url-info" title="${this.props.server.url}">${this.props.server.url}</span>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
					<div class="server-info-row">
 | 
										<div class="server-info-row">
 | 
				
			||||||
						<div class="action red server-delete-action">
 | 
											<div class="action red server-delete-action">
 | 
				
			||||||
							<i class="material-icons">indeterminate_check_box</i>
 | 
												<span>Disconnect</span>
 | 
				
			||||||
							<span>Delete</span>
 | 
					 | 
				
			||||||
						</div>
 | 
											</div>
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
@@ -44,6 +43,7 @@ class ServerInfoForm extends BaseComponent {
 | 
				
			|||||||
	initForm() {
 | 
						initForm() {
 | 
				
			||||||
		this.$serverInfoForm = this.generateNodeFromTemplate(this.template());
 | 
							this.$serverInfoForm = this.generateNodeFromTemplate(this.template());
 | 
				
			||||||
		this.$serverInfoAlias = this.$serverInfoForm.getElementsByClassName('server-info-alias')[0];
 | 
							this.$serverInfoAlias = this.$serverInfoForm.getElementsByClassName('server-info-alias')[0];
 | 
				
			||||||
 | 
							this.$serverIcon = this.$serverInfoForm.getElementsByClassName('server-info-icon')[0];
 | 
				
			||||||
		this.$deleteServerButton = this.$serverInfoForm.getElementsByClassName('server-delete-action')[0];
 | 
							this.$deleteServerButton = this.$serverInfoForm.getElementsByClassName('server-delete-action')[0];
 | 
				
			||||||
		this.$openServerButton = this.$serverInfoForm.getElementsByClassName('open-tab-button')[0];
 | 
							this.$openServerButton = this.$serverInfoForm.getElementsByClassName('open-tab-button')[0];
 | 
				
			||||||
		this.props.$root.appendChild(this.$serverInfoForm);
 | 
							this.props.$root.appendChild(this.$serverInfoForm);
 | 
				
			||||||
@@ -55,7 +55,7 @@ class ServerInfoForm extends BaseComponent {
 | 
				
			|||||||
				type: 'warning',
 | 
									type: 'warning',
 | 
				
			||||||
				buttons: ['YES', 'NO'],
 | 
									buttons: ['YES', 'NO'],
 | 
				
			||||||
				defaultId: 0,
 | 
									defaultId: 0,
 | 
				
			||||||
				message: 'Are you sure you want to delete this server?'
 | 
									message: 'Are you sure you want to disconnect this organization?'
 | 
				
			||||||
			}, response => {
 | 
								}, response => {
 | 
				
			||||||
				if (response === 0) {
 | 
									if (response === 0) {
 | 
				
			||||||
					DomainUtil.removeDomain(this.props.index);
 | 
										DomainUtil.removeDomain(this.props.index);
 | 
				
			||||||
@@ -71,7 +71,12 @@ class ServerInfoForm extends BaseComponent {
 | 
				
			|||||||
		this.$serverInfoAlias.addEventListener('click', () => {
 | 
							this.$serverInfoAlias.addEventListener('click', () => {
 | 
				
			||||||
			ipcRenderer.send('forward-message', 'switch-server-tab', this.props.index);
 | 
								ipcRenderer.send('forward-message', 'switch-server-tab', this.props.index);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.$serverIcon.addEventListener('click', () => {
 | 
				
			||||||
 | 
								ipcRenderer.send('forward-message', 'switch-server-tab', this.props.index);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = ServerInfoForm;
 | 
					module.exports = ServerInfoForm;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,7 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const BaseSection = require(__dirname + '/base-section.js');
 | 
					const BaseSection = require(__dirname + '/base-section.js');
 | 
				
			||||||
const DomainUtil = require(__dirname + '/../../utils/domain-util.js');
 | 
					 | 
				
			||||||
const ServerInfoForm = require(__dirname + '/server-info-form.js');
 | 
					 | 
				
			||||||
const NewServerForm = require(__dirname + '/new-server-form.js');
 | 
					const NewServerForm = require(__dirname + '/new-server-form.js');
 | 
				
			||||||
const CreateOrganziation = require(__dirname + '/create-new-org.js');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ServersSection extends BaseSection {
 | 
					class ServersSection extends BaseSection {
 | 
				
			||||||
	constructor(props) {
 | 
						constructor(props) {
 | 
				
			||||||
@@ -14,13 +11,14 @@ class ServersSection extends BaseSection {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	template() {
 | 
						template() {
 | 
				
			||||||
		return `
 | 
							return `
 | 
				
			||||||
			<div class="settings-pane" id="server-settings-pane">
 | 
							<div class="add-server-modal">
 | 
				
			||||||
				<div class="page-title">Register or login to a Zulip organization to get started</div>
 | 
								<div class="modal-container">
 | 
				
			||||||
				<div id="new-server-container"></div>
 | 
									<div class="settings-pane" id="server-settings-pane">
 | 
				
			||||||
				<div class="title" id="existing-servers"></div>
 | 
										<div class="page-title">Add a Zulip organization</div>
 | 
				
			||||||
				<div id="server-info-container"></div>
 | 
										<div id="new-server-container"></div>
 | 
				
			||||||
				<div id="create-organization-container"></div>
 | 
									</div>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
		`;
 | 
							`;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,35 +29,10 @@ class ServersSection extends BaseSection {
 | 
				
			|||||||
	initServers() {
 | 
						initServers() {
 | 
				
			||||||
		this.props.$root.innerHTML = '';
 | 
							this.props.$root.innerHTML = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const servers = DomainUtil.getDomains();
 | 
					 | 
				
			||||||
		this.props.$root.innerHTML = this.template();
 | 
							this.props.$root.innerHTML = this.template();
 | 
				
			||||||
		this.$serverInfoContainer = document.getElementById('server-info-container');
 | 
					 | 
				
			||||||
		this.$existingServers = document.getElementById('existing-servers');
 | 
					 | 
				
			||||||
		this.$newServerContainer = document.getElementById('new-server-container');
 | 
							this.$newServerContainer = document.getElementById('new-server-container');
 | 
				
			||||||
		this.$newServerButton = document.getElementById('new-server-action');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$serverInfoContainer.innerHTML = servers.length ? '' : '';
 | 
					 | 
				
			||||||
		// Show Existing servers if servers are there otherwise hide it
 | 
					 | 
				
			||||||
		this.$existingServers.innerHTML = servers.length === 0 ? '' : 'Existing organizations';
 | 
					 | 
				
			||||||
		this.initNewServerForm();
 | 
							this.initNewServerForm();
 | 
				
			||||||
 | 
					 | 
				
			||||||
		this.$createOrganizationContainer = document.getElementById('create-organization-container');
 | 
					 | 
				
			||||||
		this.initCreateNewOrganization();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		for (let i = 0; i < servers.length; i++) {
 | 
					 | 
				
			||||||
			new ServerInfoForm({
 | 
					 | 
				
			||||||
				$root: this.$serverInfoContainer,
 | 
					 | 
				
			||||||
				server: servers[i],
 | 
					 | 
				
			||||||
				index: i,
 | 
					 | 
				
			||||||
				onChange: this.reloadApp
 | 
					 | 
				
			||||||
			}).init();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	initCreateNewOrganization() {
 | 
					 | 
				
			||||||
		new CreateOrganziation({
 | 
					 | 
				
			||||||
			$root: this.$createOrganizationContainer
 | 
					 | 
				
			||||||
		}).init();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initNewServerForm() {
 | 
						initNewServerForm() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const BaseSection = require(__dirname + '/base-section.js');
 | 
					const BaseSection = require(__dirname + '/base-section.js');
 | 
				
			||||||
 | 
					const shell = require('electron').shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ShortcutsSection extends BaseSection {
 | 
					class ShortcutsSection extends BaseSection {
 | 
				
			||||||
	constructor(props) {
 | 
						constructor(props) {
 | 
				
			||||||
@@ -23,6 +24,10 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd><kbd>K</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd><kbd>K</kbd></td>
 | 
				
			||||||
                    <td>Keyboard Shortcuts</td>
 | 
					                    <td>Keyboard Shortcuts</td>
 | 
				
			||||||
 | 
					                  </tr>
 | 
				
			||||||
 | 
														<tr>
 | 
				
			||||||
 | 
					                    <td><kbd>${userOSKey}</kbd> + <kbd>Shift</kbd> + <kbd>M</kbd></td>
 | 
				
			||||||
 | 
					                    <td>Toggle Do Not Disturb</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>Shift</kbd><kbd>${userOSKey}</kbd><kbd>D</kbd></td>
 | 
					                    <td><kbd>Shift</kbd><kbd>${userOSKey}</kbd><kbd>D</kbd></td>
 | 
				
			||||||
@@ -78,14 +83,6 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                    <td><kbd>${userOSKey}</kbd><kbd>A</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd><kbd>A</kbd></td>
 | 
				
			||||||
                    <td>Select All</td>
 | 
					                    <td>Select All</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd><kbd>F</kbd></td>
 | 
					 | 
				
			||||||
                    <td>Find</td>
 | 
					 | 
				
			||||||
                  </tr>
 | 
					 | 
				
			||||||
                  <tr>
 | 
					 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd><kbd>G</kbd></td>
 | 
					 | 
				
			||||||
                    <td>Find Next</td>
 | 
					 | 
				
			||||||
                  </tr>
 | 
					 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>Control</kbd><kbd>${userOSKey}</kbd><kbd>Space</kbd></td>
 | 
					                    <td><kbd>Control</kbd><kbd>${userOSKey}</kbd><kbd>Space</kbd></td>
 | 
				
			||||||
                    <td>Emoji & Symbols</td>
 | 
					                    <td>Emoji & Symbols</td>
 | 
				
			||||||
@@ -109,7 +106,7 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                    <td>Enter Full Screen</td>
 | 
					                    <td>Enter Full Screen</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd><kbd>=</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd><kbd>+</kbd></td>
 | 
				
			||||||
                    <td>Zoom In</td>
 | 
					                    <td>Zoom In</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
@@ -121,7 +118,7 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                    <td>Actual Size</td>
 | 
					                    <td>Actual Size</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd><kbd>S</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd></td>
 | 
				
			||||||
                    <td>Toggle Sidebar</td>
 | 
					                    <td>Toggle Sidebar</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
@@ -163,6 +160,7 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                </table>
 | 
					                </table>
 | 
				
			||||||
                <div class="setting-control"></div>
 | 
					                <div class="setting-control"></div>
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
 | 
					              <div class="settings-card tip"><b><i class="material-icons md-14">settings</i>Tip: </b>These desktop app shortcuts extend the Zulip webapp's <span id="open-hotkeys-link">keyboard shortcuts</span>.</div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
		`;
 | 
							`;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -182,6 +180,10 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd> + <kbd>K</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd> + <kbd>K</kbd></td>
 | 
				
			||||||
                    <td>Keyboard Shortcuts</td>
 | 
					                    <td>Keyboard Shortcuts</td>
 | 
				
			||||||
 | 
					                  </tr>
 | 
				
			||||||
 | 
														<tr>
 | 
				
			||||||
 | 
					                    <td><kbd>${userOSKey}</kbd> + <kbd>Shift</kbd> + <kbd>M</kbd></td>
 | 
				
			||||||
 | 
					                    <td>Toggle Do Not Disturb</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd> + <kbd>L</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd> + <kbd>L</kbd></td>
 | 
				
			||||||
@@ -256,7 +258,7 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                    <td>Actual Size</td>
 | 
					                    <td>Actual Size</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
                    <td><kbd>${userOSKey}</kbd> + <kbd>S</kbd></td>
 | 
					                    <td><kbd>${userOSKey}</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd></td>
 | 
				
			||||||
                    <td>Toggle Sidebar</td>
 | 
					                    <td>Toggle Sidebar</td>
 | 
				
			||||||
                  </tr>
 | 
					                  </tr>
 | 
				
			||||||
                  <tr>
 | 
					                  <tr>
 | 
				
			||||||
@@ -298,13 +300,22 @@ class ShortcutsSection extends BaseSection {
 | 
				
			|||||||
                </table>
 | 
					                </table>
 | 
				
			||||||
                <div class="setting-control"></div>
 | 
					                <div class="setting-control"></div>
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
 | 
					              <div class="tip"><b><i class="material-icons md-14">lightbulb_outline</i>Tip: </b>These desktop app shortcuts extend the Zulip webapp's <span id="open-hotkeys-link">keyboard shortcuts</span>.</div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
		`;
 | 
							`;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						openHotkeysExternalLink() {
 | 
				
			||||||
 | 
							const link = 'https://zulipchat.com/help/keyboard-shortcuts';
 | 
				
			||||||
 | 
							const externalCreateNewOrgEl = document.getElementById('open-hotkeys-link');
 | 
				
			||||||
 | 
							externalCreateNewOrgEl.addEventListener('click', () => {
 | 
				
			||||||
 | 
								shell.openExternal(link);
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	init() {
 | 
						init() {
 | 
				
			||||||
		this.props.$root.innerHTML = (process.platform === 'darwin') ?
 | 
							this.props.$root.innerHTML = (process.platform === 'darwin') ?
 | 
				
			||||||
			this.templateMac() : this.templateWinLin();
 | 
								this.templateMac() : this.templateWinLin();
 | 
				
			||||||
 | 
							this.openHotkeysExternalLink();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,17 @@
 | 
				
			|||||||
'use strict';
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { ipcRenderer } = require('electron');
 | 
					const { ipcRenderer, shell } = require('electron');
 | 
				
			||||||
const SetupSpellChecker = require('./spellchecker');
 | 
					const SetupSpellChecker = require('./spellchecker');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
					const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
				
			||||||
 | 
					const LinkUtil = require(__dirname + '/utils/link-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line import/no-unassigned-import
 | 
					// eslint-disable-next-line import/no-unassigned-import
 | 
				
			||||||
require('./notification');
 | 
					require('./notification');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Prevent drag and drop event in main process which prevents remote code executaion
 | 
				
			||||||
 | 
					require(__dirname + '/shared/preventdrag.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const logout = () => {
 | 
					const logout = () => {
 | 
				
			||||||
	// Create the menu for the below
 | 
						// Create the menu for the below
 | 
				
			||||||
	document.querySelector('.dropdown-toggle').click();
 | 
						document.querySelector('.dropdown-toggle').click();
 | 
				
			||||||
@@ -20,7 +24,7 @@ const shortcut = () => {
 | 
				
			|||||||
	// Create the menu for the below
 | 
						// Create the menu for the below
 | 
				
			||||||
	const node = document.querySelector('a[data-overlay-trigger=keyboard-shortcuts]');
 | 
						const node = document.querySelector('a[data-overlay-trigger=keyboard-shortcuts]');
 | 
				
			||||||
	// Additional check
 | 
						// Additional check
 | 
				
			||||||
	if (node.text.trim().toLowerCase() === 'keyboard shortcuts') {
 | 
						if (node.text.trim().toLowerCase() === 'keyboard shortcuts (?)') {
 | 
				
			||||||
		node.click();
 | 
							node.click();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// Atleast click the dropdown
 | 
							// Atleast click the dropdown
 | 
				
			||||||
@@ -52,6 +56,29 @@ document.addEventListener('DOMContentLoaded', () => {
 | 
				
			|||||||
			ipcRenderer.send('forward-message', 'reload-viewer');
 | 
								ipcRenderer.send('forward-message', 'reload-viewer');
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Open image attachment link in the lightbox instead of opening in the default browser
 | 
				
			||||||
 | 
						const { $, lightbox } = window;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						$('#main_div').on('click', '.message_content p a', function (e) {
 | 
				
			||||||
 | 
							const url = $(this).attr('href');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (LinkUtil.isImage(url)) {
 | 
				
			||||||
 | 
								const $img = $(this).parent().siblings('.message_inline_image').find('img');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// prevent the image link from opening in a new page.
 | 
				
			||||||
 | 
								e.preventDefault();
 | 
				
			||||||
 | 
								// prevent the message compose dialog from happening.
 | 
				
			||||||
 | 
								e.stopPropagation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Open image in the default browser if image preview is unavailable
 | 
				
			||||||
 | 
								if (!$img[0]) {
 | 
				
			||||||
 | 
									shell.openExternal(window.location.origin + url);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								// Open image in lightbox
 | 
				
			||||||
 | 
								lightbox.open($img);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Clean up spellchecker events after you navigate away from this page;
 | 
					// Clean up spellchecker events after you navigate away from this page;
 | 
				
			||||||
@@ -60,3 +87,10 @@ window.addEventListener('beforeunload', () => {
 | 
				
			|||||||
	SetupSpellChecker.unsubscribeSpellChecker();
 | 
						SetupSpellChecker.unsubscribeSpellChecker();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// electron's globalShortcut can cause unexpected results
 | 
				
			||||||
 | 
					// so adding the reload shortcut in the old-school way
 | 
				
			||||||
 | 
					document.addEventListener('keydown', event => {
 | 
				
			||||||
 | 
						if (event.code === 'F5') {
 | 
				
			||||||
 | 
							ipcRenderer.send('forward-message', 'hard-reload');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								app/renderer/js/shared/preventdrag.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// This is a security fix. Following function prevents drag and drop event in the app
 | 
				
			||||||
 | 
					// so that attackers can't execute any remote code within the app
 | 
				
			||||||
 | 
					// It doesn't affect the compose box so that users can still
 | 
				
			||||||
 | 
					// use drag and drop event to share files etc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const preventDragAndDrop = () => {
 | 
				
			||||||
 | 
						const preventEvents = ['dragover', 'drop'];
 | 
				
			||||||
 | 
						preventEvents.forEach(dragEvents => {
 | 
				
			||||||
 | 
							document.addEventListener(dragEvents, event => {
 | 
				
			||||||
 | 
								event.preventDefault();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					preventDragAndDrop();
 | 
				
			||||||
@@ -3,6 +3,12 @@
 | 
				
			|||||||
const { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } = require('electron-spellchecker');
 | 
					const { SpellCheckHandler, ContextMenuListener, ContextMenuBuilder } = require('electron-spellchecker');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
					const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
				
			||||||
 | 
					const Logger = require(__dirname + '/utils/logger-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: 'errors.log',
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SetupSpellChecker {
 | 
					class SetupSpellChecker {
 | 
				
			||||||
	init() {
 | 
						init() {
 | 
				
			||||||
@@ -16,7 +22,7 @@ class SetupSpellChecker {
 | 
				
			|||||||
		try {
 | 
							try {
 | 
				
			||||||
			this.SpellCheckHandler = new SpellCheckHandler();
 | 
								this.SpellCheckHandler = new SpellCheckHandler();
 | 
				
			||||||
		} catch (err) {
 | 
							} catch (err) {
 | 
				
			||||||
			console.log(err);
 | 
								logger.error(err);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,111 +3,105 @@ const path = require('path');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const electron = require('electron');
 | 
					const electron = require('electron');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { ipcRenderer, remote } = electron;
 | 
					const {ipcRenderer, remote} = electron;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { Tray, Menu, BrowserWindow } = remote;
 | 
					const {Tray, Menu, nativeImage, BrowserWindow} = remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_ICON = path.join(__dirname, '../../resources/', 'f');
 | 
					const APP_ICON = path.join(__dirname, '../../resources/tray', 'tray');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
					const ConfigUtil = require(__dirname + '/utils/config-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const iconPath = unreadCount => {
 | 
					const iconPath = () => {
 | 
				
			||||||
	if (process.platform === 'linux') {
 | 
						if (process.platform === 'linux') {
 | 
				
			||||||
		return APP_ICON + 'linux.png';
 | 
							return APP_ICON + 'linux.png';
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!unreadCount) {
 | 
						return APP_ICON + (process.platform === 'win32' ? 'win.ico' : 'osx.png');
 | 
				
			||||||
		return path.join(__dirname, '../../resources/tray', 'trayosx@2x.png');
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (unreadCount > 99) {
 | 
					 | 
				
			||||||
		return APP_ICON + (process.platform === 'win32' ? 'win.ico' : `/favicon-infinite.png`);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return APP_ICON + (process.platform === 'win32' ? 'win.ico' : `/favicon-${unreadCount}.png`);
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let unread = 0;
 | 
					let unread = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// const trayIconSize = () => {
 | 
					const trayIconSize = () => {
 | 
				
			||||||
// 	switch (process.platform) {
 | 
						switch (process.platform) {
 | 
				
			||||||
// 		case 'darwin':
 | 
							case 'darwin':
 | 
				
			||||||
// 			return 20;
 | 
								return 20;
 | 
				
			||||||
// 		case 'win32':
 | 
							case 'win32':
 | 
				
			||||||
// 			return 100;
 | 
								return 100;
 | 
				
			||||||
// 		case 'linux':
 | 
							case 'linux':
 | 
				
			||||||
// 			return 100;
 | 
								return 100;
 | 
				
			||||||
// 		default: return 80;
 | 
							default: return 80;
 | 
				
			||||||
// 	}
 | 
						}
 | 
				
			||||||
// };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//  Default config for Icon we might make it OS specific if needed like the size
 | 
					//  Default config for Icon we might make it OS specific if needed like the size
 | 
				
			||||||
// const config = {
 | 
					const config = {
 | 
				
			||||||
// 	pixelRatio: window.devicePixelRatio,
 | 
						pixelRatio: window.devicePixelRatio,
 | 
				
			||||||
// 	unreadCount: 0,
 | 
						unreadCount: 0,
 | 
				
			||||||
// 	showUnreadCount: true,
 | 
						showUnreadCount: true,
 | 
				
			||||||
// 	unreadColor: '#000000',
 | 
						unreadColor: '#000000',
 | 
				
			||||||
// 	readColor: '#000000',
 | 
						readColor: '#000000',
 | 
				
			||||||
// 	unreadBackgroundColor: '#B9FEEA',
 | 
						unreadBackgroundColor: '#B9FEEA',
 | 
				
			||||||
// 	readBackgroundColor: '#B9FEEA',
 | 
						readBackgroundColor: '#B9FEEA',
 | 
				
			||||||
// 	size: trayIconSize(),
 | 
						size: trayIconSize(),
 | 
				
			||||||
// 	thick: process.platform === 'win32'
 | 
						thick: process.platform === 'win32'
 | 
				
			||||||
// };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// const renderCanvas = function (arg) {
 | 
					const renderCanvas = function (arg) {
 | 
				
			||||||
// 	config.unreadCount = arg;
 | 
						config.unreadCount = arg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 	return new Promise(resolve => {
 | 
						return new Promise(resolve => {
 | 
				
			||||||
// 		const SIZE = config.size * config.pixelRatio;
 | 
							const SIZE = config.size * config.pixelRatio;
 | 
				
			||||||
// 		const PADDING = SIZE * 0.05;
 | 
							const PADDING = SIZE * 0.05;
 | 
				
			||||||
// 		const CENTER = SIZE / 2;
 | 
							const CENTER = SIZE / 2;
 | 
				
			||||||
// 		const HAS_COUNT = config.showUnreadCount && config.unreadCount;
 | 
							const HAS_COUNT = config.showUnreadCount && config.unreadCount;
 | 
				
			||||||
// 		const color = config.unreadCount ? config.unreadColor : config.readColor;
 | 
							const color = config.unreadCount ? config.unreadColor : config.readColor;
 | 
				
			||||||
// 		const backgroundColor = config.unreadCount ? config.unreadBackgroundColor : config.readBackgroundColor;
 | 
							const backgroundColor = config.unreadCount ? config.unreadBackgroundColor : config.readBackgroundColor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 		const canvas = document.createElement('canvas');
 | 
							const canvas = document.createElement('canvas');
 | 
				
			||||||
// 		canvas.width = SIZE;
 | 
							canvas.width = SIZE;
 | 
				
			||||||
// 		canvas.height = SIZE;
 | 
							canvas.height = SIZE;
 | 
				
			||||||
// 		const ctx = canvas.getContext('2d');
 | 
							const ctx = canvas.getContext('2d');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 		// Circle
 | 
							// Circle
 | 
				
			||||||
// 		// If (!config.thick || config.thick && HAS_COUNT) {
 | 
							// If (!config.thick || config.thick && HAS_COUNT) {
 | 
				
			||||||
// 		ctx.beginPath();
 | 
							ctx.beginPath();
 | 
				
			||||||
// 		ctx.arc(CENTER, CENTER, (SIZE / 2) - PADDING, 0, 2 * Math.PI, false);
 | 
							ctx.arc(CENTER, CENTER, (SIZE / 2) - PADDING, 0, 2 * Math.PI, false);
 | 
				
			||||||
// 		ctx.fillStyle = backgroundColor;
 | 
							ctx.fillStyle = backgroundColor;
 | 
				
			||||||
// 		ctx.fill();
 | 
							ctx.fill();
 | 
				
			||||||
// 		ctx.lineWidth = SIZE / (config.thick ? 10 : 20);
 | 
							ctx.lineWidth = SIZE / (config.thick ? 10 : 20);
 | 
				
			||||||
// 		ctx.strokeStyle = backgroundColor;
 | 
							ctx.strokeStyle = backgroundColor;
 | 
				
			||||||
// 		ctx.stroke();
 | 
							ctx.stroke();
 | 
				
			||||||
// 		// Count or Icon
 | 
							// Count or Icon
 | 
				
			||||||
// 		if (HAS_COUNT) {
 | 
							if (HAS_COUNT) {
 | 
				
			||||||
// 			ctx.fillStyle = color;
 | 
								ctx.fillStyle = color;
 | 
				
			||||||
// 			ctx.textAlign = 'center';
 | 
								ctx.textAlign = 'center';
 | 
				
			||||||
// 			if (config.unreadCount > 99) {
 | 
								if (config.unreadCount > 99) {
 | 
				
			||||||
// 				ctx.font = `${config.thick ? 'bold ' : ''}${SIZE * 0.4}px Helvetica`;
 | 
									ctx.font = `${config.thick ? 'bold ' : ''}${SIZE * 0.4}px Helvetica`;
 | 
				
			||||||
// 				ctx.fillText('99+', CENTER, CENTER + (SIZE * 0.15));
 | 
									ctx.fillText('99+', CENTER, CENTER + (SIZE * 0.15));
 | 
				
			||||||
// 			} else if (config.unreadCount < 10) {
 | 
								} else if (config.unreadCount < 10) {
 | 
				
			||||||
// 				ctx.font = `${config.thick ? 'bold ' : ''}${SIZE * 0.5}px Helvetica`;
 | 
									ctx.font = `${config.thick ? 'bold ' : ''}${SIZE * 0.5}px Helvetica`;
 | 
				
			||||||
// 				ctx.fillText(config.unreadCount, CENTER, CENTER + (SIZE * 0.20));
 | 
									ctx.fillText(config.unreadCount, CENTER, CENTER + (SIZE * 0.20));
 | 
				
			||||||
// 			} else {
 | 
								} else {
 | 
				
			||||||
// 				ctx.font = `${config.thick ? 'bold ' : ''}${SIZE * 0.5}px Helvetica`;
 | 
									ctx.font = `${config.thick ? 'bold ' : ''}${SIZE * 0.5}px Helvetica`;
 | 
				
			||||||
// 				ctx.fillText(config.unreadCount, CENTER, CENTER + (SIZE * 0.15));
 | 
									ctx.fillText(config.unreadCount, CENTER, CENTER + (SIZE * 0.15));
 | 
				
			||||||
// 			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 			resolve(canvas);
 | 
								resolve(canvas);
 | 
				
			||||||
// 		}
 | 
							}
 | 
				
			||||||
// 	});
 | 
						});
 | 
				
			||||||
// };
 | 
					};
 | 
				
			||||||
// /**
 | 
					/**
 | 
				
			||||||
//  * Renders the tray icon as a native image
 | 
					 * Renders the tray icon as a native image
 | 
				
			||||||
//  * @param arg: Unread count
 | 
					 * @param arg: Unread count
 | 
				
			||||||
//  * @return the native image
 | 
					 * @return the native image
 | 
				
			||||||
//  */
 | 
					 */
 | 
				
			||||||
// const renderNativeImage = function (arg) {
 | 
					const renderNativeImage = function (arg) {
 | 
				
			||||||
// 	return Promise.resolve()
 | 
						return Promise.resolve()
 | 
				
			||||||
// 		.then(() => iconPath(arg))
 | 
							.then(() => renderCanvas(arg))
 | 
				
			||||||
// 	// .then(canvas => {
 | 
							.then(canvas => {
 | 
				
			||||||
// 	// 	const pngData = nativeImage.createFromDataURL(canvas.toDataURL('image/png')).toPng();
 | 
								const pngData = nativeImage.createFromDataURL(canvas.toDataURL('image/png')).toPNG();
 | 
				
			||||||
// 	// 	return Promise.resolve(nativeImage.createFromBuffer(pngData, config.pixelRatio));
 | 
								return Promise.resolve(nativeImage.createFromBuffer(pngData, config.pixelRatio));
 | 
				
			||||||
// 	// });
 | 
							});
 | 
				
			||||||
// };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function sendAction(action) {
 | 
					function sendAction(action) {
 | 
				
			||||||
	const win = BrowserWindow.getAllWindows()[0];
 | 
						const win = BrowserWindow.getAllWindows()[0];
 | 
				
			||||||
@@ -187,17 +181,17 @@ ipcRenderer.on('tray', (event, arg) => {
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// We don't want to create tray from unread messages on macOS since it already has dock badges.
 | 
						// We don't want to create tray from unread messages on macOS since it already has dock badges.
 | 
				
			||||||
	if (process.platform === 'darwin' || process.platform === 'win32') {
 | 
						if (process.platform === 'linux' || process.platform === 'win32') {
 | 
				
			||||||
		if (arg === 0) {
 | 
							if (arg === 0) {
 | 
				
			||||||
			unread = arg;
 | 
								unread = arg;
 | 
				
			||||||
			window.tray.setImage(iconPath());
 | 
								window.tray.setImage(iconPath());
 | 
				
			||||||
			window.tray.setToolTip('No unread messages');
 | 
								window.tray.setToolTip('No unread messages');
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			unread = arg;
 | 
								unread = arg;
 | 
				
			||||||
			// renderNativeImage(arg).then(image => {
 | 
								renderNativeImage(arg).then(image => {
 | 
				
			||||||
			window.tray.setImage(iconPath(arg));
 | 
									window.tray.setImage(image);
 | 
				
			||||||
			window.tray.setToolTip(arg + ' unread messages');
 | 
									window.tray.setToolTip(arg + ' unread messages');
 | 
				
			||||||
			// });
 | 
								});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
@@ -214,11 +208,11 @@ function toggleTray() {
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		state = true;
 | 
							state = true;
 | 
				
			||||||
		createTray();
 | 
							createTray();
 | 
				
			||||||
		if (process.platform === 'darwin' || process.platform === 'win32') {
 | 
							if (process.platform === 'linux' || process.platform === 'win32') {
 | 
				
			||||||
			// renderNativeImage(unread).then(image => {
 | 
								renderNativeImage(unread).then(image => {
 | 
				
			||||||
			window.tray.setImage(iconPath());
 | 
									window.tray.setImage(image);
 | 
				
			||||||
			window.tray.setToolTip(unread + ' unread messages');
 | 
									window.tray.setToolTip(unread + ' unread messages');
 | 
				
			||||||
			// });
 | 
								});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ConfigUtil.setConfigItem('trayIcon', true);
 | 
							ConfigUtil.setConfigItem('trayIcon', true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										86
									
								
								app/renderer/js/utils/certificate-util.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,86 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const { app, dialog } = require('electron').remote;
 | 
				
			||||||
 | 
					const fs = require('fs');
 | 
				
			||||||
 | 
					const path = require('path');
 | 
				
			||||||
 | 
					const JsonDB = require('node-json-db');
 | 
				
			||||||
 | 
					const Logger = require('./logger-util');
 | 
				
			||||||
 | 
					const { initSetUp } = require('./default-util');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					initSetUp();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: `certificate-util.log`,
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let instance = null;
 | 
				
			||||||
 | 
					const certificatesDir = `${app.getPath('userData')}/certificates`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class CertificateUtil {
 | 
				
			||||||
 | 
						constructor() {
 | 
				
			||||||
 | 
							if (instance) {
 | 
				
			||||||
 | 
								return instance;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								instance = this;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
							return instance;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						getCertificate(server, defaultValue = null) {
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
							const value = this.db.getData('/')[server];
 | 
				
			||||||
 | 
							if (value === undefined) {
 | 
				
			||||||
 | 
								return defaultValue;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								return value;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// Function to copy the certificate to userData folder
 | 
				
			||||||
 | 
						copyCertificate(server, location, fileName) {
 | 
				
			||||||
 | 
							let copied = false;
 | 
				
			||||||
 | 
							const filePath = `${certificatesDir}/${fileName}`;
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								fs.copyFileSync(location, filePath);
 | 
				
			||||||
 | 
								copied = true;
 | 
				
			||||||
 | 
							} catch (err) {
 | 
				
			||||||
 | 
								dialog.showErrorBox(
 | 
				
			||||||
 | 
									'Error saving certificate',
 | 
				
			||||||
 | 
									'We encountered error while saving the certificate.'
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
 | 
								logger.error('Error while copying the certificate to certificates folder.');
 | 
				
			||||||
 | 
								logger.error(err);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return copied;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						setCertificate(server, fileName) {
 | 
				
			||||||
 | 
							const filePath = `${certificatesDir}/${fileName}`;
 | 
				
			||||||
 | 
							this.db.push(`/${server}`, filePath, true);
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						removeCertificate(server) {
 | 
				
			||||||
 | 
							this.db.delete(`/${server}`);
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						reloadDB() {
 | 
				
			||||||
 | 
							const settingsJsonPath = path.join(app.getPath('userData'), '/config/certificates.json');
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								const file = fs.readFileSync(settingsJsonPath, 'utf8');
 | 
				
			||||||
 | 
								JSON.parse(file);
 | 
				
			||||||
 | 
							} catch (err) {
 | 
				
			||||||
 | 
								if (fs.existsSync(settingsJsonPath)) {
 | 
				
			||||||
 | 
									fs.unlinkSync(settingsJsonPath);
 | 
				
			||||||
 | 
									dialog.showErrorBox(
 | 
				
			||||||
 | 
										'Error saving settings',
 | 
				
			||||||
 | 
										'We encountered error while saving the certificate.'
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
									logger.error('Error while JSON parsing certificates.json: ');
 | 
				
			||||||
 | 
									logger.error(err);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							this.db = new JsonDB(settingsJsonPath, true, true);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = new CertificateUtil();
 | 
				
			||||||
@@ -48,6 +48,12 @@ class ConfigUtil {
 | 
				
			|||||||
			return value;
 | 
								return value;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// This function returns whether a key exists in the configuration file (settings.json)
 | 
				
			||||||
 | 
						isConfigItemExists(key) {
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
							const value = this.db.getData('/')[key];
 | 
				
			||||||
 | 
							return (value !== undefined);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setConfigItem(key, value) {
 | 
						setConfigItem(key, value) {
 | 
				
			||||||
		this.db.push(`/${key}`, value, true);
 | 
							this.db.push(`/${key}`, value, true);
 | 
				
			||||||
@@ -60,7 +66,7 @@ class ConfigUtil {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reloadDB() {
 | 
						reloadDB() {
 | 
				
			||||||
		const settingsJsonPath = path.join(app.getPath('userData'), '/settings.json');
 | 
							const settingsJsonPath = path.join(app.getPath('userData'), '/config/settings.json');
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			const file = fs.readFileSync(settingsJsonPath, 'utf8');
 | 
								const file = fs.readFileSync(settingsJsonPath, 'utf8');
 | 
				
			||||||
			JSON.parse(file);
 | 
								JSON.parse(file);
 | 
				
			||||||
@@ -69,7 +75,7 @@ class ConfigUtil {
 | 
				
			|||||||
				fs.unlinkSync(settingsJsonPath);
 | 
									fs.unlinkSync(settingsJsonPath);
 | 
				
			||||||
				dialog.showErrorBox(
 | 
									dialog.showErrorBox(
 | 
				
			||||||
					'Error saving settings',
 | 
										'Error saving settings',
 | 
				
			||||||
					'We encountered error while saving current settings.'
 | 
										'We encountered an error while saving the settings.'
 | 
				
			||||||
				);
 | 
									);
 | 
				
			||||||
				logger.error('Error while JSON parsing settings.json: ');
 | 
									logger.error('Error while JSON parsing settings.json: ');
 | 
				
			||||||
				logger.error(err);
 | 
									logger.error(err);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,8 @@ if (process.type === 'renderer') {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const zulipDir = app.getPath('userData');
 | 
					const zulipDir = app.getPath('userData');
 | 
				
			||||||
const logDir = `${zulipDir}/Logs/`;
 | 
					const logDir = `${zulipDir}/Logs/`;
 | 
				
			||||||
 | 
					const certificatesDir = `${zulipDir}/certificates/`;
 | 
				
			||||||
 | 
					const configDir = `${zulipDir}/config/`;
 | 
				
			||||||
const initSetUp = () => {
 | 
					const initSetUp = () => {
 | 
				
			||||||
	// if it is the first time the app is running
 | 
						// if it is the first time the app is running
 | 
				
			||||||
	// create zulip dir in userData folder to
 | 
						// create zulip dir in userData folder to
 | 
				
			||||||
@@ -22,6 +24,51 @@ const initSetUp = () => {
 | 
				
			|||||||
		if (!fs.existsSync(logDir)) {
 | 
							if (!fs.existsSync(logDir)) {
 | 
				
			||||||
			fs.mkdirSync(logDir);
 | 
								fs.mkdirSync(logDir);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!fs.existsSync(certificatesDir)) {
 | 
				
			||||||
 | 
								fs.mkdirSync(certificatesDir);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Migrate config files from app data folder to config folder inside app
 | 
				
			||||||
 | 
							// data folder. This will be done once when a user updates to the new version.
 | 
				
			||||||
 | 
							if (!fs.existsSync(configDir)) {
 | 
				
			||||||
 | 
								fs.mkdirSync(configDir);
 | 
				
			||||||
 | 
								const domainJson = `${zulipDir}/domain.json`;
 | 
				
			||||||
 | 
								const certificatesJson = `${zulipDir}/certificates.json`;
 | 
				
			||||||
 | 
								const settingsJson = `${zulipDir}/settings.json`;
 | 
				
			||||||
 | 
								const updatesJson = `${zulipDir}/updates.json`;
 | 
				
			||||||
 | 
								const windowStateJson = `${zulipDir}/window-state.json`;
 | 
				
			||||||
 | 
								const configData = [
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										path: domainJson,
 | 
				
			||||||
 | 
										fileName: `domain.json`
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										path: certificatesJson,
 | 
				
			||||||
 | 
										fileName: `certificates.json`
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										path: settingsJson,
 | 
				
			||||||
 | 
										fileName: `settings.json`
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										path: updatesJson,
 | 
				
			||||||
 | 
										fileName: `updates.json`
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								];
 | 
				
			||||||
 | 
								configData.forEach(data => {
 | 
				
			||||||
 | 
									if (fs.existsSync(data.path)) {
 | 
				
			||||||
 | 
										fs.copyFileSync(data.path, configDir + data.fileName);
 | 
				
			||||||
 | 
										fs.unlinkSync(data.path);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
								// window-state.json is only deleted not moved, as the electron-window-state
 | 
				
			||||||
 | 
								// package will recreate the file in the config folder.
 | 
				
			||||||
 | 
								if (fs.existsSync(windowStateJson)) {
 | 
				
			||||||
 | 
									fs.unlinkSync(windowStateJson);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		setupCompleted = true;
 | 
							setupCompleted = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										41
									
								
								app/renderer/js/utils/dnd-util.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const ConfigUtil = require(__dirname + '/config-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function toggle() {
 | 
				
			||||||
 | 
						const dnd = !ConfigUtil.getConfigItem('dnd', false);
 | 
				
			||||||
 | 
						const dndSettingList = ['showNotification', 'silent'];
 | 
				
			||||||
 | 
						if (process.platform === 'win32') {
 | 
				
			||||||
 | 
							dndSettingList.push('flashTaskbarOnMessage');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let newSettings;
 | 
				
			||||||
 | 
						if (dnd) {
 | 
				
			||||||
 | 
							const oldSettings = {};
 | 
				
			||||||
 | 
							newSettings = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Iterate through the dndSettingList.
 | 
				
			||||||
 | 
							for (const settingName of dndSettingList) {
 | 
				
			||||||
 | 
								// Store the current value of setting.
 | 
				
			||||||
 | 
								oldSettings[settingName] = ConfigUtil.getConfigItem(settingName);
 | 
				
			||||||
 | 
								// New value of setting.
 | 
				
			||||||
 | 
								newSettings[settingName] = (settingName === 'silent');
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Store old value in oldSettings.
 | 
				
			||||||
 | 
							ConfigUtil.setConfigItem('dndPreviousSettings', oldSettings);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							newSettings = ConfigUtil.getConfigItem('dndPreviousSettings');
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (const settingName of dndSettingList) {
 | 
				
			||||||
 | 
							ConfigUtil.setConfigItem(settingName, newSettings[settingName]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ConfigUtil.setConfigItem('dnd', dnd);
 | 
				
			||||||
 | 
						return {dnd, newSettings};
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = {
 | 
				
			||||||
 | 
						toggle
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -5,8 +5,12 @@ const fs = require('fs');
 | 
				
			|||||||
const path = require('path');
 | 
					const path = require('path');
 | 
				
			||||||
const JsonDB = require('node-json-db');
 | 
					const JsonDB = require('node-json-db');
 | 
				
			||||||
const request = require('request');
 | 
					const request = require('request');
 | 
				
			||||||
 | 
					const escape = require('escape-html');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Logger = require('./logger-util');
 | 
					const Logger = require('./logger-util');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const CertificateUtil = require(__dirname + '/certificate-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const logger = new Logger({
 | 
					const logger = new Logger({
 | 
				
			||||||
	file: `domain-util.log`,
 | 
						file: `domain-util.log`,
 | 
				
			||||||
	timestamp: true
 | 
						timestamp: true
 | 
				
			||||||
@@ -99,13 +103,24 @@ class DomainUtil {
 | 
				
			|||||||
	checkDomain(domain, silent = false) {
 | 
						checkDomain(domain, silent = false) {
 | 
				
			||||||
		if (!silent && this.duplicateDomain(domain)) {
 | 
							if (!silent && this.duplicateDomain(domain)) {
 | 
				
			||||||
			// Do not check duplicate in silent mode
 | 
								// Do not check duplicate in silent mode
 | 
				
			||||||
			alert('This server has been added.');
 | 
								return Promise.reject('This server has been added.');
 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		domain = this.formatUrl(domain);
 | 
							domain = this.formatUrl(domain);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const checkDomain = domain + '/static/audio/zulip.ogg';
 | 
							const certificate = CertificateUtil.getCertificate(encodeURIComponent(domain));
 | 
				
			||||||
 | 
							let certificateLocation = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (certificate) {
 | 
				
			||||||
 | 
								// To handle case where certificate has been moved from the location in certificates.json
 | 
				
			||||||
 | 
								try {
 | 
				
			||||||
 | 
									certificateLocation = fs.readFileSync(certificate);
 | 
				
			||||||
 | 
								} catch (err) {
 | 
				
			||||||
 | 
									logger.warn('Error while trying to get certificate: ' + err);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							// If certificate for the domain exists add it as a ca key in the request's parameter else consider only domain as the parameter for request
 | 
				
			||||||
 | 
							const checkDomain = (certificateLocation) ? ({url: domain + '/static/audio/zulip.ogg', ca: certificateLocation}) : domain + '/static/audio/zulip.ogg';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const serverConf = {
 | 
							const serverConf = {
 | 
				
			||||||
			icon: defaultIconUrl,
 | 
								icon: defaultIconUrl,
 | 
				
			||||||
@@ -115,21 +130,16 @@ class DomainUtil {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		return new Promise((resolve, reject) => {
 | 
							return new Promise((resolve, reject) => {
 | 
				
			||||||
			request(checkDomain, (error, response) => {
 | 
								request(checkDomain, (error, response) => {
 | 
				
			||||||
				const certsError =
 | 
					 | 
				
			||||||
					[
 | 
					 | 
				
			||||||
						'Error: self signed certificate',
 | 
					 | 
				
			||||||
						'Error: unable to verify the first certificate',
 | 
					 | 
				
			||||||
						'Error: unable to get local issuer certificate'
 | 
					 | 
				
			||||||
					];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				// If the domain contains following strings we just bypass the server
 | 
									// If the domain contains following strings we just bypass the server
 | 
				
			||||||
				const whitelistDomains = [
 | 
									const whitelistDomains = [
 | 
				
			||||||
					'zulipdev.org'
 | 
										'zulipdev.org'
 | 
				
			||||||
				];
 | 
									];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// make sure that error is a error or string not undefined
 | 
									// make sure that error is an error or string not undefined
 | 
				
			||||||
				// so validation does not throw error.
 | 
									// so validation does not throw error.
 | 
				
			||||||
				error = error || '';
 | 
									error = error || '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									const certsError = error.toString().includes('certificate');
 | 
				
			||||||
				if (!error && response.statusCode < 400) {
 | 
									if (!error && response.statusCode < 400) {
 | 
				
			||||||
					// Correct
 | 
										// Correct
 | 
				
			||||||
					this.getServerSettings(domain).then(serverSettings => {
 | 
										this.getServerSettings(domain).then(serverSettings => {
 | 
				
			||||||
@@ -137,7 +147,7 @@ class DomainUtil {
 | 
				
			|||||||
					}, () => {
 | 
										}, () => {
 | 
				
			||||||
						resolve(serverConf);
 | 
											resolve(serverConf);
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
				} else if (domain.indexOf(whitelistDomains) >= 0 || certsError.indexOf(error.toString()) >= 0) {
 | 
									} else if (domain.indexOf(whitelistDomains) >= 0 || certsError) {
 | 
				
			||||||
					if (silent) {
 | 
										if (silent) {
 | 
				
			||||||
						this.getServerSettings(domain).then(serverSettings => {
 | 
											this.getServerSettings(domain).then(serverSettings => {
 | 
				
			||||||
							resolve(serverSettings);
 | 
												resolve(serverSettings);
 | 
				
			||||||
@@ -146,9 +156,10 @@ class DomainUtil {
 | 
				
			|||||||
						});
 | 
											});
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						const certErrorMessage = `Do you trust certificate from ${domain}? \n ${error}`;
 | 
											const certErrorMessage = `Do you trust certificate from ${domain}? \n ${error}`;
 | 
				
			||||||
						const certErrorDetail = `The server you're connecting to is either someone impersonating the Zulip server you entered, or the server you're trying to connect to is configured in an insecure way.
 | 
											const certErrorDetail = `The organization you're connecting to is either someone impersonating the Zulip server you entered, or the server you're trying to connect to is configured in an insecure way.
 | 
				
			||||||
						\n Unless you have a good reason to believe otherwise, you should not proceed.
 | 
											\nIf you have a valid certificate please add it from Settings>Organizations and try to add the organization again.
 | 
				
			||||||
						\n You can click here if you'd like to proceed with the connection.`;
 | 
											\nUnless you have a good reason to believe otherwise, you should not proceed.
 | 
				
			||||||
 | 
											\nYou can click here if you'd like to proceed with the connection.`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						dialog.showMessageBox({
 | 
											dialog.showMessageBox({
 | 
				
			||||||
							type: 'warning',
 | 
												type: 'warning',
 | 
				
			||||||
@@ -170,7 +181,8 @@ class DomainUtil {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					const invalidZulipServerError = `${domain} does not appear to be a valid Zulip server. Make sure that \
 | 
										const invalidZulipServerError = `${domain} does not appear to be a valid Zulip server. Make sure that \
 | 
				
			||||||
					\n(1) you can connect to that URL in a web browser and \n (2) if you need a proxy to connect to the Internet, that you've configured your proxy in the Network settings \n (3) its a zulip server`;
 | 
										\n (1) you can connect to that URL in a web browser and \n (2) if you need a proxy to connect to the Internet, that you've configured your proxy in the Network settings \n (3) its a zulip server \
 | 
				
			||||||
 | 
										\n (4) the server has a valid certificate, you can add custom certificates in Settings>Organizations`;
 | 
				
			||||||
					reject(invalidZulipServerError);
 | 
										reject(invalidZulipServerError);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
@@ -189,7 +201,7 @@ class DomainUtil {
 | 
				
			|||||||
							// Following check handles both the cases
 | 
												// Following check handles both the cases
 | 
				
			||||||
							icon: data.realm_icon.startsWith('/') ? data.realm_uri + data.realm_icon : data.realm_icon,
 | 
												icon: data.realm_icon.startsWith('/') ? data.realm_uri + data.realm_icon : data.realm_icon,
 | 
				
			||||||
							url: data.realm_uri,
 | 
												url: data.realm_uri,
 | 
				
			||||||
							alias: data.realm_name
 | 
												alias: escape(data.realm_name)
 | 
				
			||||||
						});
 | 
											});
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
@@ -207,18 +219,21 @@ class DomainUtil {
 | 
				
			|||||||
			try {
 | 
								try {
 | 
				
			||||||
				request(url).on('response', response => {
 | 
									request(url).on('response', response => {
 | 
				
			||||||
					response.on('error', err => {
 | 
										response.on('error', err => {
 | 
				
			||||||
						console.log(err);
 | 
											logger.log('Could not get server icon.');
 | 
				
			||||||
 | 
											logger.log(err);
 | 
				
			||||||
						resolve(defaultIconUrl);
 | 
											resolve(defaultIconUrl);
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
					response.pipe(file).on('finish', () => {
 | 
										response.pipe(file).on('finish', () => {
 | 
				
			||||||
						resolve(filePath);
 | 
											resolve(filePath);
 | 
				
			||||||
					});
 | 
										});
 | 
				
			||||||
				}).on('error', err => {
 | 
									}).on('error', err => {
 | 
				
			||||||
					console.log(err);
 | 
										logger.log('Could not get server icon.');
 | 
				
			||||||
 | 
										logger.log(err);
 | 
				
			||||||
					resolve(defaultIconUrl);
 | 
										resolve(defaultIconUrl);
 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			} catch (err) {
 | 
								} catch (err) {
 | 
				
			||||||
				console.log(err);
 | 
									logger.log('Could not get server icon.');
 | 
				
			||||||
 | 
									logger.log(err);
 | 
				
			||||||
				resolve(defaultIconUrl);
 | 
									resolve(defaultIconUrl);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
@@ -236,7 +251,7 @@ class DomainUtil {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reloadDB() {
 | 
						reloadDB() {
 | 
				
			||||||
		const domainJsonPath = path.join(app.getPath('userData'), '/domain.json');
 | 
							const domainJsonPath = path.join(app.getPath('userData'), 'config/domain.json');
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			const file = fs.readFileSync(domainJsonPath, 'utf8');
 | 
								const file = fs.readFileSync(domainJsonPath, 'utf8');
 | 
				
			||||||
			JSON.parse(file);
 | 
								JSON.parse(file);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,20 @@ class LinkUtil {
 | 
				
			|||||||
		const currentDomain = wurl('hostname', currentUrl);
 | 
							const currentDomain = wurl('hostname', currentUrl);
 | 
				
			||||||
		const newDomain = wurl('hostname', newUrl);
 | 
							const newDomain = wurl('hostname', newUrl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return (currentDomain === newDomain) && newUrl.includes('/#narrow');
 | 
							const sameDomainUrl = (currentDomain === newDomain || newUrl === currentUrl + '/');
 | 
				
			||||||
 | 
							const isUploadsUrl = newUrl.includes(currentUrl + '/user_uploads/');
 | 
				
			||||||
 | 
							const isInternalUrl = newUrl.includes('/#narrow') || isUploadsUrl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return {
 | 
				
			||||||
 | 
								isInternalUrl: sameDomainUrl && isInternalUrl,
 | 
				
			||||||
 | 
								isUploadsUrl
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						isImage(url) {
 | 
				
			||||||
 | 
							// test for images extension as well as urls like .png?s=100
 | 
				
			||||||
 | 
							const isImageUrl = /\.(bmp|gif|jpg|jpeg|png|webp)\?*.*$/i;
 | 
				
			||||||
 | 
							return isImageUrl.test(url);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										74
									
								
								app/renderer/js/utils/linux-update-util.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,74 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const fs = require('fs');
 | 
				
			||||||
 | 
					const path = require('path');
 | 
				
			||||||
 | 
					const process = require('process');
 | 
				
			||||||
 | 
					const remote =
 | 
				
			||||||
 | 
						process.type === 'renderer' ? require('electron').remote : require('electron');
 | 
				
			||||||
 | 
					const JsonDB = require('node-json-db');
 | 
				
			||||||
 | 
					const Logger = require('./logger-util');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: 'linux-update-util.log',
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* To make the util runnable in both main and renderer process */
 | 
				
			||||||
 | 
					const { dialog, app } = remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let instance = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class LinuxUpdateUtil {
 | 
				
			||||||
 | 
						constructor() {
 | 
				
			||||||
 | 
							if (instance) {
 | 
				
			||||||
 | 
								return instance;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								instance = this;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
							return instance;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						getUpdateItem(key, defaultValue = null) {
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
							const value = this.db.getData('/')[key];
 | 
				
			||||||
 | 
							if (value === undefined) {
 | 
				
			||||||
 | 
								this.setUpdateItem(key, defaultValue);
 | 
				
			||||||
 | 
								return defaultValue;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								return value;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						setUpdateItem(key, value) {
 | 
				
			||||||
 | 
							this.db.push(`/${key}`, value, true);
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						removeUpdateItem(key) {
 | 
				
			||||||
 | 
							this.db.delete(`/${key}`);
 | 
				
			||||||
 | 
							this.reloadDB();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						reloadDB() {
 | 
				
			||||||
 | 
							const linuxUpdateJsonPath = path.join(app.getPath('userData'), '/config/updates.json');
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
 | 
								const file = fs.readFileSync(linuxUpdateJsonPath, 'utf8');
 | 
				
			||||||
 | 
								JSON.parse(file);
 | 
				
			||||||
 | 
							} catch (err) {
 | 
				
			||||||
 | 
								if (fs.existsSync(linuxUpdateJsonPath)) {
 | 
				
			||||||
 | 
									fs.unlinkSync(linuxUpdateJsonPath);
 | 
				
			||||||
 | 
									dialog.showErrorBox(
 | 
				
			||||||
 | 
										'Error saving update notifications.',
 | 
				
			||||||
 | 
										'We encountered an error while saving the update notifications.'
 | 
				
			||||||
 | 
									);
 | 
				
			||||||
 | 
									logger.error('Error while JSON parsing updates.json: ');
 | 
				
			||||||
 | 
									logger.error(err);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							this.db = new JsonDB(linuxUpdateJsonPath, true, true);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = new LinuxUpdateUtil();
 | 
				
			||||||
							
								
								
									
										96
									
								
								app/renderer/js/utils/proxy-util.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,96 @@
 | 
				
			|||||||
 | 
					'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const ConfigUtil = require('./config-util.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let instance = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ProxyUtil {
 | 
				
			||||||
 | 
						constructor() {
 | 
				
			||||||
 | 
							if (instance) {
 | 
				
			||||||
 | 
								return instance;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								instance = this;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return instance;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						resolveSystemProxy(mainWindow) {
 | 
				
			||||||
 | 
							const page = mainWindow.webContents;
 | 
				
			||||||
 | 
							const ses = page.session;
 | 
				
			||||||
 | 
							const resolveProxyUrl = 'www.google.com';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Check HTTP Proxy
 | 
				
			||||||
 | 
							const httpProxy = new Promise(resolve => {
 | 
				
			||||||
 | 
								ses.resolveProxy('http://' + resolveProxyUrl, proxy => {
 | 
				
			||||||
 | 
									let httpString = '';
 | 
				
			||||||
 | 
									if (proxy !== 'DIRECT') {
 | 
				
			||||||
 | 
										// in case of proxy HTTPS url:port, windows gives first word as HTTPS while linux gives PROXY
 | 
				
			||||||
 | 
										// for all other HTTP or direct url:port both uses PROXY
 | 
				
			||||||
 | 
										if (proxy.includes('PROXY') || proxy.includes('HTTPS')) {
 | 
				
			||||||
 | 
											httpString = 'http=' + proxy.split('PROXY')[1] + ';';
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									resolve(httpString);
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
							// Check HTTPS Proxy
 | 
				
			||||||
 | 
							const httpsProxy = new Promise(resolve => {
 | 
				
			||||||
 | 
								ses.resolveProxy('https://' + resolveProxyUrl, proxy => {
 | 
				
			||||||
 | 
									let httpsString = '';
 | 
				
			||||||
 | 
									if (proxy !== 'DIRECT' || proxy.includes('HTTPS')) {
 | 
				
			||||||
 | 
										// in case of proxy HTTPS url:port, windows gives first word as HTTPS while linux gives PROXY
 | 
				
			||||||
 | 
										// for all other HTTP or direct url:port both uses PROXY
 | 
				
			||||||
 | 
										if (proxy.includes('PROXY' || proxy.includes('HTTPS'))) {
 | 
				
			||||||
 | 
											httpsString += 'https=' + proxy.split('PROXY')[1] + ';';
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									resolve(httpsString);
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Check FTP Proxy
 | 
				
			||||||
 | 
							const ftpProxy = new Promise(resolve => {
 | 
				
			||||||
 | 
								ses.resolveProxy('ftp://' + resolveProxyUrl, proxy => {
 | 
				
			||||||
 | 
									let ftpString = '';
 | 
				
			||||||
 | 
									if (proxy !== 'DIRECT') {
 | 
				
			||||||
 | 
										if (proxy.includes('PROXY')) {
 | 
				
			||||||
 | 
											ftpString += 'ftp=' + proxy.split('PROXY')[1] + ';';
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									resolve(ftpString);
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Check SOCKS Proxy
 | 
				
			||||||
 | 
							const socksProxy = new Promise(resolve => {
 | 
				
			||||||
 | 
								ses.resolveProxy('socks4://' + resolveProxyUrl, proxy => {
 | 
				
			||||||
 | 
									let socksString = '';
 | 
				
			||||||
 | 
									if (proxy !== 'DIRECT') {
 | 
				
			||||||
 | 
										if (proxy.includes('SOCKS5')) {
 | 
				
			||||||
 | 
											socksString += 'socks=' + proxy.split('SOCKS5')[1] + ';';
 | 
				
			||||||
 | 
										} else if (proxy.includes('SOCKS4')) {
 | 
				
			||||||
 | 
											socksString += 'socks=' + proxy.split('SOCKS4')[1] + ';';
 | 
				
			||||||
 | 
										} else if (proxy.includes('PROXY')) {
 | 
				
			||||||
 | 
											socksString += 'socks=' + proxy.split('PROXY')[1] + ';';
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									resolve(socksString);
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							Promise.all([httpProxy, httpsProxy, ftpProxy, socksProxy]).then(values => {
 | 
				
			||||||
 | 
								let proxyString = '';
 | 
				
			||||||
 | 
								values.forEach(proxy => {
 | 
				
			||||||
 | 
									proxyString += proxy;
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
								ConfigUtil.setConfigItem('systemProxyRules', proxyString);
 | 
				
			||||||
 | 
								const useSystemProxy = ConfigUtil.getConfigItem('useSystemProxy');
 | 
				
			||||||
 | 
								if (useSystemProxy) {
 | 
				
			||||||
 | 
									ConfigUtil.setConfigItem('proxyRules', proxyString);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = new ProxyUtil();
 | 
				
			||||||
							
								
								
									
										60
									
								
								app/renderer/js/utils/reconnect-util.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					const isOnline = require('is-online');
 | 
				
			||||||
 | 
					const Logger = require('./logger-util');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logger = new Logger({
 | 
				
			||||||
 | 
						file: `domain-util.log`,
 | 
				
			||||||
 | 
						timestamp: true
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ReconnectUtil {
 | 
				
			||||||
 | 
						constructor(serverManagerView) {
 | 
				
			||||||
 | 
							this.serverManagerView = serverManagerView;
 | 
				
			||||||
 | 
							this.alreadyReloaded = false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						clearState() {
 | 
				
			||||||
 | 
							this.alreadyReloaded = false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pollInternetAndReload() {
 | 
				
			||||||
 | 
							const pollInterval = setInterval(() => {
 | 
				
			||||||
 | 
								this._checkAndReload()
 | 
				
			||||||
 | 
									.then(status => {
 | 
				
			||||||
 | 
										if (status) {
 | 
				
			||||||
 | 
											this.alreadyReloaded = true;
 | 
				
			||||||
 | 
											clearInterval(pollInterval);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
							}, 1500);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_checkAndReload() {
 | 
				
			||||||
 | 
							return new Promise(resolve => {
 | 
				
			||||||
 | 
								if (!this.alreadyReloaded) { // eslint-disable-line no-negated-condition
 | 
				
			||||||
 | 
									isOnline()
 | 
				
			||||||
 | 
										.then(online => {
 | 
				
			||||||
 | 
											if (online) {
 | 
				
			||||||
 | 
												if (!this.alreadyReloaded) {
 | 
				
			||||||
 | 
													this.serverManagerView.reloadView();
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
 | 
												logger.log('You\'re back online.');
 | 
				
			||||||
 | 
												return resolve(true);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											logger.log('There is no internet connection, try checking network cables, modem and router.');
 | 
				
			||||||
 | 
											const errMsgHolder = document.querySelector('#description');
 | 
				
			||||||
 | 
											if (errMsgHolder) {
 | 
				
			||||||
 | 
												errMsgHolder.innerHTML = `
 | 
				
			||||||
 | 
															<div>You internet connection does't seem to work properly!</div>
 | 
				
			||||||
 | 
															</div>Verify that it works and then click try again.</div>`;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											return resolve(false);
 | 
				
			||||||
 | 
										});
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									return resolve(true);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module.exports = ReconnectUtil;
 | 
				
			||||||
@@ -24,10 +24,18 @@
 | 
				
			|||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div id="actions-container">
 | 
					    <div id="actions-container">
 | 
				
			||||||
 | 
					      <div class="action-button" id="dnd-action">
 | 
				
			||||||
 | 
					        <i class="material-icons md-48">notifications</i>
 | 
				
			||||||
 | 
					        <span id="dnd-tooltip" style="display:none">Do Not Disturb</span>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
      <div class="action-button" id="reload-action">
 | 
					      <div class="action-button" id="reload-action">
 | 
				
			||||||
        <i class="material-icons md-48">refresh</i>
 | 
					        <i class="material-icons md-48">refresh</i>
 | 
				
			||||||
        <span id="reload-tooltip" style="display:none">Reload</span>
 | 
					        <span id="reload-tooltip" style="display:none">Reload</span>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
 | 
					      <div class="action-button disable" id="back-action">
 | 
				
			||||||
 | 
					        <i class="material-icons md-48">arrow_back</i>
 | 
				
			||||||
 | 
					        <span id="back-tooltip" style="display:none">Go Back</span>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
      <div class="action-button" id="settings-action">
 | 
					      <div class="action-button" id="settings-action">
 | 
				
			||||||
        <i class="material-icons md-48">settings</i>
 | 
					        <i class="material-icons md-48">settings</i>
 | 
				
			||||||
        <span id="setting-tooltip" style="display:none">Settings</span>
 | 
					        <span id="setting-tooltip" style="display:none">Settings</span>
 | 
				
			||||||
@@ -38,7 +46,11 @@
 | 
				
			|||||||
    <div id="webviews-container"></div>
 | 
					    <div id="webviews-container"></div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <div id="feedback-modal">
 | 
				
			||||||
 | 
					    <send-feedback></send-feedback>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
<script src="js/main.js"></script>
 | 
					<script src="js/main.js"></script>
 | 
				
			||||||
 | 
					<script>require('./js/shared/preventdrag.js')</script>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,5 +17,6 @@
 | 
				
			|||||||
      <div id="reconnect">Try now</div>
 | 
					      <div id="reconnect">Try now</div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </body>
 | 
					  </body>
 | 
				
			||||||
  <script src="js/pages/network.js"></script>  
 | 
					  <script src="js/pages/network.js"></script>
 | 
				
			||||||
 | 
					  <script>require('./js/shared/preventdrag.js')</script>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,4 +13,5 @@
 | 
				
			|||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </body>
 | 
					  </body>
 | 
				
			||||||
  <script src="js/pages/preference/preference.js"></script>
 | 
					  <script src="js/pages/preference/preference.js"></script>
 | 
				
			||||||
 | 
					  <script>require('./js/shared/preventdrag.js')</script>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
| 
		 Before Width: | Height: | Size: 1.3 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.3 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  | 
| 
		 Before Width: | Height: | Size: 1.4 KiB  |