Compare commits

...

2 Commits

Author SHA1 Message Date
binwiederhier
109271a930 Avoid playing sound more than every 2s 2026-03-08 10:55:59 -04:00
binwiederhier
fcf95dc9b8 Fix release notes 2026-03-07 16:17:00 -05:00
2 changed files with 17 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
Please check out the release notes for [upcoming releases](#not-released-yet) below.
### ntfy server v2.18.0
## ntfy server v2.18.0
Released March 7, 2026
This is the biggest release I've ever done on the server. It's 14,997 added lines of code, and 10,202 lines removed, all from
@@ -23,7 +23,7 @@ went through all queries multiple times and reviewed the logic over and over aga
which took lots of evenings.
I'll not instantly switch ntfy.sh over. Instead, I'm kindly asking the community to test the Postgres support and report back to me
if things are working (or not working). There is a one-off migration tool (entirely written by AI) that you can use to migrate.
if things are working (or not working). There is a [one-off migration tool](https://github.com/binwiederhier/ntfy/tree/main/tools/pgimport) (entirely written by AI) that you can use to migrate.
**Features:**
@@ -33,7 +33,7 @@ if things are working (or not working). There is a one-off migration tool (entir
* Preserve `<br>` line breaks in HTML-only emails received via SMTP ([#690](https://github.com/binwiederhier/ntfy/issues/690), [#1620](https://github.com/binwiederhier/ntfy/pull/1620), thanks to [@uzkikh](https://github.com/uzkikh) for the fix and to [@teastrainer](https://github.com/teastrainer) for reporting)
### ntfy Android v1.24.0
## ntfy Android v1.24.0
Released March 5, 2026
This is a tiny release that will revert the "reconnecting ..." behavior of the foreground notification. Lots of people
@@ -1755,4 +1755,8 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
## Not released yet
_None_
### ntfy server v2.19.0 (UNRELEASED)
**Bug fixes + maintenance:**
* Throttle notification sound in web app to play at most once every 2 seconds

View File

@@ -8,6 +8,8 @@ import routes from "../components/routes";
* support this; most importantly, all iOS browsers do not support window.Notification.
*/
class Notifier {
lastSoundPlayedAt = 0;
async notify(subscription, notification) {
if (!this.supported()) {
return;
@@ -49,11 +51,17 @@ class Notifier {
}
async playSound() {
// Play sound
// Play sound, but not more than once every 2 seconds
const now = Date.now();
if (now - this.lastSoundPlayedAt < 2000) {
console.log(`[Notifier] Not playing notification sound, since it was last played <2s ago`, this.lastSoundPlayedAt);
return;
}
const sound = await prefs.sound();
if (sound && sound !== "none") {
try {
await playSound(sound);
this.lastSoundPlayedAt = Date.now();
} catch (e) {
console.log(`[Notifier] Error playing audio`, e);
}