Skip to content

Commit 69faa0e

Browse files
authored
Add Vimeo preset (#158)
1 parent 15e7cc7 commit 69faa0e

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ This package ships with a few commonly used presets to get your started. *We're
158158
| `Stripe` | [stripe.com](https://stripe.com/) |
159159
| `TicketTailor` | [tickettailor.com](https://www.tickettailor.com) |
160160
| `Tolt` | [tolt.io](https://tolt.io) |
161+
| `Vimeo` | [vimeo.com](https://vimeo.com) |
161162

162163
Register the presets you want to use for your application in `config/csp.php` under the `presets` or `report_only_presets` key.
163164

src/Presets/Vimeo.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Spatie\Csp\Presets;
4+
5+
use Spatie\Csp\Directive;
6+
use Spatie\Csp\Policy;
7+
use Spatie\Csp\Preset;
8+
9+
class Vimeo implements Preset
10+
{
11+
public function configure(Policy $policy): void
12+
{
13+
$policy
14+
->add(Directive::SCRIPT, 'player.vimeo.com')
15+
->add(Directive::FRAME, 'player.vimeo.com');
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
script-src player.vimeo.com
2+
frame-src player.vimeo.com

tests/PresetTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ function (string $presetClass): void {
3838
Presets\Stripe::class,
3939
Presets\TicketTailor::class,
4040
Presets\Tolt::class,
41+
Presets\Vimeo::class,
4142
]);

0 commit comments

Comments
 (0)