mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-18 05:14:34 -04:00
tec: Allow to change CSP header from controllers
For an extension, I needed to call a script from an external domain. Unfortunately, the CSP headers didn't allow this domain and I had to patch manually the FreshRSS FrontController for my extension. It's obviously not a long-term solution since it has nothing to do in the core of FRSS, and I don't want to apply this patch manually at each update. With this patch, I allow changing the CSP header from inside the controller actions. It allows extensions to modify headers. It's also an opportunity to remove a bit of code from the FrontController. I wasn't happy with the previous implementation anyhow. Reference: https://github.com/flusio/xExtension-Flus/commit/ed12d56#diff-ff12e33ed31b23bda327499fa6e84eccR143
This commit is contained in:
@@ -15,6 +15,11 @@ class FreshRSS_stats_Controller extends Minz_ActionController {
|
||||
Minz_Error::error(403);
|
||||
}
|
||||
|
||||
$this->_csp([
|
||||
'default-src' => "'self'",
|
||||
'style-src' => "'self' 'unsafe-inline'",
|
||||
]);
|
||||
|
||||
Minz_View::prependTitle(_t('admin.stats.title') . ' · ');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user