- piuchebuono: possiblità di modificare l'immagine dalla scheda direttamente

- migliorata di poco la grafica dell'immagine.
This commit is contained in:
Surya Paolo
2024-10-03 03:55:05 +02:00
parent f9e0175f9b
commit d438867e3a
7 changed files with 85 additions and 15 deletions

View File

@@ -169,6 +169,12 @@ myLoad().then(ris => {
},
});
// Serve il tuo service worker da una certa directory
/*app.get('/service-worker.js', (req, res) => {
res.set('Cache-Control', 'no-cache'); // Aggiunge l'intestazione
// res.sendFile(path.join(__dirname, 'service-worker.js')); // Modifica il percorso secondo la tua struttura
});*/
app.use(cors({
exposedHeaders: ['x-auth', 'x-refrtok'],
}));
@@ -806,6 +812,54 @@ function startServer(app, port) {
console.log('isProduction', isProduction);
/*
const CORS_ENABLE_FOR_ALL_SITES = true;
let corsOptions = {};
if (CORS_ENABLE_FOR_ALL_SITES) {
corsOptions = {
exposedHeaders: ['x-auth', 'x-refrtok'], // Intestazioni da esporre al client
};
} else {
let myhosts = [];
for (let i = 0; i < domains.length; i++) {
myhosts.push('https://' + domains[i].hostname);
myhosts.push('https://' + 'api.' + domains[i].hostname);
myhosts.push('https://' + 'test.' + domains[i].hostname);
myhosts.push('https://' + 'testapi.' + domains[i].hostname);
}
console.log('myhosts', myhosts);
console.log('CORS');
corsOptions = {
origin: (origin, callback) => {
if (myhosts.indexOf(origin) !== -1 || !origin) {
callback(null, true);
} else {
callback(new Error('Not allowed by CORS'));
}
},
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'x-auth', 'x-refrtok'], // Intestazioni consentite
exposedHeaders: ['x-auth', 'x-refrtok'], // Intestazioni da esporre al client
credentials: true, // Consenti l'invio di cookie
preflightContinue: false,
optionsSuccessStatus: 204,
};
app.use(cors(corsOptions));
}*/
if (isProduction) {
for (let i = 0; i < domains.length; i++) {
const credentials = getCredentials(domains[i].hostname);