Skip to content

Commit 533e5e8

Browse files
author
Ives van Hoorne
committed
Fix origin check
1 parent 0682c04 commit 533e5e8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/app/src/sandbox/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getModulePath } from 'common/sandbox/modules';
77
import { generateFileFromSandbox } from 'common/templates/configuration/package-json';
88

99
import setupHistoryListeners from './url-listeners';
10-
import compile, { getCurrentManager } from './compile';
10+
import compile from './compile';
1111
import setupConsole from './console';
1212
import transformJSON from './console/transform-json';
1313

packages/codesandbox-api/src/dispatcher/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ function notifyFrames(message: Object) {
6868
function eventListener(e: MessageEvent) {
6969
const { data } = e;
7070

71+
const testedHost = host || 'https://codesandbox.io';
72+
const origin = testedHost.replace('https://', '').replace('http://', '');
73+
7174
if (
7275
data.codesandbox &&
73-
(e.origin.endsWith('.codesandbox.io') ||
74-
e.origin.endsWith('/codesandbox.io') ||
76+
(e.origin.endsWith(`.${origin}`) ||
77+
e.origin.endsWith(`/${origin}`) ||
7578
process.env.NODE_ENV !== 'production')
7679
) {
7780
notifyListeners(data, e.source);

0 commit comments

Comments
 (0)