Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
supun-io committed Oct 23, 2024
1 parent 8e29952 commit 45e6862
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/Embed/Iframe/PrivacyIframe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Hyvor\Unfold\Embed\Iframe;

class PrivacyIframe
{

}
2 changes: 1 addition & 1 deletion src/Unfold.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function unfold(
} else {
// both
// TODO:
throw new \Exception('Not implemented yet');
throw new \Exception('Not implemented yet'); // @codeCoverageIgnore
}
}
}
25 changes: 19 additions & 6 deletions src/UnfoldConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,24 @@ public function __construct(
public UnfoldMethod $method = UnfoldMethod::LINK,

/**
* Whether to wrap the embed HTML in an iframe with `srcdoc`
* This is useful for security and privacy reasons.
* If set to false, the embed HTML will be directly used, which would give Javascript access to
* the parent page.
* Adding embed codes directly to the page can be a privacy concern since
* it gives third-party platforms full access to the page via Javascript.
* The best solution is to wrap the embed code in an iframe.
*
* We tried using iframe `srcdoc` directly, but it resulted in many inconsistencies and issues
* with different platforms (ex: Reddit does not support about: scheme in srcdoc).
*
* So, the best solution is to use an iframe endpoint that wraps the embed code.
* This requires you to add an endpoint to your app to serve the iframe.
* Then, set that endpoint's absolute URL in this config.
* See https://unfold.hyvor.com/iframe for more details.
*
* Ex: 'https://yourapp.com/unfold-iframe'
*
* If this option is set to a string, the embed code will be wrapped in an iframe.
* It also comes with JS code to handle iframe resizing.
*/
public bool $embedWrapInIframe = true,
public ?string $embedIframeEndpoint = null,

/**
* If the $method is UnfoldMethod::EMBED or UnfoldMethod::EMBED_LINK,
Expand Down Expand Up @@ -81,7 +93,8 @@ public function __construct(
public ?string $facebookAccessToken = null,

// CACHE
) {
)
{
$this->setHttpClient($httpClient);
}

Expand Down

0 comments on commit 45e6862

Please sign in to comment.