Skip to content

Commit

Permalink
CoverPage: Don't use StyleWithNonce for cli interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Feb 12, 2024
1 parent c4c8ace commit 76f98be
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions library/Reporting/Web/Widget/CoverPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Icinga\Module\Reporting\Web\Widget;

use Icinga\Application\Icinga;
use Icinga\Module\Reporting\Common\Macros;
use ipl\Html\BaseHtmlElement;
use ipl\Html\Html;
use ipl\Web\Compat\StyleWithNonce;
use ipl\Web\Style;

class CoverPage extends BaseHtmlElement
{
Expand Down Expand Up @@ -139,7 +141,13 @@ public function setTitle($title)
protected function assemble()
{
if ($this->hasBackgroundImage()) {
$coverPageBackground = (new StyleWithNonce())
if (Icinga::app()->isWeb()) {
$coverPageBackground = new StyleWithNonce();
} else {
$coverPageBackground = new Style();
}

$coverPageBackground
->setModule('reporting')
->addFor($this, [
'background-image' => sprintf("url('%s')", Template::getDataUrl($this->getBackgroundImage()))
Expand All @@ -150,7 +158,13 @@ protected function assemble()

$content = Html::tag('div', ['class' => 'cover-page-content']);
if ($this->hasColor()) {
$coverPageLogo = (new StyleWithNonce())
if (Icinga::app()->isWeb()) {
$coverPageLogo = new StyleWithNonce();
} else {
$coverPageLogo = new Style();
}

$coverPageLogo
->setModule('reporting')
->addFor($content, ['color' => $this->getColor()]);

Expand Down

0 comments on commit 76f98be

Please sign in to comment.