Make trailing slashes consistent

This commit is contained in:
thepaperpilot 2024-02-18 16:35:41 +00:00
parent 886c3bbb3a
commit dae532627c

View file

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