diff --git a/deploy/gen_static_config.php b/deploy/gen_static_config.php
index f83c547..dca6f87 100755
--- a/deploy/gen_static_config.php
+++ b/deploy/gen_static_config.php
@@ -1,9 +1,8 @@
#!/usr/bin/env php
get_hash($file),
+ 'integrity' => []
+ ];
+ foreach (RESOURCE_INTEGRITY_HASHES as $hash_type)
+ $hashes[$type.'/'.basename($file)]['integrity'][$hash_type] = base64_encode(hash_file($hash_type, $file, true));
+ }
}
echo "';
+ return '';
}
function cssLink(string $name, string $theme, &$bname = null): string {
@@ -165,7 +165,7 @@ function cssLink(string $name, string $theme, &$bname = null): string {
if ($theme == 'dark')
$id .= '_dark';
- return '';
+ return '';
}
function cssPrefetchLink(string $name): string {
@@ -195,7 +195,14 @@ function getStaticVersion(string $name): string {
logWarning(__FUNCTION__.': '.$name.' starts with /');
$name = substr($name, 1);
}
- return $config['static'][$name] ?? 'notfound';
+ return $config['static'][$name]['version'] ?? 'notfound';
+}
+
+function getStaticIntegrityAttribute(string $name): string {
+ if (is_dev())
+ return '';
+ global $config;
+ return ' integrity="'.implode(' ', array_map(fn($hash_type) => $hash_type.'-'.$config['static'][$name]['integrity'][$hash_type], RESOURCE_INTEGRITY_HASHES)).'"';
}