Remove the service worker.

This commit is contained in:
James Cole
2022-08-03 05:39:47 +02:00
parent cc6a7b181a
commit aa3fba91d4
5 changed files with 0 additions and 105 deletions

View File

@@ -1,58 +0,0 @@
/*
* serviceworker.js
* Copyright (c) 2021 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
let staticCachePrefix = "firefly-III-"
let staticCacheName = staticCachePrefix + new Date().getTime();
let cachedFiles = [
'/offline',
'/v2/plugins/local-fonts/gf-source.css',
'/v2/css/app.css',
];
// Create cache on install
self.addEventListener("install", event => {
this.skipWaiting();
event.waitUntil(
caches.open(staticCacheName).then(cache => cache.addAll(cachedFiles))
)
});
// Clear cache on activate
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames
.filter(cacheName => (cacheName.startsWith(staticCachePrefix)))
.filter(cacheName => (cacheName !== staticCacheName))
.map(cacheName => caches.delete(cacheName))
);
})
);
});
// Serve from Cache or return the offline page
self.addEventListener("fetch", event => {
event.respondWith(
caches.match(event.request)
.then(response => (response || fetch(event.request)))
.catch(() => caches.match('offline'))
)
});

View File

@@ -228,17 +228,6 @@
<noscript><p><img src="//{{ config('firefly.tracker_url') }}/matomo.php?idsite={{ config('firefly.tracker_site_id') }}&amp;rec=1" style="border:0;" alt="" /></p></noscript>
{% endif %}
<script nonce="{{ JS_NONCE }}">
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('serviceworker.js?v={{ FF_VERSION }}', {
scope: '{{ route('index') }}'
}).then(
() => console.log('ServiceWorker registration successful'),
(err) => console.log('ServiceWorker registration failed: ', err)
);
}
</script>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
</form>

View File

@@ -61,17 +61,5 @@
<noscript><p><img src="//{{ config('firefly.tracker_url') }}/matomo.php?idsite={{ config('firefly.tracker_site_id') }}&amp;rec=1" style="border:0;" alt="" /></p></noscript>
{% endif %}
<script nonce="{{ JS_NONCE }}">
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('serviceworker.js?v={{ FF_VERSION }}', {
scope: '{{ route('index') }}'
}).then(
() => console.log('ServiceWorker registration successful'),
(err) => console.log('ServiceWorker registration failed: ', err)
);
}
</script>
</body>
</html>

View File

@@ -76,17 +76,5 @@
<noscript><p><img src="//{{ config('firefly.tracker_url') }}/matomo.php?idsite={{ config('firefly.tracker_site_id') }}&amp;rec=1" style="border:0;" alt="" /></p></noscript>
{% endif %}
<script nonce="{{ JS_NONCE }}">
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('serviceworker.js?v={{ FF_VERSION }}', {
scope: '{{ route('index') }}'
}).then(
() => console.log('ServiceWorker registration successful'),
(err) => console.log('ServiceWorker registration failed: ', err)
);
}
</script>
</body>
</html>

View File

@@ -36,17 +36,5 @@
</div>
<script src="v1/js/app.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>
{% block scripts %}{% endblock %}
<script nonce="{{ JS_NONCE }}">
// Initialize the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('serviceworker.js?v={{ FF_VERSION }}', {
scope: '{{ route('index') }}'
}).then(
() => console.log('ServiceWorker registration successful'),
(err) => console.log('ServiceWorker registration failed: ', err)
);
}
</script>
</body>
</html>