summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/index.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/public/index.php b/public/index.php
index 9de0c7d..a7f9674 100644
--- a/public/index.php
+++ b/public/index.php
@@ -31,6 +31,13 @@ function delTree($dir) {
return rmdir($dir);
}
+function file_cachebuster(string $filename): string {
+ return htmlentities(urlencode(md5(
+ strval(filemtime($filename)) .
+ strval(filesize($filename))
+ )));
+}
+
$defaultCode = <<<java
public class Program {
public static void main(String[] args) {
@@ -157,11 +164,11 @@ $csrf = csrf_token();
<title>Java</title>
<link rel="stylesheet" href="dist/codemirror.css">
<link rel="stylesheet" href="dist/eclipse.css">
- <link rel="stylesheet" href="site.css">
+ <link rel="stylesheet" href="site.css?_=<?= file_cachebuster(__DIR__ . "/site.css") ?>">
<script src="dist/jquery-1.12.4.min.js"></script>
<script src="dist/codemirror.js"></script>
<script src="dist/clike.js"></script>
- <script src="site.js"></script>
+ <script src="site.js?_=<?= file_cachebuster(__DIR__ . "/site.js") ?>"></script>
</head>
<body>
<div id="loader" style="display: none;">