Skip to content

Firefly III: a personal finances manager

Remove the service worker.

James Coleaa3fba91d453
diff --git a/public/serviceworker.js b/public/serviceworker.js
deleted file mode 100644
index 1eb9b19f82..0000000000
--- a/public/serviceworker.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * serviceworker.js
- * Copyright (c) 2021 [email protected]
- *
- * 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'))
- )
-});
diff --git a/resources/views/layout/default.twig b/resources/views/layout/default.twig
index 555140d32c..aedf826479 100644
--- a/resources/views/layout/default.twig
+++ b/resources/views/layout/default.twig
@@ -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>
diff --git a/resources/views/layout/empty.twig b/resources/views/layout/empty.twig
index c72672279f..516e82c9f7 100644
--- a/resources/views/layout/empty.twig
+++ b/resources/views/layout/empty.twig
@@ -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>
diff --git a/resources/views/layout/guest.twig b/resources/views/layout/guest.twig
index 50177b2b95..f96592aad6 100644
--- a/resources/views/layout/guest.twig
+++ b/resources/views/layout/guest.twig
@@ -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>
diff --git a/resources/views/layout/install.twig b/resources/views/layout/install.twig
index edb8564ca0..a4cc4e9c81 100644
--- a/resources/views/layout/install.twig
+++ b/resources/views/layout/install.twig
@@ -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>