Compare commits

...

43 Commits

Author SHA1 Message Date
Akash Nimare
531973194c Use stable module version
Using stable version of node modules. 
Using '*' or 'latest' in node modules version could cause unexpected results and could break your code.
2017-01-03 15:14:56 +05:30
akashnimare
4d1face275 Removed electron-context-menu 2017-01-03 14:45:04 +05:30
akashnimare
ca7503f1f0 using electron-builder v10.15.1 2017-01-03 14:42:52 +05:30
Akash Nimare
9c163b4166 Merge pull request #97 from zulip/dev
export spellchecker function
2017-01-02 19:19:11 +05:30
akashnimare
742afb1c09 export spellchecker function 2017-01-02 19:15:08 +05:30
akashnimare
edf34efd86 Removed unnecessary dep. electron-dl 2016-12-31 22:26:42 +05:30
akashnimare
72ebed95da v0.5.4 2016-12-31 22:17:51 +05:30
Akash Nimare
975a6ab8bf electron-spellchecker
Downgrading since v0.7.1 is not working properly on linux.
2016-12-31 22:06:19 +05:30
akashnimare
3352301b67 :head_bandage: update electron-spellchecker 2016-12-31 20:28:09 +05:30
Akash Nimare
358260f766 Update README.md 2016-12-30 03:14:32 +05:30
Akash Nimare
b58052ce34 Merge pull request #94 from GervaisdeM/launch-script-tweak
rename zulip-electron-updater-and-launcher.sh to
2016-12-29 07:29:16 +05:30
GervaisdeM
de9ad8082b rename zulip-electron-updater-and-launcher.sh to
zulip-electron-launcher.sh

changed `npm upgrade` to `npm install`
2016-12-27 00:39:06 -04:00
akashnimare
d6bf84c821 🆙 Linux app version 2016-12-25 02:32:01 +05:30
Akash Nimare
d5cba4096d Update README.md 2016-12-23 02:40:01 +05:30
Akash Nimare
afa12cc266 Update README.md 2016-12-23 02:38:41 +05:30
Akash Nimare
42ede5e54b typo in email 2016-12-23 02:35:56 +05:30
Akash Nimare
1549db5ce0 Merge pull request #93 from zulip/autoupdates
🎉 Autoupdates for windows
2016-12-23 02:35:01 +05:30
akashnimare
a0de440c2e Unregister shortcuts on will-quit 2016-12-23 02:10:45 +05:30
akashnimare
7e54eb89c2 manage squirrel events 2016-12-23 01:48:22 +05:30
akashnimare
f8e77dfa72 Using squirrel.windows 2016-12-23 01:32:08 +05:30
akashnimare
db6d1f300a adding windows auto-update 2016-12-22 02:30:48 +05:30
Akash Nimare
eac2b92cb6 ⬆️ Test timeout 2016-12-16 15:20:03 +05:30
Akash Nimare
a349e0e4e0 Check linux travis 2016-12-16 14:32:02 +05:30
Akash Nimare
58f35569c8 Added trusty option for linux travis 2016-12-16 03:23:20 +05:30
Akash Nimare
4a9f51aa1b Autoupdate button >> later 2016-12-16 02:01:37 +05:30
Akash Nimare
5bb05906b5 Merge pull request #92 from zulip/dev
Update master with dev branch
2016-12-16 01:59:00 +05:30
akashnimare
f80095d953 Updated travis build script 2016-12-15 20:53:35 +05:30
akashnimare
181803755a fix OSX travis build 2016-12-15 20:39:50 +05:30
akashnimare
ef30cd9624 💚 Fixing CI Build 2016-12-15 20:21:05 +05:30
akashnimare
7c82f41e87 🎨 fixed linting errors 2016-12-15 19:59:12 +05:30
akashnimare
61dfcfc3b1 🐛 unregister keyboard shortcuts 2016-12-15 01:57:20 +05:30
Akash Nimare
e3deb93730 Update Zulip server 2016-12-14 03:16:45 +05:30
Akash Nimare
d6a3e5fe1b Updated zulip server 2016-12-14 03:15:33 +05:30
akashnimare
dc15edf0cd Unsubscribe spellchekcer 2016-12-14 03:02:01 +05:30
akashnimare
e5a60cc077 📦 v0.5.2-Beta 2016-12-14 01:53:00 +05:30
akashnimare
4d5c57fa0b disable auto-updates on dev mode 2016-12-14 01:11:08 +05:30
akashnimare
98bd4fd9b9 🔥 2016-12-14 00:55:29 +05:30
akashnimare
8b808ff9b2 Added auto-updates for OSX 2016-12-14 00:49:30 +05:30
akashnimare
4a2a495738 new tray icons 2016-12-10 14:39:54 +05:30
akashnimare
309816e40a tray icon fixed 2016-12-12 19:15:36 +05:30
Akash Nimare
79a31000df 📝 Updated installation instructions 2016-12-12 18:49:40 +05:30
akashnimare
8410769fdd linux icon fixed 2016-12-10 10:42:48 +05:30
Akash Nimare
fd25ac0cc4 Added Linux app category 2016-11-25 15:08:02 +05:30
20 changed files with 165 additions and 65 deletions

View File

@@ -1,12 +1,13 @@
language: node_js
sudo: required
dist: trusty
os:
- osx
- linux
sudo: required
language: node_js
node_js:
- 'node'
- '6'
before_install:
- npm install -g gulp
@@ -14,7 +15,10 @@ before_install:
cache:
directories:
- node_modules
- node_modules
- app/node_modules
- $HOME/.electron
- $HOME/.cache
script:
- npm run travis

View File

@@ -11,6 +11,15 @@ The goal is to achieve feature-compatibility with the old desktop app
and then start adding cool features like easy support for
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`:
```sh
$ sudo apt-get install nodejs-legacy
```
## Installation
Clone the source locally:
@@ -19,14 +28,6 @@ Clone the source locally:
$ git clone https://github.com/zulip/zulip-electron
$ cd zulip-electron
```
If you're on Debian or Ubuntu, you'll also need to install
`nodejs-legacy`:
Use your package manager to install `npm`.
```sh
$ sudo apt-get install npm nodejs-legacy
```
Install project dependencies:
@@ -59,6 +60,8 @@ You can create Windows installer only when running on Windows, the same is true
- [x] Native Notifications
- [x] SpellChecker
- [x] OSX/Win/Linux installer
- [x] Automatic Updates (macOS/Windows)
- [x] Keyboard shortcuts
Description | Keys
@@ -68,9 +71,6 @@ Change Zulip Server | <kbd>Cmd/Ctrl</kbd> <kbd>,</kbd>
Back | <kbd>Cmd/Ctrl</kbd> <kbd>[</kbd>
Forward | <kbd>Cmd/Ctrl</kbd> <kbd>]</kbd>
- [x] OSX/Win/Linux installer
- [ ] Launch on OS startup
- [ ] Automatic Updates
## Contribute

50
app/main/autoupdater.js Normal file
View File

@@ -0,0 +1,50 @@
'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;
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'));
// 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';
});
}
// 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
}, response => {
if (response === 0) {
setTimeout(() => autoUpdater.quitAndInstall(), 1);
}
});
});
// init for updates
autoUpdater.checkForUpdates();
}
exports = module.exports = {
appUpdater
};

View File

@@ -1,7 +1,7 @@
const JsonDB = require('node-json-db');
const {app} = require('electron').remote;
const request = require('request');
const ipcRenderer = require('electron').ipcRenderer;
const JsonDB = require('node-json-db');
const request = require('request');
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);
const data = db.getData('/');

View File

@@ -3,23 +3,29 @@ const path = require('path');
const fs = require('fs');
const electron = require('electron');
const {app} = require('electron');
const electronLocalshortcut = require('electron-localshortcut');
const ipc = require('electron').ipcMain;
const electronLocalshortcut = require('electron-localshortcut');
const Configstore = require('configstore');
const JsonDB = require('node-json-db');
const isDev = require('electron-is-dev');
const tray = require('./tray');
const appMenu = require('./menu');
const {linkIsInternal, skipImages} = require('./link-helper');
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')();
const conf = new Configstore('Zulip-Desktop');
// prevent window being garbage collected
let mainWindow;
let targetLink;
@@ -30,9 +36,8 @@ const staticURL = 'file://' + path.join(__dirname, '../renderer', 'index.html');
const targetURL = function () {
if (data.domain === undefined) {
return staticURL;
} else {
return data.domain;
}
return data.domain;
};
const isAlreadyRunning = app.makeSingleInstance(() => {
@@ -56,6 +61,10 @@ function checkWindowURL() {
return targetLink;
}
function isWindowsOrmacOS() {
return process.platform === 'darwin' || process.platform === 'win32';
}
const APP_ICON = path.join(__dirname, '../resources', 'Icon');
const iconPath = () => {
@@ -150,6 +159,8 @@ function createMainWindow() {
app.commandLine.appendSwitch('ignore-certificate-errors', 'true');
app.on('window-all-closed', () => {
// unregister all the shortcuts so that they don't interfare with other apps
electronLocalshortcut.unregisterAll(mainWindow);
if (process.platform !== 'darwin') {
app.quit();
}
@@ -198,6 +209,19 @@ app.on('ready', () => {
event.preventDefault();
electron.shell.openExternal(url);
});
page.once('did-frame-finish-load', () => {
const checkOS = isWindowsOrmacOS();
if (checkOS && !isDev) {
// Initate auto-updates on macOs and windows
appUpdater();
}
});
});
app.on('will-quit', () => {
// unregister all the shortcuts so that they don't interfare with other apps
electronLocalshortcut.unregisterAll(mainWindow);
});
ipc.on('new-domain', (e, domain) => {

View File

@@ -22,7 +22,6 @@ function sendAction(action) {
const viewSubmenu = [
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click(item, focusedWindow) {
if (focusedWindow) {
focusedWindow.reload();

View File

@@ -1,8 +1,11 @@
'use strict';
const ipcRenderer = require('electron').ipcRenderer;
const {webFrame} = require('electron');
const {spellChecker} = require('./spellchecker');
// Handle zooming functionality
require('./domain');
// handle zooming functionality
const zoomIn = () => {
webFrame.setZoomFactor(webFrame.getZoomFactor() + 0.1);
};
@@ -15,7 +18,7 @@ const zoomActualSize = () => {
webFrame.setZoomFactor(1);
};
// Get zooming actions from main process
// get zooming actions from main process
ipcRenderer.on('zoomIn', () => {
zoomIn();
});
@@ -44,9 +47,8 @@ ipcRenderer.on('shortcut', () => {
nodes[nodes.length - 1].click();
});
require('./domain');
// To prevent failing this script on linux we need to load it after the document loaded
document.addEventListener('DOMContentLoaded', function () {
require('./spellchecker');
document.addEventListener('DOMContentLoaded', () => {
// init spellchecker
spellChecker();
});

View File

@@ -1,14 +1,27 @@
const {SpellCheckHandler, ContextMenuListener, ContextMenuBuilder} = require('electron-spellchecker');
// Implement spellcheck using electron api
function spellChecker() {
// Implement spellcheck using electron api
window.spellCheckHandler = new SpellCheckHandler();
window.spellCheckHandler.attachToInput();
window.spellCheckHandler = new SpellCheckHandler();
window.spellCheckHandler.attachToInput();
// Start off as US English
window.spellCheckHandler.switchLanguage('en-US');
// Start off as US English
window.spellCheckHandler.switchLanguage('en-US');
const contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler);
const contextMenuListener = new ContextMenuListener(info => {
contextMenuBuilder.showPopupMenu(info);
});
let contextMenuBuilder = new ContextMenuBuilder(window.spellCheckHandler);
let contextMenuListener = new ContextMenuListener((info) => {
contextMenuBuilder.showPopupMenu(info);
});
// Clean up events after you navigate away from this page;
// otherwise, you may experience errors
window.addEventListener('beforeunload', () => {
// eslint-disable-next-line no-undef
spellCheckHandler.unsubscribe();
contextMenuListener.unsubscribe();
});
}
exports = module.exports = {
spellChecker
};

View File

@@ -6,10 +6,13 @@ const {addDomain, about} = require('./windowmanager');
let tray = null;
const APP_ICON = path.join(__dirname, '../resources', 'Icon');
const APP_ICON = path.join(__dirname, '../resources/tray', 'tray');
const iconPath = () => {
return APP_ICON + (process.platform === 'win32' ? '.ico' : '.png');
if (process.platform === 'linux') {
return APP_ICON + 'linux.png';
}
return APP_ICON + (process.platform === 'win32' ? 'win.ico' : 'osx.png');
};
exports.create = () => {

View File

@@ -1,7 +1,7 @@
{
"name": "zulip",
"productName": "Zulip",
"version": "0.5.1",
"version": "0.5.4",
"description": "Zulip Desktop App",
"license": "Apache-2.0",
"email":"<svnitakash@gmail.com>",
@@ -27,15 +27,15 @@
"InstantMessaging"
],
"dependencies": {
"configstore": "^2.0.0",
"electron-is-dev": "0.1.2",
"electron-squirrel-startup": "1.0.0",
"configstore": "2.1.0",
"dialogs": "1.1.14",
"electron-context-menu": "0.4.0",
"electron-debug": "^1.0.0",
"electron-dl": "^0.2.0",
"electron-localshortcut": "^0.6.1",
"node-json-db": "^0.7.2",
"request": "^2.74.0",
"electron-spellchecker": "^0.5.12",
"wurl": "^2.1.0"
"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",
"wurl": "2.1.0"
}
}

View File

@@ -23,7 +23,7 @@
<fieldset>
<div class="control-group control-required">
<div class="control-field">
<input type="text" id="url" autofocus="autofocus" spellcheck="false" placeholder="zulip.tabbott.net">
<input type="text" id="url" autofocus="autofocus" spellcheck="false" placeholder="chat.zulip.org">
</div>
</div>
<div class="control-group">

View File

@@ -1,4 +1,5 @@
'use strict';
// eslint-disable-next-line import/no-extraneous-dependencies
const {remote} = require('electron');
const prefWindow = remote.getCurrentWindow();
@@ -15,8 +16,10 @@ document.addEventListener('keydown', event => {
// eslint-disable-next-line no-unused-vars
function addDomain() {
const request = require('request');
// eslint-disable-next-line import/no-extraneous-dependencies
const ipcRenderer = require('electron').ipcRenderer;
const JsonDB = require('node-json-db');
// eslint-disable-next-line import/no-extraneous-dependencies
const {app} = require('electron').remote;
const db = new JsonDB(app.getPath('userData') + '/domain.json', true, true);

View File

@@ -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="zulip.example.com">
<input id="url" type="text" placeholder="chat.zulip.org">
<button type="submit" id="main" value="Submit" onclick="addDomain();">
Switch</button>
<img id="pic" src="img/loader.gif" />
@@ -19,4 +19,4 @@
</div>
<script src="js/pref.js"></script>
</body>
</html>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 333 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@@ -1,7 +1,7 @@
{
"name": "zulip",
"productName": "Zulip",
"version": "0.5.1",
"version": "0.5.4",
"description": "Zulip Desktop App",
"license": "Apache-2.0",
"email":"<svnitakash@gmail.com>",
@@ -40,10 +40,10 @@
"linux" : {
"synopsis": "Zulip Desktop App",
"category": "",
"packageCategory": "",
"packageCategory": "GNOME;GTK;Network;InstantMessaging",
"description": "Zulip Desktop Client for Linux",
"target" : ["deb", "AppImage"],
"version" : "0.5.1",
"version" : "0.5.4",
"title" : "Zulip",
"license": "Apache-2.0",
"maintainer": "Akash Nimare <svnitakash@gmail.com>"
@@ -67,7 +67,7 @@
]
},
"win": {
"target": "nsis",
"target": "squirrel",
"icon": "build/icon.ico"
}
},
@@ -82,7 +82,7 @@
"devDependencies": {
"assert": "^1.4.1",
"devtron": "^1.1.0",
"electron-builder": "*",
"electron-builder": "10.15.1",
"electron": "1.4.7",
"electron-connect": "^0.4.6",
"gulp": "^3.9.1",
@@ -101,7 +101,9 @@
350
],
"no-warning-comments": 0,
"no-else-return": 0
"no-else-return": 0,
"import/no-unresolved": 0,
"import/no-extraneous-dependencies":0
}
}
],
@@ -114,4 +116,4 @@
"mocha"
]
}
}
}

View File

@@ -2,7 +2,7 @@ const assert = require('assert')
const Application = require('spectron').Application
describe('application launch', function () {
this.timeout(10000)
this.timeout(15000)
beforeEach(function () {
this.app = new Application({

View File

@@ -74,11 +74,11 @@ gitCheckout()
}
# }}}
# {{{ npmUpgradeStart()
# {{{ npmInstallStart()
npmUpgradeStart()
npmInstallStart()
{
npm upgrade
npm install
npm start &
}
@@ -105,5 +105,5 @@ cleanUp()
envSetup $*
gitCheckout
npmUpgradeStart
cleanUp
npmInstallStart
cleanUp