mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 23:39:30 +00:00
Apparently shared albums code also uses the upload URL
Need to understand more why this is happening, but it is.
This commit is contained in:
parent
64dedb7edd
commit
1dffe49069
@ -39,20 +39,18 @@ const handleOPTIONS = (request: Request) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const isAllowedOrigin = (origin: string | null) => {
|
const isAllowedOrigin = (origin: string | null) => {
|
||||||
const desktopApp = "ente://app";
|
|
||||||
const allowedHostnames = [
|
|
||||||
"web.ente.io",
|
|
||||||
"photos.ente.io",
|
|
||||||
"photos.ente.sh",
|
|
||||||
"localhost",
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!origin) return false;
|
if (!origin) return false;
|
||||||
try {
|
try {
|
||||||
const url = new URL(origin);
|
const url = new URL(origin);
|
||||||
return origin == desktopApp || allowedHostnames.includes(url.hostname);
|
const hostname = url.hostname;
|
||||||
|
return (
|
||||||
|
origin == "ente://app" /* desktop app */ ||
|
||||||
|
hostname.endsWith("ente.io") ||
|
||||||
|
hostname.endsWith("ente.sh") ||
|
||||||
|
hostname == "localhost"
|
||||||
|
);
|
||||||
} catch {
|
} catch {
|
||||||
// origin is likely an invalid URL
|
// `origin` is likely an invalid URL.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user