mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
OpenPGP - part 2 - unstable (#53)
This commit is contained in:
parent
d181974127
commit
0bb69d4494
23 changed files with 600 additions and 339 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
function AdminSecurity()
|
function AdminSecurity()
|
||||||
{
|
{
|
||||||
this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection'));
|
this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection'));
|
||||||
|
this.openPGP = ko.observable(!!RL.settingsGet('OpenPGP'));
|
||||||
|
|
||||||
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
||||||
this.adminPassword = ko.observable('');
|
this.adminPassword = ko.observable('');
|
||||||
|
|
@ -65,6 +66,12 @@ AdminSecurity.prototype.onBuild = function ()
|
||||||
'TokenProtection': bValue ? '1' : '0'
|
'TokenProtection': bValue ? '1' : '0'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.openPGP.subscribe(function (bValue) {
|
||||||
|
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||||
|
'OpenPGP': bValue ? '1' : '0'
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminSecurity.prototype.onHide = function ()
|
AdminSecurity.prototype.onHide = function ()
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,7 @@ AbstractApp.prototype.sub = function (sName, fFunc, oContext)
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.pub = function (sName, aArgs)
|
AbstractApp.prototype.pub = function (sName, aArgs)
|
||||||
{
|
{
|
||||||
|
Plugins.runHook('rl-pub', [sName, aArgs]);
|
||||||
if (!Utils.isUnd(this.oSubs[sName]))
|
if (!Utils.isUnd(this.oSubs[sName]))
|
||||||
{
|
{
|
||||||
_.each(this.oSubs[sName], function (aItem) {
|
_.each(this.oSubs[sName], function (aItem) {
|
||||||
|
|
|
||||||
|
|
@ -703,6 +703,7 @@ RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
|
||||||
|
|
||||||
RainLoopApp.prototype.bootstart = function ()
|
RainLoopApp.prototype.bootstart = function ()
|
||||||
{
|
{
|
||||||
|
RL.pub('rl.bootstart');
|
||||||
AbstractApp.prototype.bootstart.call(this);
|
AbstractApp.prototype.bootstart.call(this);
|
||||||
|
|
||||||
RL.data().populateDataOnStart();
|
RL.data().populateDataOnStart();
|
||||||
|
|
@ -785,17 +786,26 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
|
|
||||||
if (bValue)
|
if (bValue)
|
||||||
{
|
{
|
||||||
// if (window.crypto && window.crypto.getRandomValues)
|
if (window.crypto && window.crypto.getRandomValues && RL.settingsGet('OpenPGP'))
|
||||||
// {
|
{
|
||||||
// $.ajax({
|
$.ajax({
|
||||||
// 'url': RL.link().openPgpJs(),
|
'url': RL.link().openPgpJs(),
|
||||||
// 'dataType': 'script',
|
'dataType': 'script',
|
||||||
// 'cache': true,
|
'cache': true,
|
||||||
// 'success': function () {
|
'success': function () {
|
||||||
// window.console.log('openPgpJs');
|
if (window.openpgp)
|
||||||
// }
|
{
|
||||||
// });
|
// window.console.log(window.openpgp);
|
||||||
// }
|
Globals.bAllowOpenPGP = true;
|
||||||
|
RL.pub('openpgp.init');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals.bAllowOpenPGP = false;
|
||||||
|
}
|
||||||
|
|
||||||
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
||||||
|
|
||||||
|
|
@ -846,13 +856,15 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
|
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
|
||||||
Plugins.runHook('rl-start-user-screens');
|
Plugins.runHook('rl-start-user-screens');
|
||||||
|
RL.pub('rl.bootstart-user-screens');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kn.startScreens([LoginScreen]);
|
kn.startScreens([LoginScreen]);
|
||||||
|
|
||||||
Plugins.runHook('rl-start-login-screens');
|
Plugins.runHook('rl-start-login-screens');
|
||||||
|
RL.pub('rl.bootstart-login-screens');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.SimplePace)
|
if (window.SimplePace)
|
||||||
|
|
@ -878,6 +890,7 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
kn.startScreens([LoginScreen]);
|
kn.startScreens([LoginScreen]);
|
||||||
|
|
||||||
Plugins.runHook('rl-start-login-screens');
|
Plugins.runHook('rl-start-login-screens');
|
||||||
|
RL.pub('rl.bootstart-login-screens');
|
||||||
|
|
||||||
if (window.SimplePace)
|
if (window.SimplePace)
|
||||||
{
|
{
|
||||||
|
|
@ -925,6 +938,7 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
});
|
});
|
||||||
|
|
||||||
Plugins.runHook('rl-start-screens');
|
Plugins.runHook('rl-start-screens');
|
||||||
|
RL.pub('rl.bootstart-end');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,11 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
||||||
*/
|
*/
|
||||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
Globals.bAllowOpenPGP = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -82,11 +82,16 @@ function MessageModel()
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.body = null;
|
this.body = null;
|
||||||
|
this.plainRaw = '';
|
||||||
this.isRtl = ko.observable(false);
|
this.isRtl = ko.observable(false);
|
||||||
this.isHtml = ko.observable(false);
|
this.isHtml = ko.observable(false);
|
||||||
this.hasImages = ko.observable(false);
|
this.hasImages = ko.observable(false);
|
||||||
this.attachments = ko.observableArray([]);
|
this.attachments = ko.observableArray([]);
|
||||||
|
|
||||||
|
this.isPgpSigned = ko.observable(false);
|
||||||
|
this.isPgpEncrypted = ko.observable(false);
|
||||||
|
this.pgpSignature = ko.observable('');
|
||||||
|
|
||||||
this.priority = ko.observable(Enums.MessagePriority.Normal);
|
this.priority = ko.observable(Enums.MessagePriority.Normal);
|
||||||
this.readReceipt = ko.observable('');
|
this.readReceipt = ko.observable('');
|
||||||
|
|
||||||
|
|
@ -254,6 +259,10 @@ MessageModel.prototype.clear = function ()
|
||||||
this.hasImages(false);
|
this.hasImages(false);
|
||||||
this.attachments([]);
|
this.attachments([]);
|
||||||
|
|
||||||
|
this.isPgpSigned(false);
|
||||||
|
this.isPgpEncrypted(false);
|
||||||
|
this.pgpSignature('');
|
||||||
|
|
||||||
this.priority(Enums.MessagePriority.Normal);
|
this.priority(Enums.MessagePriority.Normal);
|
||||||
this.readReceipt('');
|
this.readReceipt('');
|
||||||
this.aDraftInfo = [];
|
this.aDraftInfo = [];
|
||||||
|
|
@ -347,6 +356,13 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
||||||
this.sInReplyTo = oJsonMessage.InReplyTo;
|
this.sInReplyTo = oJsonMessage.InReplyTo;
|
||||||
this.sReferences = oJsonMessage.References;
|
this.sReferences = oJsonMessage.References;
|
||||||
|
|
||||||
|
if (Globals.bAllowOpenPGP)
|
||||||
|
{
|
||||||
|
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||||
|
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||||
|
this.pgpSignature(oJsonMessage.PgpSignature);
|
||||||
|
}
|
||||||
|
|
||||||
this.hasAttachments(!!oJsonMessage.HasAttachments);
|
this.hasAttachments(!!oJsonMessage.HasAttachments);
|
||||||
this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
|
this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
|
||||||
|
|
||||||
|
|
@ -808,6 +824,10 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||||
// this.hasImages(false);
|
// this.hasImages(false);
|
||||||
// this.attachments([]);
|
// this.attachments([]);
|
||||||
|
|
||||||
|
// this.isPgpSigned(false);
|
||||||
|
// this.isPgpEncrypted(false);
|
||||||
|
// this.pgpSignature('');
|
||||||
|
|
||||||
this.priority(Enums.MessagePriority.Normal);
|
this.priority(Enums.MessagePriority.Normal);
|
||||||
this.aDraftInfo = [];
|
this.aDraftInfo = [];
|
||||||
this.sMessageId = '';
|
this.sMessageId = '';
|
||||||
|
|
|
||||||
|
|
@ -709,6 +709,10 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
oBody = null,
|
oBody = null,
|
||||||
oTextBody = null,
|
oTextBody = null,
|
||||||
sId = '',
|
sId = '',
|
||||||
|
sPlain = '',
|
||||||
|
bPgpSigned = false,
|
||||||
|
bPgpEncrypted = false,
|
||||||
|
mPgpMessage = null,
|
||||||
oMessagesBodiesDom = this.messagesBodiesDom(),
|
oMessagesBodiesDom = this.messagesBodiesDom(),
|
||||||
oMessage = this.message()
|
oMessage = this.message()
|
||||||
;
|
;
|
||||||
|
|
@ -747,7 +751,57 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain)
|
else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain)
|
||||||
{
|
{
|
||||||
bIsHtml = false;
|
bIsHtml = false;
|
||||||
oBody.html(oData.Result.Plain.toString()).addClass('b-text-part plain');
|
sPlain = oData.Result.Plain.toString();
|
||||||
|
|
||||||
|
if (Globals.bAllowOpenPGP && (oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||||
|
Utils.isNormal(oData.Result.PlainRaw))
|
||||||
|
{
|
||||||
|
bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oData.Result.PlainRaw);
|
||||||
|
if (!bPgpEncrypted)
|
||||||
|
{
|
||||||
|
bPgpSigned = /-----BEGIN PGP SIGNED MESSAGE-----/.test(oData.Result.PlainRaw) &&
|
||||||
|
/-----BEGIN PGP SIGNATURE-----/.test(oData.Result.PlainRaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bPgpSigned && oMessage.isPgpSigned() && oMessage.pgpSignature())
|
||||||
|
{
|
||||||
|
sPlain = '<pre class="b-plain-openpgp signed">' + oData.Result.PlainRaw + '</pre>';
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mPgpMessage = window.openpgp.cleartext.readArmored(oData.Result.PlainRaw);
|
||||||
|
}
|
||||||
|
catch (oExc) {}
|
||||||
|
|
||||||
|
if (mPgpMessage && mPgpMessage.getText)
|
||||||
|
{
|
||||||
|
sPlain = mPgpMessage.getText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bPgpSigned = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bPgpEncrypted && oMessage.isPgpEncrypted())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mPgpMessage = window.openpgp.message.readArmored(oData.Result.PlainRaw);
|
||||||
|
}
|
||||||
|
catch (oExc) {}
|
||||||
|
|
||||||
|
sPlain = '<pre class="b-plain-openpgp encrypted">' + oData.Result.PlainRaw + '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bPgpSigned || bPgpEncrypted)
|
||||||
|
{
|
||||||
|
oBody.data('rl-plain-raw', oData.Result.PlainRaw);
|
||||||
|
oBody.data('rl-plain-pgp-encrypted', bPgpEncrypted);
|
||||||
|
oBody.data('rl-plain-pgp-signed', bPgpSigned);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oBody.html(sPlain).addClass('b-text-part plain');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -760,15 +814,19 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
oBody.addClass('rtl-text-part');
|
oBody.addClass('rtl-text-part');
|
||||||
}
|
}
|
||||||
|
|
||||||
oMessagesBodiesDom.append(oBody);
|
|
||||||
|
|
||||||
oBody.data('rl-is-html', bIsHtml);
|
|
||||||
oBody.data('rl-has-images', bHasExternals);
|
|
||||||
|
|
||||||
oMessage.isRtl(!!oBody.data('rl-is-rtl'));
|
|
||||||
oMessage.isHtml(!!oBody.data('rl-is-html'));
|
|
||||||
oMessage.hasImages(!!oBody.data('rl-has-images'));
|
|
||||||
oMessage.body = oBody;
|
oMessage.body = oBody;
|
||||||
|
if (oMessage.body)
|
||||||
|
{
|
||||||
|
oMessagesBodiesDom.append(oMessage.body);
|
||||||
|
|
||||||
|
oMessage.body.data('rl-is-html', bIsHtml);
|
||||||
|
oMessage.body.data('rl-has-images', bHasExternals);
|
||||||
|
|
||||||
|
oMessage.isRtl(!!oMessage.body.data('rl-is-rtl'));
|
||||||
|
oMessage.isHtml(!!oMessage.body.data('rl-is-html'));
|
||||||
|
oMessage.hasImages(!!oMessage.body.data('rl-has-images'));
|
||||||
|
oMessage.plainRaw = Utils.pString(oMessage.body.data('rl-plain-raw'));
|
||||||
|
}
|
||||||
|
|
||||||
if (bHasInternals)
|
if (bHasInternals)
|
||||||
{
|
{
|
||||||
|
|
@ -784,12 +842,26 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oTextBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
|
||||||
|
|
||||||
oMessage.isRtl(!!oTextBody.data('rl-is-rtl'));
|
|
||||||
oMessage.isHtml(!!oTextBody.data('rl-is-html'));
|
|
||||||
oMessage.hasImages(!!oTextBody.data('rl-has-images'));
|
|
||||||
oMessage.body = oTextBody;
|
oMessage.body = oTextBody;
|
||||||
|
if (oMessage.body)
|
||||||
|
{
|
||||||
|
oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
||||||
|
oMessage.isRtl(!!oMessage.body.data('rl-is-rtl'));
|
||||||
|
oMessage.isHtml(!!oMessage.body.data('rl-is-html'));
|
||||||
|
oMessage.hasImages(!!oMessage.body.data('rl-has-images'));
|
||||||
|
oMessage.plainRaw = Utils.pString(oMessage.body.data('rl-plain-raw'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.bAllowOpenPGP && oMessage.body)
|
||||||
|
{
|
||||||
|
oMessage.isPgpSigned(!!oMessage.body.data('rl-plain-pgp-signed'));
|
||||||
|
oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oMessage.isPgpSigned(false);
|
||||||
|
oMessage.isPgpEncrypted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.messageActiveDom(oMessage.body);
|
this.messageActiveDom(oMessage.body);
|
||||||
|
|
|
||||||
|
|
@ -145,24 +145,4 @@
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.editorTextArea, .editorHtmlArea {
|
|
||||||
|
|
||||||
background: #fff;
|
|
||||||
color: #000;
|
|
||||||
font-family: Arial, Verdana, Geneva, sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
table {
|
|
||||||
border-collapse: separate;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockquote {
|
|
||||||
border: 0;
|
|
||||||
border-left: solid 2px #444;
|
|
||||||
margin-left: 5px;
|
|
||||||
margin: 5px 0;
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -76,12 +76,15 @@
|
||||||
|
|
||||||
.box-sizing(border-box);
|
.box-sizing(border-box);
|
||||||
|
|
||||||
|
background: #fff;
|
||||||
|
color: #000;
|
||||||
|
|
||||||
border: 0px !important;
|
border: 0px !important;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
font-family: arial, sans-serif;
|
font-family: Arial, Verdana, Geneva, sans-serif;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
line-height: 16px;
|
line-height: 15px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|
||||||
|
|
@ -102,9 +105,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
|
border: 0;
|
||||||
border-left: solid 2px #444;
|
border-left: solid 2px #444;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
padding-left: 5px
|
margin: 5px 0;
|
||||||
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
|
@ -119,14 +124,17 @@
|
||||||
.editorTextArea {
|
.editorTextArea {
|
||||||
.box-sizing(border-box);
|
.box-sizing(border-box);
|
||||||
|
|
||||||
|
background: #fff;
|
||||||
|
color: #000;
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
border: 0px !important;
|
border: 0px !important;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
line-height: 16px;
|
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-family: arial, sans-serif;
|
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ html.rl-no-preview-pane {
|
||||||
height: 0px;
|
height: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.showImages, .readReceipt {
|
.showImages, .readReceipt, .pgpSigned, .pgpEncrypted {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
@ -192,6 +192,10 @@ html.rl-no-preview-pane {
|
||||||
background-color: #ffffd9;
|
background-color: #ffffd9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pgpSigned, .pgpEncrypted {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
.attachmentsPlace {
|
.attachmentsPlace {
|
||||||
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
@ -306,14 +310,13 @@ html.rl-no-preview-pane {
|
||||||
&.plain {
|
&.plain {
|
||||||
|
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
font-family: arial, sans-serif;
|
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
white-space: normal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,6 @@ class Message
|
||||||
*/
|
*/
|
||||||
private $sPlain;
|
private $sPlain;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $sPlainRaw;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
|
@ -168,6 +163,16 @@ class Message
|
||||||
*/
|
*/
|
||||||
private $sPgpSignature;
|
private $sPgpSignature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $bPgpSigned;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $bPgpEncrypted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
|
|
@ -201,7 +206,6 @@ class Message
|
||||||
$this->oBcc = null;
|
$this->oBcc = null;
|
||||||
|
|
||||||
$this->sPlain = '';
|
$this->sPlain = '';
|
||||||
$this->sPlainRaw = '';
|
|
||||||
$this->sHtml = '';
|
$this->sHtml = '';
|
||||||
|
|
||||||
$this->oAttachments = null;
|
$this->oAttachments = null;
|
||||||
|
|
@ -220,6 +224,8 @@ class Message
|
||||||
$this->iParentThread = 0;
|
$this->iParentThread = 0;
|
||||||
|
|
||||||
$this->sPgpSignature = '';
|
$this->sPgpSignature = '';
|
||||||
|
$this->bPgpSigned = false;
|
||||||
|
$this->bPgpEncrypted = false;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
@ -240,14 +246,6 @@ class Message
|
||||||
return $this->sPlain;
|
return $this->sPlain;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function PlainRaw()
|
|
||||||
{
|
|
||||||
return $this->sPlainRaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
@ -264,6 +262,22 @@ class Message
|
||||||
return $this->sPgpSignature;
|
return $this->sPgpSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function PgpSigned()
|
||||||
|
{
|
||||||
|
return $this->bPgpSigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function PgpEncrypted()
|
||||||
|
{
|
||||||
|
return $this->bPgpEncrypted;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sHtml
|
* @param string $sHtml
|
||||||
*
|
*
|
||||||
|
|
@ -776,24 +790,20 @@ class Message
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->sPlain = \implode("\n", $sPlainParts);
|
$this->sPlain = \trim(\implode("\n", $sPlainParts));
|
||||||
$this->sPlainRaw = $this->sPlain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
if (\preg_match('/-----BEGIN PGP SIGNATURE-----(.+)-----END PGP SIGNATURE-----/ism', $this->sPlain, $aMatch) && !empty($aMatch[0]))
|
if (\preg_match('/-----BEGIN PGP SIGNATURE-----(.+)-----END PGP SIGNATURE-----/ism', $this->sPlain, $aMatch) && !empty($aMatch[0]))
|
||||||
{
|
{
|
||||||
$this->sPgpSignature = $aMatch[0];
|
$this->sPgpSignature = \trim($aMatch[0]);
|
||||||
$this->sPlain = \trim($this->sPlain);
|
$this->bPgpSigned = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aMatch = array();
|
$aMatch = array();
|
||||||
if (!empty($this->sPgpSignature) &&
|
if (\preg_match('/-----BEGIN PGP MESSAGE-----/ism', $this->sPlain, $aMatch) && !empty($aMatch[0]))
|
||||||
\preg_match('/-----BEGIN PGP SIGNED MESSAGE-----(.+)-----BEGIN PGP SIGNATURE-----(.+)-----END PGP SIGNATURE-----/ism', $this->sPlain, $aMatch) &&
|
|
||||||
!empty($aMatch[0]) && isset($aMatch[1]))
|
|
||||||
{
|
{
|
||||||
$this->sPlain = \str_replace($aMatch[0], $aMatch[1], $this->sPlain);
|
$this->bPgpEncrypted = true;
|
||||||
$this->sPlain = \trim(\preg_replace('/^Hash: [^\s]+/i', '', \trim($this->sPlain)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($sHtmlParts, $sPlainParts, $aMatch);
|
unset($sHtmlParts, $sPlainParts, $aMatch);
|
||||||
|
|
@ -812,6 +822,7 @@ class Message
|
||||||
if (\is_string($sPgpSignatureText) && 0 < \strlen($sPgpSignatureText) && 0 < \strpos($sPgpSignatureText, 'BEGIN PGP SIGNATURE'))
|
if (\is_string($sPgpSignatureText) && 0 < \strlen($sPgpSignatureText) && 0 < \strpos($sPgpSignatureText, 'BEGIN PGP SIGNATURE'))
|
||||||
{
|
{
|
||||||
$this->sPgpSignature = \trim($sPgpSignatureText);
|
$this->sPgpSignature = \trim($sPgpSignatureText);
|
||||||
|
$this->bPgpSigned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -902,6 +902,7 @@ class Actions
|
||||||
'LoginDescription' => $oConfig->Get('branding', 'login_desc', ''),
|
'LoginDescription' => $oConfig->Get('branding', 'login_desc', ''),
|
||||||
'LoginCss' => $oConfig->Get('branding', 'login_css', ''),
|
'LoginCss' => $oConfig->Get('branding', 'login_css', ''),
|
||||||
'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '',
|
'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '',
|
||||||
|
'OpenPGP' => $oConfig->Get('security', 'openpgp', false),
|
||||||
'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false),
|
'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false),
|
||||||
'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true),
|
'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true),
|
||||||
'CustomLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''),
|
'CustomLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''),
|
||||||
|
|
@ -1955,6 +1956,7 @@ class Actions
|
||||||
$this->setConfigFromParams($oConfig, 'LoginCss', 'branding', 'login_css', 'string');
|
$this->setConfigFromParams($oConfig, 'LoginCss', 'branding', 'login_css', 'string');
|
||||||
|
|
||||||
$this->setConfigFromParams($oConfig, 'TokenProtection', 'security', 'csrf_protection', 'bool');
|
$this->setConfigFromParams($oConfig, 'TokenProtection', 'security', 'csrf_protection', 'bool');
|
||||||
|
$this->setConfigFromParams($oConfig, 'OpenPGP', 'security', 'openpgp', 'bool');
|
||||||
$this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool');
|
$this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool');
|
||||||
|
|
||||||
$this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool');
|
$this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool');
|
||||||
|
|
@ -6320,14 +6322,13 @@ class Actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sPlain = $sPlainRaw = '';
|
$sPlain = '';
|
||||||
$sHtml = $mResponse->Html();
|
$sHtml = $mResponse->Html();
|
||||||
$bRtl = false;
|
$bRtl = false;
|
||||||
|
|
||||||
if (0 === \strlen($sHtml))
|
if (0 === \strlen($sHtml))
|
||||||
{
|
{
|
||||||
$sPlain = $mResponse->Plain();
|
$sPlain = $mResponse->Plain();
|
||||||
$sPlainRaw = $mResponse->PlainRaw();
|
|
||||||
$bRtl = \MailSo\Base\Utils::IsRTL($sPlain);
|
$bRtl = \MailSo\Base\Utils::IsRTL($sPlain);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -6341,13 +6342,15 @@ class Actions
|
||||||
$mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml(
|
$mResult['Html'] = 0 === \strlen($sHtml) ? '' : \MailSo\Base\HtmlUtils::ClearHtml(
|
||||||
$sHtml, $bHasExternals, $mFoundedCIDs, $aContentLocationUrls, $mFoundedContentLocationUrls);
|
$sHtml, $bHasExternals, $mFoundedCIDs, $aContentLocationUrls, $mFoundedContentLocationUrls);
|
||||||
|
|
||||||
|
$mResult['PlainRaw'] = $sPlain;
|
||||||
$mResult['Plain'] = 0 === \strlen($sPlain) ? '' : \MailSo\Base\HtmlUtils::ConvertPlainToHtml($sPlain);
|
$mResult['Plain'] = 0 === \strlen($sPlain) ? '' : \MailSo\Base\HtmlUtils::ConvertPlainToHtml($sPlain);
|
||||||
$mResult['PlainRaw'] = $sPlainRaw;
|
|
||||||
$mResult['Rtl'] = $bRtl;
|
$mResult['Rtl'] = $bRtl;
|
||||||
|
|
||||||
|
$mResult['PgpSigned'] = $mResponse->PgpSigned();
|
||||||
|
$mResult['PgpEncrypted'] = $mResponse->PgpEncrypted();
|
||||||
$mResult['PgpSignature'] = $mResponse->PgpSignature();
|
$mResult['PgpSignature'] = $mResponse->PgpSignature();
|
||||||
|
|
||||||
unset($sHtml, $sPlain, $sPlainRaw);
|
unset($sHtml, $sPlain);
|
||||||
|
|
||||||
$mResult['HasExternals'] = $bHasExternals;
|
$mResult['HasExternals'] = $bHasExternals;
|
||||||
$mResult['HasInternals'] = (\is_array($mFoundedCIDs) && 0 < \count($mFoundedCIDs)) ||
|
$mResult['HasInternals'] = (\is_array($mFoundedCIDs) && 0 < \count($mFoundedCIDs)) ||
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
||||||
'Enable CSRF protection (http://en.wikipedia.org/wiki/Cross-site_request_forgery)'),
|
'Enable CSRF protection (http://en.wikipedia.org/wiki/Cross-site_request_forgery)'),
|
||||||
|
|
||||||
'custom_server_signature' => array('RainLoop'),
|
'custom_server_signature' => array('RainLoop'),
|
||||||
|
'openpgp' => array(false),
|
||||||
'admin_login' => array('admin', 'Login and password for web admin panel'),
|
'admin_login' => array('admin', 'Login and password for web admin panel'),
|
||||||
'admin_password' => array('12345'),
|
'admin_password' => array('12345'),
|
||||||
'allow_admin_panel' => array(true, 'Access settings'),
|
'allow_admin_panel' => array(true, 'Access settings'),
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,15 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<label data-bind="click: function () { openPGP(!openPGP()); }">
|
||||||
|
<i data-bind="css: openPGP() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
||||||
|
|
||||||
|
Allow OpenPGP (beta)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a href="#" target="_blank" class="g-ui-link" data-bind="link: phpInfoLink()">Show PHP information</a>
|
<a href="#" target="_blank" class="g-ui-link" data-bind="link: phpInfoLink()">Show PHP information</a>
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,16 @@
|
||||||
|
|
||||||
<span class="i18n text" data-i18n-text="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></span>
|
<span class="i18n text" data-i18n-text="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pgpSigned" data-bind="visible: message() && message().isPgpSigned(), click: function() {}">
|
||||||
|
<i class="icon-lock"></i>
|
||||||
|
|
||||||
|
PGP signed
|
||||||
|
</div>
|
||||||
|
<div class="pgpEncrypted" data-bind="visible: message() && message().isPgpEncrypted(), click: function() {}">
|
||||||
|
<i class="icon-lock"></i>
|
||||||
|
|
||||||
|
PGP encrypted
|
||||||
|
</div>
|
||||||
<div class="attachmentsPlace" data-bind="visible: message() && message().hasVisibleAttachments()">
|
<div class="attachmentsPlace" data-bind="visible: message() && message().hasVisibleAttachments()">
|
||||||
<ul class="attachmentList" data-bind="foreach: message() ? message().attachments() : []">
|
<ul class="attachmentList" data-bind="foreach: message() ? message().attachments() : []">
|
||||||
<li class="attachmentItem" draggable="true" data-bind="visible: !isLinked, title: fileName, event: { 'dragstart': eventDragStart }">
|
<li class="attachmentItem" draggable="true" data-bind="visible: !isLinked, title: fileName, event: { 'dragstart': eventDragStart }">
|
||||||
|
|
|
||||||
|
|
@ -7064,7 +7064,9 @@ showImages html.rl-no-preview-pane .messageView.message-selected {
|
||||||
height: 0px;
|
height: 0px;
|
||||||
}
|
}
|
||||||
.messageView .b-content .messageItem .showImages,
|
.messageView .b-content .messageItem .showImages,
|
||||||
.messageView .b-content .messageItem .readReceipt {
|
.messageView .b-content .messageItem .readReceipt,
|
||||||
|
.messageView .b-content .messageItem .pgpSigned,
|
||||||
|
.messageView .b-content .messageItem .pgpEncrypted {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
@ -7073,6 +7075,10 @@ showImages html.rl-no-preview-pane .messageView.message-selected {
|
||||||
.messageView .b-content .messageItem .readReceipt {
|
.messageView .b-content .messageItem .readReceipt {
|
||||||
background-color: #ffffd9;
|
background-color: #ffffd9;
|
||||||
}
|
}
|
||||||
|
.messageView .b-content .messageItem .pgpSigned,
|
||||||
|
.messageView .b-content .messageItem .pgpEncrypted {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
.messageView .b-content .messageItem .attachmentsPlace {
|
.messageView .b-content .messageItem .attachmentsPlace {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
@ -7165,14 +7171,13 @@ showImages html.rl-no-preview-pane .messageView.message-selected {
|
||||||
}
|
}
|
||||||
.messageView .b-content .messageItem .bodyText .b-text-part.plain {
|
.messageView .b-content .messageItem .bodyText .b-text-part.plain {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
||||||
}
|
}
|
||||||
.messageView .b-content .messageItem .bodyText .b-text-part.plain pre {
|
.messageView .b-content .messageItem .bodyText .b-text-part.plain pre {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
font-family: arial, sans-serif;
|
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
white-space: normal;
|
|
||||||
}
|
}
|
||||||
.messageView .b-content .messageItem .bodyText .b-text-part.plain blockquote {
|
.messageView .b-content .messageItem .bodyText .b-text-part.plain blockquote {
|
||||||
border-left: 2px solid blue;
|
border-left: 2px solid blue;
|
||||||
|
|
@ -7686,25 +7691,6 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
|
||||||
background: #777;
|
background: #777;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.b-compose .editorTextArea,
|
|
||||||
.b-compose .editorHtmlArea {
|
|
||||||
background: #fff;
|
|
||||||
color: #000;
|
|
||||||
font-family: Arial, Verdana, Geneva, sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.b-compose .editorTextArea table,
|
|
||||||
.b-compose .editorHtmlArea table {
|
|
||||||
border-collapse: separate;
|
|
||||||
}
|
|
||||||
.b-compose .editorTextArea blockquote,
|
|
||||||
.b-compose .editorHtmlArea blockquote {
|
|
||||||
border: 0;
|
|
||||||
border-left: solid 2px #444;
|
|
||||||
margin-left: 5px;
|
|
||||||
margin: 5px 0;
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
.b-admin-left .b-toolbar {
|
.b-admin-left .b-toolbar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
@ -8650,12 +8636,14 @@ html.rl-started-trigger.no-mobile #rl-content {
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
background: #fff;
|
||||||
|
color: #000;
|
||||||
border: 0px !important;
|
border: 0px !important;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
font-family: arial, sans-serif;
|
font-family: Arial, Verdana, Geneva, sans-serif;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
line-height: 16px;
|
line-height: 15px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
@ -8672,8 +8660,10 @@ html.rl-started-trigger.no-mobile #rl-content {
|
||||||
list-style-type: decimal !important;
|
list-style-type: decimal !important;
|
||||||
}
|
}
|
||||||
.textAreaParent .editorHtmlArea blockquote {
|
.textAreaParent .editorHtmlArea blockquote {
|
||||||
|
border: 0;
|
||||||
border-left: solid 2px #444;
|
border-left: solid 2px #444;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
margin: 5px 0;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
.textAreaParent .editorHtmlArea img {
|
.textAreaParent .editorHtmlArea img {
|
||||||
|
|
@ -8686,14 +8676,16 @@ html.rl-started-trigger.no-mobile #rl-content {
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
background: #fff;
|
||||||
|
color: #000;
|
||||||
display: block;
|
display: block;
|
||||||
border: 0px !important;
|
border: 0px !important;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
line-height: 16px;
|
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-family: arial, sans-serif;
|
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
|
line-height: 15px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -143,6 +143,11 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
||||||
*/
|
*/
|
||||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
Globals.bAllowOpenPGP = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
@ -5774,6 +5779,7 @@ AdminDomains.prototype.onDomainListChangeRequest = function ()
|
||||||
function AdminSecurity()
|
function AdminSecurity()
|
||||||
{
|
{
|
||||||
this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection'));
|
this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection'));
|
||||||
|
this.openPGP = ko.observable(!!RL.settingsGet('OpenPGP'));
|
||||||
|
|
||||||
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
||||||
this.adminPassword = ko.observable('');
|
this.adminPassword = ko.observable('');
|
||||||
|
|
@ -5833,6 +5839,12 @@ AdminSecurity.prototype.onBuild = function ()
|
||||||
'TokenProtection': bValue ? '1' : '0'
|
'TokenProtection': bValue ? '1' : '0'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.openPGP.subscribe(function (bValue) {
|
||||||
|
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||||
|
'OpenPGP': bValue ? '1' : '0'
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminSecurity.prototype.onHide = function ()
|
AdminSecurity.prototype.onHide = function ()
|
||||||
|
|
@ -7365,6 +7377,7 @@ AbstractApp.prototype.sub = function (sName, fFunc, oContext)
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.pub = function (sName, aArgs)
|
AbstractApp.prototype.pub = function (sName, aArgs)
|
||||||
{
|
{
|
||||||
|
Plugins.runHook('rl-pub', [sName, aArgs]);
|
||||||
if (!Utils.isUnd(this.oSubs[sName]))
|
if (!Utils.isUnd(this.oSubs[sName]))
|
||||||
{
|
{
|
||||||
_.each(this.oSubs[sName], function (aItem) {
|
_.each(this.oSubs[sName], function (aItem) {
|
||||||
|
|
|
||||||
4
rainloop/v/0.0.0/static/js/admin.min.js
vendored
4
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -143,6 +143,11 @@ Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
||||||
*/
|
*/
|
||||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
Globals.bAllowOpenPGP = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
|
|
@ -6402,11 +6407,16 @@ function MessageModel()
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.body = null;
|
this.body = null;
|
||||||
|
this.plainRaw = '';
|
||||||
this.isRtl = ko.observable(false);
|
this.isRtl = ko.observable(false);
|
||||||
this.isHtml = ko.observable(false);
|
this.isHtml = ko.observable(false);
|
||||||
this.hasImages = ko.observable(false);
|
this.hasImages = ko.observable(false);
|
||||||
this.attachments = ko.observableArray([]);
|
this.attachments = ko.observableArray([]);
|
||||||
|
|
||||||
|
this.isPgpSigned = ko.observable(false);
|
||||||
|
this.isPgpEncrypted = ko.observable(false);
|
||||||
|
this.pgpSignature = ko.observable('');
|
||||||
|
|
||||||
this.priority = ko.observable(Enums.MessagePriority.Normal);
|
this.priority = ko.observable(Enums.MessagePriority.Normal);
|
||||||
this.readReceipt = ko.observable('');
|
this.readReceipt = ko.observable('');
|
||||||
|
|
||||||
|
|
@ -6574,6 +6584,10 @@ MessageModel.prototype.clear = function ()
|
||||||
this.hasImages(false);
|
this.hasImages(false);
|
||||||
this.attachments([]);
|
this.attachments([]);
|
||||||
|
|
||||||
|
this.isPgpSigned(false);
|
||||||
|
this.isPgpEncrypted(false);
|
||||||
|
this.pgpSignature('');
|
||||||
|
|
||||||
this.priority(Enums.MessagePriority.Normal);
|
this.priority(Enums.MessagePriority.Normal);
|
||||||
this.readReceipt('');
|
this.readReceipt('');
|
||||||
this.aDraftInfo = [];
|
this.aDraftInfo = [];
|
||||||
|
|
@ -6667,6 +6681,13 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
||||||
this.sInReplyTo = oJsonMessage.InReplyTo;
|
this.sInReplyTo = oJsonMessage.InReplyTo;
|
||||||
this.sReferences = oJsonMessage.References;
|
this.sReferences = oJsonMessage.References;
|
||||||
|
|
||||||
|
if (Globals.bAllowOpenPGP)
|
||||||
|
{
|
||||||
|
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||||
|
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||||
|
this.pgpSignature(oJsonMessage.PgpSignature);
|
||||||
|
}
|
||||||
|
|
||||||
this.hasAttachments(!!oJsonMessage.HasAttachments);
|
this.hasAttachments(!!oJsonMessage.HasAttachments);
|
||||||
this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
|
this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
|
||||||
|
|
||||||
|
|
@ -7128,6 +7149,10 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||||
// this.hasImages(false);
|
// this.hasImages(false);
|
||||||
// this.attachments([]);
|
// this.attachments([]);
|
||||||
|
|
||||||
|
// this.isPgpSigned(false);
|
||||||
|
// this.isPgpEncrypted(false);
|
||||||
|
// this.pgpSignature('');
|
||||||
|
|
||||||
this.priority(Enums.MessagePriority.Normal);
|
this.priority(Enums.MessagePriority.Normal);
|
||||||
this.aDraftInfo = [];
|
this.aDraftInfo = [];
|
||||||
this.sMessageId = '';
|
this.sMessageId = '';
|
||||||
|
|
@ -14292,6 +14317,10 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
oBody = null,
|
oBody = null,
|
||||||
oTextBody = null,
|
oTextBody = null,
|
||||||
sId = '',
|
sId = '',
|
||||||
|
sPlain = '',
|
||||||
|
bPgpSigned = false,
|
||||||
|
bPgpEncrypted = false,
|
||||||
|
mPgpMessage = null,
|
||||||
oMessagesBodiesDom = this.messagesBodiesDom(),
|
oMessagesBodiesDom = this.messagesBodiesDom(),
|
||||||
oMessage = this.message()
|
oMessage = this.message()
|
||||||
;
|
;
|
||||||
|
|
@ -14330,7 +14359,57 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain)
|
else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain)
|
||||||
{
|
{
|
||||||
bIsHtml = false;
|
bIsHtml = false;
|
||||||
oBody.html(oData.Result.Plain.toString()).addClass('b-text-part plain');
|
sPlain = oData.Result.Plain.toString();
|
||||||
|
|
||||||
|
if (Globals.bAllowOpenPGP && (oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||||
|
Utils.isNormal(oData.Result.PlainRaw))
|
||||||
|
{
|
||||||
|
bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oData.Result.PlainRaw);
|
||||||
|
if (!bPgpEncrypted)
|
||||||
|
{
|
||||||
|
bPgpSigned = /-----BEGIN PGP SIGNED MESSAGE-----/.test(oData.Result.PlainRaw) &&
|
||||||
|
/-----BEGIN PGP SIGNATURE-----/.test(oData.Result.PlainRaw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bPgpSigned && oMessage.isPgpSigned() && oMessage.pgpSignature())
|
||||||
|
{
|
||||||
|
sPlain = '<pre class="b-plain-openpgp signed">' + oData.Result.PlainRaw + '</pre>';
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mPgpMessage = window.openpgp.cleartext.readArmored(oData.Result.PlainRaw);
|
||||||
|
}
|
||||||
|
catch (oExc) {}
|
||||||
|
|
||||||
|
if (mPgpMessage && mPgpMessage.getText)
|
||||||
|
{
|
||||||
|
sPlain = mPgpMessage.getText();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bPgpSigned = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bPgpEncrypted && oMessage.isPgpEncrypted())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mPgpMessage = window.openpgp.message.readArmored(oData.Result.PlainRaw);
|
||||||
|
}
|
||||||
|
catch (oExc) {}
|
||||||
|
|
||||||
|
sPlain = '<pre class="b-plain-openpgp encrypted">' + oData.Result.PlainRaw + '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bPgpSigned || bPgpEncrypted)
|
||||||
|
{
|
||||||
|
oBody.data('rl-plain-raw', oData.Result.PlainRaw);
|
||||||
|
oBody.data('rl-plain-pgp-encrypted', bPgpEncrypted);
|
||||||
|
oBody.data('rl-plain-pgp-signed', bPgpSigned);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oBody.html(sPlain).addClass('b-text-part plain');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -14343,15 +14422,19 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
oBody.addClass('rtl-text-part');
|
oBody.addClass('rtl-text-part');
|
||||||
}
|
}
|
||||||
|
|
||||||
oMessagesBodiesDom.append(oBody);
|
|
||||||
|
|
||||||
oBody.data('rl-is-html', bIsHtml);
|
|
||||||
oBody.data('rl-has-images', bHasExternals);
|
|
||||||
|
|
||||||
oMessage.isRtl(!!oBody.data('rl-is-rtl'));
|
|
||||||
oMessage.isHtml(!!oBody.data('rl-is-html'));
|
|
||||||
oMessage.hasImages(!!oBody.data('rl-has-images'));
|
|
||||||
oMessage.body = oBody;
|
oMessage.body = oBody;
|
||||||
|
if (oMessage.body)
|
||||||
|
{
|
||||||
|
oMessagesBodiesDom.append(oMessage.body);
|
||||||
|
|
||||||
|
oMessage.body.data('rl-is-html', bIsHtml);
|
||||||
|
oMessage.body.data('rl-has-images', bHasExternals);
|
||||||
|
|
||||||
|
oMessage.isRtl(!!oMessage.body.data('rl-is-rtl'));
|
||||||
|
oMessage.isHtml(!!oMessage.body.data('rl-is-html'));
|
||||||
|
oMessage.hasImages(!!oMessage.body.data('rl-has-images'));
|
||||||
|
oMessage.plainRaw = Utils.pString(oMessage.body.data('rl-plain-raw'));
|
||||||
|
}
|
||||||
|
|
||||||
if (bHasInternals)
|
if (bHasInternals)
|
||||||
{
|
{
|
||||||
|
|
@ -14367,12 +14450,26 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oTextBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
|
||||||
|
|
||||||
oMessage.isRtl(!!oTextBody.data('rl-is-rtl'));
|
|
||||||
oMessage.isHtml(!!oTextBody.data('rl-is-html'));
|
|
||||||
oMessage.hasImages(!!oTextBody.data('rl-has-images'));
|
|
||||||
oMessage.body = oTextBody;
|
oMessage.body = oTextBody;
|
||||||
|
if (oMessage.body)
|
||||||
|
{
|
||||||
|
oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
||||||
|
oMessage.isRtl(!!oMessage.body.data('rl-is-rtl'));
|
||||||
|
oMessage.isHtml(!!oMessage.body.data('rl-is-html'));
|
||||||
|
oMessage.hasImages(!!oMessage.body.data('rl-has-images'));
|
||||||
|
oMessage.plainRaw = Utils.pString(oMessage.body.data('rl-plain-raw'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Globals.bAllowOpenPGP && oMessage.body)
|
||||||
|
{
|
||||||
|
oMessage.isPgpSigned(!!oMessage.body.data('rl-plain-pgp-signed'));
|
||||||
|
oMessage.isPgpEncrypted(!!oMessage.body.data('rl-plain-pgp-encrypted'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oMessage.isPgpSigned(false);
|
||||||
|
oMessage.isPgpEncrypted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.messageActiveDom(oMessage.body);
|
this.messageActiveDom(oMessage.body);
|
||||||
|
|
@ -16514,6 +16611,7 @@ AbstractApp.prototype.sub = function (sName, fFunc, oContext)
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.pub = function (sName, aArgs)
|
AbstractApp.prototype.pub = function (sName, aArgs)
|
||||||
{
|
{
|
||||||
|
Plugins.runHook('rl-pub', [sName, aArgs]);
|
||||||
if (!Utils.isUnd(this.oSubs[sName]))
|
if (!Utils.isUnd(this.oSubs[sName]))
|
||||||
{
|
{
|
||||||
_.each(this.oSubs[sName], function (aItem) {
|
_.each(this.oSubs[sName], function (aItem) {
|
||||||
|
|
@ -17289,6 +17387,7 @@ RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
|
||||||
|
|
||||||
RainLoopApp.prototype.bootstart = function ()
|
RainLoopApp.prototype.bootstart = function ()
|
||||||
{
|
{
|
||||||
|
RL.pub('rl.bootstart');
|
||||||
AbstractApp.prototype.bootstart.call(this);
|
AbstractApp.prototype.bootstart.call(this);
|
||||||
|
|
||||||
RL.data().populateDataOnStart();
|
RL.data().populateDataOnStart();
|
||||||
|
|
@ -17371,17 +17470,26 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
|
|
||||||
if (bValue)
|
if (bValue)
|
||||||
{
|
{
|
||||||
// if (window.crypto && window.crypto.getRandomValues)
|
if (window.crypto && window.crypto.getRandomValues && RL.settingsGet('OpenPGP'))
|
||||||
// {
|
{
|
||||||
// $.ajax({
|
$.ajax({
|
||||||
// 'url': RL.link().openPgpJs(),
|
'url': RL.link().openPgpJs(),
|
||||||
// 'dataType': 'script',
|
'dataType': 'script',
|
||||||
// 'cache': true,
|
'cache': true,
|
||||||
// 'success': function () {
|
'success': function () {
|
||||||
// window.console.log('openPgpJs');
|
if (window.openpgp)
|
||||||
// }
|
{
|
||||||
// });
|
// window.console.log(window.openpgp);
|
||||||
// }
|
Globals.bAllowOpenPGP = true;
|
||||||
|
RL.pub('openpgp.init');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Globals.bAllowOpenPGP = false;
|
||||||
|
}
|
||||||
|
|
||||||
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
||||||
|
|
||||||
|
|
@ -17432,13 +17540,15 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
|
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
|
||||||
Plugins.runHook('rl-start-user-screens');
|
Plugins.runHook('rl-start-user-screens');
|
||||||
|
RL.pub('rl.bootstart-user-screens');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kn.startScreens([LoginScreen]);
|
kn.startScreens([LoginScreen]);
|
||||||
|
|
||||||
Plugins.runHook('rl-start-login-screens');
|
Plugins.runHook('rl-start-login-screens');
|
||||||
|
RL.pub('rl.bootstart-login-screens');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.SimplePace)
|
if (window.SimplePace)
|
||||||
|
|
@ -17464,6 +17574,7 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
kn.startScreens([LoginScreen]);
|
kn.startScreens([LoginScreen]);
|
||||||
|
|
||||||
Plugins.runHook('rl-start-login-screens');
|
Plugins.runHook('rl-start-login-screens');
|
||||||
|
RL.pub('rl.bootstart-login-screens');
|
||||||
|
|
||||||
if (window.SimplePace)
|
if (window.SimplePace)
|
||||||
{
|
{
|
||||||
|
|
@ -17511,6 +17622,7 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
});
|
});
|
||||||
|
|
||||||
Plugins.runHook('rl-start-screens');
|
Plugins.runHook('rl-start-screens');
|
||||||
|
RL.pub('rl.bootstart-end');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
16
rainloop/v/0.0.0/static/js/app.min.js
vendored
16
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue