keanu-weblite/public/offline.html
N-Pex 47ebc55f80 Build 94
Preserve the path name for mirror links
2025-12-22 13:23:43 +01:00

172 lines
No EOL
5.8 KiB
HTML

<html>
<head>
<meta charset="UTF-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<script lang="javascript">
const STORE_KEY_USER = `convene_${window.location.hostname}_user`;
const STORE_KEY_SETTINGS = `convene_${window.location.hostname}_settings`;
let windowProxy = null;
function updateNetworkState() {
if (navigator.onLine) {
document.body.classList.remove("offline");
} else {
document.body.classList.add("offline");
}
}
window.addEventListener("load", (event) => {
updateNetworkState();
});
window.addEventListener("offline", (e) => {
updateNetworkState();
});
window.addEventListener("online", (e) => {
updateNetworkState();
});
function go() {
if (navigator.onLine) {
let url = "<!--MIRROR_URL-->" + window.location.pathname + "#/?migrate=1";
if (!url.includes("://")) {
url = window.location.protocol + "//" + url;
}
windowProxy = window.open(url, "_blank");
}
}
window.addEventListener("message", function (e) {
// if (e.origin !== origin) { // TODO - What should we check here?
// return
// }
try {
const data = JSON.parse(e.data);
if (data !== null && data.cmd == "getMigrationData") {
let migrationInfo = {
};
if (window.localStorage.getItem(STORE_KEY_USER)) {
migrationInfo.type = "local";
migrationInfo.user = window.localStorage.getItem(STORE_KEY_USER);
migrationInfo.settings = window.localStorage.getItem(STORE_KEY_SETTINGS);
} else {
migrationInfo.type = "session";
migrationInfo.user = window.sessionStorage.getItem(STORE_KEY_USER);
migrationInfo.settings = window.sessionStorage.getItem(STORE_KEY_SETTINGS);
}
if (migrationInfo.user) {
try {
const user = JSON.parse(migrationInfo.user);
delete user.access_token;
delete user.device_id;
migrationInfo.user = JSON.stringify(user);
} catch (error) { }
}
event.source.postMessage(JSON.stringify(migrationInfo), event.origin);
} else if (data !== null && data.cmd == "migrationDone") {
if (windowProxy) {
windowProxy.close();
let url = "<!--MIRROR_URL-->" + window.location.pathname + "#/";
if (!url.includes("://")) {
url = window.location.protocol + "//" + url;
}
window.location.href = url;
}
}
} catch (error) {
}
});
</script>
<style>
body {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.title {
font-family: "Inter", sans-serif;
font-weight: 700;
font-style: Bold;
font-size: 16px;
leading-trim: NONE;
line-height: 125%;
letter-spacing: 0.4px;
text-align: center;
vertical-align: middle;
}
.message {
font-family: "Inter", sans-serif;
font-weight: 400;
font-style: normal;
font-size: 16px;
leading-trim: NONE;
line-height: 125%;
letter-spacing: 0.4px;
text-align: center;
vertical-align: middle;
}
button {
margin-top: 16px;
height: 40px;
border: 1px solid black;
border-radius: 20px;
background-color: white;
padding: 8px 16px;
font-family: "Poppins", sans-serif;
font-weight: 600;
font-style: SemiBold;
font-size: 14px;
leading-trim: NONE;
line-height: 18px;
letter-spacing: 0.34px;
text-align: center;
vertical-align: middle;
text-transform: uppercase;
}
button:hover {
opacity: 0.8;
cursor: pointer;
}
.offline-message {
margin-top: 40px;
visibility: hidden;
}
.offline .offline-message {
visibility: visible;
}
</style>
</head>
<body>
<div class="container">
<div class="title"><!--OFFLINE_TITLE_START-->Having trouble connecting?<!--OFFLINE_TITLE_END--></div>
<div class="message"><!--OFFLINE_MESSAGE_START-->Redirect to an alternate link to join the room<!--OFFLINE_MESSAGE_END--></div>
<button onclick="go()"><!--OFFLINE_REDIRECT_START-->Redirect me<!--OFFLINE_REDIRECT_END--></button>
<div class="offline-message">You are offline</div>
</div>
</body>
</html>