Skip to content

Commit

Permalink
get rid of csp-module and implement secure-renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
rommelfreddy committed Aug 27, 2024
1 parent 226cc3f commit 623cc3e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 45 deletions.
26 changes: 0 additions & 26 deletions Plugin/AddCspInlineScripts.php

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
4 changes: 0 additions & 4 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
<plugin name="Yireo_NextGenImages::replaceTagsInHtml" type="Yireo\NextGenImages\Plugin\ReplaceTagsInHtml"/>
</type>

<type name="Magento\Framework\View\Element\Template">
<plugin name="Yireo_NextGenImages::addCspInlineScripts" type="Yireo\NextGenImages\Plugin\AddCspInlineScripts"/>
</type>

<type name="Magento\Swatches\Helper\Data">
<plugin name="Yireo_NextGenImages::correctImagesInAjaxResponse" type="Yireo\NextGenImages\Plugin\CorrectImagesInAjaxResponse"/>
</type>
Expand Down
1 change: 0 additions & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<module name="Magento_PageCache"/>
<module name="Magento_Store"/>
<module name="Magento_Swatches"/>
<module name="Yireo_CspUtilities"/>
</sequence>
</module>
</config>
10 changes: 0 additions & 10 deletions view/frontend/layout/hyva_catalog_category_view.xml

This file was deleted.

1 change: 0 additions & 1 deletion view/frontend/templates/hyva/category-additions.phtml

This file was deleted.

13 changes: 11 additions & 2 deletions view/frontend/templates/hyva/gallery-additions.phtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<script>
<?php
/**
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/

$script = <<<JS
'use strict'
document.addEventListener('alpine:init', () => {
Alpine.data('initGallery', () => {
const galleryInitData = initGallery();
document.dispatchEvent(new CustomEvent('gallery-init', {detail: galleryInitData}));
return galleryInitData;
});
});</script>
});
JS;

echo $secureRenderer->renderTag('script', [], $script, false);

0 comments on commit 623cc3e

Please sign in to comment.