mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-09 04:19:56 +00:00
Disable service worker
This commit is contained in:
parent
f967a06875
commit
e11699597e
2 changed files with 3 additions and 111 deletions
|
@ -1,42 +1,10 @@
|
|||
<script>
|
||||
import { IcnGitHub } from '$lib/components/svg';
|
||||
</script>
|
||||
|
||||
<div class="flex w-full items-end border-t border-surface-500/10 bg-surface-50 dark:bg-surface-900">
|
||||
<footer class="w-full">
|
||||
<div
|
||||
class="md:flex-no-wrap container mx-auto flex max-w-screen-xl flex-col flex-wrap px-5 py-10 md:flex-row md:items-center lg:items-start"
|
||||
>
|
||||
<div class="mx-auto w-64 flex-shrink-0 text-center lg:text-left">
|
||||
<a
|
||||
href="/"
|
||||
class="title-font flex items-center justify-center font-medium md:justify-start"
|
||||
>
|
||||
<span class="txt-logo-gradient text-5xl font-bold">XMR Nodes</span>
|
||||
</a>
|
||||
<p class="mt-2">
|
||||
By <a href="https://www.ditatompel.com">ditatompel</a>,
|
||||
<a href="https://github.com/ditatompel/xmr-nodes" target="_blank" rel="noopener"
|
||||
>source code</a
|
||||
>.
|
||||
</p>
|
||||
<div class="mt-4">
|
||||
<span class="mt-2 inline-flex justify-center sm:ml-auto sm:mt-0 sm:justify-start">
|
||||
<a
|
||||
href="https://github.com/ditatompel/xmr-nodes"
|
||||
target="_blank"
|
||||
class="cursor-pointer text-gray-500 hover:text-gray-700"
|
||||
aria-label="Link to ditatompel's GitHub profile"
|
||||
>
|
||||
<IcnGitHub class="h-5 w-5" />
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-surface-500/5">
|
||||
<div class="container mx-auto px-5 py-4">
|
||||
<p class="text-center text-sm">XMR Nodes</p>
|
||||
<p class="text-center text-sm">
|
||||
XMR Nodes by <a href="https://www.ditatompel.com" class="anchor">ditatompel.com</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -9,17 +9,13 @@
|
|||
Modal,
|
||||
Drawer,
|
||||
initializeStores,
|
||||
getToastStore,
|
||||
storePopup // PopUps
|
||||
} from '@skeletonlabs/skeleton';
|
||||
import { dev, browser } from '$app/environment';
|
||||
import { MainNav, MobileDrawer } from '$lib/components/navigation';
|
||||
import Footer from '$lib/components/Footer.svelte';
|
||||
|
||||
initializeStores();
|
||||
|
||||
const toastStore = getToastStore();
|
||||
|
||||
// popups
|
||||
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
||||
|
||||
|
@ -69,9 +65,6 @@
|
|||
if (typeof page.data.meta.article === 'object') {
|
||||
meta.article.author = page.data.meta.article.author ?? '';
|
||||
}
|
||||
// if (!dev) {
|
||||
// promotionEnabled.set(page.data.promotionEnabled ?? false);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -90,65 +83,6 @@
|
|||
// elemPage.scrollTop = 0;
|
||||
// }
|
||||
});
|
||||
|
||||
if (browser) {
|
||||
/* Service Worker */
|
||||
/** @type {any} */
|
||||
let newWorker;
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register('/service-worker.js', {
|
||||
type: dev ? 'module' : 'classic'
|
||||
})
|
||||
.then((reg) => {
|
||||
reg.addEventListener('updatefound', () => {
|
||||
console.log('SW Update found');
|
||||
// An updated service worker has appeared in reg.installing!
|
||||
newWorker = reg.installing;
|
||||
|
||||
newWorker.addEventListener('statechange', () => {
|
||||
// Has service worker state changed?
|
||||
switch (newWorker.state) {
|
||||
case 'installed':
|
||||
// There is a new service worker available, show the notification
|
||||
if (navigator.serviceWorker.controller) {
|
||||
const notifUpdateSw = {
|
||||
message: 'New version avaiable for this site is available.',
|
||||
autohide: false,
|
||||
action: {
|
||||
label: 'Reload',
|
||||
response: () => window.location.reload()
|
||||
}
|
||||
};
|
||||
toastStore.trigger(notifUpdateSw);
|
||||
// localStorage.clear();
|
||||
// sessionStorage.clear();
|
||||
newWorker.postMessage({ action: 'skipWaiting' });
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('error with service worker', err);
|
||||
});
|
||||
|
||||
/** @type {any} */
|
||||
let refreshing;
|
||||
// The event listener that is fired when the service worker updates
|
||||
// Here we reload the page
|
||||
navigator.serviceWorker.addEventListener('controllerchange', function () {
|
||||
if (refreshing) {
|
||||
// console.log('refreshing');
|
||||
return;
|
||||
}
|
||||
// window.location.reload();
|
||||
refreshing = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
@ -191,16 +125,6 @@
|
|||
<hr />
|
||||
</Drawer>
|
||||
|
||||
<!-- <AppShell slotSidebarLeft="bg-surface-500/5 w-0 lg:w-64"> -->
|
||||
<!-- <svelte:fragment slot="header"> -->
|
||||
<!-- <MainNav /> -->
|
||||
<!-- </svelte:fragment> -->
|
||||
<!-- <slot /> -->
|
||||
<!-- <svelte:fragment slot="pageFooter"> -->
|
||||
<!-- <Footer /> -->
|
||||
<!-- </svelte:fragment> -->
|
||||
<!-- </AppShell> -->
|
||||
|
||||
<MainNav />
|
||||
|
||||
<div class="pt-10 md:pt-12">
|
||||
|
|
Loading…
Reference in a new issue