server.js aktualisiert
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Artem Anufrij 2024-02-21 21:59:12 +01:00
parent c07984c506
commit cd7e2e7a0f

View File

@ -101,11 +101,11 @@ app.use(fileUpload({
})); }));
const corsOptions = { const corsOptions = {
origin: (origin, callback) => { origin: (origin, callback) => {
if (!origin || config.allowed_domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) { if (!origin || config.domain == origin.replace(/:\d*$/g, "") || config.allowed_domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) {
callback(null, true); callback(null, true);
} else { } else {
database.system.domains((domains) => { database.system.domains((domains) => {
if (config.domain == origin.replace(/:\d*$/g, "") || domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) { if (domains.indexOf(origin.replace(/:\d*$/g, "")) !== -1) {
callback(null, true); callback(null, true);
} else { } else {
callback("Origin not allowed: " + origin); callback("Origin not allowed: " + origin);