diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index c593893..265a7ec 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -5,6 +5,7 @@ namespace App\Providers; use App\Models\Interfaces\MovieDbInterface; use App\Services\OmdbService; use Illuminate\Support\ServiceProvider; +use Livewire\Livewire; class AppServiceProvider extends ServiceProvider { @@ -24,5 +25,10 @@ class AppServiceProvider extends ServiceProvider if ($this->app->environment('production')) { \URL::forceScheme('https'); } + + // Configure Livewire CSP nonce + Livewire::setScriptNonce(function () { + return request()->attributes->get('csp-nonce'); + }); } } diff --git a/app/Support/LivewireNonce.php b/app/Support/LivewireNonce.php deleted file mode 100644 index 3e8f2a4..0000000 --- a/app/Support/LivewireNonce.php +++ /dev/null @@ -1,11 +0,0 @@ -attributes->get('csp-nonce'); - } -} diff --git a/config/livewire.php b/config/livewire.php index 4eb361a..8a4be98 100644 --- a/config/livewire.php +++ b/config/livewire.php @@ -170,17 +170,4 @@ return [ */ 'pagination_theme' => 'tailwind', - - /* - |--------------------------------------------------------------------------- - | Content Security Policy Nonce - |--------------------------------------------------------------------------- - | - | When using Content-Security-Policy headers, Livewire can automatically - | apply nonces to its injected scripts. Provide a closure that returns - | the nonce value for the current request, or null to disable. - | - */ - - 'nonce' => \App\Support\LivewireNonce::class.'@__invoke', ];