0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Fixed Explore iframe route handling hijacking routes on reload

This commit is contained in:
Aileen Nowak 2022-10-26 16:48:52 +01:00 committed by Aileen Booker
parent c7ef22d4df
commit 8d9b8cf79c
3 changed files with 5 additions and 3 deletions

View file

@ -20,7 +20,8 @@ export default class GhBillingIframe extends Component {
this.billing.getBillingIframe().src = this.billing.getIframeURL(); this.billing.getBillingIframe().src = this.billing.getIframeURL();
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event?.data) { // only process messages coming from the billing iframe
if (event?.data && this.billing.getIframeURL().includes(event?.origin)) {
if (event.data?.request === 'token') { if (event.data?.request === 'token') {
this._handleTokenRequest(); this._handleTokenRequest();
} }

View file

@ -12,7 +12,8 @@ export default class GhExploreIframe extends Component {
this.explore.getExploreIframe().src = this.explore.getIframeURL(); this.explore.getExploreIframe().src = this.explore.getIframeURL();
window.addEventListener('message', async (event) => { window.addEventListener('message', async (event) => {
if (event?.data) { // only process messages coming from the explore iframe
if (event?.data && this.explore.getIframeURL().includes(event?.origin)) {
if (event.data?.request === 'apiUrl') { if (event.data?.request === 'apiUrl') {
this._handleUrlRequest(); this._handleUrlRequest();
} }

View file

@ -67,7 +67,7 @@ export default class ExploreService extends Service {
} }
} }
return url += '/'; return url;
} }
// Sends a route update to a child route in the BMA, because we can't control // Sends a route update to a child route in the BMA, because we can't control