new_songs = [s for s in new_songs if not s.hidden] # Filter out hidden songs
unique_users = sorted(set(s.username for s in new_songs))
- title = None
+ title = f"New music!"
+ body = None
_except = None
if len(new_songs) == 1:
- title = f"New song from {unique_users[0]}"
+ body = f"New song from {unique_users[0]}"
_except = new_songs[0].userid
elif len(new_songs) > 1:
- title = f"New songs from {', '.join(unique_users)}"
+ body = f"New songs from {', '.join(unique_users)}"
- if title:
+ if body:
notify_all(
title,
- body=None,
+ body,
url="/",
setting=SubscriptionSetting.SONGS,
_except=_except)
<div class="navbar">
<a href="/users/{{ session["username"] }}" class="nav-logged-in" id="my-profile" hidden>My Profile</a>
<a href="/activity" class="nav-logged-in" hidden><span id="activity-indicator" hidden></span>Activity</a>
+ <a href="/settings" class="nav-logged-in" hidden>Settings</a>
<a href="/logout" class="nav-logged-in" hidden>Sign Out</a>
<a href="/signup" class="nav-logged-out">Create Account</a>
{% block body %}
<h1>site news</h1>
+<h2>2025-08-29 - Finally, Push Notifications!</h2>
+<p>
+Mobile push notifications have landed. Add a bookmark to your phone's home
+screen, and then open the new <a href="/settings">Settings</a> page and select
+which things you'd like to be notified about.
+</p>
+
<h2>2025-08-17 - Leaving GitHub</h2>
<p>
I have felt for a while like GitHub was not really the right home for the
<h1>settings</h1>
<h2>push notifications</h2>
+<p>
+<b>Note:</b> For the best notification experience, you can add a bookmark to
+the site to your mobile device's home screen. This will allow the the site to
+run in "progressive web app" mode, which enables background notifications.
+</p>
<div id="activity-settings" style="line-height: 1.5;">
<!--<span>Push notifications are currently disabled on this device.</span>-->
<!--<button onclick="enablePushNotifications()" class="button" style="float: right;">Enable</button>-->
- Send me a push notification on this device when:
+ <b>Send me a push notification on this device when:</b>
<br/>
<label><input type="checkbox" onclick="updateSettings()" id="comment-push">I get a new comment</label>
<br/>
<label><input type="checkbox" onclick="updateSettings()" id="song-push">Anyone uploads a new song (at most once per day)</label>
</div>
+<br/>
<button class="button" onclick="fetch('/push-notifications/test')">Test Notifications</button>
pushmock.assert_called_once_with(
json.loads(SUBDATA),
- '{"title": "New song from user2", "body": null, "url": "/"}',
+ '{"title": "New music!", "body": "New song from user2", "url": "/"}',
vapid_private_key="vapid-private-key",
vapid_claims={"sub": "mailto:littlesongplace@gmail.com"})