diff --git a/dev/App/Abstract.jsx b/dev/App/Abstract.jsx index dab31b074..de52c9667 100644 --- a/dev/App/Abstract.jsx +++ b/dev/App/Abstract.jsx @@ -23,7 +23,7 @@ class AbstractApp extends AbstractBoot { super(); - this.iframe = $('').appendTo('body'); + this.iframe = $('').appendTo('body'); Globals.$win.on('error', function (oEvent) { if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message && diff --git a/dev/Common/Booter.jsx b/dev/Common/Booter.jsx index 678bb2807..d07ddf7d2 100644 --- a/dev/Common/Booter.jsx +++ b/dev/Common/Booter.jsx @@ -28,6 +28,12 @@ window.__rlah_clear = () => { } }; +function getComputedStyle(id, name) +{ + var element = window.document.getElementById(id); + return element.currentStyle ? element.currentStyle[name] : (window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(name) : null); +} + function includeStyle(styles) { window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E')); @@ -41,10 +47,16 @@ function includeScr(src) function includeLayout() { const + css = require('Styles/@Boot.css'), layout = require('Html/Layout.html'), app = window.document.getElementById('rl-app') ; + if (css) + { + includeStyle(css); + } + if (app && layout) { app.innerHTML = layout.replace(/[\r\n\t]+/g, ''); @@ -163,12 +175,6 @@ function runApp() libs = window.jassl(appData.StaticLibJsLink).then(() => { if (window.$) { - if (!window.$('#rl-check').is(':visible')) - { - window.$('html').addClass('no-css'); - throw new Error('no-css'); - } - window.$('#rl-check').remove(); if (appData.IncludeBackground) @@ -224,7 +230,7 @@ window.__initAppData = function(data) { if (rlAppDataStorage.NewThemeLink) { - window.document.getElementById('app-theme-link').href = rlAppDataStorage.NewThemeLink; + (window.document.getElementById('app-theme-link') || {}).href = rlAppDataStorage.NewThemeLink; } if (rlAppDataStorage.IncludeCss) @@ -244,6 +250,12 @@ window.__runBoot = function() { window.document.location.replace('./?/NoCookie'); } + if ('none' !== getComputedStyle('rl-check', 'display')) + { + const root = document.documentElement; + root.className += ' no-css'; + } + if (includeLayout()) { includeAppScr(getRainloopBootData()); diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 53f6650d2..be006dba6 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -1532,6 +1532,25 @@ } }; + Utils.appendStyles = function ($styleTag, css) + { + if ($styleTag && $styleTag[0]) + { + if ($styleTag[0].styleSheet && !Utils.isUnd($styleTag[0].styleSheet.cssText)) + { + $styleTag[0].styleSheet.cssText = css; + } + else + { + $styleTag.text(css); + } + + return true; + } + + return false; + }; + Utils.__themeTimer = 0; Utils.__themeAjax = null; @@ -1583,14 +1602,9 @@ if (oThemeStyle && oThemeStyle[0]) { - oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]); - if (oThemeStyle[0].styleSheet && !Utils.isUnd(oThemeStyle[0].styleSheet.cssText)) + if (Utils.appendStyles(oThemeStyle, aData[1])) { - oThemeStyle[0].styleSheet.cssText = aData[1]; - } - else - { - oThemeStyle.text(aData[1]); + oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]); } } diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js index b4ff3e5eb..9b3ded211 100644 --- a/dev/Knoin/Knoin.js +++ b/dev/Knoin/Knoin.js @@ -31,7 +31,7 @@ Knoin.prototype.hideLoading = function () { - $('#rl-content').show(); + $('#rl-content').addClass('rl-content-show'); $('#rl-loading').hide().remove(); }; @@ -422,9 +422,9 @@ */ Knoin.prototype.startScreens = function (aScreensClasses) { - $('#rl-content').css({ - 'visibility': 'hidden' - }); +// $('#rl-content').css({ +// 'visibility': 'hidden' +// }); _.each(aScreensClasses, function (CScreen) { @@ -468,9 +468,9 @@ hasher.changed.add(oCross.parse, oCross); hasher.init(); - $('#rl-content').css({ - 'visibility': 'visible' - }); +// $('#rl-content').css({ +// 'visibility': 'visible' +// }); _.delay(function () { Globals.$html.removeClass('rl-started-trigger').addClass('rl-started'); diff --git a/dev/Styles/@Boot.css b/dev/Styles/@Boot.css new file mode 100644 index 000000000..a998c33ea --- /dev/null +++ b/dev/Styles/@Boot.css @@ -0,0 +1,57 @@ + +#rl-content{ + display: none; +} + +.internal-hiddden{ + display: none !important; +} + +html.no-css, html.no-css body { + margin: 0; + padding: 0; + font-family: Arial, Verdana, Geneva, sans-serif; + background-color: #eee; +} + +html.no-css #rl-content, html.no-css #rl-loading{ + display: none; +} + +html.no-css #rl-loading-error { + position: absolute; + font-size: 30px; + line-height: 130%; + top: 50%; + width: 100%; + height: 65px; + margin: 0; + margin-top: -60px; + background-color: transparent; + text-align: center; + color: #333; +} + +html.no-css .progressjs-container { + display: none; +} + +html.no-css .thm-body { + color: #333; + background-color: #aaa; + background-image: none; +} + +html.no-css .thm-loading { + color: #333 !important; + text-shadow: none !important; + + .e-spinner .e-bounce { + display: none !important; + } +} + +html.no-css .thm-login-desc .desc { + color: #333 !important; + text-shadow: none !important; +} diff --git a/dev/Styles/Layout.less b/dev/Styles/Layout.less index 5d61f4a42..a642498af 100644 --- a/dev/Styles/Layout.less +++ b/dev/Styles/Layout.less @@ -375,7 +375,11 @@ html.rl-ctrl-key-pressed { } #rl-check{ - display: block; + display: none; +} + +.rl-content-show { + display: block !important; } html.rl-mobile .hide-on-mobile { diff --git a/gulpfile.js b/gulpfile.js index 6afaf839f..29488ba28 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -97,7 +97,7 @@ function copyFile(sFile, sNewFile, callback) callback(); } -cfg.paths.globjs = 'dev/**/*.{js,jsx,html}'; +cfg.paths.globjs = 'dev/**/*.{js,jsx,html,css}'; cfg.paths.globjsonly = 'dev/**/*.js'; cfg.paths.globjsxonly = 'dev/**/*.jsx'; cfg.paths.static = 'rainloop/v/' + cfg.devVersion + '/static/'; diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Version.php b/rainloop/v/0.0.0/app/libraries/MailSo/Version.php index 9db6f5052..bc9ad1619 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Version.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Version.php @@ -3,7 +3,7 @@ /* * This file is part of MailSo. * - * (c) 2014 Usenko Timur + * (c) 2016 Usenko Timur * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -19,7 +19,7 @@ final class Version /** * @var string */ - const APP_VERSION = '2.0.0'; + const APP_VERSION = '2.0.1'; /** * @var string diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index f6b516759..eeb864174 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -2396,27 +2396,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack $sPassword = $this->clientRsaDecryptHelper($sPassword); $this->Logger()->AddSecret($sPassword); - if (0 < \strlen($sEmail) && 0 < \strlen($sPassword) && - $this->Config()->Get('security', 'allow_universal_login', true) && - $this->Config()->Get('security', 'allow_admin_panel', true) && - $sEmail === $this->Config()->Get('security', 'admin_login', '') - ) - { - if ($this->Config()->ValidatePassword($sPassword)) - { - $this->setAdminAuthToken($this->getAdminToken()); - - return $this->DefaultResponse(__FUNCTION__, true, array( - 'Admin' => true - )); - } - else - { - $this->loginErrorDelay(); - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); - } - } - else if ('sleep@sleep.dev' === $sEmail && 0 < \strlen($sPassword) && + if ('sleep@sleep.dev' === $sEmail && 0 < \strlen($sPassword) && \is_numeric($sPassword) && $this->Config()->Get('debug', 'enable', false) ) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index efc9ceeae..36915d018 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -207,9 +207,9 @@ class Application extends \RainLoop\Config\AbstractConfig 'allow_admin_panel' => array(true, 'Access settings'), 'allow_two_factor_auth' => array(false), 'force_two_factor_auth' => array(false), - 'allow_universal_login' => array(false), 'admin_panel_host' => array(''), 'admin_panel_key' => array('admin'), + 'content_security_policy' => array(''), 'core_install_access_domain' => array('') ), diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php index 940a78722..1fa372711 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php @@ -284,6 +284,8 @@ class Service $sFaviconPngLink = $sFaviconUrl ? $sFaviconUrl : $this->staticPath('apple-touch-icon.png'); $sAppleTouchLink = $sFaviconUrl ? '' : $this->staticPath('apple-touch-icon.png'); + $sContentSecurityPolicy = $this->oActions->Config()->Get('security', 'content_security_policy', ''); + $aTemplateParameters = array( '{{BaseAppFaviconPngLinkTag}}' => $sFaviconPngLink ? '' : '', '{{BaseAppFaviconTouchLinkTag}}' => $sAppleTouchLink ? '' : '', @@ -291,6 +293,8 @@ class Service '{{BaseAppThemeCssLink}}' => $this->oActions->ThemeLink($sTheme, $bAdmin), '{{BaseAppBootScriptLink}}' => $this->staticPath('js/'.($bAppJsDebug ? '' : 'min/').'boot.js'), '{{BaseViewport}}' => $bMobile ? 'width=device-width,initial-scale=1,user-scalable=no' : 'width=950,maximum-scale=2', + '{{BaseContentSecurityPolicy}}' => $sContentSecurityPolicy ? + '' : '', '{{BaseDir}}' => false && \in_array($sLanguage, array('ar', 'he', 'ur')) ? 'rtl' : 'ltr' ); diff --git a/rainloop/v/0.0.0/app/templates/Index.html b/rainloop/v/0.0.0/app/templates/Index.html index a4e681d84..7f5914d92 100644 --- a/rainloop/v/0.0.0/app/templates/Index.html +++ b/rainloop/v/0.0.0/app/templates/Index.html @@ -14,10 +14,10 @@ + {{BaseContentSecurityPolicy}}