skin: move enable_assets_integrity option to config

This commit is contained in:
E. S. 2025-05-15 17:00:31 +03:00
parent bcbd721f7f
commit ce2f9058dc
2 changed files with 3 additions and 1 deletions

View File

@ -37,6 +37,7 @@ wiki_root: wiki
skin_cache_prod_dir: replace_with_path_twig_cache_dir_on_prod
skin_cache_dev_dir: replace_with_path_twig_cache_dir_on_dev
enable_assets_integrity: yes
git_repo: git@github.com:example/example_org.git

View File

@ -294,7 +294,8 @@ HTML;
}
protected function getStaticIntegrityAttribute(string $name): string {
if (isDev() || !isset($_GET['__enable_assets_integrity']))
global $config;
if (isDev() || !$config['enable_assets_integrity'])
return '';
global $config, $globalContext;
return ' integrity="'.implode(' ', array_map(fn($hash_type) => $hash_type.'-'.$config['assets'][$globalContext->project][$name]['integrity'][$hash_type], self::RESOURCE_INTEGRITY_HASHES)).'"';