mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
Added "use_local_proxy_for_external_images" setting (Closes #211)
This commit is contained in:
parent
a19e19d866
commit
3ae18e76c6
16 changed files with 230 additions and 43 deletions
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
function AdminSecurity()
|
||||
{
|
||||
this.useLocalProxyForExternalImages = RL.data().useLocalProxyForExternalImages;
|
||||
|
||||
this.capaOpenPGP = ko.observable(RL.capa(Enums.Capa.OpenPGP));
|
||||
this.capaTwoFactorAuth = ko.observable(RL.capa(Enums.Capa.TwoFactor));
|
||||
|
||||
|
|
@ -88,6 +90,12 @@ AdminSecurity.prototype.onBuild = function ()
|
|||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.useLocalProxyForExternalImages.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'UseLocalProxyForExternalImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AdminSecurity.prototype.onHide = function ()
|
||||
|
|
|
|||
|
|
@ -777,6 +777,8 @@ Utils.initDataConstructorBySettings = function (oData)
|
|||
oData.capaThemes = ko.observable(false);
|
||||
oData.allowLanguagesOnSettings = ko.observable(true);
|
||||
oData.allowLanguagesOnLogin = ko.observable(true);
|
||||
|
||||
oData.useLocalProxyForExternalImages = ko.observable(false);
|
||||
|
||||
oData.desktopNotifications = ko.observable(false);
|
||||
oData.useThreads = ko.observable(true);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ function MessageModel()
|
|||
this.dateTimeStampInUTC = ko.observable(0);
|
||||
this.priority = ko.observable(Enums.MessagePriority.Normal);
|
||||
|
||||
this.proxy = false;
|
||||
|
||||
this.fromEmailString = ko.observable('');
|
||||
this.toEmailsString = ko.observable('');
|
||||
this.senderEmailsString = ko.observable('');
|
||||
|
|
@ -232,6 +234,8 @@ MessageModel.prototype.clear = function ()
|
|||
this.dateTimeStampInUTC(0);
|
||||
this.priority(Enums.MessagePriority.Normal);
|
||||
|
||||
this.proxy = false;
|
||||
|
||||
this.fromEmailString('');
|
||||
this.toEmailsString('');
|
||||
this.senderEmailsString('');
|
||||
|
|
@ -312,6 +316,8 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
|
|||
this.hash = oJsonMessage.Hash;
|
||||
this.requestHash = oJsonMessage.RequestHash;
|
||||
|
||||
this.proxy = !!oJsonMessage.ExternalProxy;
|
||||
|
||||
this.size(Utils.pInt(oJsonMessage.Size));
|
||||
|
||||
this.from = MessageModel.initEmailsFromJson(oJsonMessage.From);
|
||||
|
|
@ -365,6 +371,8 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
|||
this.sInReplyTo = oJsonMessage.InReplyTo;
|
||||
this.sReferences = oJsonMessage.References;
|
||||
|
||||
this.proxy = !!oJsonMessage.ExternalProxy;
|
||||
|
||||
if (RL.data().capaOpenPGP())
|
||||
{
|
||||
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||
|
|
@ -807,6 +815,8 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
|||
this.dateTimeStampInUTC(oMessage.dateTimeStampInUTC());
|
||||
this.priority(oMessage.priority());
|
||||
|
||||
this.proxy = oMessage.proxy;
|
||||
|
||||
this.fromEmailString(oMessage.fromEmailString());
|
||||
this.toEmailsString(oMessage.toEmailsString());
|
||||
|
||||
|
|
@ -860,30 +870,33 @@ MessageModel.prototype.showExternalImages = function (bLazy)
|
|||
{
|
||||
if (this.body && this.body.data('rl-has-images'))
|
||||
{
|
||||
var sAttr = '';
|
||||
bLazy = Utils.isUnd(bLazy) ? false : bLazy;
|
||||
|
||||
this.hasImages(false);
|
||||
this.body.data('rl-has-images', false);
|
||||
|
||||
$('[data-x-src]', this.body).each(function () {
|
||||
sAttr = this.proxy ? 'data-x-additional-src' : 'data-x-src';
|
||||
$('[' + sAttr + ']', this.body).each(function () {
|
||||
if (bLazy && $(this).is('img'))
|
||||
{
|
||||
$(this)
|
||||
.addClass('lazy')
|
||||
.attr('data-original', $(this).attr('data-x-src'))
|
||||
.removeAttr('data-x-src')
|
||||
.attr('data-original', $(this).attr(sAttr))
|
||||
.removeAttr(sAttr)
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr('src', $(this).attr('data-x-src')).removeAttr('data-x-src');
|
||||
$(this).attr('src', $(this).attr(sAttr)).removeAttr(sAttr);
|
||||
}
|
||||
});
|
||||
|
||||
$('[data-x-style-url]', this.body).each(function () {
|
||||
sAttr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url';
|
||||
$('[' + sAttr + ']', this.body).each(function () {
|
||||
var sStyle = Utils.trim($(this).attr('style'));
|
||||
sStyle = '' === sStyle ? '' : (';' === sStyle.substr(-1) ? sStyle + ' ' : sStyle + '; ');
|
||||
$(this).attr('style', sStyle + $(this).attr('data-x-style-url')).removeAttr('data-x-style-url');
|
||||
$(this).attr('style', sStyle + $(this).attr(sAttr)).removeAttr(sAttr);
|
||||
});
|
||||
|
||||
if (bLazy)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ function AbstractData()
|
|||
{
|
||||
this.leftPanelDisabled = ko.observable(false);
|
||||
this.useKeyboardShortcuts = ko.observable(true);
|
||||
|
||||
|
||||
this.keyScopeReal = ko.observable(Enums.KeyState.All);
|
||||
this.keyScopeFake = ko.observable(Enums.KeyState.All);
|
||||
|
||||
|
||||
this.keyScope = ko.computed({
|
||||
'owner': this,
|
||||
'read': function () {
|
||||
|
|
@ -35,11 +35,11 @@ function AbstractData()
|
|||
sValue = Enums.KeyState.Menu;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.keyScopeReal(sValue);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.keyScopeReal.subscribe(function (sValue) {
|
||||
// window.console.log(sValue);
|
||||
key.setScope(sValue);
|
||||
|
|
@ -93,6 +93,7 @@ AbstractData.prototype.populateDataOnStart = function()
|
|||
this.capaThemes(RL.capa(Enums.Capa.Themes));
|
||||
this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin'));
|
||||
this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings'));
|
||||
this.useLocalProxyForExternalImages(!!RL.settingsGet('UseLocalProxyForExternalImages'));
|
||||
|
||||
this.editorDefaultType(RL.settingsGet('EditorDefaultType'));
|
||||
this.showImages(!!RL.settingsGet('ShowImages'));
|
||||
|
|
@ -105,7 +106,7 @@ AbstractData.prototype.populateDataOnStart = function()
|
|||
this.useThreads(!!RL.settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!RL.settingsGet('ReplySameFolder'));
|
||||
this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList'));
|
||||
|
||||
|
||||
this.layout(Enums.Layout.SidePreview);
|
||||
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue