From b76c997975e80c09c270b48e4bdbac2a62ae9a66 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 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 994ec5d..2905984 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -381,10 +381,12 @@ final class BackendController extends Controller */ public function viewRegionAnalysis(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/Billing/Theme/Backend/region-analysis'); @@ -581,10 +583,12 @@ final class BackendController extends Controller */ public function viewBillAnalysis(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/Billing/Theme/Backend/bill-analysis'); @@ -607,10 +611,12 @@ final class BackendController extends Controller */ public function viewSalesRepAnalysis(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/Billing/Theme/Backend/rep-analysis');