aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/ActionController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-05-23 14:03:19 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-23 14:03:19 +0200
commitf89819bd64bb5ada706f9b85abd6f7b600a95786 (patch)
tree9bc1649eb12d54f0cf9a6e6385772e91be6481f7 /lib/Minz/ActionController.php
parent8668ca7230e9198981e33f9882a6030c1733e7f3 (diff)
Custom logo HTML (#4369)
* Custom logo HTML Add option for custom HTML logo/title in the main Web UI view. Can potentially be different per user. #fix https://github.com/FreshRSS/FreshRSS/pull/3830/files#r850472247 * logo_html in main config With new `./data/config.custom.php` to provide custom values before install * Docker documentation * whitespace * Auto relax CSP to allow images for HTML logo * Documentation
Diffstat (limited to 'lib/Minz/ActionController.php')
-rw-r--r--lib/Minz/ActionController.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php
index 1d29d4c20..08ef2a051 100644
--- a/lib/Minz/ActionController.php
+++ b/lib/Minz/ActionController.php
@@ -8,15 +8,22 @@
* The Minz_ActionController class is a controller in the MVC paradigm
*/
class Minz_ActionController {
- protected $view;
- private $csp_policies = array(
+
+ /** @var array<string,string> */
+ private static $csp_default = [
'default-src' => "'self'",
- );
+ ];
+
+ /** @var array<string,string> */
+ private $csp_policies;
+
+ protected $view;
// Gives the possibility to override the default View type.
public static $viewType = 'Minz_View';
public function __construct () {
+ $this->csp_policies = self::$csp_default;
if (class_exists(self::$viewType)) {
$this->view = new self::$viewType();
} else {
@@ -35,6 +42,17 @@ class Minz_ActionController {
}
/**
+ * Set default CSP policies.
+ * @param array<string,string> $policies An array where keys are directives and values are sources.
+ */
+ public static function _defaultCsp($policies) {
+ if (!isset($policies['default-src'])) {
+ Minz_Log::warning('Default CSP policy is not declared', ADMIN_LOG);
+ }
+ self::$csp_default = $policies;
+ }
+
+ /**
* Set CSP policies.
*
* A default-src directive should always be given.