2 <div v-if="offline" class="offline-message">
3 <i class="far fa-dizzy"></i>
6 <span @click="checkOffline"> <i class="fas fa-redo-alt"></i></span>
13 name: "ConnectivityChecker",
19 created: function () {
20 if (/t=\d+/.test(window.location.href)) {
21 window.history.replaceState({}, document.title, window.location.pathname);
26 document.addEventListener(
29 if (document.visibilityState == "visible") {
35 window.addEventListener(
42 window.addEventListener(
51 checkOffline: function () {
52 if (!navigator.onLine) {
57 // extra check to make sure we're not offline
59 const aliveCheckUrl = window.location.href + "?t="+(new Date().valueOf());
60 return fetch(aliveCheckUrl, {
65 .then(function (response) {
66 // opaqueredirect means request has been redirected, to auth provider probably
67 if ((response.type === "opaqueredirect" && !response.ok) || [401, 403].indexOf(response.status) != -1) {
68 window.location.href = aliveCheckUrl;
70 that.offline = !response.ok;
75 .finally(function () {
76 that.$emit("network-status-update", that.offline);