Skip to content

Commit

Permalink
Merge pull request #20 from alvinjohnsonso/fix-widget-selection-issue
Browse files Browse the repository at this point in the history
Fixed on how the parentDomain's protocol was being provided to the widget selection iframe. Used an API from Magento that does the checking if the request is HTTPS or not. Also, added tawk.to to style-src CSP whitelist.
  • Loading branch information
alvinjohnsonso authored Jul 13, 2021
2 parents c70b233 + 98eff52 commit 6a839d6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
8 changes: 3 additions & 5 deletions Block/Adminhtml/SelectWidgetBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ public function __construct(Template\Context $context, WidgetFactory $modelFacto

public function mainurl()
{
$httpsServer = $this->request->getServer('HTTPS');
if (isset($httpsServer) && $httpsServer != 'off') {
$protocol = "https";
} else {
$protocol = 'http';
$protocol = 'http';
if ($this->request->isSecure()) {
$protocol = 'https';
}
return $protocol . "://" . $this->request->getServer('HTTP_HOST');
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"email": "support@tawk.to",
"issues": "https://github.com/tawk/tawk-magento-2/issues"
},
"version": "1.5.1",
"version": "1.5.2",
"license": [
"OSL-3.0"
],
Expand Down
1 change: 1 addition & 0 deletions etc/csp_whitelist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<policies>
<policy id="style-src">
<values>
<value id="tawkto" type="host">*.tawk.to</value>
<value id="googleapis-font" type="host">fonts.googleapis.com</value>
<value id="jsdelivr-cdn" type="host">cdn.jsdelivr.net</value>
</values>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Tawk_Widget" setup_version="1.5.1"/>
<module name="Tawk_Widget" setup_version="1.5.2"/>
</config>

0 comments on commit 6a839d6

Please sign in to comment.