mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-24 16:43:38 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2286b6110 | ||
|
|
27ba3f3068 | ||
|
|
9859315fea | ||
|
|
73d18dde9e | ||
|
|
0372befc5a | ||
|
|
063799a053 | ||
|
|
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
|
||||
* node >= v6.3.1
|
||||
* npm >= 3.10.3
|
||||
* If you're on Debian or Ubuntu, you'll also need to install
|
||||
`nodejs-legacy`:
|
||||
* python (v2.7.x recommended)
|
||||
* If you're on Debian or Ubuntu, you'll need to install following packages:
|
||||
```sh
|
||||
$ sudo apt-get install nodejs-legacy
|
||||
$ sudo apt-get install nodejs-legacy build-essential libxext-dev libxtst-dev libxkbfile-dev
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -1,40 +1,36 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const {app, autoUpdater, dialog} = require('electron');
|
||||
|
||||
const version = app.getVersion();
|
||||
const platform = os.platform() + '_' + os.arch(); // usually returns darwin_64
|
||||
|
||||
const updaterFeedURL = 'http://zulipdesktop.herokuapp.com/update/' + platform + '/' + version;
|
||||
const {app, dialog} = require('electron');
|
||||
const {autoUpdater} = require('electron-updater');
|
||||
|
||||
function appUpdater() {
|
||||
autoUpdater.setFeedURL(updaterFeedURL);
|
||||
|
||||
// Log whats happening
|
||||
// TODO send autoUpdater events to renderer so that we could
|
||||
// it could console log in developer tools
|
||||
autoUpdater.on('error', err => console.log(err));
|
||||
autoUpdater.on('checking-for-update', () => console.log('checking-for-update'));
|
||||
autoUpdater.on('update-available', () => console.log('update-available'));
|
||||
autoUpdater.on('update-not-available', () => console.log('update-not-available'));
|
||||
const log = require('electron-log');
|
||||
log.transports.file.level = 'info';
|
||||
autoUpdater.logger = log;
|
||||
/*
|
||||
autoUpdater.on('error', err => log.info(err));
|
||||
autoUpdater.on('checking-for-update', () => log.info('checking-for-update'));
|
||||
autoUpdater.on('update-available', () => log.info('update-available'));
|
||||
autoUpdater.on('update-not-available', () => log.info('update-not-available'));
|
||||
*/
|
||||
|
||||
// Ask the user if update is available
|
||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
||||
let message = app.getName() + ' ' + releaseName + ' is now available. It will be installed the next time you restart the application.';
|
||||
if (releaseNotes) {
|
||||
const splitNotes = releaseNotes.split(/[^\r]\n/);
|
||||
message += '\n\nRelease notes:\n';
|
||||
splitNotes.forEach(notes => {
|
||||
message += notes + '\n\n';
|
||||
});
|
||||
}
|
||||
autoUpdater.on('update-downloaded', (event, info) => {
|
||||
// let message = app.getName() + ' ' + info.releaseName + ' is now available. It will be installed the next time you restart the application.';
|
||||
// if (info.releaseNotes) {
|
||||
// const splitNotes = info.releaseNotes.split(/[^\r]\n/);
|
||||
// message += '\n\nRelease notes:\n';
|
||||
// splitNotes.forEach(notes => {
|
||||
// message += notes + '\n\n';
|
||||
// });
|
||||
// }
|
||||
// Ask user to update the app
|
||||
dialog.showMessageBox({
|
||||
type: 'question',
|
||||
buttons: ['Install and Relaunch', 'Later'],
|
||||
defaultId: 0,
|
||||
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 => {
|
||||
if (response === 0) {
|
||||
setTimeout(() => autoUpdater.quitAndInstall(), 1);
|
||||
|
||||
@@ -29,7 +29,7 @@ window.addDomain = function () {
|
||||
ipcRenderer.send('new-domain', domain);
|
||||
} else {
|
||||
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,11 +16,6 @@ const {appUpdater} = require('./autoupdater');
|
||||
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
|
||||
const data = db.getData('/');
|
||||
|
||||
// Handling squirrel.windows events on windows
|
||||
if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
}
|
||||
|
||||
// adds debug features like hotkeys for triggering dev tools and reload
|
||||
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 electron = require('electron');
|
||||
|
||||
const {dialog} = require('electron');
|
||||
|
||||
const app = electron.app;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const shell = electron.shell;
|
||||
@@ -19,6 +21,14 @@ function sendAction(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 = [
|
||||
{
|
||||
label: 'Reload',
|
||||
@@ -134,8 +144,15 @@ const darwinTpl = [
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Clear Cache',
|
||||
click() {
|
||||
clearCache();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Log Out',
|
||||
accelerator: 'Cmd+L',
|
||||
click(item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
sendAction('log-out');
|
||||
@@ -263,8 +280,15 @@ const otherTpl = [
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Clear Cache',
|
||||
click() {
|
||||
clearCache();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Log Out',
|
||||
accelerator: 'Ctrl+L',
|
||||
click(item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
sendAction('log-out');
|
||||
@@ -312,7 +336,6 @@ const otherTpl = [
|
||||
{
|
||||
role: 'selectall'
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,6 +3,10 @@ const ipcRenderer = require('electron').ipcRenderer;
|
||||
const {webFrame} = require('electron');
|
||||
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');
|
||||
|
||||
// handle zooming functionality
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "zulip",
|
||||
"productName": "Zulip",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.8",
|
||||
"description": "Zulip Desktop App",
|
||||
"license": "Apache-2.0",
|
||||
"email":"<svnitakash@gmail.com>",
|
||||
"copyright": "©2016 Kandra Labs, Inc.",
|
||||
"copyright": "©2017 Kandra Labs, Inc.",
|
||||
"author": {
|
||||
"name": "Akash Nimare",
|
||||
"email": "svnitakash@gmail.com"
|
||||
@@ -28,14 +28,15 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"electron-is-dev": "0.1.2",
|
||||
"electron-squirrel-startup": "1.0.0",
|
||||
"electron-updater": "1.6.2",
|
||||
"electron-log": "1.3.0",
|
||||
"configstore": "2.1.0",
|
||||
"dialogs": "1.1.14",
|
||||
"electron-debug": "1.1.0",
|
||||
"electron-localshortcut": "0.6.1",
|
||||
"node-json-db": "0.7.3",
|
||||
"request": "2.79.0",
|
||||
"electron-spellchecker": "0.7.0",
|
||||
"electron-spellchecker": "1.0.0",
|
||||
"wurl": "2.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
<section class="content">
|
||||
<section class="server">
|
||||
<div class="container">
|
||||
<h1>Login to Zulip Server</h1>
|
||||
<h1>Enter your Zulip Server URL</h1>
|
||||
<form id="frm-signInForm" class="form-large" onsubmit="addDomain(); return false">
|
||||
<fieldset>
|
||||
<div class="control-group control-required">
|
||||
<div class="control-field">
|
||||
<input type="text" id="url" autofocus="autofocus" spellcheck="false" placeholder="chat.zulip.org">
|
||||
<input type="text" id="url" autofocus="autofocus" spellcheck="false" placeholder="Server URL">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
||||
@@ -42,7 +42,7 @@ function addDomain() {
|
||||
} else {
|
||||
document.getElementById('pic').style.display = 'none';
|
||||
document.getElementById('main').innerHTML = 'Switch';
|
||||
document.getElementById('urladded').innerHTML = 'Not a vaild Zulip Server.';
|
||||
document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="close" id="close-button">Close</div>
|
||||
<div class="form">
|
||||
<form onsubmit="addDomain(); return false">
|
||||
<input id="url" type="text" placeholder="chat.zulip.org">
|
||||
<input id="url" type="text" placeholder="Server URL">
|
||||
<button type="submit" id="main" value="Submit" onclick="addDomain();">
|
||||
Switch</button>
|
||||
<img id="pic" src="img/loader.gif" />
|
||||
|
||||
25
package.json
25
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "zulip",
|
||||
"productName": "Zulip",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.8",
|
||||
"description": "Zulip Desktop App",
|
||||
"license": "Apache-2.0",
|
||||
"email":"<svnitakash@gmail.com>",
|
||||
@@ -24,6 +24,7 @@
|
||||
"dev": "gulp dev",
|
||||
"pack": "build --dir",
|
||||
"dist": "build",
|
||||
"build:win": "build --win nsis-web --ia32 --x64",
|
||||
"travis": "cd ./scripts && ./travis-build-test.sh"
|
||||
},
|
||||
"build": {
|
||||
@@ -33,7 +34,7 @@
|
||||
"**/*",
|
||||
"!node_modules/@paulcbetts/cld/deps/cld${/*}"
|
||||
],
|
||||
"copyright": "©2016 Kandra Labs, Inc.",
|
||||
"copyright": "©2017 Kandra Labs, Inc.",
|
||||
"mac": {
|
||||
"category": "public.app-category.productivity"
|
||||
},
|
||||
@@ -43,7 +44,7 @@
|
||||
"packageCategory": "GNOME;GTK;Network;InstantMessaging",
|
||||
"description": "Zulip Desktop Client for Linux",
|
||||
"target" : ["deb", "AppImage"],
|
||||
"version" : "0.5.4",
|
||||
"version" : "0.5.8",
|
||||
"title" : "Zulip",
|
||||
"license": "Apache-2.0",
|
||||
"maintainer": "Akash Nimare <svnitakash@gmail.com>"
|
||||
@@ -67,8 +68,13 @@
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"target": "squirrel",
|
||||
"icon": "build/icon.ico"
|
||||
"target": "nsis",
|
||||
"icon": "build/icon.ico",
|
||||
"iconUrl": "https://raw.githubusercontent.com/zulip/zulip-electron/master/build/icon.ico"
|
||||
},
|
||||
"nsis": {
|
||||
"perMachine": true,
|
||||
"oneClick": false
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
@@ -82,7 +88,7 @@
|
||||
"devDependencies": {
|
||||
"assert": "^1.4.1",
|
||||
"devtron": "^1.1.0",
|
||||
"electron-builder": "10.15.1",
|
||||
"electron-builder": "13.6.0",
|
||||
"electron": "1.4.7",
|
||||
"electron-connect": "^0.4.6",
|
||||
"gulp": "^3.9.1",
|
||||
@@ -98,7 +104,7 @@
|
||||
"rules": {
|
||||
"max-lines": [
|
||||
"warn",
|
||||
350
|
||||
500
|
||||
],
|
||||
"no-warning-comments": 0,
|
||||
"no-else-return": 0,
|
||||
@@ -108,7 +114,8 @@
|
||||
}
|
||||
],
|
||||
"ignore": [
|
||||
"tests/*.js"
|
||||
"tests/*.js",
|
||||
"app/main/macos-swipe-navigation.js"
|
||||
],
|
||||
"envs": [
|
||||
"node",
|
||||
@@ -116,4 +123,4 @@
|
||||
"mocha"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
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
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user