mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-27 18:13:45 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
297b307726 | ||
|
|
deed66973f | ||
|
|
03486e438d | ||
|
|
e113f59aad | ||
|
|
29ece4824a | ||
|
|
66c62c55e2 | ||
|
|
40852942d2 | ||
|
|
15c8591691 | ||
|
|
e21902a5e3 | ||
|
|
a5d42e8ccd | ||
|
|
0923df7250 | ||
|
|
37f5258210 | ||
|
|
19819f7d48 | ||
|
|
40f74cdac2 | ||
|
|
e4ba3b9721 | ||
|
|
9a221585b9 | ||
|
|
069a0ff306 | ||
|
|
3153fb91da | ||
|
|
92d4d27fa8 | ||
|
|
209fc4a65c | ||
|
|
5e9ecedecd | ||
|
|
613df32bf1 | ||
|
|
7606f37695 | ||
|
|
a2f758a46b | ||
|
|
2a477abe5f | ||
|
|
5f027820f4 | ||
|
|
9e75861546 | ||
|
|
4060596474 | ||
|
|
2e5888c8af | ||
|
|
03d1188e14 | ||
|
|
c91b0c209a | ||
|
|
f9f70f001b |
@@ -14,10 +14,10 @@ multi-account, auto-updates etc.
|
|||||||
## Prerequisites
|
## Prerequisites
|
||||||
* node >= v6.3.1
|
* node >= v6.3.1
|
||||||
* npm >= 3.10.3
|
* npm >= 3.10.3
|
||||||
* If you're on Debian or Ubuntu, you'll also need to install
|
* python (v2.7.x recommended)
|
||||||
`nodejs-legacy`:
|
* If you're on Debian or Ubuntu, you'll need to install following packages:
|
||||||
```sh
|
```sh
|
||||||
$ sudo apt-get install nodejs-legacy
|
$ sudo apt-get install nodejs-legacy build-essential libxext-dev libxtst-dev libxkbfile-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -1,40 +1,46 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const os = require('os');
|
// const os = require('os');
|
||||||
const {app, autoUpdater, dialog} = require('electron');
|
const {app, dialog} = require('electron');
|
||||||
|
const {autoUpdater} = require('electron-updater');
|
||||||
|
|
||||||
const version = app.getVersion();
|
// We don't need to call all of these since it's automatically handled by electron-updater
|
||||||
const platform = os.platform() + '_' + os.arch(); // usually returns darwin_64
|
// const version = app.getVersion();
|
||||||
|
// const platform = os.platform() + '_' + os.arch(); // usually returns darwin_64
|
||||||
const updaterFeedURL = 'http://zulipdesktop.herokuapp.com/update/' + platform + '/' + version;
|
// const updaterFeedURL = 'http://zulipdesktop.herokuapp.com/update/' + platform + '/' + version;
|
||||||
|
|
||||||
function appUpdater() {
|
function appUpdater() {
|
||||||
autoUpdater.setFeedURL(updaterFeedURL);
|
// autoUpdater.setFeedURL(updaterFeedURL);
|
||||||
|
|
||||||
// Log whats happening
|
// Log whats happening
|
||||||
|
const log = require('electron-log');
|
||||||
|
log.transports.file.level = 'info';
|
||||||
|
autoUpdater.logger = log;
|
||||||
// TODO send autoUpdater events to renderer so that we could
|
// TODO send autoUpdater events to renderer so that we could
|
||||||
// it could console log in developer tools
|
// it could console log in developer tools
|
||||||
|
/*
|
||||||
autoUpdater.on('error', err => console.log(err));
|
autoUpdater.on('error', err => console.log(err));
|
||||||
autoUpdater.on('checking-for-update', () => console.log('checking-for-update'));
|
autoUpdater.on('checking-for-update', () => console.log('checking-for-update'));
|
||||||
autoUpdater.on('update-available', () => console.log('update-available'));
|
autoUpdater.on('update-available', () => console.log('update-available'));
|
||||||
autoUpdater.on('update-not-available', () => console.log('update-not-available'));
|
autoUpdater.on('update-not-available', () => console.log('update-not-available'));
|
||||||
|
*/
|
||||||
|
|
||||||
// Ask the user if update is available
|
// Ask the user if update is available
|
||||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
autoUpdater.on('update-downloaded', (event, info) => {
|
||||||
let message = app.getName() + ' ' + releaseName + ' is now available. It will be installed the next time you restart the application.';
|
// let message = app.getName() + ' ' + info.releaseName + ' is now available. It will be installed the next time you restart the application.';
|
||||||
if (releaseNotes) {
|
// if (info.releaseNotes) {
|
||||||
const splitNotes = releaseNotes.split(/[^\r]\n/);
|
// const splitNotes = info.releaseNotes.split(/[^\r]\n/);
|
||||||
message += '\n\nRelease notes:\n';
|
// message += '\n\nRelease notes:\n';
|
||||||
splitNotes.forEach(notes => {
|
// splitNotes.forEach(notes => {
|
||||||
message += notes + '\n\n';
|
// message += notes + '\n\n';
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
// Ask user to update the app
|
// Ask user to update the app
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Install and Relaunch', 'Later'],
|
buttons: ['Install and Relaunch', 'Later'],
|
||||||
defaultId: 0,
|
defaultId: 0,
|
||||||
message: 'A new version of ' + app.getName() + ' has been downloaded',
|
message: 'A new version of ' + app.getName() + ' has been downloaded',
|
||||||
detail: message
|
detail: 'It will be installed the next time you restart the application'
|
||||||
}, response => {
|
}, response => {
|
||||||
if (response === 0) {
|
if (response === 0) {
|
||||||
setTimeout(() => autoUpdater.quitAndInstall(), 1);
|
setTimeout(() => autoUpdater.quitAndInstall(), 1);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ window.addDomain = function () {
|
|||||||
ipcRenderer.send('new-domain', domain);
|
ipcRenderer.send('new-domain', domain);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('main').innerHTML = 'Connect';
|
document.getElementById('main').innerHTML = 'Connect';
|
||||||
document.getElementById('server-status').innerHTML = 'Not a vaild Zulip Server.';
|
document.getElementById('server-status').innerHTML = 'Not a valid Zulip Server.';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ const {appUpdater} = require('./autoupdater');
|
|||||||
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
|
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
|
||||||
const data = db.getData('/');
|
const data = db.getData('/');
|
||||||
|
|
||||||
// Handling squirrel.windows events on windows
|
/* Handling squirrel.windows events on windows
|
||||||
|
Update - Not needed for NSIS
|
||||||
if (require('electron-squirrel-startup')) {
|
if (require('electron-squirrel-startup')) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
} */
|
||||||
|
|
||||||
// adds debug features like hotkeys for triggering dev tools and reload
|
// adds debug features like hotkeys for triggering dev tools and reload
|
||||||
require('electron-debug')();
|
require('electron-debug')();
|
||||||
|
|||||||
69
app/main/macos-swipe-navigation.js
Normal file
69
app/main/macos-swipe-navigation.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
// Adopted from
|
||||||
|
// https://github.com/wozaki/twitter-js-apps/blob/9bc00eafd575fd180dc7a450e1b1daf425e67b80/redux/src/main/renderer/registries/electron/swipeNavigatorImpl.js
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
const {remote} = require('electron');
|
||||||
|
|
||||||
|
const THRESHOLD_DELTA_X = 70;
|
||||||
|
const THRESHOLD_LIMIT_DELTA_Y = 50;
|
||||||
|
const THRESHOLD_TIME = 50;
|
||||||
|
|
||||||
|
// TODO avoid module global state
|
||||||
|
let tracking = false;
|
||||||
|
let deltaX = 0;
|
||||||
|
let deltaY = 0;
|
||||||
|
let startTime = 0;
|
||||||
|
let time = 0;
|
||||||
|
|
||||||
|
module.exports.register = function register() {
|
||||||
|
remote.getCurrentWindow()
|
||||||
|
.on('scroll-touch-begin', onScrollBegin)
|
||||||
|
.on('scroll-touch-end', onScrollEnd)
|
||||||
|
.on('swipe', onSwipe)
|
||||||
|
|
||||||
|
window.addEventListener('wheel', onMouseWheel, {passive: true});
|
||||||
|
window.addEventListener('beforeunload', remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
const remove = module.exports.remove = function remove() {
|
||||||
|
remote.getCurrentWindow()
|
||||||
|
.removeListener('scroll-touch-begin', onScrollBegin)
|
||||||
|
.removeListener('scroll-touch-end', onScrollEnd)
|
||||||
|
.removeListener('swipe', onSwipe)
|
||||||
|
|
||||||
|
window.removeEventListener('mousewheel', onMouseWheel);
|
||||||
|
window.removeEventListener('beforeunload', remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSwipe(e, direction) {
|
||||||
|
if (direction === 'left')
|
||||||
|
remote.getCurrentWebContents().goBack()
|
||||||
|
else if (direction === 'right')
|
||||||
|
remote.getCurrentWebContents().goForward()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseWheel(e) {
|
||||||
|
if (tracking) {
|
||||||
|
deltaX = deltaX + e.deltaX
|
||||||
|
deltaY = deltaY + e.deltaY
|
||||||
|
time = (new Date()).getTime() - startTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onScrollBegin() {
|
||||||
|
tracking = true
|
||||||
|
startTime = (new Date()).getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onScrollEnd() {
|
||||||
|
if (time > THRESHOLD_TIME && tracking && Math.abs(deltaY) < THRESHOLD_LIMIT_DELTA_Y)
|
||||||
|
if (deltaX > THRESHOLD_DELTA_X)
|
||||||
|
remote.getCurrentWebContents().goForward()
|
||||||
|
else if (deltaX < -THRESHOLD_DELTA_X)
|
||||||
|
remote.getCurrentWebContents().goBack()
|
||||||
|
|
||||||
|
tracking = false
|
||||||
|
deltaX = 0
|
||||||
|
deltaY = 0
|
||||||
|
startTime = 0
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
const os = require('os');
|
const os = require('os');
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
|
|
||||||
|
const {dialog} = require('electron');
|
||||||
|
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
const BrowserWindow = electron.BrowserWindow;
|
const BrowserWindow = electron.BrowserWindow;
|
||||||
const shell = electron.shell;
|
const shell = electron.shell;
|
||||||
@@ -19,6 +21,14 @@ function sendAction(action) {
|
|||||||
win.webContents.send(action);
|
win.webContents.send(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearCache() {
|
||||||
|
const win = BrowserWindow.getAllWindows()[0];
|
||||||
|
const ses = win.webContents.session;
|
||||||
|
ses.clearCache(() => {
|
||||||
|
dialog.showMessageBox({type: 'info', buttons: [], message: 'Cache cleared!'});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const viewSubmenu = [
|
const viewSubmenu = [
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
@@ -134,8 +144,15 @@ const darwinTpl = [
|
|||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Clear Cache',
|
||||||
|
click() {
|
||||||
|
clearCache();
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Log Out',
|
label: 'Log Out',
|
||||||
|
accelerator: 'Cmd+L',
|
||||||
click(item, focusedWindow) {
|
click(item, focusedWindow) {
|
||||||
if (focusedWindow) {
|
if (focusedWindow) {
|
||||||
sendAction('log-out');
|
sendAction('log-out');
|
||||||
@@ -263,8 +280,15 @@ const otherTpl = [
|
|||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Clear Cache',
|
||||||
|
click() {
|
||||||
|
clearCache();
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Log Out',
|
label: 'Log Out',
|
||||||
|
accelerator: 'Ctrl+L',
|
||||||
click(item, focusedWindow) {
|
click(item, focusedWindow) {
|
||||||
if (focusedWindow) {
|
if (focusedWindow) {
|
||||||
sendAction('log-out');
|
sendAction('log-out');
|
||||||
@@ -312,7 +336,6 @@ const otherTpl = [
|
|||||||
{
|
{
|
||||||
role: 'selectall'
|
role: 'selectall'
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ const ipcRenderer = require('electron').ipcRenderer;
|
|||||||
const {webFrame} = require('electron');
|
const {webFrame} = require('electron');
|
||||||
const {spellChecker} = require('./spellchecker');
|
const {spellChecker} = require('./spellchecker');
|
||||||
|
|
||||||
|
// enable swipe back/forward navigation on macOS
|
||||||
|
require('./macos-swipe-navigation.js').register();
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-unassigned-import
|
||||||
require('./domain');
|
require('./domain');
|
||||||
|
|
||||||
// handle zooming functionality
|
// handle zooming functionality
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "zulip",
|
"name": "zulip",
|
||||||
"productName": "Zulip",
|
"productName": "Zulip",
|
||||||
"version": "0.5.4",
|
"version": "0.5.6",
|
||||||
"description": "Zulip Desktop App",
|
"description": "Zulip Desktop App",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"email":"<svnitakash@gmail.com>",
|
"email":"<svnitakash@gmail.com>",
|
||||||
@@ -28,14 +28,15 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"electron-is-dev": "0.1.2",
|
"electron-is-dev": "0.1.2",
|
||||||
"electron-squirrel-startup": "1.0.0",
|
"electron-updater": "1.4.1",
|
||||||
|
"electron-log": "1.3.0",
|
||||||
"configstore": "2.1.0",
|
"configstore": "2.1.0",
|
||||||
"dialogs": "1.1.14",
|
"dialogs": "1.1.14",
|
||||||
"electron-debug": "1.1.0",
|
"electron-debug": "1.1.0",
|
||||||
"electron-localshortcut": "0.6.1",
|
"electron-localshortcut": "0.6.1",
|
||||||
"node-json-db": "0.7.3",
|
"node-json-db": "0.7.3",
|
||||||
"request": "2.79.0",
|
"request": "2.79.0",
|
||||||
"electron-spellchecker": "0.7.0",
|
"electron-spellchecker": "1.0.0",
|
||||||
"wurl": "2.1.0"
|
"wurl": "2.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function addDomain() {
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById('pic').style.display = 'none';
|
document.getElementById('pic').style.display = 'none';
|
||||||
document.getElementById('main').innerHTML = 'Switch';
|
document.getElementById('main').innerHTML = 'Switch';
|
||||||
document.getElementById('urladded').innerHTML = 'Not a vaild Zulip Server.';
|
document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
22
package.json
22
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "zulip",
|
"name": "zulip",
|
||||||
"productName": "Zulip",
|
"productName": "Zulip",
|
||||||
"version": "0.5.4",
|
"version": "0.5.6",
|
||||||
"description": "Zulip Desktop App",
|
"description": "Zulip Desktop App",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"email":"<svnitakash@gmail.com>",
|
"email":"<svnitakash@gmail.com>",
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"packageCategory": "GNOME;GTK;Network;InstantMessaging",
|
"packageCategory": "GNOME;GTK;Network;InstantMessaging",
|
||||||
"description": "Zulip Desktop Client for Linux",
|
"description": "Zulip Desktop Client for Linux",
|
||||||
"target" : ["deb", "AppImage"],
|
"target" : ["deb", "AppImage"],
|
||||||
"version" : "0.5.4",
|
"version" : "0.5.6",
|
||||||
"title" : "Zulip",
|
"title" : "Zulip",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"maintainer": "Akash Nimare <svnitakash@gmail.com>"
|
"maintainer": "Akash Nimare <svnitakash@gmail.com>"
|
||||||
@@ -67,8 +67,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"target": "squirrel",
|
"target": "nsis",
|
||||||
"icon": "build/icon.ico"
|
"icon": "build/icon.ico",
|
||||||
|
"iconUrl": "https://raw.githubusercontent.com/zulip/zulip-electron/master/build/icon.ico"
|
||||||
|
},
|
||||||
|
"nsis": {
|
||||||
|
"perMachine": true,
|
||||||
|
"oneClick": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -82,7 +87,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"assert": "^1.4.1",
|
"assert": "^1.4.1",
|
||||||
"devtron": "^1.1.0",
|
"devtron": "^1.1.0",
|
||||||
"electron-builder": "10.15.1",
|
"electron-builder": "13.0.0",
|
||||||
"electron": "1.4.7",
|
"electron": "1.4.7",
|
||||||
"electron-connect": "^0.4.6",
|
"electron-connect": "^0.4.6",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
@@ -98,7 +103,7 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"max-lines": [
|
"max-lines": [
|
||||||
"warn",
|
"warn",
|
||||||
350
|
500
|
||||||
],
|
],
|
||||||
"no-warning-comments": 0,
|
"no-warning-comments": 0,
|
||||||
"no-else-return": 0,
|
"no-else-return": 0,
|
||||||
@@ -108,7 +113,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"tests/*.js"
|
"tests/*.js",
|
||||||
|
"app/main/macos-swipe-navigation.js"
|
||||||
],
|
],
|
||||||
"envs": [
|
"envs": [
|
||||||
"node",
|
"node",
|
||||||
@@ -116,4 +122,4 @@
|
|||||||
"mocha"
|
"mocha"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||||
export DISPLAY=:99.0
|
export {no_proxy,NO_PROXY}="127.0.0.1,localhost"
|
||||||
|
export DISPLAY=:99.0
|
||||||
sh -e /etc/init.d/xvfb start
|
sh -e /etc/init.d/xvfb start
|
||||||
sleep 3
|
sleep 3
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user