UI: Allow iframe context to get defined by opener (#6615)

The CSS to hide certain elements in the iframe context was introduced in #6574.

The mechanism to define the iframe context is now shifted to the opener, so that we can limit that behaviour to the mobile app.

Closes #6614.
This commit is contained in:
d11n
2025-03-03 14:27:49 +01:00
committed by GitHub
parent a7e3cbb105
commit 78f33f0ca4
2 changed files with 3 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
<script>
if (window.localStorage.getItem('btcpay-hide-sensitive-info') === 'true') { document.documentElement.setAttribute('data-hide-sensitive-info', 'true')}
if (window.location !== window.parent.location) { document.documentElement.setAttribute('data-within-iframe', 'true')}
if (window.location !== window.parent.location) { window.addEventListener('message', function(event) { try { const data = JSON.parse(event.data); if (data.context) { document.documentElement.setAttribute('data-context', data.context) } } catch {} }, false); }
</script>
@if (Theme.CustomTheme && Theme.CustomThemeCssUrl is not null)
{ // new customization uses theme file id provided by upload

View File

@@ -28,8 +28,8 @@
}
/* Iframe context */
[data-within-iframe] #StoreLink,
[data-within-iframe] .store-footer {
[data-context="btcpayapp"] #Checkout #StoreLink,
[data-context="btcpayapp"] #Checkout .store-footer {
display: none;
}