We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
nonce
1 parent 68667fe commit a414129Copy full SHA for a414129
src/Compat/StyleWithNonce.php
@@ -2,6 +2,7 @@
2
3
namespace ipl\Web\Compat;
4
5
+use Icinga\Application\Icinga;
6
use Icinga\Application\Version;
7
use Icinga\Util\Csp;
8
use ipl\Web\Style;
@@ -15,9 +16,10 @@ class StyleWithNonce extends Style
15
16
public function getNonce(): ?string
17
{
18
if ($this->nonce === null) {
- $this->nonce = version_compare(Version::VERSION, '2.12.0', '>=')
19
- ? Csp::getStyleNonce() ?? ''
20
- : '';
+ $this->nonce = '';
+ if (version_compare(Version::VERSION, '2.12.0', '>=') && Icinga::app()->isWeb()) {
21
+ $this->nonce = Csp::getStyleNonce() ?? '';
22
+ }
23
}
24
25
return parent::getNonce();
0 commit comments