From ade75b4cbe2a89c20afb0f37c988ffb76e176df9 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 22 Feb 2023 14:13:18 +0100 Subject: [PATCH] Bugfix solution #537 for cached template --- .../v/0.0.0/app/libraries/RainLoop/Service.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php index 45f28110d..bd460d6ae 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Service.php @@ -180,14 +180,8 @@ abstract class Service if ($sResult) { $sResult .= ''; } else { - $SameSite = \strtolower($oConfig->Get('security', 'cookie_samesite', 'Strict')); - $Secure = (isset($_SERVER['HTTPS']) || 'none' == $SameSite) ? ';secure' : ''; $aTemplateParameters['{{BaseAppBootCss}}'] = \file_get_contents(APP_VERSION_ROOT_PATH.'static/css/boot'.$sAppCssMin.'.css'); - $aTemplateParameters['{{BaseAppBootScript}}'] = \str_replace( - 'samesite=strict', - "samesite={$SameSite}{$Secure}", - \file_get_contents(APP_VERSION_ROOT_PATH.'static/js'.($sAppJsMin ? '/min' : '').'/boot'.$sAppJsMin.'.js') - ); + $aTemplateParameters['{{BaseAppBootScript}}'] = \file_get_contents(APP_VERSION_ROOT_PATH.'static/js'.($sAppJsMin ? '/min' : '').'/boot'.$sAppJsMin.'.js'); $aTemplateParameters['{{BaseAppMainCssLink}}'] = Utils::WebStaticPath('css/'.($bAdmin ? 'admin' : 'app').$sAppCssMin.'.css'); $aTemplateParameters['{{BaseAppThemeCss}}'] = \preg_replace('/\\s*([:;{},]+)\\s*/s', '$1', $oActions->compileCss($sThemeName, $bAdmin)); $aTemplateParameters['{{BaseLanguage}}'] = $oActions->compileLanguage($sLanguage, $bAdmin); @@ -204,6 +198,10 @@ abstract class Service } } + $SameSite = \strtolower($oConfig->Get('security', 'cookie_samesite', 'Strict')); + $Secure = (isset($_SERVER['HTTPS']) || 'none' == $SameSite) ? ';secure' : ''; + $sResult = \str_replace('samesite=strict', "samesite={$SameSite}{$Secure}", $sResult); + $sScriptNonce = \SnappyMail\UUID::generate(); static::setCSP($sScriptNonce); $sResult = \str_replace('nonce=""', 'nonce="'.$sScriptNonce.'"', $sResult);