diff --git a/galaxy.js b/galaxy.js index 71ae7a7..1d7932d 100644 --- a/galaxy.js +++ b/galaxy.js @@ -124,8 +124,9 @@ export function initGalaxy({ onLoggedInChanged }) { return new Promise((accept, reject) => { - acceptedOrigins = acceptedOrigins ?? ["https://galaxy.click/"]; - if (acceptedOrigins.includes(document.referrer)) { + acceptedOrigins = acceptedOrigins.map(url => + url.replace(/\/?$/, '/')) ?? ["https://galaxy.click/"]; + if (acceptedOrigins.includes(document.referrer.replace(/\/?$/, '/'))) { // Callbacks to resolve promises /** @type function(SaveListResponse["list"]):void */ let saveListAccept, @@ -180,7 +181,7 @@ export function initGalaxy({ }; window.addEventListener("message", e => { - if (e.origin === galaxy.origin) { + if (e.origin.replace(/\/?$/, '/') === galaxy.origin.replace(/\/?$/, '/')) { console.log("Received message from Galaxy", e.data); /** @type GalaxyResponse */ const data = e.data;