fix: add cache-busting to prevent stale JS/CSS from breaking the UI
- Added ?v=20260502 query param to all <script src=...> and <link> tags - Added Cache-Control: no-cache, no-store, must-revalidate to index route - Added <meta> cache-control tags in HTML head for extra coverage - This ensures the browser always fetches fresh HTML/JS/CSS after deploy, preventing the old loadLastPrompt() from running against new HTML (which would crash since #prompt-cat-info no longer exists)
This commit is contained in:
@@ -14,7 +14,8 @@ router = APIRouter()
|
|||||||
|
|
||||||
@router.get("/")
|
@router.get("/")
|
||||||
def read_index():
|
def read_index():
|
||||||
return FileResponse("static/index.html")
|
headers = {"Cache-Control": "no-cache, no-store, must-revalidate"}
|
||||||
|
return FileResponse("static/index.html", headers=headers)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/logs")
|
@router.get("/logs")
|
||||||
|
|||||||
@@ -3,10 +3,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||||||
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
|
<meta http-equiv="Expires" content="0">
|
||||||
<title>Miku Control Panel</title>
|
<title>Miku Control Panel</title>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.2/cropper.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.2/cropper.min.css">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.2/cropper.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.2/cropper.min.js"></script>
|
||||||
<link rel="stylesheet" href="/static/css/style.css">
|
<link rel="stylesheet" href="/static/css/style.css?v=20260502">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -1369,15 +1372,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/core.js"></script>
|
<script src="/static/js/core.js?v=20260502"></script>
|
||||||
<script src="/static/js/servers.js"></script>
|
<script src="/static/js/servers.js?v=20260502"></script>
|
||||||
<script src="/static/js/modes.js"></script>
|
<script src="/static/js/modes.js?v=20260502"></script>
|
||||||
<script src="/static/js/actions.js"></script>
|
<script src="/static/js/actions.js?v=20260502"></script>
|
||||||
<script src="/static/js/image-gen.js"></script>
|
<script src="/static/js/image-gen.js?v=20260502"></script>
|
||||||
<script src="/static/js/status.js"></script>
|
<script src="/static/js/status.js?v=20260502"></script>
|
||||||
<script src="/static/js/dm.js"></script>
|
<script src="/static/js/dm.js?v=20260502"></script>
|
||||||
<script src="/static/js/chat.js"></script>
|
<script src="/static/js/chat.js?v=20260502"></script>
|
||||||
<script src="/static/js/memories.js"></script>
|
<script src="/static/js/memories.js?v=20260502"></script>
|
||||||
<script src="/static/js/profile.js"></script>
|
<script src="/static/js/profile.js?v=20260502"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user