From 623cc3e2911c1a96484d038cc644f2f3a4efd2fa Mon Sep 17 00:00:00 2001 From: Frederik Rommel Date: Tue, 27 Aug 2024 22:55:09 +0200 Subject: [PATCH] get rid of csp-module and implement secure-renderer --- Plugin/AddCspInlineScripts.php | 26 ------------------- composer.json | 1 - etc/frontend/di.xml | 4 --- etc/module.xml | 1 - .../layout/hyva_catalog_category_view.xml | 10 ------- .../templates/hyva/category-additions.phtml | 1 - .../templates/hyva/gallery-additions.phtml | 13 ++++++++-- 7 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 Plugin/AddCspInlineScripts.php delete mode 100644 view/frontend/layout/hyva_catalog_category_view.xml delete mode 100644 view/frontend/templates/hyva/category-additions.phtml diff --git a/Plugin/AddCspInlineScripts.php b/Plugin/AddCspInlineScripts.php deleted file mode 100644 index 4498d23..0000000 --- a/Plugin/AddCspInlineScripts.php +++ /dev/null @@ -1,26 +0,0 @@ -replaceInlineScripts = $replaceInlineScripts; - } - - public function afterToHtml(Template $block, $html): string - { - if (false === strstr((string)$block->getNameInLayout(), 'yireo_nextgenimages.')) { - return (string) $html; - } - - return $this->replaceInlineScripts->replace((string)$html); - } -} diff --git a/composer.json b/composer.json index 76b12e1..4289073 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "magento/module-store": "^100.0|^101.0", "magento/module-swatches": "^100.0", "magento/module-page-cache": "^100.0", - "yireo/magento2-csp-utilities": "^1.0", "psr/log": "^1 || ^2 || ^3", "php": ">=7.4.0", "ext-dom": "*", diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index 5cbaf31..67bfd15 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -4,10 +4,6 @@ - - - - diff --git a/etc/module.xml b/etc/module.xml index 7a806fe..aa77570 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -10,7 +10,6 @@ - diff --git a/view/frontend/layout/hyva_catalog_category_view.xml b/view/frontend/layout/hyva_catalog_category_view.xml deleted file mode 100644 index 5956d84..0000000 --- a/view/frontend/layout/hyva_catalog_category_view.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/view/frontend/templates/hyva/category-additions.phtml b/view/frontend/templates/hyva/category-additions.phtml deleted file mode 100644 index f0b453d..0000000 --- a/view/frontend/templates/hyva/category-additions.phtml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/view/frontend/templates/hyva/gallery-additions.phtml b/view/frontend/templates/hyva/gallery-additions.phtml index 4056d6c..ee4f874 100644 --- a/view/frontend/templates/hyva/gallery-additions.phtml +++ b/view/frontend/templates/hyva/gallery-additions.phtml @@ -1,8 +1,17 @@ - \ No newline at end of file + }); +JS; + +echo $secureRenderer->renderTag('script', [], $script, false);