mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Pgp improvements
This commit is contained in:
parent
3849fd02b4
commit
5123841540
18 changed files with 397 additions and 80 deletions
|
|
@ -74,9 +74,7 @@
|
||||||
// Audio.prototype.record = function ()
|
// Audio.prototype.record = function ()
|
||||||
// {
|
// {
|
||||||
// this.getUserMedia({audio:true}, function () {
|
// this.getUserMedia({audio:true}, function () {
|
||||||
// window.console.log(arguments);
|
|
||||||
// }, function(oError) {
|
// }, function(oError) {
|
||||||
// window.console.log(arguments);
|
|
||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
||||||
Enums = require('Common/Enums'),
|
Enums = require('Common/Enums'),
|
||||||
|
Utils = require('Common/Utils'),
|
||||||
Globals = require('Common/Globals')
|
Globals = require('Common/Globals')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -24,6 +25,8 @@
|
||||||
this.trigger = ko.observable(false);
|
this.trigger = ko.observable(false);
|
||||||
|
|
||||||
this.i18n = _.bind(this.i18n, this);
|
this.i18n = _.bind(this.i18n, this);
|
||||||
|
|
||||||
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator.prototype.data = {};
|
Translator.prototype.data = {};
|
||||||
|
|
@ -293,29 +296,41 @@
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
$html = $('html'),
|
|
||||||
fEmptyFunction = function () {},
|
|
||||||
iStart = (new Date()).getTime()
|
iStart = (new Date()).getTime()
|
||||||
;
|
;
|
||||||
|
|
||||||
$html.addClass('rl-changing-language');
|
Globals.$html.addClass('rl-changing-language');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
'url': require('Common/Links').langLink(sLanguage, bAdmin),
|
'url': require('Common/Links').langLink(sLanguage, bAdmin),
|
||||||
'dataType': 'script',
|
'dataType': 'script',
|
||||||
'cache': true
|
'cache': true
|
||||||
})
|
})
|
||||||
.fail(fFail || fEmptyFunction)
|
.fail(fFail || Utils.emptyFunction)
|
||||||
.done(function () {
|
.done(function () {
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
|
|
||||||
self.reloadData();
|
self.reloadData();
|
||||||
(fDone || fEmptyFunction)();
|
|
||||||
$html.removeClass('rl-changing-language');
|
(fDone || Utils.emptyFunction)();
|
||||||
|
|
||||||
|
Globals.$html
|
||||||
|
.removeClass('rl-changing-language')
|
||||||
|
.removeClass('rl-rtl rl-ltr')
|
||||||
|
.addClass(-1 < Utils.inArray(sLanguage, ['ar', 'he', 'ur']) ? 'rl-rtl' : 'rl-ltr')
|
||||||
|
// .attr('dir', -1 < Utils.inArray(sLanguage, ['ar', 'he', 'ur']) ? 'rtl' : 'ltr')
|
||||||
|
;
|
||||||
|
|
||||||
}, 500 < (new Date()).getTime() - iStart ? 1 : 500);
|
}, 500 < (new Date()).getTime() - iStart ? 1 : 500);
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Translator.prototype.init = function ()
|
||||||
|
{
|
||||||
|
Globals.$html.addClass('rl-' + (Globals.$html.attr('dir') || 'ltr'));
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = new Translator();
|
module.exports = new Translator();
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
|
||||||
|
|
@ -852,7 +852,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
convertPre = function () {
|
convertPre = function () {
|
||||||
return (arguments && 1 < arguments.length) ? arguments[1].toString().replace(/[\n]/gm, '<br />') : '';
|
return (arguments && 1 < arguments.length) ?
|
||||||
|
arguments[1].toString()
|
||||||
|
.replace(/[\n]/gm, '<br />')
|
||||||
|
.replace(/[\r]/gm, '')
|
||||||
|
: '';
|
||||||
},
|
},
|
||||||
|
|
||||||
fixAttibuteValue = function () {
|
fixAttibuteValue = function () {
|
||||||
|
|
@ -868,7 +872,7 @@
|
||||||
sText = sHtml
|
sText = sHtml
|
||||||
.replace(/\u0002([\s\S]*)\u0002/gm, '\u200C$1\u200C')
|
.replace(/\u0002([\s\S]*)\u0002/gm, '\u200C$1\u200C')
|
||||||
.replace(/<p[^>]*><\/p>/gi, '')
|
.replace(/<p[^>]*><\/p>/gi, '')
|
||||||
.replace(/<pre[^>]*>([\s\S\r\n]*)<\/pre>/gmi, convertPre)
|
.replace(/<pre[^>]*>([\s\S\r\n\t]*)<\/pre>/gmi, convertPre)
|
||||||
.replace(/[\s]+/gm, ' ')
|
.replace(/[\s]+/gm, ' ')
|
||||||
.replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gmi, fixAttibuteValue)
|
.replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gmi, fixAttibuteValue)
|
||||||
.replace(/<br[^>]*>/gmi, '\n')
|
.replace(/<br[^>]*>/gmi, '\n')
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
|
|
||||||
Utils = require('Common/Utils'),
|
Utils = require('Common/Utils'),
|
||||||
|
Translator = require('Common/Translator'),
|
||||||
|
|
||||||
AbstractInput = require('Component/AbstractInput')
|
AbstractInput = require('Component/AbstractInput')
|
||||||
;
|
;
|
||||||
|
|
@ -26,6 +27,12 @@
|
||||||
|
|
||||||
this.optionsText = oParams.optionsText || null;
|
this.optionsText = oParams.optionsText || null;
|
||||||
this.optionsValue = oParams.optionsValue || null;
|
this.optionsValue = oParams.optionsValue || null;
|
||||||
|
this.optionsCaption = oParams.optionsCaption || null;
|
||||||
|
|
||||||
|
if (this.optionsCaption)
|
||||||
|
{
|
||||||
|
this.optionsCaption = Translator.i18n(this.optionsCaption);
|
||||||
|
}
|
||||||
|
|
||||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
{
|
{
|
||||||
this.oSettings = window['rainloopAppData'] || {};
|
this.oSettings = window['rainloopAppData'] || {};
|
||||||
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
|
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
|
||||||
// window.console.log(this.oSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsStorage.prototype.oSettings = null;
|
SettingsStorage.prototype.oSettings = null;
|
||||||
|
|
|
||||||
|
|
@ -526,6 +526,7 @@
|
||||||
var
|
var
|
||||||
bNew = false,
|
bNew = false,
|
||||||
bIsHtml = false,
|
bIsHtml = false,
|
||||||
|
sTag = 'div',
|
||||||
bHasExternals = false,
|
bHasExternals = false,
|
||||||
bHasInternals = false,
|
bHasInternals = false,
|
||||||
oBody = null,
|
oBody = null,
|
||||||
|
|
@ -584,9 +585,6 @@
|
||||||
bHasExternals = !!oData.Result.HasExternals;
|
bHasExternals = !!oData.Result.HasExternals;
|
||||||
bHasInternals = !!oData.Result.HasInternals;
|
bHasInternals = !!oData.Result.HasInternals;
|
||||||
|
|
||||||
oBody = $('<div id="' + sId + '" />').hide().addClass('rl-cache-class');
|
|
||||||
oBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
|
||||||
|
|
||||||
if (Utils.isNormal(oData.Result.Html) && '' !== oData.Result.Html)
|
if (Utils.isNormal(oData.Result.Html) && '' !== oData.Result.Html)
|
||||||
{
|
{
|
||||||
bIsHtml = true;
|
bIsHtml = true;
|
||||||
|
|
@ -625,6 +623,10 @@
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sResultHtml = '<pre>' + sResultHtml + '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
sPlain = '';
|
sPlain = '';
|
||||||
|
|
||||||
|
|
@ -633,12 +635,20 @@
|
||||||
oMessage.isPgpSigned(bPgpSigned);
|
oMessage.isPgpSigned(bPgpSigned);
|
||||||
oMessage.isPgpEncrypted(bPgpEncrypted);
|
oMessage.isPgpEncrypted(bPgpEncrypted);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sResultHtml = '<pre>' + sResultHtml + '</pre>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bIsHtml = false;
|
bIsHtml = false;
|
||||||
|
sResultHtml = '<pre>' + sResultHtml + '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oBody = $('<div id="' + sId + '" ></div>').hide().addClass('rl-cache-class');
|
||||||
|
oBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
||||||
|
|
||||||
oBody
|
oBody
|
||||||
.html(Utils.findEmailAndLinks(sResultHtml))
|
.html(Utils.findEmailAndLinks(sResultHtml))
|
||||||
.addClass('b-text-part ' + (bIsHtml ? 'html' : 'plain'))
|
.addClass('b-text-part ' + (bIsHtml ? 'html' : 'plain'))
|
||||||
|
|
@ -753,8 +763,6 @@
|
||||||
{
|
{
|
||||||
if (sFolder && sUid)
|
if (sFolder && sUid)
|
||||||
{
|
{
|
||||||
window.console.log(sFolder, sUid);
|
|
||||||
|
|
||||||
this.message(this.staticMessage.populateByMessageListItem(null));
|
this.message(this.staticMessage.populateByMessageListItem(null));
|
||||||
this.message().folderFullNameRaw = sFolder;
|
this.message().folderFullNameRaw = sFolder;
|
||||||
this.message().uid = sUid;
|
this.message().uid = sUid;
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,28 @@
|
||||||
}), true));
|
}), true));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} sEmail
|
||||||
|
* @return {?}
|
||||||
|
*/
|
||||||
|
PgpUserStore.prototype.findPublicKeyByEmailNotNative = function (sEmail)
|
||||||
|
{
|
||||||
|
return _.find(this.openpgpkeysPublic(), function (oItem) {
|
||||||
|
return oItem && sEmail === oItem.email;
|
||||||
|
}) || null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} sEmail
|
||||||
|
* @return {?}
|
||||||
|
*/
|
||||||
|
PgpUserStore.prototype.findPrivateKeyByEmailNotNative = function (sEmail)
|
||||||
|
{
|
||||||
|
return _.find(this.openpgpkeysPrivate(), function (oItem) {
|
||||||
|
return oItem && sEmail === oItem.email;
|
||||||
|
}) || null;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sEmail
|
* @param {string} sEmail
|
||||||
* @param {string=} sPassword
|
* @param {string=} sPassword
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,72 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.b-compose-open-pgp-content {
|
||||||
|
&.modal {
|
||||||
|
width: 700px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.key-list {
|
||||||
|
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
margin-top: 10px;
|
||||||
|
min-height: 40px;
|
||||||
|
|
||||||
|
&-wrp {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 10px;
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__item {
|
||||||
|
|
||||||
|
color: #333;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&-delete {
|
||||||
|
display: inline;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-name {
|
||||||
|
margin-right: 5px;
|
||||||
|
color: #333;
|
||||||
|
display: inline;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-error {
|
||||||
|
margin-right: 5px;
|
||||||
|
color: red;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-hash {
|
||||||
|
margin-right: 5px;
|
||||||
|
color: #aaa;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.key-actions {
|
||||||
|
margin-top: 10px;
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.b-message-open-pgp-content {
|
.b-message-open-pgp-content {
|
||||||
&.modal {
|
&.modal {
|
||||||
width: 700px;
|
width: 700px;
|
||||||
|
|
|
||||||
|
|
@ -28,88 +28,137 @@
|
||||||
{
|
{
|
||||||
AbstractView.call(this, 'Popups', 'PopupsComposeOpenPgp');
|
AbstractView.call(this, 'Popups', 'PopupsComposeOpenPgp');
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.optionsCaption = Translator.i18n('@i18n/Add a public key');
|
||||||
|
|
||||||
this.notification = ko.observable('');
|
this.notification = ko.observable('');
|
||||||
|
|
||||||
this.sign = ko.observable(true);
|
this.sign = ko.observable(false);
|
||||||
this.encrypt = ko.observable(true);
|
this.encrypt = ko.observable(false);
|
||||||
|
|
||||||
this.password = ko.observable('');
|
this.password = ko.observable('');
|
||||||
this.password.focus = ko.observable(false);
|
this.password.focus = ko.observable(false);
|
||||||
this.buttonFocus = ko.observable(false);
|
this.buttonFocus = ko.observable(false);
|
||||||
|
|
||||||
this.from = ko.observable('');
|
|
||||||
this.to = ko.observableArray([]);
|
|
||||||
this.text = ko.observable('');
|
this.text = ko.observable('');
|
||||||
|
this.selectedPublicKey = ko.observable(null);
|
||||||
|
|
||||||
this.resultCallback = null;
|
this.signKey = ko.observable(null);
|
||||||
|
this.encryptKeys = ko.observableArray([]);
|
||||||
|
|
||||||
|
this.encryptKeysView = ko.computed(function () {
|
||||||
|
return _.compact(_.map(this.encryptKeys(), function (oKey) {
|
||||||
|
return oKey ? oKey.key : null;
|
||||||
|
}));
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
this.publicKeysOptions = ko.computed(function () {
|
||||||
|
return _.compact(_.map(PgpStore.openpgpkeysPublic(), function (oKey) {
|
||||||
|
return -1 < Utils.inArray(oKey, self.encryptKeysView()) ? null : {
|
||||||
|
'id': oKey.guid,
|
||||||
|
'name': '(' + oKey.id.substr(-6) + ') ' + oKey.user,
|
||||||
|
'key': oKey
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
this.submitRequest = ko.observable(false);
|
this.submitRequest = ko.observable(false);
|
||||||
|
|
||||||
|
this.resultCallback = null;
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
this.doCommand = Utils.createCommand(this, function () {
|
this.doCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
var
|
var
|
||||||
self = this,
|
|
||||||
bResult = true,
|
bResult = true,
|
||||||
oPrivateKey = null,
|
oPrivateKey = null,
|
||||||
|
aPrivateKeys = [],
|
||||||
aPublicKeys = []
|
aPublicKeys = []
|
||||||
;
|
;
|
||||||
|
|
||||||
this.submitRequest(true);
|
this.submitRequest(true);
|
||||||
|
|
||||||
if (bResult && this.sign() && '' === this.from())
|
|
||||||
{
|
|
||||||
this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL'));
|
|
||||||
bResult = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bResult && this.sign())
|
if (bResult && this.sign())
|
||||||
{
|
{
|
||||||
oPrivateKey = PgpStore.findPrivateKeyByEmail(this.from(), this.password());
|
if (!this.signKey())
|
||||||
if (!oPrivateKey)
|
{
|
||||||
|
this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL'));
|
||||||
|
bResult = false;
|
||||||
|
}
|
||||||
|
else if (!this.signKey().key)
|
||||||
{
|
{
|
||||||
this.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
|
this.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
|
||||||
'EMAIL': this.from()
|
'EMAIL': this.signKey().email
|
||||||
}));
|
}));
|
||||||
|
|
||||||
bResult = false;
|
bResult = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (bResult && this.encrypt() && 0 === this.to().length)
|
if (bResult)
|
||||||
{
|
{
|
||||||
this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT'));
|
aPrivateKeys = this.signKey().key.getNativeKeys();
|
||||||
bResult = false;
|
oPrivateKey = aPrivateKeys[0] || null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (oPrivateKey)
|
||||||
|
{
|
||||||
|
oPrivateKey.decrypt(Utils.pString(this.password()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
oPrivateKey = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!oPrivateKey)
|
||||||
|
{
|
||||||
|
this.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
||||||
|
bResult = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bResult && this.encrypt())
|
if (bResult && this.encrypt())
|
||||||
{
|
{
|
||||||
aPublicKeys = [];
|
if (0 === this.encryptKeys().length)
|
||||||
_.each(this.to(), function (sEmail) {
|
{
|
||||||
var aKeys = PgpStore.findPublicKeysByEmail(sEmail);
|
this.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
|
||||||
if (0 === aKeys.length && bResult)
|
bResult = false;
|
||||||
{
|
}
|
||||||
self.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
|
else if (this.encryptKeys())
|
||||||
'EMAIL': sEmail
|
{
|
||||||
}));
|
aPublicKeys = [];
|
||||||
|
|
||||||
|
_.each(this.encryptKeys(), function (oKey) {
|
||||||
|
if (oKey && oKey.key)
|
||||||
|
{
|
||||||
|
aPublicKeys = aPublicKeys.concat(_.compact(_.flatten(oKey.key.getNativeKeys())));
|
||||||
|
}
|
||||||
|
else if (oKey && oKey.email)
|
||||||
|
{
|
||||||
|
self.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
|
||||||
|
'EMAIL': oKey.email
|
||||||
|
}));
|
||||||
|
|
||||||
|
bResult = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (bResult && (0 === aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length))
|
||||||
|
{
|
||||||
bResult = false;
|
bResult = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPublicKeys = aPublicKeys.concat(aKeys);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (bResult && (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length))
|
|
||||||
{
|
|
||||||
bResult = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_.delay(function () {
|
if (bResult && self.resultCallback)
|
||||||
|
{
|
||||||
|
_.delay(function () {
|
||||||
|
|
||||||
if (self.resultCallback && bResult)
|
|
||||||
{
|
|
||||||
var oPromise = null;
|
var oPromise = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (oPrivateKey && 0 === aPublicKeys.length)
|
if (oPrivateKey && 0 === aPublicKeys.length)
|
||||||
|
|
@ -154,17 +203,56 @@
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
self.submitRequest(false);
|
self.submitRequest(false);
|
||||||
|
|
||||||
}, 10);
|
}, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
return !this.submitRequest() && (this.sign() || this.encrypt());
|
return !this.submitRequest() && (this.sign() || this.encrypt());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.addCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
|
var
|
||||||
|
sKeyId = this.selectedPublicKey(),
|
||||||
|
aKeys = this.encryptKeys(),
|
||||||
|
oOption = sKeyId ? _.find(this.publicKeysOptions(), function (oItem) {
|
||||||
|
return oItem && sKeyId === oItem.id;
|
||||||
|
}) : null
|
||||||
|
;
|
||||||
|
|
||||||
|
if (oOption)
|
||||||
|
{
|
||||||
|
aKeys.push({
|
||||||
|
'empty': !oOption.key,
|
||||||
|
'selected': ko.observable(!!oOption.key),
|
||||||
|
'user': oOption.key.user,
|
||||||
|
'hash': oOption.key.id.substr(-6),
|
||||||
|
'key': oOption.key
|
||||||
|
});
|
||||||
|
|
||||||
|
this.encryptKeys(aKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
return !this.submitRequest() && this.selectedPublicKey();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.selectedPublicKey.subscribe(function (sValue) {
|
||||||
|
if (sValue)
|
||||||
|
{
|
||||||
|
this.addCommand();
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.sDefaultKeyScope = Enums.KeyState.PopupComposeOpenPGP;
|
this.sDefaultKeyScope = Enums.KeyState.PopupComposeOpenPGP;
|
||||||
|
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||||
|
|
||||||
|
this.deletePublickKey = _.bind(this.deletePublickKey, this);
|
||||||
|
|
||||||
kn.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
}
|
}
|
||||||
|
|
@ -172,16 +260,24 @@
|
||||||
kn.extendAsViewModel(['View/Popup/ComposeOpenPgp', 'PopupsComposeOpenPgpViewModel'], ComposeOpenPgpPopupView);
|
kn.extendAsViewModel(['View/Popup/ComposeOpenPgp', 'PopupsComposeOpenPgpViewModel'], ComposeOpenPgpPopupView);
|
||||||
_.extend(ComposeOpenPgpPopupView.prototype, AbstractView.prototype);
|
_.extend(ComposeOpenPgpPopupView.prototype, AbstractView.prototype);
|
||||||
|
|
||||||
|
ComposeOpenPgpPopupView.prototype.deletePublickKey = function (oKey)
|
||||||
|
{
|
||||||
|
this.encryptKeys.remove(oKey);
|
||||||
|
};
|
||||||
|
|
||||||
ComposeOpenPgpPopupView.prototype.clearPopup = function ()
|
ComposeOpenPgpPopupView.prototype.clearPopup = function ()
|
||||||
{
|
{
|
||||||
this.notification('');
|
this.notification('');
|
||||||
|
|
||||||
|
this.sign(false);
|
||||||
|
this.encrypt(false);
|
||||||
|
|
||||||
this.password('');
|
this.password('');
|
||||||
this.password.focus(false);
|
this.password.focus(false);
|
||||||
this.buttonFocus(false);
|
this.buttonFocus(false);
|
||||||
|
|
||||||
this.from('');
|
this.signKey(null);
|
||||||
this.to([]);
|
this.encryptKeys([]);
|
||||||
this.text('');
|
this.text('');
|
||||||
|
|
||||||
this.submitRequest(false);
|
this.submitRequest(false);
|
||||||
|
|
@ -231,6 +327,8 @@
|
||||||
|
|
||||||
var
|
var
|
||||||
aRec = [],
|
aRec = [],
|
||||||
|
sEmail = '',
|
||||||
|
oKey = null,
|
||||||
oEmail = new EmailModel()
|
oEmail = new EmailModel()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -258,8 +356,44 @@
|
||||||
return '' === oEmail.email ? false : oEmail.email;
|
return '' === oEmail.email ? false : oEmail.email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.from(oIdentity ? oIdentity.email() : '');
|
if (oIdentity && oIdentity.email())
|
||||||
this.to(aRec);
|
{
|
||||||
|
sEmail = oIdentity.email();
|
||||||
|
oKey = PgpStore.findPrivateKeyByEmailNotNative(sEmail);
|
||||||
|
if (oKey)
|
||||||
|
{
|
||||||
|
this.signKey({
|
||||||
|
'user': oKey.user || sEmail,
|
||||||
|
'hash': oKey.id.substr(-6),
|
||||||
|
'key': oKey
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.signKey())
|
||||||
|
{
|
||||||
|
this.sign(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aRec && 0 < aRec.length)
|
||||||
|
{
|
||||||
|
this.encryptKeys(_.compact(_.map(aRec, function (sEmail) {
|
||||||
|
var oKey = PgpStore.findPublicKeyByEmailNotNative(sEmail) || null;
|
||||||
|
return {
|
||||||
|
'empty': !oKey,
|
||||||
|
'selected': ko.observable(!!oKey),
|
||||||
|
'user': oKey ? (oKey.user || sEmail) : sEmail,
|
||||||
|
'hash': oKey ? oKey.id.substr(-6) : '',
|
||||||
|
'key': oKey
|
||||||
|
};
|
||||||
|
})));
|
||||||
|
|
||||||
|
if (0 < this.encryptKeys().length)
|
||||||
|
{
|
||||||
|
this.encrypt(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.text(sText);
|
this.text(sText);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ var
|
||||||
plumber = require('gulp-plumber'),
|
plumber = require('gulp-plumber'),
|
||||||
gulpif = require('gulp-if'),
|
gulpif = require('gulp-if'),
|
||||||
eol = require('gulp-eol'),
|
eol = require('gulp-eol'),
|
||||||
|
livereload = require('gulp-livereload'),
|
||||||
gutil = require('gulp-util')
|
gutil = require('gulp-util')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -242,6 +243,7 @@ gulp.task('css:main-begin', ['less:main'], function() {
|
||||||
// .pipe(csslint.reporter())
|
// .pipe(csslint.reporter())
|
||||||
.pipe(eol('\n', true))
|
.pipe(eol('\n', true))
|
||||||
.pipe(gulp.dest(cfg.paths.staticCSS))
|
.pipe(gulp.dest(cfg.paths.staticCSS))
|
||||||
|
.pipe(livereload())
|
||||||
;
|
;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -330,7 +332,7 @@ gulp.task('js:webpack:clear', function() {
|
||||||
.pipe(require('gulp-rimraf')());
|
.pipe(require('gulp-rimraf')());
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('js:webpack', ['js:webpack:clear'], function(callback) {
|
gulp.task('js:webpack', [/*'js:webpack:clear'*/], function(callback) {
|
||||||
|
|
||||||
var
|
var
|
||||||
webpack = require('webpack'),
|
webpack = require('webpack'),
|
||||||
|
|
@ -678,12 +680,14 @@ gulp.task('owncloud+', ['package:community-off', 'owncloud-']);
|
||||||
//WATCH
|
//WATCH
|
||||||
gulp.task('watch', ['fast'], function() {
|
gulp.task('watch', ['fast'], function() {
|
||||||
cfg.watch = true;
|
cfg.watch = true;
|
||||||
|
livereload.listen();
|
||||||
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']);
|
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']);
|
||||||
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']);
|
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch+', ['fast+'], function() {
|
gulp.task('watch+', ['fast+'], function() {
|
||||||
cfg.watch = true;
|
cfg.watch = true;
|
||||||
|
livereload.listen();
|
||||||
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']);
|
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']);
|
||||||
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']);
|
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@
|
||||||
"gulp-through": "~0.3.0",
|
"gulp-through": "~0.3.0",
|
||||||
"lodash": "~3.9.3",
|
"lodash": "~3.9.3",
|
||||||
"gulp-if": "~1.2.5",
|
"gulp-if": "~1.2.5",
|
||||||
"node-notifier": "~4.2.3"
|
"node-notifier": "~4.2.3",
|
||||||
|
"gulp-livereload": "~3.8.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,9 @@ LANG_BS = "Bosanski"
|
||||||
LANG_BS_BS = "Bosanski"
|
LANG_BS_BS = "Bosanski"
|
||||||
LANG_BS_BA = "Bosanski"
|
LANG_BS_BA = "Bosanski"
|
||||||
|
|
||||||
|
LANG_AR = "العربية"
|
||||||
|
LANG_AR_AR = "العربية"
|
||||||
|
|
||||||
[LANGS_NAMES_EN]
|
[LANGS_NAMES_EN]
|
||||||
LANG_EN = "English"
|
LANG_EN = "English"
|
||||||
LANG_EN_US = "English (US)"
|
LANG_EN_US = "English (US)"
|
||||||
|
|
@ -210,3 +213,6 @@ LANG_SR_RS = "Serbian"
|
||||||
LANG_BS = "Bosnian"
|
LANG_BS = "Bosnian"
|
||||||
LANG_BS_BS = "Bosnian"
|
LANG_BS_BS = "Bosnian"
|
||||||
LANG_BS_BA = "Bosnian"
|
LANG_BS_BA = "Bosnian"
|
||||||
|
|
||||||
|
LANG_AR = "Arabic"
|
||||||
|
LANG_AR_AR = "Arabic"
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,8 @@ class Service
|
||||||
'{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'],
|
'{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'],
|
||||||
'{{BaseAppMainCommonScriptLink}}' => $aData['AppJsCommonLink'],
|
'{{BaseAppMainCommonScriptLink}}' => $aData['AppJsCommonLink'],
|
||||||
'{{BaseAppMainScriptLink}}' => $aData['AppJsLink'],
|
'{{BaseAppMainScriptLink}}' => $aData['AppJsLink'],
|
||||||
'{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr'
|
'{{BaseDir}}' => 'ltr'
|
||||||
|
// '{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr'
|
||||||
);
|
);
|
||||||
|
|
||||||
$aTemplateParameters['{{BaseHash}}'] = \md5(
|
$aTemplateParameters['{{BaseHash}}'] = \md5(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html class="no-js rl-booted-trigger rl-started-trigger">
|
<html class="no-js rl-booted-trigger rl-started-trigger" dir="{{BaseDir}}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
<select data-bind="options: options, value: value, enable: enable, optionsText: optionsText, optionsValue: optionsValue,
|
<select data-bind="options: options, value: value, enable: enable, optionsText: optionsText, optionsValue: optionsValue,
|
||||||
css: className, optionsAfterRender: defautOptionsAfterRender"></select>
|
optionsCaption: optionsCaption, css: className, optionsAfterRender: defautOptionsAfterRender"></select>
|
||||||
<!-- ko if: labeled -->
|
<!-- ko if: labeled -->
|
||||||
|
|
||||||
<span class="i18n" data-bind="attr: {'data-i18n': label}"></span>
|
<span class="i18n" data-bind="attr: {'data-i18n': label}"></span>
|
||||||
|
|
|
||||||
|
|
@ -8,34 +8,83 @@
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="form-horizontal">
|
<div class="alert" data-bind="visible: '' !== notification()">
|
||||||
<div class="alert" data-bind="visible: '' !== notification()">
|
<span data-bind="text: notification"></span>
|
||||||
<span data-bind="text: notification"></span>
|
</div>
|
||||||
</div>
|
<div class="row-fluid">
|
||||||
<br />
|
<div class="span5">
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
<div data-bind="component: {
|
||||||
<div data-bind="component: {
|
|
||||||
name: 'Checkbox',
|
name: 'Checkbox',
|
||||||
params: {
|
params: {
|
||||||
label: 'POPUPS_COMPOSE_OPEN_PGP/LABEL_SIGN',
|
label: 'POPUPS_COMPOSE_OPEN_PGP/LABEL_SIGN',
|
||||||
value: sign
|
value: sign
|
||||||
}
|
}
|
||||||
}"></div>
|
}"></div>
|
||||||
<div data-bind="component: {
|
|
||||||
|
<div class="key-list" data-bind="visible: sign">
|
||||||
|
<div class="key-list-wrp empty" data-bind="visible: !signKey()">
|
||||||
|
No private key found
|
||||||
|
</div>
|
||||||
|
<div class="key-list-wrp" data-bind="visible: signKey">
|
||||||
|
<div class="key-list__item">
|
||||||
|
<div class="key-list__item-hash">
|
||||||
|
(<span data-bind="text: signKey() ? signKey().hash : ''"></span>)
|
||||||
|
</div>
|
||||||
|
<div class="key-list__item-name">
|
||||||
|
<span data-bind="text: signKey() ? signKey().user : ''"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="span7">
|
||||||
|
|
||||||
|
<div data-bind="component: {
|
||||||
name: 'Checkbox',
|
name: 'Checkbox',
|
||||||
params: {
|
params: {
|
||||||
label: 'POPUPS_COMPOSE_OPEN_PGP/LABEL_ENCRYPT',
|
label: 'POPUPS_COMPOSE_OPEN_PGP/LABEL_ENCRYPT',
|
||||||
value: encrypt
|
value: encrypt
|
||||||
}
|
}
|
||||||
}"></div>
|
}"></div>
|
||||||
|
|
||||||
|
<div class="key-list" data-bind="visible: encrypt">
|
||||||
|
<div class="key-list-wrp empty" data-bind="visible: !encryptKeys() || encryptKeys().length === 0">
|
||||||
|
No public keys selected
|
||||||
|
</div>
|
||||||
|
<div class="key-list-wrp" data-bind="visible: encryptKeys() && encryptKeys().length > 0">
|
||||||
|
<div data-bind="foreach: encryptKeys">
|
||||||
|
<div class="key-list__item">
|
||||||
|
<div class="key-list__item-delete" data-bind="click: $parent.deletePublickKey">
|
||||||
|
<i class="icon-trash"></i>
|
||||||
|
</div>
|
||||||
|
<div class="key-list__item-hash" data-bind="visible: !empty">
|
||||||
|
(<span data-bind="text: hash"></span>)
|
||||||
|
</div>
|
||||||
|
<div class="key-list__item-name" data-bind="css: {'empty': empty}">
|
||||||
|
<span data-bind="text: user"></span>
|
||||||
|
</div>
|
||||||
|
<div class="key-list__item-error" data-bind="visible: empty">
|
||||||
|
(Public key not found)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
</div>
|
||||||
<label class="i18n control-label" data-i18n="POPUPS_COMPOSE_OPEN_PGP/LABEL_PASSWORD"></label>
|
<div class="row-fluid key-actions">
|
||||||
<div class="controls">
|
<div class="span5">
|
||||||
<input type="password" class="inputPassword input-large" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
<input type="password" class="inputPassword input-block-level i18n"
|
||||||
data-bind="value: password, hasfocus: password.focus, onEnter: doCommand" />
|
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
|
||||||
|
data-i18n="[placeholder]POPUPS_COMPOSE_OPEN_PGP/LABEL_PASSWORD"
|
||||||
|
data-bind="visible: sign, value: password, hasfocus: password.focus, onEnter: doCommand" />
|
||||||
|
</div>
|
||||||
|
<div class="span7" data-bind="visible: encrypt() && 0 < publicKeysOptions().length">
|
||||||
|
<div class="form-inline">
|
||||||
|
<select class="input-block-level" data-bind="options: publicKeysOptions, value: selectedPublicKey,
|
||||||
|
optionsCaption: optionsCaption, optionsText: 'name', optionsValue: 'id',
|
||||||
|
optionsAfterRender: defautOptionsAfterRender"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
1
vendors/flags/flags-fixed.css
vendored
1
vendors/flags/flags-fixed.css
vendored
|
|
@ -17,6 +17,7 @@
|
||||||
.flag.flag-en-uk {background-position: -176px -44px}
|
.flag.flag-en-uk {background-position: -176px -44px}
|
||||||
.flag.flag-en-ca {background-position: -48px -22px}
|
.flag.flag-en-ca {background-position: -48px -22px}
|
||||||
|
|
||||||
|
.flag.flag-ar, .flag.flag-ar-ar {background-position: -160px 0}
|
||||||
.flag.flag-bg, .flag.flag-bg-bg {background-position: -80px -11px}
|
.flag.flag-bg, .flag.flag-bg-bg {background-position: -80px -11px}
|
||||||
.flag.flag-nl, .flag.flag-nl-nl {background-position: -80px -110px}
|
.flag.flag-nl, .flag.flag-nl-nl {background-position: -80px -110px}
|
||||||
.flag.flag-pl, .flag.flag-pl-pl {background-position: -32px -121px}
|
.flag.flag-pl, .flag.flag-pl-pl {background-position: -32px -121px}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue