Compare commits
No commits in common. "2e63cd951afd66a32e03c86c3958966ed65e387a" and "ab90dd2679f518b271def11fbf2c82c581013ad9" have entirely different histories.
2e63cd951a
...
ab90dd2679
@ -1,5 +1,5 @@
|
||||
[tool.bumpversion]
|
||||
current_version = "1.3.31"
|
||||
current_version = "1.3.30"
|
||||
commit = true
|
||||
tag = true
|
||||
tag_name = "{new_version}"
|
||||
|
@ -35,6 +35,11 @@
|
||||
<a class="nav-link" href="/urls">URLs</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<button id="enable-notifications" class="btn btn-outline-light">Enable Notifications</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@ -55,15 +60,20 @@
|
||||
{% block scripts %}{% endblock %}
|
||||
<script>
|
||||
if ('serviceWorker' in navigator && 'PushManager' in window) {
|
||||
let swRegistration = null;
|
||||
navigator.serviceWorker.register('{{ url_for("static", filename="service-worker.js") }}').then(function(registration) {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
// Check if we should ask for permission
|
||||
if (document.referrer.includes('/login') || (performance.navigation.type == performance.navigation.TYPE_RELOAD && new URLSearchParams(window.location.search).has('loggedin'))) {
|
||||
askPermission(registration);
|
||||
}
|
||||
swRegistration = registration;
|
||||
}, function(err) {
|
||||
console.log('ServiceWorker registration failed: ', err);
|
||||
});
|
||||
|
||||
const enableNotificationsButton = document.getElementById('enable-notifications');
|
||||
enableNotificationsButton.addEventListener('click', function() {
|
||||
if (swRegistration) {
|
||||
askPermission(swRegistration);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function askPermission(registration) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user