* Allow for NONCEs on inline scripts
In order to support CSP-Header.
See also
* 6e62a0036e
* https://github.com/SemanticMediaWiki/SemanticResultFormats/issues/785
* Remove explicit removal of NONCEs
---------
Co-authored-by: rvogel <vogel@hallowelt.biz>
这个提交包含在:
父节点
80b0924603
当前提交
b428fb35aa
|
@ -39,7 +39,7 @@ final class SRFUtils {
|
|||
];
|
||||
|
||||
$requireHeadItem = [ 'srf.options' => $options ];
|
||||
SMWOutputs::requireHeadItem( 'srf.options', self::makeVariablesScript( $requireHeadItem, false ) );
|
||||
SMWOutputs::requireHeadItem( 'srf.options', self::makeVariablesScript( $requireHeadItem ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,6 +77,9 @@ final class SRFUtils {
|
|||
*/
|
||||
public static function makeVariablesScript( $data, $nonce = null ) {
|
||||
$script = ResourceLoader::makeConfigSetScript( $data );
|
||||
if ( $nonce === null ) {
|
||||
$nonce = RequestContext::getMain()->getOutput()->getCSP()->getNonce();
|
||||
}
|
||||
|
||||
return ResourceLoader::makeInlineScript( $script, $nonce );
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ class MediaPlayer extends ResultPrinter {
|
|||
];
|
||||
|
||||
$requireHeadItem = [ $ID => FormatJson::encode( $output ) ];
|
||||
SMWOutputs::requireHeadItem( $ID, SRFUtils::makeVariablesScript( $requireHeadItem, false ) );
|
||||
SMWOutputs::requireHeadItem( $ID, SRFUtils::makeVariablesScript( $requireHeadItem ) );
|
||||
|
||||
SMWOutputs::requireResource( 'ext.jquery.jplayer.skin.' . $this->params['theme'] );
|
||||
SMWOutputs::requireResource( 'ext.srf.formats.media' );
|
||||
|
|
正在加载...
在新工单中引用