2019-02-07 03:34:39 +05:30
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2019-09-15 15:52:43 +05:30
|
|
|
<meta name="viewport" content="width=device-width, user-scalable=no">
|
2020-08-12 15:12:42 +05:30
|
|
|
<meta name="application-name" content="Hydrogen Chat"/>
|
2019-09-15 18:02:12 +05:30
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
2020-08-12 15:12:42 +05:30
|
|
|
<meta name="apple-mobile-web-app-title" content="Hydrogen Chat">
|
2019-09-15 18:02:12 +05:30
|
|
|
<meta name="description" content="A matrix chat application">
|
2020-10-15 14:47:33 +05:30
|
|
|
<link rel="apple-touch-icon" href="assets/icon-maskable.png">
|
2019-06-16 18:51:20 +05:30
|
|
|
<link rel="stylesheet" type="text/css" href="src/ui/web/css/main.css">
|
2020-08-12 20:11:03 +05:30
|
|
|
<link rel="stylesheet" type="text/css" href="src/ui/web/css/themes/element/theme.css" title="Element Theme">
|
|
|
|
<link rel="alternate stylesheet" type="text/css" href="src/ui/web/css/themes/bubbles/theme.css" title="Bubbles Theme">
|
2019-02-07 03:34:39 +05:30
|
|
|
</head>
|
2020-08-12 15:12:42 +05:30
|
|
|
<body class="hydrogen">
|
2020-03-24 03:16:31 +05:30
|
|
|
<script id="version" type="disabled">
|
2020-08-12 15:12:42 +05:30
|
|
|
window.HYDROGEN_VERSION = "%%VERSION%%";
|
2020-10-02 23:24:24 +05:30
|
|
|
window.HYDROGEN_GLOBAL_HASH = "%%GLOBAL_HASH%%";
|
2019-09-15 18:02:12 +05:30
|
|
|
</script>
|
|
|
|
<script id="main" type="module">
|
2020-08-12 15:19:42 +05:30
|
|
|
import {main} from "./src/main.js";
|
2020-08-27 16:54:04 +05:30
|
|
|
main(document.body, {
|
2020-09-10 22:11:23 +05:30
|
|
|
worker: "src/worker.js",
|
|
|
|
olm: {
|
|
|
|
wasm: "lib/olm/olm.wasm",
|
|
|
|
legacyBundle: "lib/olm/olm_legacy.js",
|
|
|
|
wasmBundle: "lib/olm/olm.js",
|
|
|
|
}
|
2020-08-27 16:54:04 +05:30
|
|
|
});
|
2019-02-11 01:55:29 +05:30
|
|
|
</script>
|
2020-10-15 22:42:16 +05:30
|
|
|
<script id="service-worker" type="module">
|
|
|
|
|
|
|
|
function workerMessage(worker, type) {
|
|
|
|
const body = {type, id: Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)};
|
|
|
|
let resolve;
|
|
|
|
const promise = new Promise(r => resolve = r);
|
|
|
|
const onMessage = function(event) {
|
|
|
|
if (event.data.replyTo === body.id) {
|
|
|
|
worker.removeEventListener("message", onMessage);
|
|
|
|
resolve(event.data.content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
worker.addEventListener("message", onMessage);
|
|
|
|
worker.postMessage(body);
|
|
|
|
return promise;
|
|
|
|
}
|
|
|
|
|
2019-09-15 18:02:12 +05:30
|
|
|
if('serviceWorker' in navigator) {
|
2020-10-15 19:29:15 +05:30
|
|
|
navigator.serviceWorker.register('sw.js').then(function(registration) {
|
2020-10-15 15:19:09 +05:30
|
|
|
console.log("Service Worker registered");
|
2020-10-15 22:42:16 +05:30
|
|
|
async function tryActivateUpdate() {
|
2020-10-15 19:29:15 +05:30
|
|
|
if (registration.waiting && registration.active) {
|
2020-10-15 22:42:16 +05:30
|
|
|
const version = await workerMessage(registration.waiting, "version");
|
|
|
|
if (confirm(`Version ${version.version} (${version.buildHash}) is ready to install. Apply now?`)) {
|
|
|
|
registration.waiting.postMessage({type: "skipWaiting"}); // will trigger controllerchange event
|
|
|
|
}
|
2020-10-15 19:29:15 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
tryActivateUpdate();
|
2020-10-15 15:19:09 +05:30
|
|
|
registration.onupdatefound = function() {
|
|
|
|
const newWorker = registration.installing;
|
|
|
|
newWorker.onstatechange = function() {
|
2020-10-15 19:29:15 +05:30
|
|
|
tryActivateUpdate();
|
2020-10-15 15:19:09 +05:30
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
2020-10-15 22:42:16 +05:30
|
|
|
navigator.serviceWorker.addEventListener("controllerchange", function() {
|
|
|
|
document.location.reload();
|
|
|
|
});
|
2019-09-15 18:02:12 +05:30
|
|
|
}
|
2020-08-13 21:29:10 +05:30
|
|
|
</script>
|
2019-02-07 03:34:39 +05:30
|
|
|
</body>
|
2019-02-27 03:15:58 +05:30
|
|
|
</html>
|