feat(core): only load the inline script if EnablePreferences is true

This commit is contained in:
alistair3149 2024-04-25 19:33:11 -04:00
parent e5af1717bd
commit 52f4bab1a5
No known key found for this signature in database

View file

@ -65,11 +65,13 @@ class SkinHooks implements
return;
}
$script = file_get_contents( MW_INSTALL_PATH . '/skins/Citizen/resources/skins.citizen.scripts/inline.js' );
$script = Html::inlineScript( $script );
// TODO: Consider turning on cache after this is more stable
$script = RL\ResourceLoader::filter( 'minify-js', $script, [ 'cache' => false ] );
$out->addHeadItem( 'skin.citizen.inline', $script );
if ( $this->getConfigValue( 'CitizenEnablePreferences', $out ) === true ) {
$script = file_get_contents( MW_INSTALL_PATH . '/skins/Citizen/resources/skins.citizen.scripts/inline.js' );
$script = Html::inlineScript( $script );
// TODO: Consider turning on cache after this is more stable
$script = RL\ResourceLoader::filter( 'minify-js', $script, [ 'cache' => false ] );
$out->addHeadItem( 'skin.citizen.inline', $script );
}
}
/**