mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
parent
07b0f20305
commit
d3ee36bb97
68 changed files with 629 additions and 392 deletions
16
dev/Admin/About.js
Normal file
16
dev/Admin/About.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminAbout()
|
||||
{
|
||||
this.version = ko.observable(RL.settingsGet('Version'));
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminAbout, 'AdminSettingsAbout', 'About', 'about');
|
||||
|
||||
//AdminAbout.prototype.onBuild = function ()
|
||||
//{
|
||||
//
|
||||
//};
|
||||
|
|
@ -13,11 +13,11 @@ function AdminGeneral()
|
|||
this.language = oData.language;
|
||||
this.theme = oData.theme;
|
||||
|
||||
this.allowThemes = oData.allowThemes;
|
||||
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
|
||||
this.allowAdditionalAccounts = oData.allowAdditionalAccounts;
|
||||
this.allowIdentities = oData.allowIdentities;
|
||||
this.allowGravatar = oData.allowGravatar;
|
||||
this.capaThemes = oData.capaThemes;
|
||||
this.capaGravatar = oData.capaGravatar;
|
||||
this.capaAdditionalAccounts = oData.capaAdditionalAccounts;
|
||||
this.capaAdditionalIdentities = oData.capaAdditionalIdentities;
|
||||
|
||||
this.themesOptions = ko.computed(function () {
|
||||
return _.map(oData.themes(), function (sTheme) {
|
||||
|
|
@ -62,27 +62,27 @@ AdminGeneral.prototype.onBuild = function ()
|
|||
});
|
||||
});
|
||||
|
||||
self.allowAdditionalAccounts.subscribe(function (bValue) {
|
||||
self.capaAdditionalAccounts.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'AllowAdditionalAccounts': bValue ? '1' : '0'
|
||||
'CapaAdditionalAccounts': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowIdentities.subscribe(function (bValue) {
|
||||
self.capaAdditionalIdentities.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'AllowIdentities': bValue ? '1' : '0'
|
||||
'CapaAdditionalIdentities': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowGravatar.subscribe(function (bValue) {
|
||||
self.capaGravatar.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'AllowGravatar': bValue ? '1' : '0'
|
||||
'CapaGravatar': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowThemes.subscribe(function (bValue) {
|
||||
self.capaThemes.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'AllowThemes': bValue ? '1' : '0'
|
||||
'CapaThemes': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
function AdminSecurity()
|
||||
{
|
||||
this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection'));
|
||||
this.openPGP = ko.observable(!!RL.settingsGet('OpenPGP'));
|
||||
this.allowTwoFactorAuth = ko.observable(!!RL.settingsGet('AllowTwoFactorAuth'));
|
||||
this.capaOpenPGP = ko.observable(RL.capa(Enums.Capa.OpenPGP));
|
||||
this.capaTwoFactorAuth = ko.observable(RL.capa(Enums.Capa.TwoFactor));
|
||||
|
||||
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
||||
this.adminPassword = ko.observable('');
|
||||
|
|
@ -84,15 +84,15 @@ AdminSecurity.prototype.onBuild = function ()
|
|||
});
|
||||
});
|
||||
|
||||
this.openPGP.subscribe(function (bValue) {
|
||||
this.capaOpenPGP.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'OpenPGP': bValue ? '1' : '0'
|
||||
'CapaOpenPGP': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.allowTwoFactorAuth.subscribe(function (bValue) {
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'AllowTwoFactorAuth': bValue ? '1' : '0'
|
||||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ AdminApp.prototype.bootstart = function ()
|
|||
}
|
||||
else
|
||||
{
|
||||
Utils.removeSettingsViewModel(AdminAbout);
|
||||
|
||||
if (!RL.capa(Enums.Capa.Prem))
|
||||
{
|
||||
Utils.removeSettingsViewModel(AdminBranding);
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ RainLoopApp.prototype.folders = function (fCallback)
|
|||
|
||||
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
||||
{
|
||||
if (RL.data().allowOpenPGP())
|
||||
if (RL.data().capaOpenPGP())
|
||||
{
|
||||
var
|
||||
aKeys = [],
|
||||
|
|
@ -1043,12 +1043,12 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
Utils.removeSettingsViewModel(SettingsContacts);
|
||||
}
|
||||
|
||||
if (!RL.settingsGet('AllowAdditionalAccounts'))
|
||||
if (!RL.capa(Enums.Capa.AdditionalAccounts))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsAccounts);
|
||||
}
|
||||
|
||||
if (RL.settingsGet('AllowIdentities'))
|
||||
if (RL.capa(Enums.Capa.AdditionalIdentities))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsIdentity);
|
||||
}
|
||||
|
|
@ -1057,26 +1057,26 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
Utils.removeSettingsViewModel(SettingsIdentities);
|
||||
}
|
||||
|
||||
if (!RL.settingsGet('OpenPGP'))
|
||||
if (!RL.capa(Enums.Capa.OpenPGP))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsOpenPGP);
|
||||
}
|
||||
|
||||
if (!RL.settingsGet('AllowTwoFactorAuth'))
|
||||
if (!RL.capa(Enums.Capa.TwoFactor))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsSecurity);
|
||||
}
|
||||
|
||||
if (!RL.capa(Enums.Capa.Themes))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsThemes);
|
||||
}
|
||||
|
||||
if (!bGoogle && !bFacebook && !bTwitter)
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsSocialScreen);
|
||||
}
|
||||
|
||||
if (!RL.settingsGet('AllowThemes'))
|
||||
{
|
||||
Utils.removeSettingsViewModel(SettingsThemes);
|
||||
}
|
||||
|
||||
Utils.initOnStartOrLangChange(function () {
|
||||
|
||||
$.extend(true, $.magnificPopup.defaults, {
|
||||
|
|
@ -1113,7 +1113,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
|
||||
if (bValue)
|
||||
{
|
||||
if (window.crypto && window.crypto.getRandomValues && RL.settingsGet('OpenPGP'))
|
||||
if (window.crypto && window.crypto.getRandomValues && RL.capa(Enums.Capa.OpenPGP))
|
||||
{
|
||||
$.ajax({
|
||||
'url': RL.link().openPgpJs(),
|
||||
|
|
@ -1123,7 +1123,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
if (window.openpgp)
|
||||
{
|
||||
RL.data().openpgpKeyring = new window.openpgp.Keyring();
|
||||
RL.data().allowOpenPGP(true);
|
||||
RL.data().capaOpenPGP(true);
|
||||
|
||||
RL.pub('openpgp.init');
|
||||
|
||||
|
|
@ -1134,7 +1134,7 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
}
|
||||
else
|
||||
{
|
||||
RL.data().allowOpenPGP(false);
|
||||
RL.data().capaOpenPGP(false);
|
||||
}
|
||||
|
||||
kn.startScreens([MailBoxScreen, SettingsScreen]);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,14 @@ Enums.StateType = {
|
|||
* @enum {string}
|
||||
*/
|
||||
Enums.Capa = {
|
||||
'Prem': 'PREM'
|
||||
'Prem': 'PREM',
|
||||
'TwoFactor': 'TWO_FACTOR',
|
||||
'OpenPGP': 'OPEN_PGP',
|
||||
'Prefetch': 'PREFETCH',
|
||||
'Gravatar': 'GRAVATAR',
|
||||
'Themes': 'THEMES',
|
||||
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
|
||||
'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -772,7 +772,7 @@ Utils.initDataConstructorBySettings = function (oData)
|
|||
|
||||
Globals.sAnimationType = Enums.InterfaceAnimation.Full;
|
||||
|
||||
oData.allowThemes = ko.observable(true);
|
||||
oData.capaThemes = ko.observable(false);
|
||||
oData.allowCustomLogin = ko.observable(false);
|
||||
oData.allowLanguagesOnSettings = ko.observable(true);
|
||||
oData.allowLanguagesOnLogin = ko.observable(true);
|
||||
|
|
@ -940,9 +940,9 @@ Utils.initDataConstructorBySettings = function (oData)
|
|||
}
|
||||
});
|
||||
|
||||
oData.allowAdditionalAccounts = ko.observable(false);
|
||||
oData.allowIdentities = ko.observable(false);
|
||||
oData.allowGravatar = ko.observable(false);
|
||||
oData.capaAdditionalAccounts = ko.observable(false);
|
||||
oData.capaAdditionalIdentities = ko.observable(false);
|
||||
oData.capaGravatar = ko.observable(false);
|
||||
oData.determineUserLanguage = ko.observable(false);
|
||||
|
||||
oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
|||
this.sInReplyTo = oJsonMessage.InReplyTo;
|
||||
this.sReferences = oJsonMessage.References;
|
||||
|
||||
if (RL.data().allowOpenPGP())
|
||||
if (RL.data().capaOpenPGP())
|
||||
{
|
||||
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||
|
|
@ -997,7 +997,7 @@ MessageModel.prototype.storeDataToDom = function ()
|
|||
|
||||
this.body.data('rl-plain-raw', this.plainRaw);
|
||||
|
||||
if (RL.data().allowOpenPGP())
|
||||
if (RL.data().capaOpenPGP())
|
||||
{
|
||||
this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
|
||||
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
|
||||
|
|
@ -1009,7 +1009,7 @@ MessageModel.prototype.storeDataToDom = function ()
|
|||
|
||||
MessageModel.prototype.storePgpVerifyDataToDom = function ()
|
||||
{
|
||||
if (this.body && RL.data().allowOpenPGP())
|
||||
if (this.body && RL.data().capaOpenPGP())
|
||||
{
|
||||
this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
|
||||
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
|
||||
|
|
@ -1026,7 +1026,7 @@ MessageModel.prototype.fetchDataToDom = function ()
|
|||
|
||||
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
|
||||
|
||||
if (RL.data().allowOpenPGP())
|
||||
if (RL.data().capaOpenPGP())
|
||||
{
|
||||
this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
|
||||
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ MailBoxScreen.prototype.onStart = function ()
|
|||
}
|
||||
;
|
||||
|
||||
if (RL.settingsGet('AllowAdditionalAccounts') || RL.settingsGet('AllowIdentities'))
|
||||
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))
|
||||
{
|
||||
RL.accountsAndIdentities();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ function AbstractCacheStorage()
|
|||
{
|
||||
this.oEmailsPicsHashes = {};
|
||||
this.oServices = {};
|
||||
this.bAllowGravatar = !!RL.settingsGet('AllowGravatar');
|
||||
this.bCapaGravatar = RL.capa(Enums.Capa.Gravatar);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -23,7 +23,7 @@ AbstractCacheStorage.prototype.oServices = {};
|
|||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.bAllowGravatar = false;
|
||||
AbstractCacheStorage.prototype.bCapaGravatar = false;
|
||||
|
||||
AbstractCacheStorage.prototype.clear = function ()
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@ AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
|
|||
}
|
||||
|
||||
|
||||
if (this.bAllowGravatar && '' === sUrl)
|
||||
if (this.bCapaGravatar && '' === sUrl)
|
||||
{
|
||||
fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,12 +84,12 @@ AbstractData.prototype.populateDataOnStart = function()
|
|||
this.mainLanguage(RL.settingsGet('Language'));
|
||||
this.mainTheme(RL.settingsGet('Theme'));
|
||||
|
||||
this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts'));
|
||||
this.allowIdentities(!!RL.settingsGet('AllowIdentities'));
|
||||
this.allowGravatar(!!RL.settingsGet('AllowGravatar'));
|
||||
this.capaAdditionalAccounts(RL.capa(Enums.Capa.AdditionalAccounts));
|
||||
this.capaAdditionalIdentities(RL.capa(Enums.Capa.AdditionalIdentities));
|
||||
this.capaGravatar(RL.capa(Enums.Capa.Gravatar));
|
||||
this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage'));
|
||||
|
||||
this.allowThemes(!!RL.settingsGet('AllowThemes'));
|
||||
|
||||
this.capaThemes(RL.capa(Enums.Capa.Themes));
|
||||
this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin'));
|
||||
this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin'));
|
||||
this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings'));
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ function WebMailDataStorage()
|
|||
}, this);
|
||||
|
||||
// other
|
||||
this.allowOpenPGP = ko.observable(false);
|
||||
this.capaOpenPGP = ko.observable(false);
|
||||
this.openpgpkeys = ko.observableArray([]);
|
||||
this.openpgpKeyring = null;
|
||||
|
||||
|
|
@ -929,8 +929,7 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
|
|||
sPlain = oData.Result.Plain.toString();
|
||||
|
||||
if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) &&
|
||||
RL.data().allowOpenPGP() &&
|
||||
Utils.isNormal(oData.Result.PlainRaw))
|
||||
RL.data().capaOpenPGP() && Utils.isNormal(oData.Result.PlainRaw))
|
||||
{
|
||||
oMessage.plainRaw = Utils.pString(oData.Result.PlainRaw);
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@
|
|||
@import "AdminPackages.less";
|
||||
@import "AdminPlugins.less";
|
||||
@import "AdminPlugin.less";
|
||||
@import "AdminAbout.less";
|
||||
@import "Activate.less";
|
||||
@import "Settings.less";
|
||||
@import "SettingsGeneral.less";
|
||||
|
|
|
|||
10
dev/Styles/AdminAbout.less
Normal file
10
dev/Styles/AdminAbout.less
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
.b-admin-about {
|
||||
.rl-logo {
|
||||
display: inline-block;
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
background-image: url("images/rainloop-logo.png");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ function AbstractSystemDropDownViewModel()
|
|||
|
||||
this.accountMenuDropdownTrigger = ko.observable(false);
|
||||
|
||||
this.allowAddAccount = RL.settingsGet('AllowAdditionalAccounts');
|
||||
this.capaAdditionalAccounts = RL.capa(Enums.Capa.AdditionalAccounts);
|
||||
|
||||
this.loading = ko.computed(function () {
|
||||
return this.accountsLoading();
|
||||
|
|
@ -58,7 +58,7 @@ AbstractSystemDropDownViewModel.prototype.settingsHelp = function ()
|
|||
|
||||
AbstractSystemDropDownViewModel.prototype.addAccountClick = function ()
|
||||
{
|
||||
if (this.allowAddAccount)
|
||||
if (this.capaAdditionalAccounts)
|
||||
{
|
||||
kn.showScreenPopup(PopupsAddAccountViewModel);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
|
|||
this.initUploaderForAppend();
|
||||
this.initShortcuts();
|
||||
|
||||
if (!Globals.bMobileDevice && !!RL.settingsGet('AllowPrefetch') && ifvisible)
|
||||
if (!Globals.bMobileDevice && RL.capa(Enums.Capa.Prefetch) && ifvisible)
|
||||
{
|
||||
ifvisible.setIdleDuration(10);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ function PopupsComposeViewModel()
|
|||
this.bFromDraft = false;
|
||||
this.bSkipNext = false;
|
||||
this.sReferences = '';
|
||||
|
||||
this.bAllowIdentities = RL.settingsGet('AllowIdentities');
|
||||
|
||||
this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities);
|
||||
|
||||
var
|
||||
self = this,
|
||||
|
|
@ -28,7 +28,7 @@ function PopupsComposeViewModel()
|
|||
}
|
||||
;
|
||||
|
||||
this.allowOpenPGP = oRainLoopData.allowOpenPGP;
|
||||
this.capaOpenPGP = oRainLoopData.capaOpenPGP;
|
||||
|
||||
this.resizer = ko.observable(false).extend({'throttle': 50});
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ function PopupsComposeViewModel()
|
|||
sID = this.currentIdentityID()
|
||||
;
|
||||
|
||||
if (this.bAllowIdentities && sID && sID !== RL.data().accountEmail())
|
||||
if (this.bCapaAdditionalIdentities && sID && sID !== RL.data().accountEmail())
|
||||
{
|
||||
oItem = _.find(aList, function (oItem) {
|
||||
return oItem && sID === oItem['id'];
|
||||
|
|
@ -366,7 +366,7 @@ Utils.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel);
|
|||
|
||||
PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
|
||||
{
|
||||
if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml())
|
||||
if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
|
||||
{
|
||||
var self = this;
|
||||
kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [
|
||||
|
|
@ -417,7 +417,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp
|
|||
}
|
||||
;
|
||||
|
||||
if (this.bAllowIdentities)
|
||||
if (this.bCapaAdditionalIdentities)
|
||||
{
|
||||
_.each(this.identities(), function (oItem) {
|
||||
oIDs[oItem.email()] = oItem['id'];
|
||||
|
|
|
|||
|
|
@ -47,6 +47,13 @@ function PopupsGenerateNewOpenPgpKeyViewModel()
|
|||
|
||||
_.delay(function () {
|
||||
mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password()));
|
||||
// 0.6.0
|
||||
// mKeyPair = window.openpgp.generateKeyPair({
|
||||
// 'numBits': Utils.pInt(self.keyBitLength()),
|
||||
// 'userId': sUserID,
|
||||
// 'passphrase': Utils.trim(self.password())
|
||||
// });
|
||||
|
||||
if (mKeyPair && mKeyPair.privateKeyArmored)
|
||||
{
|
||||
oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue