Ajoute un rafraîchissement forcé de l'application
This commit is contained in:
47
chrono.html
47
chrono.html
@@ -18,7 +18,45 @@
|
||||
<link rel="shortcut icon" href="/favicon.png" />
|
||||
<link rel="apple-touch-icon" href="logo.png" />
|
||||
<link rel="manifest" href="site.webmanifest" />
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<script>
|
||||
(() => {
|
||||
const assetTokenStorageKey = "chesscubing-arena-asset-token";
|
||||
const pageUrl = new URL(window.location.href);
|
||||
const refreshToken = pageUrl.searchParams.get("refresh");
|
||||
if (refreshToken) {
|
||||
try {
|
||||
window.sessionStorage.setItem(assetTokenStorageKey, refreshToken);
|
||||
} catch {
|
||||
// Ignore storage failures in restricted browsers.
|
||||
}
|
||||
pageUrl.searchParams.delete("refresh");
|
||||
window.history.replaceState(null, "", pageUrl.toString());
|
||||
}
|
||||
|
||||
let assetToken = "";
|
||||
try {
|
||||
assetToken = window.sessionStorage.getItem(assetTokenStorageKey) || "";
|
||||
} catch {
|
||||
assetToken = "";
|
||||
}
|
||||
|
||||
window.__CHESSCUBING_ASSET_TOKEN__ = assetToken;
|
||||
window.__CHESSCUBING_ASSET_URL__ = (path) => {
|
||||
if (!assetToken) {
|
||||
return path;
|
||||
}
|
||||
|
||||
const assetUrl = new URL(path, window.location.href);
|
||||
assetUrl.searchParams.set("v", assetToken);
|
||||
return `${assetUrl.pathname}${assetUrl.search}${assetUrl.hash}`;
|
||||
};
|
||||
|
||||
const stylesheet = document.createElement("link");
|
||||
stylesheet.rel = "stylesheet";
|
||||
stylesheet.href = window.__CHESSCUBING_ASSET_URL__("styles.css");
|
||||
document.head.append(stylesheet);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body data-page="chrono" class="phase-body">
|
||||
<main class="phase-shell chrono-stage">
|
||||
@@ -151,6 +189,11 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script type="module" src="app.js"></script>
|
||||
<script>
|
||||
const appScript = document.createElement("script");
|
||||
appScript.type = "module";
|
||||
appScript.src = window.__CHESSCUBING_ASSET_URL__("app.js");
|
||||
document.body.append(appScript);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user