에셋 리로드 파일별 캐시 검증 보강

This commit is contained in:
seo
2026-07-25 19:45:14 +09:00
parent 07836bad10
commit 08e705c1f7
7 changed files with 79 additions and 35 deletions
+22 -7
View File
@@ -1,11 +1,26 @@
<?php
function h($value): string
{
return htmlspecialchars((string)($value ?? ''), ENT_QUOTES, 'UTF-8');
}
function won($value): string
function h($value): string
{
return htmlspecialchars((string)($value ?? ''), ENT_QUOTES, 'UTF-8');
}
function asset_url(string $path): string
{
$publicRoot = realpath(__DIR__ . '/../../public');
$fullPath = $publicRoot ? $publicRoot . '/' . ltrim($path, '/') : '';
$version = 'dev';
if ($fullPath !== '' && 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 won($value): string
{
return number_format((float)$value, 0) . '원';
}
@@ -95,4 +110,4 @@ function get_flash_message(): ?array
$flash = $_SESSION['flash_message'];
unset($_SESSION['flash_message']);
return $flash;
}
}
+7 -7
View File
@@ -23,10 +23,10 @@ if (function_exists('send_private_no_store_headers')) {
<meta name="apple-mobile-web-app-title" content="Financial">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="icon" type="image/png" href="/favicon.png?v=2">
<link rel="shortcut icon" href="/favicon.png?v=2">
<link rel="apple-touch-icon" href="/favicon.png?v=2">
<link rel="manifest" href="/manifest.webmanifest">
<link rel="icon" type="image/png" href="<?= h(asset_url('/favicon.png')) ?>">
<link rel="shortcut icon" href="<?= h(asset_url('/favicon.png')) ?>">
<link rel="apple-touch-icon" href="<?= h(asset_url('/favicon.png')) ?>">
<link rel="manifest" href="<?= h(asset_url('/manifest.webmanifest')) ?>">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Financial">
@@ -40,9 +40,9 @@ if (function_exists('send_private_no_store_headers')) {
<meta name="twitter:description" content="개인 금융 통합 관리 서비스">
<meta name="twitter:image" content="https://seo.chaegeon.com/favicon.png">
<link href="/assets/vendor/bootstrap.min.css" rel="stylesheet">
<link href="/assets/app.css" rel="stylesheet">
<script src="/assets/asset-reload.js?v=20260721_nocache1" data-service="financial" defer></script>
<link href="<?= h(asset_url('/assets/vendor/bootstrap.min.css')) ?>" rel="stylesheet">
<link href="<?= h(asset_url('/assets/app.css')) ?>" rel="stylesheet">
<script src="<?= h(asset_url('/assets/asset-reload.js')) ?>" data-service="financial" defer></script>
<script src="https://chaegeon.com/log/bancheck.min.js?_=<?php echo time(); ?>"></script>
<script src="/assets/vendor/chart.umd.js"></script>
</head>