diff options
| author | 2024-03-30 13:09:44 -0400 | |
|---|---|---|
| committer | 2024-03-30 18:09:44 +0100 | |
| commit | 7da0e70a7221a42fb8ff6534fc339b18f8e2daa1 (patch) | |
| tree | 3ed0294526375bf292faed84a1dfad9a1e8bf814 /docs/en | |
| parent | bb0fc2a54ad59626970c62345a3b4c131204d705 (diff) | |
Add a way to modify CSP rules within an extension (#6246)
This will allow to change CSP rules to authorize the use of external scripts.
We might need to add some safeguard since it will be virtually possible to
load any script even malicious one.
Diffstat (limited to 'docs/en')
| -rw-r--r-- | docs/en/developers/03_Backend/05_Extensions.md | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md index 644420440..770ea29cc 100644 --- a/docs/en/developers/03_Backend/05_Extensions.md +++ b/docs/en/developers/03_Backend/05_Extensions.md @@ -164,6 +164,19 @@ The following events are available: * `post_update` (`function(none) -> none`): **TODO** add documentation. * `simplepie_before_init` (`function($simplePie, $feed) -> none`): **TODO** add documentation. +### Injecting CDN content + +When using the `init` method, it is possible to inject scripts from CDN using the `Minz_View::appendScript` directive. +FreshRSS will include the script in the page but will not load it since it will be blocked by the default content security policy (**CSP**). +To amend the existing CSP, you need to define the extension CSP policies: +```php +// in the extension.php file +protected array $csp_policies = [ + 'default-src' => 'example.org', +]; +``` +This will only amend the extension CSP to FreshRSS CSP. + ### Writing your own configure.phtml When you want to support user configurations for your extension or simply display some information, you have to create the `configure.phtml` file. |
