Skip to content

Commit 8c7c6db

Browse files
authored
feat: add cloudflare cdn preset (#183)
1 parent 9ce4535 commit 8c7c6db

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ This package ships with a few commonly used presets to get your started. *We're
160160
| `Algolia` | [algolia.com](https://www.algolia.com) |
161161
| `Bootstrap` | [getbootstrap.com](https://getbootstrap.com) |
162162
| `Bunny Fonts` | [fonts.bunny.net](https://fonts.bunny.net/) |
163+
| `Cloudflare Cdn` | [cloudflare.com](https://www.cloudflare.com/en-in/application-services/products/cdn/) |
163164
| `Cloudflare Turnstile` | [cloudflare.com](https://www.cloudflare.com/application-services/products/turnstile/) |
164165
| `Cloudflare Web Analytics` | [cloudflare.com](https://developers.cloudflare.com/web-analytics/) |
165166
| `Fathom` | [usefathom.com](https://usefathom.com) |

src/Presets/CloudflareCdn.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 CloudflareCdn implements Preset
10+
{
11+
public function configure(Policy $policy): void
12+
{
13+
$policy
14+
->add([Directive::STYLE, Directive::SCRIPT], [
15+
'https://cdnjs.cloudflare.com',
16+
]);
17+
}
18+
}

0 commit comments

Comments
 (0)