Compare commits
No commits in common. "2cdb6017067b7e890a4222a06901ed4f2c3ab43f" and "64f0da662bea968f063e73f055c8ebf600e4a748" have entirely different histories.
2cdb601706
...
64f0da662b
@ -1,5 +1,5 @@
|
||||
[tool.bumpversion]
|
||||
current_version = "1.3.53"
|
||||
current_version = "1.3.52"
|
||||
commit = true
|
||||
tag = true
|
||||
tag_name = "{new_version}"
|
||||
|
@ -49,35 +49,18 @@
|
||||
<p>Version: <a href="#" id="version-link">{{ version }}</a></p>
|
||||
</footer>
|
||||
|
||||
<input type="hidden" id="is-logged-in" value="{{ 'true' if session.get('logged_in') else 'false' }}">
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
<script>
|
||||
if ('serviceWorker' in navigator && 'PushManager' in window) {
|
||||
const isLoggedIn = document.getElementById('is-logged-in').value === 'true';
|
||||
navigator.serviceWorker.register('{{ url_for("static", filename="service-worker.js") }}').then(function(registration) {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
const enableNotificationsBtn = document.getElementById('enable-notifications-btn');
|
||||
|
||||
function setupNotificationButton() {
|
||||
registration.pushManager.getSubscription().then(function(subscription) {
|
||||
if (enableNotificationsBtn) {
|
||||
if (subscription) {
|
||||
enableNotificationsBtn.style.display = 'none';
|
||||
} else {
|
||||
enableNotificationsBtn.style.display = 'block';
|
||||
enableNotificationsBtn.addEventListener('click', function() {
|
||||
askPermission(registration);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (enableNotificationsBtn) {
|
||||
setupNotificationButton();
|
||||
// Check for the 'loggedin' query parameter to trigger the prompt
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has('loggedin')) {
|
||||
askPermission(registration);
|
||||
}
|
||||
}, function(err) {
|
||||
console.log('ServiceWorker registration failed: ', err);
|
||||
@ -158,10 +141,6 @@
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Subscription saved successfully.');
|
||||
const enableNotificationsBtn = document.getElementById('enable-notifications-btn');
|
||||
if (enableNotificationsBtn) {
|
||||
enableNotificationsBtn.style.display = 'none';
|
||||
}
|
||||
return response.json();
|
||||
} else {
|
||||
console.error('Failed to save subscription. Status:', response.status);
|
||||
|
@ -5,9 +5,6 @@
|
||||
{% block content %}
|
||||
<h1>Welcome {{ username }}!</h1>
|
||||
<br>
|
||||
<button id="enable-notifications-btn" class="btn btn-primary">Enable Notifications</button>
|
||||
<br>
|
||||
<br>
|
||||
<h2>You have {{ accounts }} active accounts</h2>
|
||||
<br>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user