Skip to content

Commit 34113b5

Browse files
committed
feat: make automatic padding configurable
1 parent 74636de commit 34113b5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

config/webpush.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
* The Guzzle client options used by Minishlink\WebPush.
3535
*/
3636
'client_options' => [],
37-
37+
3838
/**
3939
* The automatic padding in bytes used by Minishlink\WebPush.
40-
* Set to false to support Firefox Android with v1 endpoint
40+
* Set to false to support Firefox Android with v1 endpoint
4141
*/
42-
'automatic_padding' => 3052,
42+
'automatic_padding' => env('WEBPUSH_AUTOMATIC_PADDING', true),
4343

4444
/**
4545
* Google Cloud Messaging.

src/WebPushServiceProvider.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Illuminate\Support\ServiceProvider;
66
use Illuminate\Support\Str;
77
use Minishlink\WebPush\WebPush;
8-
use Minishlink\WebPush\Encryption;
98

109
class WebPushServiceProvider extends ServiceProvider
1110
{
@@ -28,10 +27,10 @@ public function boot(): void
2827
->needs(WebPush::class)
2928
->give(function () {
3029
return (new WebPush(
31-
$this->webPushAuth(), [], 30, config('webpush.client_options', [])
32-
))
30+
$this->webPushAuth(), [], 30, config('webpush.client_options', [])
31+
))
3332
->setReuseVAPIDHeaders(true)
34-
->setAutomaticPadding(config('webpush.automatic_padding', Encryption::MAX_COMPATIBILITY_PAYLOAD_LENGTH));
33+
->setAutomaticPadding(config('webpush.automatic_padding'));
3534
});
3635

3736
$this->app->when(WebPushChannel::class)

0 commit comments

Comments
 (0)