diff --git a/library/Feeds/ProvidedHook/Csp.php b/library/Feeds/ProvidedHook/Csp.php new file mode 100644 index 0000000..b93d81d --- /dev/null +++ b/library/Feeds/ProvidedHook/Csp.php @@ -0,0 +1,41 @@ +getFeeds() as $feed) { + $url = Url::fromPath($feed->url); + $csp->add('img-src', $url->getScheme() . '://' . $url->getHost()); + } + + return $csp; + } + + public function getCspForUser(User $user): CspInstance + { + if (Auth::getInstance()->hasPermission('feeds/view')) { + return $this->getCspForAllUsers(); + } + + return new CspInstance(); + } +} diff --git a/run.php b/run.php index b3d9bbc..04b49f3 100644 --- a/run.php +++ b/run.php @@ -1 +1,5 @@