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.
This commit is contained in:
Eugen Rochko
2018-05-19 14:46:47 +02:00
committed by GitHub
parent 1951ff41b3
commit 4b94e9c65e
76 changed files with 217 additions and 623 deletions

View File

@ -576,19 +576,6 @@ ar:
other: إعدادات أخرى
publishing: النشر
web: الويب
push_notifications:
favourite:
title: أعجب %{name} بمنشورك
follow:
title: "%{name} من متتبعيك الآن"
group:
title: "%{count} إخطارات"
mention:
action_boost: ترقية
action_expand: عرض المزيد
title: أشار إليك %{name}
reblog:
title: قام %{name} بترقية منشورك
remote_follow:
acct: قم بإدخال عنوان حسابك username@domain الذي من خلاله تود المتابعة
missing_resource: تعذر العثور على رابط التحويل المطلوب الخاص بحسابك

View File

@ -594,20 +594,6 @@ ca:
other: Altre
publishing: Publicació
web: Web
push_notifications:
favourite:
title: "%{name} ha marcat com a preferit el teu estat"
follow:
title: "%{name} ara et segueix"
group:
title: "%{count} notificacions"
mention:
action_boost: Retooteja
action_expand: Mostra'n més
action_favourite: Preferit
title: "%{name} t'ha mencionat"
reblog:
title: "%{name} t'ha retootejat"
remote_follow:
acct: Escriu el teu usuari@domini des del qual vols seguir
missing_resource: No s'ha pogut trobar la URL de redirecció necessaria per al compte

View File

@ -593,20 +593,6 @@ co:
other: Altre
publishing: Pubblicazione
web: Web
push_notifications:
favourite:
title: "%{name} hà aghjuntu u vostru statutu à i so favuriti"
follow:
title: "%{name} vi seguita"
group:
title: "%{count} nutificazioni"
mention:
action_boost: Sparte
action_expand: Vede di più
action_favourite: Aghjunghje à i favuriti
title: "%{name} vhà mintuvatu·a"
reblog:
title: "%{name} hà spartutu u vostru statutu"
remote_follow:
acct: Entrate u vostru cugnome@istanza da induve vulete siguità stu contu
missing_resource: Ùn avemu pussutu à truvà lindirizzu di ridirezzione

View File

@ -594,20 +594,6 @@ de:
other: Weiteres
publishing: Beiträge
web: Web
push_notifications:
favourite:
title: "%{name} hat deinen Beitrag favorisiert"
follow:
title: "%{name} folgt dir nun"
group:
title: "%{count} Benachrichtigungen"
mention:
action_boost: Teilen
action_expand: Mehr anzeigen
action_favourite: Favorisieren
title: "%{name} hat dich erwähnt"
reblog:
title: "%{name} hat deinen Beitrag geteilt"
remote_follow:
acct: Profilname@Domain, von wo aus du dieser Person folgen möchtest
missing_resource: Die erforderliche Weiterleitungs-URL für dein Konto konnte nicht gefunden werden

View File

@ -595,20 +595,6 @@ en:
other: Other
publishing: Publishing
web: Web
push_notifications:
favourite:
title: "%{name} favourited your status"
follow:
title: "%{name} is now following you"
group:
title: "%{count} notifications"
mention:
action_boost: Boost
action_expand: Show more
action_favourite: Favourite
title: "%{name} mentioned you"
reblog:
title: "%{name} boosted your status"
remote_follow:
acct: Enter your username@domain you want to follow from
missing_resource: Could not find the required redirect URL for your account

View File

@ -596,20 +596,6 @@ eo:
other: Aliaj aferoj
publishing: Publikado
web: Reto
push_notifications:
favourite:
title: "%{name} stelumis vian mesaĝon"
follow:
title: "%{name} eksekvis vin"
group:
title: "%{count} sciigoj"
mention:
action_boost: Diskonigi
action_expand: Montri pli
action_favourite: Stelumi
title: "%{name} menciis vin"
reblog:
title: "%{name} diskonigis vian mesaĝon"
remote_follow:
acct: Enmetu vian uzantnomo@domajno de kie vi volas sekvi
missing_resource: La URL de plusendado ne estis trovita

View File

@ -593,20 +593,6 @@ es:
other: Otros
publishing: Publicación
web: Web
push_notifications:
favourite:
title: "%A {name} le gustó tu estado"
follow:
title: "%{name} te ha empezado a seguir"
group:
title: "%{count} notificaciones"
mention:
action_boost: Retoot
action_expand: Mostrar más
action_favourite: Me Gusta
title: "%{name} te mencionó"
reblog:
title: "%{name} boosteó tu estado"
remote_follow:
acct: Ingesa tu usuario@dominio desde el que quieres seguir
missing_resource: No se pudo encontrar la URL de redirección requerida para tu cuenta

View File

@ -593,20 +593,6 @@ fa:
other: سایر
publishing: انتشار
web: وب
push_notifications:
favourite:
title: "%{name} نوشتهٔ شما را پسندید"
follow:
title: "%{name} هم‌اینک پیگیر شماست"
group:
title: "%{count} اعلان"
mention:
action_boost: بازبوق
action_expand: نمایش بیشتر
action_favourite: پسندیدن
title: "%{name} از شما نام برد"
reblog:
title: "%{name} نوشتهٔ شما را بازبوقید"
remote_follow:
acct: نشانی حساب username@domain خود را این‌جا بنویسید
missing_resource: نشانی اینترنتی برای رسیدن به حساب شما پیدا نشد

View File

@ -590,20 +590,6 @@ fi:
other: Muut
publishing: Julkaiseminen
web: Web
push_notifications:
favourite:
title: "%{name} tykkäsi tilastasi"
follow:
title: "%{name} seuraa nyt sinua"
group:
title: "%{count} ilmoitusta"
mention:
action_boost: Buustaa
action_expand: Näytä lisää
action_favourite: Tykkää
title: "%{nimi} mainitsi sinut"
reblog:
title: "%{name} buustasi tilaasi"
remote_follow:
acct: Syötä se käyttäjätunnus@verkkotunnus, josta haluat seurata
missing_resource: Vaadittavaa uudelleenohjaus-URL:ää tiliisi ei löytynyt

View File

@ -594,20 +594,6 @@ fr:
other: Autre
publishing: Publication
web: Web
push_notifications:
favourite:
title: "%{name} a mis votre statut en favori"
follow:
title: "%{name} vous suit"
group:
title: "%{count} notifications"
mention:
action_boost: Partager
action_expand: Montrer plus
action_favourite: Ajouter aux favoris
title: "%{name} vous a mentionné·e"
reblog:
title: "%{name} a partagé votre statut"
remote_follow:
acct: Entrez votre pseudo@instance depuis lequel vous voulez suivre cet·te utilisateur⋅ice
missing_resource: LURL de redirection na pas pu être trouvée

View File

@ -594,20 +594,6 @@ gl:
other: Outro
publishing: Publicando
web: Web
push_notifications:
favourite:
title: "%{name} marcou favorito o seu estado"
follow:
title: "%{name} agora está a seguila"
group:
title: "%{count} notificacións"
mention:
action_boost: Promover
action_expand: Mostar máis
action_favourite: Favorito
title: "%{name} mencionouna"
reblog:
title: "%{name} promoveu un dos seus estados"
remote_follow:
acct: Introduza o seu nomedeusuaria@dominio desde onde quere facer seguimento
missing_resource: Non se puido atopar o URL de redirecionamento requerido para a súa conta

View File

@ -531,20 +531,6 @@ hu:
other: Egyéb
publishing: Közzététel
web: Web
push_notifications:
favourite:
title: "%{name} a kedvenceihez adta a tülköd"
follow:
title: "%{name} mostantól követ téged"
group:
title: "%{count} értesítés"
mention:
action_boost: Reblog
action_expand: Mutass többet
action_favourite: Kedvencekhez adás
title: "%{name} megemlített téged"
reblog:
title: "%{name} reblogolta a tülköd"
remote_follow:
acct: Írd be a felhasználódat, amelyről követni szeretnéd felhasznalonev@domain formátumban
missing_resource: A fiókodnál nem található a szükséges átirányítási URL

View File

@ -506,18 +506,6 @@ it:
other: Altro
publishing: Pubblicazione
web: Web
push_notifications:
favourite:
title: "%{name} ha segnato il tuo status come apprezzato"
follow:
title: "%{name} ha iniziato a seguirti"
group:
title: "%{count} notifiche"
mention:
action_expand: Mostra altro
action_favourite: Apprezzato
reblog:
title: "%{name} ha condiviso il tuo status"
remote_follow:
acct: Inserisci il tuo username@dominio da cui vuoi seguire questo utente
missing_resource: Impossibile trovare l'URL di reindirizzamento richiesto per il tuo account

View File

@ -594,20 +594,6 @@ ja:
other: その他
publishing: 投稿
web: ウェブ
push_notifications:
favourite:
title: あなたのトゥートが %{name} さんにお気に入り登録されました
follow:
title: "%{name} さんにフォローされました"
group:
title: "%{count} 件の通知"
mention:
action_boost: ブースト
action_expand: もっと見る
action_favourite: お気に入り
title: "%{name} さんから返信がありました"
reblog:
title: あなたのトゥートが %{name} さんにブーストされました
remote_follow:
acct: あなたの ユーザー名@ドメイン を入力してください
missing_resource: リダイレクト先が見つかりませんでした

View File

@ -596,20 +596,6 @@ ko:
other: 기타
publishing: 퍼블리싱
web:
push_notifications:
favourite:
title: "%{name} 님이 당신의 툿를 즐겨찾기에 등록했습니다"
follow:
title: "%{name} 님이 나를 팔로우 하고 있습니다"
group:
title: "%{count} 건의 알림"
mention:
action_boost: 부스트
action_expand: 더보기
action_favourite: 즐겨찾기
title: "%{name} 님이 답장을 보냈습니다"
reblog:
title: "%{name} 님이 당신의 툿을 부스트 했습니다"
remote_follow:
acct: 아이디@도메인을 입력해 주십시오
missing_resource: 리디렉션 대상을 찾을 수 없습니다

View File

@ -594,20 +594,6 @@ nl:
other: Overig
publishing: Publiceren
web: Webapp
push_notifications:
favourite:
title: "%{name} markeerde jouw toot als favoriet"
follow:
title: "%{name} volgt jou nu"
group:
title: "%{count} meldingen"
mention:
action_boost: Boost
action_expand: Meer tonen
action_favourite: Favoriet
title: "%{name} vermeldde jou"
reblog:
title: "%{name} boostte jouw toot"
remote_follow:
acct: Geef jouw account@domein.tld op waarvandaan je wilt volgen
missing_resource: Kon vereiste doorverwijzings-URL voor jouw account niet vinden

View File

@ -531,20 +531,6 @@
other: Annet
publishing: Publisering
web: Web
push_notifications:
favourite:
title: "%{name} favoriserte din status"
follow:
title: "%{name} følger deg nå"
group:
title: "%{count} varslinger"
mention:
action_boost: Fremhev
action_expand: Vis mer
action_favourite: Favoritter
title: "%{name} nevnte deg"
reblog:
title: "%{name} fremhevde din status"
remote_follow:
acct: Tast inn brukernavn@domene som du vil følge fra
missing_resource: Kunne ikke finne URLen for din konto

View File

@ -668,20 +668,6 @@ oc:
other: Autre
publishing: Publicar
web: Interfàcia Web
push_notifications:
favourite:
title: "%{name} a mes vòstre estatut en favorit"
follow:
title: "%{name} vos sèc ara"
group:
title: "%{count} notificacions"
mention:
action_boost: Partejar
action_expand: Ne veire mai
action_favourite: Ajustar als favorits
title: "%{name} vos a mencionat"
reblog:
title: "%{name} a partejat vòstre estatut"
remote_follow:
acct: Picatz vòstre utilizaire@instància que cal utilizar per sègre aqueste utilizaire
missing_resource: URL de redireccion pas trobada

View File

@ -603,20 +603,6 @@ pl:
other: Pozostałe
publishing: Publikowanie
web: Sieć
push_notifications:
favourite:
title: "%{name} dodał Twój wpis do ulubionych"
follow:
title: "%{name} zaczął Cię śledzić"
group:
title: "%{count} powiadomień"
mention:
action_boost: Podbij
action_expand: Pokaż więcej
action_favourite: Dodaj do ulubionych
title: "%{name} wspomniał o Tobie"
reblog:
title: "%{name} podbił Twój wpis"
remote_follow:
acct: Podaj swój adres (nazwa@domena), z którego chcesz śledzić
missing_resource: Nie udało się znaleźć adresu przekierowania z Twojej domeny

View File

@ -593,20 +593,6 @@ pt-BR:
other: Outro
publishing: Publicação
web: Web
push_notifications:
favourite:
title: "%{name} favoritou a sua postagem"
follow:
title: "%{name} está te seguindo"
group:
title: "%{count} notificações"
mention:
action_boost: Compartilhar
action_expand: Mostrar mais
action_favourite: Favoritar
title: "%{name} mencionou você"
reblog:
title: "%{name} compartilhou a sua postagem"
remote_follow:
acct: Insira o seu usuário@domínio do qual você quer seguir
missing_resource: Não foi possível encontrar a URL de direcionamento para a sua conta

View File

@ -534,20 +534,6 @@ pt:
other: Outro
publishing: Publicação
web: Web
push_notifications:
favourite:
title: "%{name} adicionou o teu post aos favoritos"
follow:
title: "%{name} começou a seguir-te"
group:
title: "%{count} notificações"
mention:
action_boost: Partilhar
action_expand: Mostrar mais
action_favourite: Adicionar aos favoritos
title: "%{name} mencionou-te"
reblog:
title: "%{name} partilhou o teu post"
remote_follow:
acct: Entre seu usuário@domínio do qual quer seguir
missing_resource: Não foi possível achar a URL de redirecionamento para sua conta

View File

@ -606,20 +606,6 @@ ru:
other: Другое
publishing: Публикация
web: WWW
push_notifications:
favourite:
title: Ваш статус понравился %{name}
follow:
title: "%{name} теперь подписан(а) на Вас"
group:
title: "%{count} уведомлений"
mention:
action_boost: Продвинуть
action_expand: Развернуть
action_favourite: Нравится
title: Вас упомянул(а) %{name}
reblog:
title: "%{name} продвинул(а) Ваш статус"
remote_follow:
acct: Введите username@domain, откуда Вы хотите подписаться
missing_resource: Поиск требуемого перенаправления URL для Вашего аккаунта завершился неудачей

View File

@ -591,20 +591,6 @@ sk:
other: Ostatné
publishing: Publikovanie
web: Web
push_notifications:
favourite:
title: "%{name} si obľúbil/a tvoj príspevok"
follow:
title: "%{name} ťa teraz následuje"
group:
title: "%{count} notifikácie"
mention:
action_boost: Pozdvihni
action_expand: Ukáž viac
action_favourite: Obľúbené
title: "%{name} ťa spomenul/a"
reblog:
title: "%{name} vyzdvihli tvoj príspevok"
remote_follow:
acct: Napíš svoju prezývku@doménu z ktorej chceš následovať
missing_resource: Nemôžeme nájsť potrebnú presmerovaciu adresu k tvojmu účtu

View File

@ -525,20 +525,6 @@ sr-Latn:
other: Ostali
publishing: Objavljivanje
web: Veb
push_notifications:
favourite:
title: "%{name} je stavio Vaš status za omiljeni"
follow:
title: "%{name} Vas je zapratio"
group:
title: "%{count} obaveštenja"
mention:
action_boost: Podrži
action_expand: Prikaži još
action_favourite: Omiljeni
title: "%{name} Vas je pomenuo"
reblog:
title: "%{name} je podržao(la) Vaš status"
remote_follow:
acct: Unesite Vaš korisnik@domen sa koga želite da pratite
missing_resource: Ne mogu da nađem zahtevanu adresu preusmeravanja za Vaš nalog

View File

@ -525,20 +525,6 @@ sr:
other: Остали
publishing: Објављивање
web: Веб
push_notifications:
favourite:
title: "%{name} је ставио Ваш статус за омиљени"
follow:
title: "%{name} Вас је запратио"
group:
title: "%{count} обавештења"
mention:
action_boost: Подржи
action_expand: Прикажи још
action_favourite: Омиљени
title: "%{name} Вас је поменуо"
reblog:
title: "%{name} је подржао(ла) Ваш статус"
remote_follow:
acct: Унесите Ваш корисник@домен са кога желите да пратите
missing_resource: Не могу да нађем захтевану адресу преусмеравања за Ваш налог

View File

@ -592,20 +592,6 @@ sv:
other: Annat
publishing: Publicering
web: Webb
push_notifications:
favourite:
title: "%{name} favoriserade din status"
follow:
title: "%{name} följer nu dig"
group:
title: "%{count} meddelanden"
mention:
action_boost: Knuffa
action_expand: Visa mer
action_favourite: Favoriter
title: "%{name} nämnde dig"
reblog:
title: "%{name} boostade din status"
remote_follow:
acct: Ange ditt användarnamn@domän du vill följa från
missing_resource: Det gick inte att hitta den begärda omdirigeringsadressen för ditt konto

View File

@ -523,20 +523,6 @@ zh-CN:
other: 其他
publishing: 发布
web: 站内
push_notifications:
favourite:
title: "%{name} 收藏了你的嘟文"
follow:
title: "%{name} 关注了你"
group:
title: "%{count} 条新通知"
mention:
action_boost: 转嘟
action_expand: 显示更多
action_favourite: 收藏
title: "%{name} 提到了你"
reblog:
title: "%{name} 转嘟了你的嘟文"
remote_follow:
acct: 请输入你的“用户名@实例域名”
missing_resource: 无法确定你的帐户的跳转 URL

View File

@ -593,20 +593,6 @@ zh-HK:
other: 其他
publishing: 發佈
web: 站内
push_notifications:
favourite:
title: "%{name} 收藏了你的文章"
follow:
title: "%{name} 關注了你"
group:
title: "%{count} 條新通知"
mention:
action_boost: 轉推
action_expand: 顯示更多
action_favourite: 收藏
title: "%{name} 提到了你"
reblog:
title: "%{name} 轉推了你的文章"
remote_follow:
acct: 請輸入你的︰用戶名稱@服務點域名
missing_resource: 無法找到你用戶的轉接網址