mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Improve boot script
This commit is contained in:
parent
a655b94aba
commit
e3fa252cf2
17 changed files with 2595 additions and 125 deletions
|
|
@ -194,9 +194,14 @@ class Service
|
|||
}
|
||||
|
||||
$aTemplateParameters = $this->indexTemplateParameters($bAdmin, $bMobile, $bMobileDevice);
|
||||
if (!empty($aTemplateParameters['{{BaseApplicationConfigurationJson}}']))
|
||||
{
|
||||
$this->oActions->Logger()->Write($aTemplateParameters['{{BaseApplicationConfigurationJson}}'],
|
||||
\MailSo\Log\Enumerations\Type::INFO, 'APP');
|
||||
}
|
||||
|
||||
$sCacheFileName = '';
|
||||
if ($this->oActions->Config()->Get('labs', 'cache_system_data', true))
|
||||
if ($this->oActions->Config()->Get('labs', 'cache_system_data', true) && !empty($aTemplateParameters['{{BaseHash}}']))
|
||||
{
|
||||
$sCacheFileName = 'TMPL:'.$aTemplateParameters['{{BaseHash}}'];
|
||||
$sResult = $this->oActions->Cacher()->Get($sCacheFileName);
|
||||
|
|
@ -327,6 +332,18 @@ class Service
|
|||
) : array());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPath
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function staticPath($sPath)
|
||||
{
|
||||
$sStaticSuffix = $this->oActions->IsOpen() ? '?vo' : '?vs';
|
||||
|
||||
return \RainLoop\Utils::WebStaticPath().$sPath.$sStaticSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bAdmin = false
|
||||
* @param bool $bMobile = false
|
||||
|
|
@ -346,21 +363,18 @@ class Service
|
|||
|
||||
$sFaviconUrl = (string) $this->oActions->Config()->Get('webmail', 'favicon_url', '');
|
||||
|
||||
$sStaticPrefix = \RainLoop\Utils::WebStaticPath();
|
||||
|
||||
$aData = array(
|
||||
'Language' => $sLanguage,
|
||||
'Theme' => $sTheme,
|
||||
'FaviconPngLink' => $sFaviconUrl ? $sFaviconUrl : $sStaticPrefix.'favicon.png',
|
||||
'AppleTouchLink' => $sFaviconUrl ? '' : $sStaticPrefix.'apple-touch-icon.png',
|
||||
'AppCssLink' => $sStaticPrefix.'css/app'.($bAppCssDebug ? '' : '.min').'.css',
|
||||
'BootJsLink' => $sStaticPrefix.'js/min/boot.js',
|
||||
'ComponentsJsLink' => $sStaticPrefix.'js/'.($bAppJsDebug ? '' : 'min/').'components.js',
|
||||
'LibJsLink' => $sStaticPrefix.'js/min/libs.js',
|
||||
'EditorJsLink' => $sStaticPrefix.'ckeditor/ckeditor.js',
|
||||
'OpenPgpJsLink' => $sStaticPrefix.'js/min/openpgp.min.js',
|
||||
'AppJsCommonLink' => $sStaticPrefix.'js/'.($bAppJsDebug ? '' : 'min/').'common.js',
|
||||
'AppJsLink' => $sStaticPrefix.'js/'.($bAppJsDebug ? '' : 'min/').($bAdmin ? 'admin' : 'app').'.js'
|
||||
'FaviconPngLink' => $sFaviconUrl ? $sFaviconUrl : $this->staticPath('apple-touch-icon.png'),
|
||||
'AppleTouchLink' => $sFaviconUrl ? '' : $this->staticPath('apple-touch-icon.png'),
|
||||
'AppCssLink' => $this->staticPath('css/app'.($bAppCssDebug ? '' : '.min').'.css'),
|
||||
'BootJsLink' => $this->staticPath('js/'.($bAppJsDebug ? '' : 'min/').'boot.js'),
|
||||
'LibJsLink' => $this->staticPath('js/min/libs.js'),
|
||||
'EditorJsLink' => $this->staticPath('ckeditor/ckeditor.js'),
|
||||
'OpenPgpJsLink' => $this->staticPath('js/min/openpgp.min.js'),
|
||||
'AppJsCommonLink' => $this->staticPath('js/'.($bAppJsDebug ? '' : 'min/').'common.js'),
|
||||
'AppJsLink' => $this->staticPath('js/'.($bAppJsDebug ? '' : 'min/').($bAdmin ? 'admin' : 'app').'.js')
|
||||
);
|
||||
|
||||
$aTemplateParameters = array(
|
||||
|
|
@ -370,7 +384,6 @@ class Service
|
|||
'{{BaseAppAppleTouchFile}}' => $aData['AppleTouchLink'],
|
||||
'{{BaseAppMainCssLink}}' => $aData['AppCssLink'],
|
||||
'{{BaseAppBootScriptLink}}' => $aData['BootJsLink'],
|
||||
'{{BaseAppComponentsScriptLink}}' => $aData['ComponentsJsLink'],
|
||||
'{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'],
|
||||
'{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'],
|
||||
'{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'],
|
||||
|
|
@ -388,7 +401,8 @@ class Service
|
|||
$bAdmin ? '1' : '0',
|
||||
\md5($this->oActions->Config()->Get('cache', 'index', '')),
|
||||
$this->oActions->Plugins()->Hash(),
|
||||
\RainLoop\Utils::WebVersionPath(), APP_VERSION
|
||||
\RainLoop\Utils::WebVersionPath(),
|
||||
APP_VERSION,
|
||||
)).
|
||||
\implode('~', $aTemplateParameters)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -69,89 +69,7 @@
|
|||
<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'])
|
||||
{
|
||||
window.rainloopProgressJs = progressJs();
|
||||
|
||||
window.rainloopProgressJs.setOptions({'theme': 'rainloop'});
|
||||
window.rainloopProgressJs.start().set(5);
|
||||
|
||||
window.$LAB
|
||||
.script(function () {
|
||||
return [
|
||||
{'src': '{{BaseAppLibsScriptLink}}', 'type': 'text/javascript', 'charset': 'utf-8'}
|
||||
];
|
||||
})
|
||||
.wait(function () {
|
||||
|
||||
window.rainloopProgressJs.set(20);
|
||||
|
||||
if (window.rainloopAppData['IncludeBackground']) {
|
||||
$('#rl-bg').attr('style', 'background-image: none !important;').backstretch(
|
||||
window.rainloopAppData['IncludeBackground'].replace('{{USER}}',
|
||||
(window.__rlah ? window.__rlah() || '0' : '0')), {
|
||||
'fade': 100, 'centeredX': true, 'centeredY': true
|
||||
}).removeAttr('style');
|
||||
}
|
||||
})
|
||||
.script(function () {
|
||||
return [
|
||||
{'src': window.rainloopAppData['TemplatesLink'], 'type': 'text/javascript', 'charset': 'utf-8'},
|
||||
{'src': window.rainloopAppData['LangLink'], 'type': 'text/javascript', 'charset': 'utf-8'}
|
||||
];
|
||||
})
|
||||
.wait(function () {
|
||||
window.rainloopProgressJs.set(30);
|
||||
})
|
||||
.script(function () {
|
||||
return {'src': '{{BaseAppMainScriptLink}}', 'type': 'text/javascript', 'charset': 'utf-8'};
|
||||
})
|
||||
.wait(function () {
|
||||
window.rainloopProgressJs.set(50);
|
||||
})
|
||||
.script(function () {
|
||||
return window.rainloopAppData['PluginsLink'] ?
|
||||
{'src': window.rainloopAppData['PluginsLink'], 'type': 'text/javascript', 'charset': 'utf-8'} : null;
|
||||
})
|
||||
.wait(function () {
|
||||
window.rainloopProgressJs.set(70);
|
||||
__runBoot(false);
|
||||
})
|
||||
.script(function () {
|
||||
return {'src': '{{BaseAppEditorScriptLink}}', 'type': 'text/javascript', 'charset': 'utf-8'};
|
||||
})
|
||||
.wait(function () {
|
||||
if (window.CKEDITOR && window.__initEditor) {
|
||||
window.__initEditor();
|
||||
window.__initEditor = null;
|
||||
}
|
||||
})
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
__runBoot(true);
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" data-cfasync="false">__showDescription(window.rainloopAppData ? window.rainloopAppData['LoadingDescriptionEsc'] : '');</script>
|
||||
<script type="text/javascript" data-cfasync="false">__runApp('{{BaseAppLibsScriptLink}}', '{{BaseAppMainScriptLink}}', '{{BaseAppEditorScriptLink}}');</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue