Inlince oc.js if possible!
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
e351ba56f1
commit
6dbe417c51
|
@ -18,6 +18,11 @@
|
|||
<?php foreach($_['printcssfiles'] as $cssfile): ?>
|
||||
<link rel="stylesheet" href="<?php print_unescaped($cssfile); ?>" media="print">
|
||||
<?php endforeach; ?>
|
||||
<?php if (isset($_['inline_ocjs'])): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
|
||||
<?php print_unescaped($_['inline_ocjs']); ?>
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($_['jsfiles'] as $jsfile): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php print_unescaped($jsfile); ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
<?php foreach($_['printcssfiles'] as $cssfile): ?>
|
||||
<link rel="stylesheet" href="<?php print_unescaped($cssfile); ?>" media="print">
|
||||
<?php endforeach; ?>
|
||||
<?php if (isset($_['inline_ocjs'])): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
|
||||
<?php print_unescaped($_['inline_ocjs']); ?>
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php print_unescaped($jsfile); ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
<?php foreach($_['printcssfiles'] as $cssfile): ?>
|
||||
<link rel="stylesheet" href="<?php print_unescaped($cssfile); ?>" media="print">
|
||||
<?php endforeach; ?>
|
||||
<?php if (isset($_['inline_ocjs'])): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
|
||||
<?php print_unescaped($_['inline_ocjs']); ?>
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php print_unescaped($jsfile); ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -43,6 +43,7 @@ use Assetic\Filter\CssMinFilter;
|
|||
use Assetic\Filter\CssRewriteFilter;
|
||||
use Assetic\Filter\JSqueezeFilter;
|
||||
use Assetic\Filter\SeparatorFilter;
|
||||
use OC\Template\JSConfigHelper;
|
||||
|
||||
class TemplateLayout extends \OC_Template {
|
||||
|
||||
|
@ -142,8 +143,23 @@ class TemplateLayout extends \OC_Template {
|
|||
$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
|
||||
$this->assign('jsfiles', array());
|
||||
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
|
||||
if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
|
||||
$jsConfigHelper = new JSConfigHelper(
|
||||
\OC::$server->getL10N('core'),
|
||||
\OC::$server->getThemingDefaults(),
|
||||
\OC::$server->getAppManager(),
|
||||
\OC::$server->getUserSession()->getUser(),
|
||||
\OC::$server->getConfig(),
|
||||
\OC::$server->getGroupManager(),
|
||||
\OC::$server->getIniWrapper(),
|
||||
\OC::$server->getURLGenerator()
|
||||
);
|
||||
$this->assign('inline_ocjs', $jsConfigHelper->getConfig());
|
||||
$this->assign('foo', 'bar');
|
||||
} else {
|
||||
$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
|
||||
}
|
||||
}
|
||||
foreach($jsFiles as $info) {
|
||||
$web = $info[1];
|
||||
$file = $info[2];
|
||||
|
|
Loading…
Reference in New Issue