Skip to content

Commit

Permalink
feat: allow post message for all sites, add a source tag in message
Browse files Browse the repository at this point in the history
- this is so our app make sure we are processing the right message
  • Loading branch information
Elabar committed Jan 9, 2025
1 parent 86655df commit 5cfc978
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions packages/meteor-wallet-app/src/lib/meteor-wallet-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,7 @@ const postMessage = function (data: string) {
if (window !== window.top) {
// in an iframe
if (window.top.location) {
const parentUrl =
window.location !== window.parent.location
? document.referrer
: document.location.href;

const enablePostMessage = window.localStorage.getItem(
"__meteor_app_enable_post_message"
);

if (parentUrl === "https://xxx.com" || enablePostMessage) {
return window.top.postMessage(data, "*");
}
return window.top.postMessage(data, "*");
}
}
}
Expand All @@ -76,6 +65,7 @@ const tryPostOrFail = <R extends Result>(
JSON.stringify({
...action,
nonce,
source: "meteor-wallet-app-selector",
})
);

Expand Down

0 comments on commit 5cfc978

Please sign in to comment.