Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Antelle committed Nov 22, 2015
2 parents 542f9ef + a26a6c8 commit 004e6f1
Show file tree
Hide file tree
Showing 70 changed files with 1,009 additions and 220 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function(grunt) {
var webpack = require('webpack');
var pkg = require('./package.json');
var dt = new Date().toISOString().replace(/T.*/, '');
var electronVersion = '0.34.0';
var electronVersion = '0.35.1';

function replaceFont(css) {
css.walkAtRules('font-face', function (rule) {
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The app can run either in browser, or as a desktop app.

Apps: [Web](https://antelle.github.io/keeweb/) [Desktop](https://github.com/antelle/keeweb/releases/latest)
Timeline: [Release Notes](release-notes.md) [TODO](TODO.md)
On one page: [Features](features.md)
On one page: [Features](features.md) [FAQ](https://github.com/antelle/keeweb/wiki/FAQ)
Twitter: [kee_web](https://twitter.com/kee_web)

# Status
Expand All @@ -21,6 +21,7 @@ Reading and display is mostly complete; modification and sync is under construct
These major issues are in progress, or will be fixed in next releases, before v1.0:

- dropbox sync is one-way: changes are not loaded from dropbox, only saved
- files are considered saved only when they are exported

# Self-hosting

Expand Down
21 changes: 4 additions & 17 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
# TODO

## v0.4
Nov
- [ ] lock flow, auto-lock
- [ ] minimize to tray
- [ ] trim history by rules
- [ ] custom icons, favicons
- [ ] drag to trash
- [ ] switch view
- [ ] option to check updates without install

## v0.5
Dec
- [ ] conflict-free 2-way merge sync
- [ ] rethink locking and storage concept
- [ ] tech debt: unify storage providers
- [ ] tech debt: reload after db operations

## v0.6
Dec-Jan
- [ ] secure inputs for all passwords
- [ ] option to auto-clear clipboard
- [ ] mobile bugfixes
- [ ] advanced search
- [ ] help/tips

## v0.7
Jan
- [ ] tech debt: unify storage providers
- [ ] tech debt: refactor app-view
- [ ] tech debt: reload after db operations
- [ ] tech debt: string globalization
- [ ] tech debt: binaries and history

Expand All @@ -35,14 +22,14 @@ Feb
- [ ] QA

## Future
- [ ] desktop dropbox
- [ ] auto-type for desktop
- [ ] file type associations
- [ ] one-time passwords
- [ ] audit
- [ ] generation templates
- [ ] entry templates
- [ ] drag entries across files
- [ ] customizable table view
- [ ] i18n
- [ ] allow to increase font size
- [ ] different storage options
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var AppModel = require('./models/app-model'),
AppView = require('./views/app-view'),
KeyHandler = require('./comp/key-handler'),
IdleTracker = require('./comp/idle-tracker'),
Alerts = require('./comp/alerts'),
DropboxLink = require('./comp/dropbox-link'),
Updater = require('./comp/updater'),
Expand All @@ -17,6 +18,7 @@ $(function() {
return;
}
KeyHandler.init();
IdleTracker.init();

var appModel = new AppModel();
if (appModel.settings.get('theme')) {
Expand Down
10 changes: 7 additions & 3 deletions app/scripts/comp/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@
var ModalView = require('../views/modal-view');

var Alerts = {
alertDisplayed: false,

buttons: {
ok: {result: 'yes', title: 'OK'},
yes: {result: 'yes', title: 'Yes'},
no: {result: '', title: 'No'}
},

alert: function(config) {
Alerts.alertDisplayed = true;
var view = new ModalView({ model: config });
view.render();
view.on('result', function(res) {
view.on('result', function(res, check) {
Alerts.alertDisplayed = false;
if (res && config.success) {
config.success(res);
config.success(res, check);
}
if (!res && config.cancel) {
config.cancel();
}
if (config.complete) {
config.complete(res);
config.complete(res, check);
}
});
},
Expand Down
25 changes: 23 additions & 2 deletions app/scripts/util/copy-paste.js → app/scripts/comp/copy-paste.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
'use strict';

var FeatureDetector = require('./feature-detector');
var FeatureDetector = require('../util/feature-detector'),
Launcher = require('./launcher'),
AppSettingsModel = require('../models/app-settings-model');

var CopyPaste = {
tryCopy: function() {
try {
return document.execCommand('copy');
var success = document.execCommand('copy');
if (success) {
this.copied();
}
return success;
} catch (e) {
return false;
}
Expand All @@ -31,6 +37,21 @@ var CopyPaste = {
'copy cut paste': function() { setTimeout(function() { hiddenInput.blur(); }, 0); },
blur: function() { hiddenInput.remove(); }
});
},

copied: function() {
if (Launcher) {
var clipboardSeconds = AppSettingsModel.instance.get('clipboardSeconds');
if (clipboardSeconds > 0) {
setTimeout(function() {
setTimeout((function (prevText) {
if (Launcher.getClipboardText() === prevText) {
Launcher.clearClipboardText();
}
}).bind(null, Launcher.getClipboardText()), clipboardSeconds * 1000);
}, 0);
}
}
}
};

Expand Down
42 changes: 34 additions & 8 deletions app/scripts/comp/dropbox-link.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
'use strict';

var Dropbox = require('dropbox'),
Alerts = require('./alerts');
Alerts = require('./alerts'),
Launcher = require('./launcher'),
Links = require('../const/links');

var DropboxKeys = {
AppFolder: 'qp7ctun6qt5n9d6'
AppFolder: 'qp7ctun6qt5n9d6',
AppFolderKeyParts: ['qp7ctun6', 'qt5n9d6'] // to allow replace key by sed, compare in this way
};

var DropboxCustomErrors = {
BadKey: 'bad-key'
};

function isValidKey() {
var isSelfHostedApp = !/^http(s?):\/\/localhost:8085/.test(location.href) &&
!/http(s?):\/\/antelle\.github\.io\/keeweb/.test(location.href);
return Launcher || !isSelfHostedApp || DropboxKeys.AppFolder !== DropboxKeys.AppFolderKeyParts.join('');
}

var DropboxChooser = function(callback) {
this.cb = callback;
this.onMessage = this.onMessage.bind(this);
Expand Down Expand Up @@ -113,8 +126,21 @@ var DropboxLink = {
complete(null, this._dropboxClient);
return;
}
var client = new Dropbox.Client({ key: DropboxKeys.AppFolder });
client.authDriver(new Dropbox.AuthDriver.Popup({ receiverUrl: location.href }));
if (!isValidKey()) {
Alerts.error({
icon: 'dropbox',
header: 'Dropbox not configured',
body: 'So, you are using KeeWeb on your own server? Good!<br/>' +
'<a href="' + Links.SelfHostedDropbox + '" target="blank">Some configuration</a> is required to make Dropbox work, it\'s just 3 steps away.'
});
return complete(DropboxCustomErrors.BadKey);
}
var client = new Dropbox.Client({key: DropboxKeys.AppFolder});
if (Launcher) {
client.authDriver(new Dropbox.AuthDriver.Electron({ receiverUrl: location.href }));
} else {
client.authDriver(new Dropbox.AuthDriver.Popup({ receiverUrl: location.href }));
}
client.authenticate((function(error, client) {
if (!error) {
this._dropboxClient = client;
Expand Down Expand Up @@ -189,7 +215,7 @@ var DropboxLink = {
if (err) {
return callback(err);
}
client[callName].apply(client, args.concat(function(err, res) {
client[callName].apply(client, args.concat(function(err) {
if (err) {
that._handleUiError(err, errorAlertCallback, function(repeat) {
if (repeat) {
Expand All @@ -199,7 +225,7 @@ var DropboxLink = {
}
});
} else {
callback(err, res);
callback.apply(null, arguments);
}
}));
});
Expand Down Expand Up @@ -231,11 +257,11 @@ var DropboxLink = {
},

getFileList: function(complete) {
this._callAndHandleError('readdir', [''], function(err, files) {
this._callAndHandleError('readdir', [''], function(err, files, dirStat) {
if (files) {
files = files.filter(function(f) { return /\.kdbx$/i.test(f); });
}
complete(err, files);
complete(err, files, dirStat);
});
},

Expand Down
21 changes: 21 additions & 0 deletions app/scripts/comp/idle-tracker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

var Backbone = require('backbone'),
AppSettingsModel = require('../models/app-settings-model');

var IdleTracker = {
idleMinutes: 0,
init: function() {
setInterval(this.minuteTick.bind(this), 1000 * 60);
},
minuteTick: function() {
if (++this.idleMinutes === AppSettingsModel.instance.get('idleMinutes')) {
Backbone.trigger('user-idle');
}
},
regUserAction: function() {
this.idleMinutes = 0;
}
};

module.exports = IdleTracker;
8 changes: 7 additions & 1 deletion app/scripts/comp/key-handler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

var Backbone = require('backbone'),
Keys = require('../const/keys');
Keys = require('../const/keys'),
IdleTracker = require('../comp/idle-tracker');

var shortcutKeyProp = navigator.platform.indexOf('Mac') >= 0 ? 'metaKey' : 'ctrlKey';

Expand All @@ -11,6 +12,7 @@ var KeyHandler = {

shortcuts: {},
modal: false,

init: function() {
$(document).bind('keypress', this.keypress.bind(this));
$(document).bind('keydown', this.keydown.bind(this));
Expand All @@ -36,6 +38,7 @@ var KeyHandler = {
return e[shortcutKeyProp];
},
keydown: function(e) {
IdleTracker.regUserAction();
var code = e.keyCode || e.which;
var keyShortcuts = this.shortcuts[code];
if (keyShortcuts && keyShortcuts.length) {
Expand Down Expand Up @@ -72,6 +75,9 @@ var KeyHandler = {
!e.altKey && !e.ctrlKey && !e.metaKey) {
this.trigger('keypress', e);
}
},
reg: function() {
IdleTracker.regUserAction();
}
};

Expand Down
12 changes: 12 additions & 0 deletions app/scripts/comp/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ if (window.process && window.process.versions && window.process.versions.electro
},
cancelRestart: function() {
this.restartPending = false;
},
getClipboardText: function() {
return this.req('clipboard').readText();
},
clearClipboardText: function() {
return this.req('clipboard').clear();
},
minimizeApp: function() {
this.remReq('app').minimizeApp();
},
canMinimize: function() {
return process.platform === 'win32';
}
};
window.launcherOpen = function(path) {
Expand Down
Loading

0 comments on commit 004e6f1

Please sign in to comment.