Skip to content

Commit 2dc3fb2

Browse files
feat: allow to set WebPush automatic padding in config (#176)
* Update webpush.php * Update WebPushServiceProvider.php * Update webpush.php * Update webpush.php * Update WebPushServiceProvider.php * Use Encryption::MAX_COMPATIBILITY_PAYLOAD_LENGTH * feat: configure automatic padding --------- Co-authored-by: Joost de Bruijn <[email protected]>
1 parent ff792c3 commit 2dc3fb2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

config/webpush.php

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
*/
3636
'client_options' => [],
3737

38+
/**
39+
* The automatic padding in bytes used by Minishlink\WebPush.
40+
* Set to false to support Firefox Android with v1 endpoint.
41+
*/
42+
'automatic_padding' => env('WEBPUSH_AUTOMATIC_PADDING', true),
43+
3844
/**
3945
* Google Cloud Messaging.
4046
*

src/WebPushServiceProvider.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ public function boot(): void
2525
{
2626
$this->app->when(WebPushChannel::class)
2727
->needs(WebPush::class)
28-
->give(fn (): WebPush => (new WebPush(
29-
$this->webPushAuth(), [], 30, config('webpush.client_options', [])
30-
))->setReuseVAPIDHeaders(true));
28+
->give(function () {
29+
return (new WebPush(
30+
$this->webPushAuth(), [], 30, config('webpush.client_options', [])
31+
))
32+
->setReuseVAPIDHeaders(true)
33+
->setAutomaticPadding(config('webpush.automatic_padding'));
34+
});
3135

3236
$this->app->when(WebPushChannel::class)
3337
->needs(ReportHandlerInterface::class)

0 commit comments

Comments
 (0)