1
0
Fork 1
forked from fedi/mastodon
mastodon/app
Eugen Rochko 4b94e9c65e
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.
2018-05-19 14:46:47 +02:00
..
chewy Full-text search for authorized statuses (#6423) 2018-02-09 23:04:47 +01:00
controllers Add preference to hide following/followers lists (#7532) 2018-05-18 02:26:51 +02:00
helpers Fix double-encoding of display name in title and e-mails (#7534) 2018-05-18 15:56:57 +02:00
javascript Improve payload format of Web Push API now that it's open (#7521) 2018-05-19 14:46:47 +02:00
lib Resolve unknown status from Add activity, skip Remove if unknown (#7526) 2018-05-18 11:33:56 +02:00
mailers Account archive download (#6460) 2018-02-21 23:21:32 +01:00
models Improve payload format of Web Push API now that it's open (#7521) 2018-05-19 14:46:47 +02:00
policies Fix n+1 queries in StatusThreadingConcern (#7321) 2018-05-03 10:41:58 +02:00
presenters Better pagination for ActivityPub outbox (#7356) 2018-05-04 19:19:11 +02:00
serializers Improve payload format of Web Push API now that it's open (#7521) 2018-05-19 14:46:47 +02:00
services Raise Mastodon::RaceConditionError if Redis lock failed (#7511) 2018-05-16 12:29:45 +02:00
validators Implement the ability for instances to define a list of disallowed hashtags (#7176) 2018-04-23 23:52:58 +02:00
views Add preference to hide following/followers lists (#7532) 2018-05-18 02:26:51 +02:00
workers Do not raise delivery failure on 4xx errors, increase stoplight threshold (#7541) 2018-05-19 00:23:19 +02:00