Commit Graph

20 Commits

Author SHA1 Message Date
Eugen Rochko
e583f110c3
Unescape HTML entities in rich web push notifications in web UI (#7569) 2018-05-21 16:00:56 +02:00
Eugen Rochko
9ada532809
Convert rich push notifications to plaintext in webapp (#7563)
* Convert rich push notifications to plaintext in webapp

* Fix code style issues
2018-05-21 03:35:37 +02:00
Akihiko Odaki
4e1400cecb Cache media only when storage can be freed (#7547) 2018-05-19 19:22:11 +02:00
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
Akihiko Odaki
65d6b253fb Let navigator follow redirect instead that handling redirect in fetch (#7500)
* Let navigator follow redirect instead that handling redirect in fetch

* Do not use cache when fetched resource is to redirect
2018-05-16 04:59:44 +02:00
Akihiko Odaki
17c1a62ec8 Consider only-if-cached in FetchEvent valid on non-Mozilla-Firefox browser (#7506) 2018-05-15 21:42:31 +02:00
Akihiko Odaki
918cfd3be6 Ignore only-if-cached cache mode on Mozilla Firefox prior to version 60 (#7503) 2018-05-15 20:14:30 +02:00
Akihiko Odaki
3705cd8322 Clone response before using when caching web page (#7498) 2018-05-15 14:24:50 +02:00
Akihiko Odaki
03b69ebc45 Disallow async function in service worker (#7482)
offline-plugin depends on webpack.optimize.UglifyJsPlugin, which is an
alias of uglifyjs-webpack-plugin v0.4.6. uglifyjs-webpack-plugin v0.4.6
uses uglify-js 2.8.29, which is not compatible with async function.
2018-05-14 19:58:11 +02:00
Akihiko Odaki
1ed1014546 Free stroage if it is exceeding disk quota (#7061) 2018-04-08 13:32:39 +02:00
unarist
f5ed5f3860 Clone response before put it to the cache (#6932)
`Response.prototype.clone()` must be called before the response used.

This fixes an error from ServiceWorker and failing to load image when the
image is not cached.
2018-03-27 15:18:35 +02:00
Akihiko Odaki
ca42f9b0eb Cache media (#6902) 2018-03-27 12:32:30 +02:00
Akihiko Odaki
721234230c Synchronize HTML page cache with sessions (#6815) 2018-03-18 15:14:38 +01:00
Akihiko Odaki
f0cd957c7a Cache HTML page with Service Worker (#6802)
This is the first step to make Mastodon work offline. It is also required
by Chromium to trigger Web Manifest automated install prompt.
2018-03-17 12:35:13 +01:00
Eugen Rochko
74437c6bff Refactor Web::PushSubscription, remove welcome message (#4524)
* Refactor Web::PushSubscription, remove welcome message

* Add missing helper

* Use locale of the receiver on push notifications (#4519)

* Remove unused translations

* Fix dir on notifications
2017-09-01 13:35:23 +02:00
Sorin Davidoi
d4c4820c03 fix(web_push_notifications): Send message with welcome notifications (#4471)
* fix(web_push_notifications): Send grouping title in welcome notification

* fix(web_push_notifications): Read message from last notification
2017-08-01 06:00:13 +02:00
Sorin Davidoi
e67fc997dc feat(web_push_notifications): Group notifications (#4388) 2017-07-28 05:06:22 +02:00
Sorin Davidoi
3e01a7e677 fix(web_push_notification): Do not hard reload tab (#4380)
* fix(web_push_notification): Do not hard reload tab

* fix(web_push_notification_worker): Guard against null subscription

* refactor: Incorporate pull request feedback
2017-07-28 05:06:01 +02:00
Sorin Davidoi
719ab720a7 feat(push-notifications): Open link in current tab if possible (#4228)
* fix(push-notification): Open link in current tab if possible

* feat(sw): Skip waiting and claim clients
2017-07-18 00:19:17 +02:00
Sorin Davidoi
0c7c188c45 Web Push Notifications (#3243)
* feat: Register push subscription

* feat: Notify when mentioned

* feat: Boost, favourite, reply, follow, follow request

* feat: Notification interaction

* feat: Handle change of public key

* feat: Unsubscribe if things go wrong

* feat: Do not send normal notifications if push is enabled

* feat: Focus client if open

* refactor: Move push logic to WebPushSubscription

* feat: Better title and body

* feat: Localize messages

* chore: Fix lint errors

* feat: Settings

* refactor: Lazy load

* fix: Check if push settings exist

* feat: Device-based preferences

* refactor: Simplify logic

* refactor: Pull request feedback

* refactor: Pull request feedback

* refactor: Create /api/web/push_subscriptions endpoint

* feat: Spec PushSubscriptionController

* refactor: WebPushSubscription => Web::PushSubscription

* feat: Spec Web::PushSubscription

* feat: Display first media attachment

* feat: Support direction

* fix: Stuff broken while rebasing

* refactor: Integration with session activations

* refactor: Cleanup

* refactor: Simplify implementation

* feat: Set VAPID keys via environment

* chore: Comments

* fix: Crash when no alerts

* fix: Set VAPID keys in testing environment

* fix: Follow link

* feat: Notification actions

* fix: Delete previous subscription

* chore: Temporary logs

* refactor: Move migration to a later date

* fix: Fetch the correct session activation and misc bugs

* refactor: Move migration to a later date

* fix: Remove follow request (no notifications)

* feat: Send administrator contact to push service

* feat: Set time-to-live

* fix: Do not show sensitive images

* fix: Reducer crash in error handling

* feat: Add badge

* chore: Fix lint error

* fix: Checkbox label overlap

* fix: Check for payload support

* fix: Rename action "type" (crash in latest Chrome)

* feat: Action to expand notification

* fix: Lint errors

* fix: Unescape notification body

* fix: Do not allow boosting if the status is hidden

* feat: Add VAPID keys to the production sample environment

* fix: Strip HTML tags from status

* refactor: Better error messages

* refactor: Handle browser not implementing the VAPID protocol (Samsung Internet)

* fix: Error when target_status is nil

* fix: Handle lack of image

* fix: Delete reference to invalid subscriptions

* feat: Better error handling

* fix: Unescape HTML characters after tags are striped

* refactor: Simpify code

* fix: Modify to work with #4091

* Sort strings alphabetically

* i18n: Updated Polish translation

it annoys me that it's not fully localized :P

* refactor: Use current_session in PushSubscriptionController

* fix: Rebase mistake

* fix: Set cacheName to mastodon

* refactor: Pull request feedback

* refactor: Remove logging statements

* chore(yarn): Fix conflicts with master

* chore(yarn): Copy latest from master

* chore(yarn): Readd offline-plugin

* refactor: Use save! and update!

* refactor: Send notifications async

* fix: Allow retry when push fails

* fix: Save track for failed pushes

* fix: Minify sw.js

* fix: Remove account_id from fabricator
2017-07-13 22:15:32 +02:00