mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
Split application data
This commit is contained in:
parent
3215c5f8d3
commit
1391648e1b
22 changed files with 186 additions and 130 deletions
|
|
@ -103,6 +103,10 @@ class AbstractApp extends AbstractBoot
|
|||
return null;
|
||||
}
|
||||
|
||||
getApplicationConfiguration(name, default_) {
|
||||
return this.applicationConfiguration[name] || default_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} link
|
||||
* @return {boolean}
|
||||
|
|
@ -200,10 +204,10 @@ class AbstractApp extends AbstractBoot
|
|||
|
||||
const
|
||||
kn = require('Knoin/Knoin'),
|
||||
inIframe = !!Settings.settingsGet('InIframe')
|
||||
inIframe = !!Settings.appSettingsGet('inIframe')
|
||||
;
|
||||
|
||||
let customLogoutLink = Utils.pString(Settings.settingsGet('CustomLogoutLink'));
|
||||
let customLogoutLink = Utils.pString(Settings.appSettingsGet('customLogoutLink'));
|
||||
|
||||
if (logout)
|
||||
{
|
||||
|
|
@ -273,7 +277,7 @@ class AbstractApp extends AbstractBoot
|
|||
ko.components.register('x-script', require('Component/Script'));
|
||||
// ko.components.register('svg-icon', require('Component/SvgIcon'));
|
||||
|
||||
if (Settings.settingsGet('MaterialDesign') && Globals.bAnimationSupported)
|
||||
if (Settings.appSettingsGet('materialDesign') && Globals.bAnimationSupported)
|
||||
{
|
||||
ko.components.register('Checkbox', require('Component/MaterialDesign/Checkbox'));
|
||||
ko.components.register('CheckboxSimple', require('Component/Checkbox'));
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ class AdminApp extends AbstractApp
|
|||
|
||||
kn.hideLoading();
|
||||
|
||||
if (!Settings.settingsGet('AllowAdminPanel'))
|
||||
if (!Settings.appSettingsGet('allowAdminPanel'))
|
||||
{
|
||||
kn.routeOff();
|
||||
kn.setHash(Links.root(), true);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class AppUser extends AbstractApp
|
|||
Remote.jsVersion((sResult, oData) => {
|
||||
if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
|
||||
{
|
||||
if (window.parent && !!Settings.settingsGet('InIframe'))
|
||||
if (window.parent && !!Settings.appSettingsGet('inIframe'))
|
||||
{
|
||||
window.parent.location.reload();
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ class AppUser extends AbstractApp
|
|||
window.location.reload();
|
||||
}
|
||||
}
|
||||
}, Settings.settingsGet('Version'));
|
||||
}, Settings.appSettingsGet('version'));
|
||||
}, {}, 60 * 60 * 1000);
|
||||
|
||||
if (Settings.settingsGet('UserBackgroundHash'))
|
||||
|
|
@ -1185,7 +1185,7 @@ class AppUser extends AbstractApp
|
|||
|
||||
Globals.$html.removeClass('rl-user-auth').addClass('rl-user-no-auth');
|
||||
|
||||
const customLoginLink = Utils.pString(Settings.settingsGet('CustomLoginLink'));
|
||||
const customLoginLink = Utils.pString(Settings.appSettingsGet('customLoginLink'));
|
||||
if (!customLoginLink)
|
||||
{
|
||||
kn.startScreens([
|
||||
|
|
@ -1239,7 +1239,7 @@ class AppUser extends AbstractApp
|
|||
|
||||
var
|
||||
$LAB = require('$LAB'),
|
||||
sJsHash = Settings.settingsGet('JsHash'),
|
||||
sJsHash = Settings.appSettingsGet('jsHash'),
|
||||
sStartupUrl = Utils.pString(Settings.settingsGet('StartupUrl')),
|
||||
iContactsSyncInterval = Utils.pInt(Settings.settingsGet('ContactsSyncInterval')),
|
||||
bGoogle = Settings.settingsGet('AllowGoogleSocial'),
|
||||
|
|
@ -1411,7 +1411,7 @@ class AppUser extends AbstractApp
|
|||
{
|
||||
_.defer(() => this.initVerticalLayoutResizer(Enums.ClientSideKeyName.FolderListSize));
|
||||
|
||||
if (Tinycon && Settings.settingsGet('FaviconStatus') && !Settings.settingsGet('Filtered'))
|
||||
if (Tinycon && Settings.appSettingsGet('faviconStatus') && !Settings.appSettingsGet('listPermanentFiltered'))
|
||||
{
|
||||
Tinycon.setOptions({
|
||||
fallback: false
|
||||
|
|
|
|||
|
|
@ -238,8 +238,8 @@ class HtmlEditor
|
|||
const
|
||||
config = Globals.oHtmlEditorDefaultConfig,
|
||||
language = Settings.settingsGet('Language'),
|
||||
allowSource = !!Settings.settingsGet('AllowHtmlEditorSourceButton'),
|
||||
biti = !!Settings.settingsGet('AllowHtmlEditorBitiButtons')
|
||||
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
|
||||
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons')
|
||||
;
|
||||
|
||||
if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited)
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ class Links
|
|||
this.sBase = '#/';
|
||||
this.sServer = './?';
|
||||
|
||||
this.sVersion = Settings.settingsGet('Version');
|
||||
this.sVersion = Settings.appSettingsGet('version');
|
||||
this.sWebPrefix = Settings.appSettingsGet('webPath') || '';
|
||||
this.sVersionPrefix = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + this.sVersion + '/';
|
||||
this.sAdminPath = Settings.appSettingsGet('adminPath') || 'admin';
|
||||
|
||||
this.sAuthSuffix = Settings.settingsGet('AuthAccountHash') || '0';
|
||||
this.sWebPrefix = Settings.settingsGet('WebPath') || '';
|
||||
this.sAdminPath = Settings.settingsGet('AdminPath') || 'admin';
|
||||
this.sVersionPrefix = Settings.settingsGet('WebVersionPath') || 'rainloop/v/' + this.sVersion + '/';
|
||||
|
||||
this.sStaticPrefix = this.sVersionPrefix + 'static/';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
Autolinker = require('Autolinker'),
|
||||
JSON = require('JSON'),
|
||||
JSEncrypt = require('JSEncrypt'),
|
||||
|
||||
Mime = require('Common/Mime'),
|
||||
|
|
@ -1433,6 +1434,28 @@
|
|||
return (sResult === sFileName) ? '' : sResult;
|
||||
};
|
||||
|
||||
Utils.configurationScriptTagCache = {};
|
||||
|
||||
/**
|
||||
* @param {string} sConfiguration
|
||||
* @return {object}
|
||||
*/
|
||||
Utils.getConfigurationFromScriptTag = function (sConfiguration)
|
||||
{
|
||||
var oResult = {};
|
||||
|
||||
if (!Utils.configurationScriptTagCache[sConfiguration])
|
||||
{
|
||||
Utils.configurationScriptTagCache[sConfiguration] = $('script[type="application/json"][data-configuration="' + sConfiguration + '"]');
|
||||
}
|
||||
|
||||
try {
|
||||
oResult = JSON.parse(Utils.configurationScriptTagCache[sConfiguration].text());
|
||||
} catch (e) {/* eslint-disable-line no-empty */}
|
||||
|
||||
return oResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFileName
|
||||
* @return {string}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
if (bPost)
|
||||
{
|
||||
oParameters['XToken'] = Settings.settingsGet('Token');
|
||||
oParameters['XToken'] = Settings.appSettingsGet('token');
|
||||
}
|
||||
|
||||
Plugins.runHook('ajax-default-request', [sAction, oParameters, sAdditionalGetString]);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@
|
|||
oData['@Collection'] && Utils.isArray(oData['@Collection']))
|
||||
{
|
||||
var
|
||||
iLimit = Utils.pInt(Settings.settingsGet('FolderSpecLimit')),
|
||||
iLimit = Utils.pInt(Settings.appSettingsGet('folderSpecLimit')),
|
||||
iC = Utils.pInt(oData['CountRec'])
|
||||
;
|
||||
|
||||
|
|
@ -163,9 +163,7 @@
|
|||
FolderStore.namespace = oData.Namespace;
|
||||
}
|
||||
|
||||
AppStore.threadsAllowed(
|
||||
!!Settings.settingsGet('UseImapThread') &&
|
||||
oData.IsThreadsSupported && true);
|
||||
AppStore.threadsAllowed(!!Settings.appSettingsGet('useImapThread') && oData.IsThreadsSupported && true);
|
||||
|
||||
FolderStore.folderList.optimized(!!oData.Optimized);
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@
|
|||
|
||||
if (bPost)
|
||||
{
|
||||
oParameters['XToken'] = Settings.settingsGet('Token');
|
||||
oParameters['XToken'] = Settings.appSettingsGet('token');
|
||||
}
|
||||
|
||||
oDefAjax = $.ajax({
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount()
|
||||
;
|
||||
|
||||
if (Settings.settingsGet('Filtered'))
|
||||
if (Settings.appSettingsGet('listPermanentFiltered'))
|
||||
{
|
||||
nFoldersInboxUnreadCount = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
function AboutAdminSettings()
|
||||
{
|
||||
this.version = ko.observable(Settings.settingsGet('Version'));
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
}
|
||||
]});
|
||||
|
||||
this.useImapSubscribe = !!Settings.settingsGet('UseImapSubscribe');
|
||||
this.useImapSubscribe = !!Settings.appSettingsGet('useImapSubscribe');
|
||||
}
|
||||
|
||||
FoldersUserSettings.prototype.folderEditOnEnter = function (oFolder)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,17 @@ import Utils from 'Common/Utils';
|
|||
|
||||
class SettingsStorage
|
||||
{
|
||||
settings = {};
|
||||
appSettings = {};
|
||||
|
||||
constructor() {
|
||||
this.settings = window.rainloopAppData || {};
|
||||
this.settings = Utils.isNormal(this.settings) ? this.settings : {};
|
||||
|
||||
this.appSettings = Utils.getConfigurationFromScriptTag('application');
|
||||
this.appSettings = Utils.isNormal(this.appSettings) ? this.appSettings : {};
|
||||
|
||||
window.console.log(this.appSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +33,14 @@ class SettingsStorage
|
|||
this.settings[name] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {*}
|
||||
*/
|
||||
appSettingsGet(name) {
|
||||
return Utils.isUnd(this.appSettings[name]) ? null : this.appSettings[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @return {boolean}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class AppUserStore extends AbstractAppStore
|
|||
|
||||
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
|
||||
|
||||
const attachmentsActions = Settings.settingsGet('AttachmentsActions');
|
||||
const attachmentsActions = Settings.appSettingsGet('attachmentsActions');
|
||||
this.attachmentsActions(Utils.isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.devEmail = Settings.settingsGet('DevEmail');
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
AbstractView.call(this, 'Right', 'AdminPane');
|
||||
|
||||
this.adminDomain = ko.observable(Settings.settingsGet('AdminDomain'));
|
||||
this.version = ko.observable(Settings.settingsGet('Version'));
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
|
||||
this.capa = !!Settings.settingsGet('PremType');
|
||||
this.community = RL_COMMUNITY;
|
||||
|
|
|
|||
|
|
@ -1461,7 +1461,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (!!Settings.settingsGet('AllowCtrlEnterOnCompose'))
|
||||
if (!!Settings.appSettingsGet('allowCtrlEnterOnCompose'))
|
||||
{
|
||||
key('ctrl+enter, command+enter', Enums.KeyState.Compose, function () {
|
||||
self.sendCommand();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
{
|
||||
AbstractView.call(this, 'Center', 'About');
|
||||
|
||||
this.version = ko.observable(Settings.settingsGet('Version'));
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@
|
|||
this.logoPowered = !!Settings.settingsGet('LoginPowered');
|
||||
this.loginDescription = Utils.trim(Settings.settingsGet('LoginDescription'));
|
||||
|
||||
this.forgotPasswordLinkUrl = Settings.settingsGet('ForgotPasswordLinkUrl');
|
||||
this.registrationLinkUrl = Settings.settingsGet('RegistrationLinkUrl');
|
||||
this.forgotPasswordLinkUrl = Settings.appSettingsGet('forgotPasswordLinkUrl');
|
||||
this.registrationLinkUrl = Settings.appSettingsGet('registrationLinkUrl');
|
||||
|
||||
this.emailError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
|
@ -266,10 +266,9 @@
|
|||
}, this)
|
||||
;
|
||||
|
||||
if (!!Settings.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported &&
|
||||
Settings.settingsGet('RsaPublicKey'))
|
||||
if (Settings.appSettingsGet('rsaPublicKey') && Utils.rsaEncode.supported)
|
||||
{
|
||||
fLoginRequest(Utils.rsaEncode(sPassword, Settings.settingsGet('RsaPublicKey')));
|
||||
fLoginRequest(Utils.rsaEncode(sPassword, Settings.appSettingsGet('rsaPublicKey')));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -979,7 +979,7 @@
|
|||
|
||||
MessageListMailBoxUserView.prototype.initUploaderForAppend = function ()
|
||||
{
|
||||
if (!Settings.settingsGet('AllowAppendMessage') || !this.dragOverArea())
|
||||
if (!Settings.appSettingsGet('allowAppendMessage') || !this.dragOverArea())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue