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