에셋 리로드 파일별 캐시 검증 보강
This commit is contained in:
+22
-7
@@ -31,6 +31,21 @@ const DATA_CURRENT_BILLING_USAGE_BYTES = [
|
||||
'2026-07' => ['total_bytes' => 6549504, 'meter_adjusted_bytes' => 7169536, 'included_bytes' => 104857600, 'coupon_registered_at' => null],
|
||||
];
|
||||
|
||||
function car_asset_url(string $path): string
|
||||
{
|
||||
$relativePath = preg_replace('#^/car/#', '', $path) ?? ltrim($path, '/');
|
||||
$fullPath = __DIR__ . '/' . ltrim($relativePath, '/');
|
||||
$version = 'dev';
|
||||
|
||||
if (is_file($fullPath)) {
|
||||
$mtime = filemtime($fullPath) ?: time();
|
||||
$hash = is_readable($fullPath) ? substr(hash_file('sha256', $fullPath) ?: '', 0, 10) : '';
|
||||
$version = $mtime . ($hash !== '' ? '-' . $hash : '');
|
||||
}
|
||||
|
||||
return $path . '?v=' . rawurlencode($version);
|
||||
}
|
||||
|
||||
function car_db(): PDO
|
||||
{
|
||||
static $pdo = null;
|
||||
@@ -1196,13 +1211,13 @@ $carMonitorSession = car_monitor_launcher_session();
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<title>Car Monitor</title>
|
||||
|
||||
<link rel="icon" href="/car/assets/favicon.svg" type="image/svg+xml">
|
||||
<link rel="shortcut icon" href="/car/favicon.ico">
|
||||
<link rel="icon" href="/car/assets/icon-32.png" type="image/png" sizes="32x32">
|
||||
<link rel="icon" href="/car/assets/icon-192.png" type="image/png" sizes="192x192">
|
||||
<link rel="apple-touch-icon" href="/car/assets/apple-touch-icon.png">
|
||||
<link rel="manifest" href="/car/assets/site.webmanifest">
|
||||
<script src="/car/assets/asset-reload.js?v=20260721_nocache1" data-service="car" defer></script>
|
||||
<link rel="icon" href="<?= htmlspecialchars(car_asset_url('/car/assets/favicon.svg'), ENT_QUOTES, 'UTF-8') ?>" type="image/svg+xml">
|
||||
<link rel="shortcut icon" href="<?= htmlspecialchars(car_asset_url('/car/favicon.ico'), ENT_QUOTES, 'UTF-8') ?>">
|
||||
<link rel="icon" href="<?= htmlspecialchars(car_asset_url('/car/assets/icon-32.png'), ENT_QUOTES, 'UTF-8') ?>" type="image/png" sizes="32x32">
|
||||
<link rel="icon" href="<?= htmlspecialchars(car_asset_url('/car/assets/icon-192.png'), ENT_QUOTES, 'UTF-8') ?>" type="image/png" sizes="192x192">
|
||||
<link rel="apple-touch-icon" href="<?= htmlspecialchars(car_asset_url('/car/assets/apple-touch-icon.png'), ENT_QUOTES, 'UTF-8') ?>">
|
||||
<link rel="manifest" href="<?= htmlspecialchars(car_asset_url('/car/assets/site.webmanifest'), ENT_QUOTES, 'UTF-8') ?>">
|
||||
<script src="<?= htmlspecialchars(car_asset_url('/car/assets/asset-reload.js'), ENT_QUOTES, 'UTF-8') ?>" data-service="car" defer></script>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap" rel="stylesheet">
|
||||
|
||||
Reference in New Issue
Block a user