Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use StyleWithNonce element #203

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions library/Reporting/Web/Widget/CoverPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace Icinga\Module\Reporting\Web\Widget;

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

class CoverPage extends BaseHtmlElement
{
Expand Down Expand Up @@ -140,9 +139,8 @@ public function setTitle($title)
protected function assemble()
{
if ($this->hasBackgroundImage()) {
$coverPageBackground = (new Style())
$coverPageBackground = (new StyleWithNonce())
->setModule('reporting')
->setNonce(Csp::getStyleNonce())
->addFor($this, [
'background-image' => sprintf("url('%s')", Template::getDataUrl($this->getBackgroundImage()))
]);
Expand All @@ -152,9 +150,8 @@ protected function assemble()

$content = Html::tag('div', ['class' => 'cover-page-content']);
if ($this->hasColor()) {
$coverPageLogo = (new Style())
$coverPageLogo = (new StyleWithNonce())
->setModule('reporting')
->setNonce(Csp::getStyleNonce())
->addFor($content, ['color' => $this->getColor()]);

$content->addHtml($coverPageLogo);
Expand Down