Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/admin/liveControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ export const LIVE_CONTROLS_SCRIPT = `
if (window.__DECO_LIVE_CONTROLS__) return;
window.__DECO_LIVE_CONTROLS__ = true;

var TRUSTED_ORIGINS = ["https://deco.cx", "https://admin.deco.cx", "https://play.deco.cx"];
function isTrustedOrigin(origin) {
return TRUSTED_ORIGINS.indexOf(origin) !== -1 ||
(origin.startsWith("https://") && origin.endsWith(".deco.cx")) ||
origin === window.location.origin;
}

addEventListener("message", function(event) {
if (!isTrustedOrigin(event.origin)) return;

var data = event.data;
if (!data || typeof data !== "object") return;
switch (data.type) {
Expand Down