mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 20:42:19 +08: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;
|
||||
}
|
||||
|
|
|
@ -1395,25 +1395,24 @@ class Actions
|
|||
$oAccount = null;
|
||||
$oConfig = $this->Config();
|
||||
|
||||
$oPremProvider = $this->PremProvider();
|
||||
/*
|
||||
required by Index.html and rl.js:
|
||||
NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBackground PluginsLink AuthAccountHash
|
||||
*/
|
||||
|
||||
$aResult = array(
|
||||
'Version' => APP_VERSION,
|
||||
'Auth' => false,
|
||||
'AccountHash' => '',
|
||||
'WebPath' => \RainLoop\Utils::WebPath(),
|
||||
'AdminPath' => \strtolower($oConfig->Get('security', 'admin_panel_key', 'admin')),
|
||||
'WebVersionPath' => \RainLoop\Utils::WebVersionPath(),
|
||||
'AccountSignMe' => false,
|
||||
'AuthAccountHash' => '',
|
||||
'MailToEmail' => '',
|
||||
'Email' => '',
|
||||
'DevEmail' => '',
|
||||
'DevPassword' => '',
|
||||
'Title' => 'RainLoop Webmail',
|
||||
'LoadingDescription' => 'RainLoop',
|
||||
'Title' => $oConfig->Get('webmail', 'title', 'RainLoop Webmail'),
|
||||
'LoadingDescription' => $oConfig->Get('webmail', 'loading_description', 'RainLoop'),
|
||||
'LoadingDescriptionEsc' => 'RainLoop',
|
||||
'FaviconUrl' => '',
|
||||
'FaviconUrl' => $oConfig->Get('webmail', 'favicon_url', ''),
|
||||
'LoginDescription' => '',
|
||||
'LoginPowered' => true,
|
||||
'LoginLogo' => '',
|
||||
|
@ -1427,89 +1426,27 @@ class Actions
|
|||
'WelcomePageDisplay' => 'none',
|
||||
'IncludeCss' => '',
|
||||
'IncludeBackground' => '',
|
||||
'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '',
|
||||
'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false),
|
||||
'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true),
|
||||
'AllowHtmlEditorSourceButton' => (bool) $oConfig->Get('labs', 'allow_html_editor_source_button', false),
|
||||
'AllowHtmlEditorBitiButtons' => (bool) $oConfig->Get('labs', 'allow_html_editor_biti_buttons', false),
|
||||
'AllowCtrlEnterOnCompose' => (bool) $oConfig->Get('labs', 'allow_ctrl_enter_on_compose', false),
|
||||
'UseRsaEncryption' => (bool) $oConfig->Get('security', 'use_rsa_encryption', false),
|
||||
'RsaPublicKey' => '',
|
||||
'CustomLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''),
|
||||
'CustomLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''),
|
||||
'LoginDefaultDomain' => $oConfig->Get('login', 'default_domain', ''),
|
||||
'DetermineUserLanguage' => (bool) $oConfig->Get('login', 'determine_user_language', true),
|
||||
'DetermineUserDomain' => (bool) $oConfig->Get('login', 'determine_user_domain', false),
|
||||
'UseLoginWelcomePage' => (bool) $oConfig->Get('login', 'welcome_page', false),
|
||||
'ForgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')),
|
||||
'RegistrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
||||
'StartupUrl' => \trim(\ltrim(\trim($oConfig->Get('labs', 'startup_url', '')), '#/')),
|
||||
'ContactsIsAllowed' => false,
|
||||
'ChangePasswordIsAllowed' => false,
|
||||
'RequireTwoFactor' => false,
|
||||
'JsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
|
||||
'UseImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
||||
'UseImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
||||
'AllowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false),
|
||||
'MaterialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true),
|
||||
'FolderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
|
||||
'StartupUrl' => \trim(\ltrim(\trim($oConfig->Get('labs', 'startup_url', '')), '#/')),
|
||||
'FaviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true),
|
||||
'Filtered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
|
||||
'Community' => true,
|
||||
'PremType' => false,
|
||||
'Admin' => array(),
|
||||
'Capa' => array(),
|
||||
'AttachmentsActions' => array(),
|
||||
'Plugins' => array()
|
||||
);
|
||||
|
||||
if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENTS_ACTIONS))
|
||||
{
|
||||
if (!!\class_exists('ZipArchive'))
|
||||
{
|
||||
$aResult['AttachmentsActions'][] = 'zip';
|
||||
}
|
||||
|
||||
if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('OCP\Files'))
|
||||
{
|
||||
$aResult['AttachmentsActions'][] = 'owncloud';
|
||||
}
|
||||
|
||||
if ($oConfig->Get('social', 'dropbox_enable', false) && 0 < \strlen(\trim($oConfig->Get('social', 'dropbox_api_key', ''))))
|
||||
{
|
||||
$aResult['AttachmentsActions'][] = 'dropbox';
|
||||
}
|
||||
}
|
||||
|
||||
$aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false);
|
||||
$aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', ''));
|
||||
|
||||
if ($aResult['UseRsaEncryption'] &&
|
||||
\file_exists(APP_PRIVATE_DATA.'rsa/public') && \file_exists(APP_PRIVATE_DATA.'rsa/private'))
|
||||
{
|
||||
$aResult['RsaPublicKey'] = \file_get_contents(APP_PRIVATE_DATA.'rsa/public');
|
||||
$aResult['RsaPublicKey'] = $aResult['RsaPublicKey'] ? $aResult['RsaPublicKey'] : '';
|
||||
|
||||
if (false === \strpos($aResult['RsaPublicKey'], 'PUBLIC KEY'))
|
||||
{
|
||||
$aResult['RsaPublicKey'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (0 === \strlen($aResult['RsaPublicKey']))
|
||||
{
|
||||
$aResult['UseRsaEncryption'] = false;
|
||||
}
|
||||
|
||||
if (0 < \strlen($sAuthAccountHash))
|
||||
{
|
||||
$aResult['AuthAccountHash'] = $sAuthAccountHash;
|
||||
}
|
||||
|
||||
$aResult['Title'] = $oConfig->Get('webmail', 'title', '');
|
||||
$aResult['LoadingDescription'] = $oConfig->Get('webmail', 'loading_description', '');
|
||||
$aResult['FaviconUrl'] = $oConfig->Get('webmail', 'favicon_url', '');
|
||||
|
||||
$oPremProvider = $this->PremProvider();
|
||||
if ($oPremProvider)
|
||||
{
|
||||
$oPremProvider->PopulateAppData($aResult);
|
||||
|
@ -1813,7 +1750,7 @@ class Actions
|
|||
|
||||
if ($oSettingsLocal instanceof \RainLoop\Settings)
|
||||
{
|
||||
// if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::FOLDERS, $oAccount))
|
||||
// if ($this->GetCapa(false, \RainLoop\Enumerations\Capa::FOLDERS, $oAccount))
|
||||
|
||||
$aResult['SentFolder'] = (string) $oSettingsLocal->GetConf('SentFolder', '');
|
||||
$aResult['DraftFolder'] = (string) $oSettingsLocal->GetConf('DraftFolder', '');
|
||||
|
@ -1851,11 +1788,11 @@ class Actions
|
|||
{
|
||||
$aResult['UserBackgroundName'] = (string) $oSettings->GetConf('UserBackgroundName', $aResult['UserBackgroundName']);
|
||||
$aResult['UserBackgroundHash'] = (string) $oSettings->GetConf('UserBackgroundHash', $aResult['UserBackgroundHash']);
|
||||
// if (!empty($aResult['UserBackgroundName']) && !empty($aResult['UserBackgroundHash']))
|
||||
// {
|
||||
// $aResult['IncludeBackground'] = './?/Raw/&q[]=/{{USER}}/UserBackground/&q[]=/'.
|
||||
// $aResult['UserBackgroundHash'].'/';
|
||||
// }
|
||||
// if (!empty($aResult['UserBackgroundName']) && !empty($aResult['UserBackgroundHash']))
|
||||
// {
|
||||
// $aResult['IncludeBackground'] = './?/Raw/&q[]=/{{USER}}/UserBackground/&q[]=/'.
|
||||
// $aResult['UserBackgroundHash'].'/';
|
||||
// }
|
||||
}
|
||||
|
||||
$aResult['EnableTwoFactor'] = (bool) $oSettings->GetConf('EnableTwoFactor', $aResult['EnableTwoFactor']);
|
||||
|
|
|
@ -183,7 +183,7 @@ class Service
|
|||
// $aTemplateParameters['{{BaseTemplates}}'] = $this->oServiceActions->compileTemplates($bAdmin, false);
|
||||
$sResult = \strtr(\file_get_contents(APP_VERSION_ROOT_PATH.'app/templates/Index.html'), $aTemplateParameters);
|
||||
|
||||
$sResult = \RainLoop\Utils::ClearHtmlOutput($sResult);
|
||||
// $sResult = \RainLoop\Utils::ClearHtmlOutput($sResult);
|
||||
if (0 < \strlen($sCacheFileName))
|
||||
{
|
||||
$this->oActions->Cacher()->Set($sCacheFileName, $sResult);
|
||||
|
@ -207,6 +207,11 @@ class Service
|
|||
// $sResult .= '][hash:'.$aTemplateParameters['{{BaseHash}}'];
|
||||
// $sResult .= '][session:'.\md5(\RainLoop\Utils::GetShortToken());
|
||||
|
||||
if ($bMobile)
|
||||
{
|
||||
$sResult .= '][mobile:true';
|
||||
}
|
||||
|
||||
if (\RainLoop\Utils::IsOwnCloud())
|
||||
{
|
||||
$sResult .= '][owncloud:true';
|
||||
|
@ -223,6 +228,76 @@ class Service
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bAdmin = false
|
||||
* @param bool $bMobile = false
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function indexApplicationConfiguration($bAdmin = false, $bMobile = false)
|
||||
{
|
||||
$oConfig = $this->oActions->Config();
|
||||
|
||||
$sRsaPublicKey = '';
|
||||
if ($oConfig->Get('security', 'use_rsa_encryption', false) &&
|
||||
\file_exists(APP_PRIVATE_DATA.'rsa/public') && \file_exists(APP_PRIVATE_DATA.'rsa/private'))
|
||||
{
|
||||
$sRsaPublicKey = @\file_get_contents(APP_PRIVATE_DATA.'rsa/public') || '';
|
||||
if (false === \strpos($sRsaPublicKey, 'PUBLIC KEY'))
|
||||
{
|
||||
$sRsaPublicKey = '';
|
||||
}
|
||||
}
|
||||
|
||||
$aAttachmentsActions = array();
|
||||
if ($this->oActions->GetCapa(false, \RainLoop\Enumerations\Capa::ATTACHMENTS_ACTIONS))
|
||||
{
|
||||
if (!!\class_exists('ZipArchive'))
|
||||
{
|
||||
$aAttachmentsActions[] = 'zip';
|
||||
}
|
||||
|
||||
if (\RainLoop\Utils::IsOwnCloudLoggedIn() && \class_exists('OCP\Files'))
|
||||
{
|
||||
$aAttachmentsActions[] = 'owncloud';
|
||||
}
|
||||
|
||||
if ($oConfig->Get('social', 'dropbox_enable', false) && 0 < \strlen(\trim($oConfig->Get('social', 'dropbox_api_key', ''))))
|
||||
{
|
||||
$aAttachmentsActions[] = 'dropbox';
|
||||
}
|
||||
}
|
||||
|
||||
return \array_merge(array(
|
||||
'version' => APP_VERSION,
|
||||
'mobile' => $bMobile,
|
||||
'webPath' => \RainLoop\Utils::WebPath(),
|
||||
'webVersionPath' => \RainLoop\Utils::WebVersionPath(),
|
||||
'token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '',
|
||||
'inIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false),
|
||||
'allowHtmlEditorSourceButton' => (bool) $oConfig->Get('labs', 'allow_html_editor_source_button', false),
|
||||
'allowHtmlEditorBitiButtons' => (bool) $oConfig->Get('labs', 'allow_html_editor_biti_buttons', false),
|
||||
'allowCtrlEnterOnCompose' => (bool) $oConfig->Get('labs', 'allow_ctrl_enter_on_compose', false),
|
||||
'customLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''),
|
||||
'customLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''),
|
||||
'forgotPasswordLinkUrl' => \trim($oConfig->Get('login', 'forgot_password_link_url', '')),
|
||||
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
|
||||
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
|
||||
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
|
||||
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),
|
||||
'allowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false),
|
||||
'materialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true),
|
||||
'folderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
|
||||
'faviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true),
|
||||
'listPermanentFiltered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
|
||||
'attachmentsActions' => $aAttachmentsActions,
|
||||
'rsaPublicKey' => $sRsaPublicKey
|
||||
), $bAdmin ? array(
|
||||
'adminPath' => \strtolower($oConfig->Get('security', 'admin_panel_key', 'admin')),
|
||||
'allowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true),
|
||||
) : array());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bAdmin = false
|
||||
* @param bool $bMobile = false
|
||||
|
@ -271,6 +346,7 @@ class Service
|
|||
'{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'],
|
||||
'{{BaseAppMainCommonScriptLink}}' => $aData['AppJsCommonLink'],
|
||||
'{{BaseAppMainScriptLink}}' => $aData['AppJsLink'],
|
||||
'{{BaseApplicationConfigurationJson}}' => \json_encode($this->indexApplicationConfiguration($bAdmin, $bMobile)),
|
||||
'{{BaseVersion}}' => APP_VERSION,
|
||||
// '{{BaseViewport}}' => $bMobile ? 'width=device-width,initial-scale=1,user-scalable=no' : 'width=950,maximum-scale=2',
|
||||
'{{BaseViewport}}' => 'width=950,maximum-scale=2',
|
||||
|
|
|
@ -51,23 +51,6 @@
|
|||
<div class="e-bounce bounce3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
(function (window) {
|
||||
var
|
||||
oE = window.document.getElementById('rl-loading'),
|
||||
oElDesc = window.document.getElementById('rl-loading-desc')
|
||||
;
|
||||
if (oElDesc && window.rainloopAppData['LoadingDescriptionEsc']) {
|
||||
oElDesc.innerHTML = window.rainloopAppData['LoadingDescriptionEsc'];
|
||||
}
|
||||
if (oE && oE.style) {
|
||||
oE.style.opacity = 0;
|
||||
window.setTimeout(function () {
|
||||
oE.style.opacity = 1;
|
||||
}, 300);
|
||||
}
|
||||
}(window));
|
||||
</script>
|
||||
<div id="rl-loading-error" class="thm-loading">
|
||||
An Error occurred,
|
||||
<br />
|
||||
|
@ -85,6 +68,24 @@
|
|||
</div>
|
||||
<div id="rl-templates"></div>
|
||||
<div id="rl-hidden"></div>
|
||||
<script type="application/json" data-cfasync="false" data-configuration="application">{{BaseApplicationConfigurationJson}}</script>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
(function (window) {
|
||||
var
|
||||
oE = window.document.getElementById('rl-loading'),
|
||||
oElDesc = window.document.getElementById('rl-loading-desc')
|
||||
;
|
||||
if (oElDesc && window.rainloopAppData['LoadingDescriptionEsc']) {
|
||||
oElDesc.innerHTML = window.rainloopAppData['LoadingDescriptionEsc'];
|
||||
}
|
||||
if (oE && oE.style) {
|
||||
oE.style.opacity = 0;
|
||||
window.setTimeout(function () {
|
||||
oE.style.opacity = 1;
|
||||
}, 300);
|
||||
}
|
||||
}(window));
|
||||
</script>
|
||||
<script type="text/javascript" data-cfasync="false">
|
||||
|
||||
if (window.$LAB && window.rainloopAppData && window.rainloopAppData['TemplatesLink'] && window.rainloopAppData['LangLink'])
|
||||
|
|
Loading…
Reference in a new issue