1
This commit is contained in:
+20
@@ -8,6 +8,26 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>
|
||||
;(() => {
|
||||
const makeVisitVersion = () => {
|
||||
if (window.crypto && typeof window.crypto.getRandomValues === 'function') {
|
||||
const bytes = new Uint32Array(2)
|
||||
window.crypto.getRandomValues(bytes)
|
||||
return `${Date.now().toString(36)}-${bytes[0].toString(36)}${bytes[1].toString(36)}`
|
||||
}
|
||||
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`
|
||||
}
|
||||
|
||||
const url = new URL(window.location.href)
|
||||
url.searchParams.set('v', makeVisitVersion())
|
||||
const nextUrl = `${url.pathname}${url.search}${url.hash}`
|
||||
const currentUrl = `${window.location.pathname}${window.location.search}${window.location.hash}`
|
||||
if (nextUrl !== currentUrl) {
|
||||
window.history.replaceState(null, '', nextUrl)
|
||||
}
|
||||
})()
|
||||
</script>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user