sw: show Photo/File in notifications for media-only messages
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 file changed,
+4
−0
web/static/sw.js+4 −0
diff --git a/web/static/sw.js b/web/static/sw.js| index 11d499f..3909b8e 100644 |
| --- a/web/static/sw.js |
| +++ b/web/static/sw.js |
| @@ -70,6 +70,10 @@ async function handlePush(event) { |
| const msg = await decryptBlob(data.blob, keyB64); |
| title = msg.name || "New message"; |
| body = msg.text || ""; |
| + if (!body && Array.isArray(msg.attachments) && msg.attachments.length) { |
| + const a = msg.attachments[0]; |
| + body = a.type && a.type.startsWith("image/") ? "📷 Photo" : "📎 " + (a.name || "File"); |
| + } |
| } |
| } catch (e) { |
| // fall back to the generic notification |