Improve payload format of Web Push API now that it's open (#7521)
> Good lord what is happening in there Previously the contents of the Web Push API payloads closely resembled the structure of JavaScript's [Notification](https://developer.mozilla.org/en-US/docs/Web/API/Notification). But now that the API is open to non-browser apps, and given that there is no required coupling between contents of the payload and a Notification object, here is how I changed the payload: ```json { "access_token": "...", "preferred_locale": "en", "notification_id": "12345", "notification_type": "follow", "title": "So and so followed you", "body": "This is my bio", "icon": "https://example.com/avatar.png" } ``` The title, body and icon attributes are included as a fallback so you can construct a minimal notification if you cannot perform a network request to the API to get more data.
Showing
- app/javascript/mastodon/actions/notifications.js 1 addition, 0 deletionsapp/javascript/mastodon/actions/notifications.js
- app/javascript/mastodon/locales/ar.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/ar.json
- app/javascript/mastodon/locales/bg.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/bg.json
- app/javascript/mastodon/locales/ca.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/ca.json
- app/javascript/mastodon/locales/co.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/co.json
- app/javascript/mastodon/locales/de.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/de.json
- app/javascript/mastodon/locales/defaultMessages.json 5 additions, 1 deletionapp/javascript/mastodon/locales/defaultMessages.json
- app/javascript/mastodon/locales/el.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/el.json
- app/javascript/mastodon/locales/en.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/en.json
- app/javascript/mastodon/locales/eo.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/eo.json
- app/javascript/mastodon/locales/es.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/es.json
- app/javascript/mastodon/locales/eu.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/eu.json
- app/javascript/mastodon/locales/fa.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/fa.json
- app/javascript/mastodon/locales/fi.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/fi.json
- app/javascript/mastodon/locales/fr.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/fr.json
- app/javascript/mastodon/locales/gl.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/gl.json
- app/javascript/mastodon/locales/he.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/he.json
- app/javascript/mastodon/locales/hr.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/hr.json
- app/javascript/mastodon/locales/hu.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/hu.json
- app/javascript/mastodon/locales/hy.json 1 addition, 0 deletionsapp/javascript/mastodon/locales/hy.json
Loading
Please register or sign in to comment