mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-15 19:09:50 +00:00
Add service worker and offline page (needed to install the webapp on mobile devices)
This commit is contained in:
@@ -19,5 +19,17 @@
|
||||
<body class="hold-transition login-page">
|
||||
{% block content %}{% endblock %}
|
||||
{% 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>
|
||||
|
||||
@@ -46,9 +46,11 @@
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0 text-dark">
|
||||
{% if mainTitleIcon|default(false) %}<span class="fa fas {{ mainTitleIcon }}"></span>{% endif %}
|
||||
{% if mainTitleIcon|default(false) %}<span
|
||||
class="fa fas {{ mainTitleIcon }}"></span>{% endif %}
|
||||
{{ title }} <small class="text-muted">
|
||||
{% if subTitleIcon|default(false) %}<span class="fa fas {{ subTitleIcon }}"></span>{% endif %}
|
||||
{% if subTitleIcon|default(false) %}<span
|
||||
class="fa fas {{ subTitleIcon }}"></span>{% endif %}
|
||||
{{ subTitle|default('') }}</small></h1>
|
||||
</div><!-- /.col -->
|
||||
<div class="col-sm-6">
|
||||
@@ -91,6 +93,18 @@
|
||||
<script src="v2/js/vendor.js?v={{ FF_VERSION }}" 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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user