From 0fcbb320de21fe68ca9df3c030a020db8e40d87e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 26 Sep 2023 20:49:43 +0000 Subject: [PATCH] lighthouse improvements --- Controller/BackendController.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 2e440a7..b0fe0a5 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -202,11 +202,13 @@ final class BackendController extends Controller */ public function viewClientManagementClientProfile(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { - $head = $response->data['Content']->head; + $head = $response->data['Content']->head; + $nonce = $this->app->appSettings->getOption('script-nonce'); + $head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css'); - $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js'); - $head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js'); - $head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']); + $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']); $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/ClientManagement/Theme/Backend/client-profile'); @@ -318,10 +320,12 @@ final class BackendController extends Controller */ public function viewClientAnalysis(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { - $head = $response->data['Content']->head; + $head = $response->data['Content']->head; + $nonce = $this->app->appSettings->getOption('script-nonce'); + $head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css'); - $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js'); - $head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']); + $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']); $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/ClientManagement/Theme/Backend/client-analysis');