Review invite sending and release to TEST channel

This commit is contained in:
Tankred Hase 2013-11-21 15:36:16 +01:00
parent ab43098fe5
commit e13268625f
5 changed files with 78 additions and 77 deletions

View File

@ -1,52 +1,60 @@
define([], function() {
'use strict';
define(function(require) {
'use strict';
/**
* Create the application namespace
*/
var app = {};
var _ = require('underscore'),
app = {},
cloudUrl, clientId;
/**
* Global app configurations
*/
app.config = {
cloudUrl: 'https://keys.whiteout.io',
symKeySize: 128,
symIvSize: 128,
asymKeySize: 2048,
workerPath: 'js',
gmail: {
clientId: '440907777130.apps.googleusercontent.com',
imap: {
secure: true,
port: 993,
host: 'imap.gmail.com'
},
smtp: {
secure: true,
port: 465,
host: 'smtp.gmail.com'
}
},
checkOutboxInterval: 30000,
iconPath: '/img/icon.png',
verificationUrl: '/verify/'
};
// parse manifest to get configurations for current runtime
try {
var manifest = chrome.runtime.getManifest();
cloudUrl = _.find(manifest.permissions, function(permission) {
return typeof permission === 'string' && permission.indexOf('http') === 0;
});
clientId = manifest.oauth2.client_id;
} catch (e) {}
/**
* Strings are maintained here
*/
app.string = {
subjectPrefix: '[whiteout] ',
invitationSubject: 'Invitation to a private conversation',
invitationMessage: 'I would like to invite you to a private conversation. To read my encrypted messages, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg',
message: 'this is a private conversation. To read my encrypted message below, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg',
cryptPrefix: '-----BEGIN PGP MESSAGE-----',
cryptSuffix: '-----END PGP MESSAGE-----',
signature: 'Sent securely from whiteout mail',
webSite: 'http://whiteout.io',
verificationSubject: 'New public key uploaded'
};
/**
* Global app configurations
*/
app.config = {
cloudUrl: cloudUrl || 'https://keys.whiteout.io',
symKeySize: 128,
symIvSize: 128,
asymKeySize: 2048,
workerPath: 'js',
gmail: {
clientId: clientId || '440907777130.apps.googleusercontent.com',
imap: {
secure: true,
port: 993,
host: 'imap.gmail.com'
},
smtp: {
secure: true,
port: 465,
host: 'smtp.gmail.com'
}
},
checkOutboxInterval: 5000,
iconPath: '/img/icon.png',
verificationUrl: '/verify/'
};
return app;
/**
* Strings are maintained here
*/
app.string = {
subjectPrefix: '[whiteout] ',
invitationSubject: 'Invitation to a private conversation',
invitationMessage: 'I would like to invite you to a private conversation. To read my encrypted messages, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg',
message: 'this is a private conversation. To read my encrypted message below, simply install Whiteout Mail for Chrome. The app is really easy to use and automatically encrypts sent emails, so that only the two of us can read them: https://chrome.google.com/webstore/detail/jjgghafhamholjigjoghcfcekhkonijg',
cryptPrefix: '-----BEGIN PGP MESSAGE-----',
cryptSuffix: '-----END PGP MESSAGE-----',
signature: 'Sent securely from whiteout mail',
webSite: 'http://whiteout.io',
verificationSubject: 'New public key uploaded'
};
return app;
});

View File

@ -36,6 +36,19 @@ define(function(require) {
$scope.state.nav.toggle(false);
};
$scope.onOutboxUpdate = function(err, count) {
if (err) {
$scope.onError(err);
return;
}
var outbox = _.findWhere($scope.folders, {
type: 'Outbox'
});
outbox.count = count;
$scope.$apply();
};
//
// Start
//
@ -64,7 +77,9 @@ define(function(require) {
});
// start checking outbox periodically
outboxBo.startChecking(onOutboxUpdate);
outboxBo.startChecking($scope.onOutboxUpdate);
// make function available globally for write controller
$scope.emptyOutbox = outboxBo._processOutbox;
callback(folders);
$scope.$apply();
@ -94,22 +109,6 @@ define(function(require) {
path: 'TRASH'
}]);
}
// update outbox count
function onOutboxUpdate(err, count) {
if (err) {
$scope.onError(err);
return;
}
var outbox = _.findWhere($scope.folders, {
type: 'Outbox'
});
outbox.count = count;
$scope.$apply();
}
};
//

View File

@ -146,15 +146,6 @@ define(function(require) {
return;
}
// only allow secure recipients until invitation is implemented
if (!$scope.toKey) {
$scope.onError({
errMsg: 'Invitations not yet supported!',
sync: true
});
return;
}
// remove generated html from body
body = parseBody($scope.body);
@ -184,7 +175,7 @@ define(function(require) {
$scope.state.writer.close();
$scope.$apply();
$scope.emptyOutbox();
$scope.emptyOutbox($scope.onOutboxUpdate);
markAnwsered();
});

View File

@ -35,7 +35,7 @@ define(function() {
return;
}
this._restDao.put(null, uri(options.recipient, options.sender), completed);
this._restDao.put({}, uri(options.recipient, options.sender), completed);
function completed(error, res, status) {
if (error) {
@ -71,7 +71,10 @@ define(function() {
return;
}
this._restDao.get(null, uri(options.recipient, options.sender), completed);
this._restDao.get({
uri: uri(options.recipient, options.sender),
type: 'text'
}, completed);
function completed(error, res, status) {
// 404 is a meaningful return value from the web service

View File

@ -12,7 +12,7 @@
"fileSystem": ["write"]
},
"notifications",
"https://keys.whiteout.io/",
"https://keys-test.whiteout.io",
"identity", {
"socket": [
"tcp-connect:imap.gmail.com:993",