- piuchebuono: possiblità di modificare l'immagine dalla scheda direttamente
- migliorata di poco la grafica dell'immagine.
This commit is contained in:
@@ -230,7 +230,7 @@ module.exports.getProductByCode = function (idapp, code) {
|
||||
module.exports.replaceProductImgToImageFile = async function () {
|
||||
const ProductInfo = this;
|
||||
|
||||
let abilitaserver = false;
|
||||
let abilitaserver = true;
|
||||
|
||||
if (abilitaserver) {
|
||||
// const result = await ProductInfo.updateMany({ "img": { $exists: true } }, { $rename: { 'img': 'imagefile' } });
|
||||
@@ -240,9 +240,9 @@ module.exports.replaceProductImgToImageFile = async function () {
|
||||
|
||||
// Aggiorna ciascun documento
|
||||
for (let doc of documents) {
|
||||
if (doc.img && doc.img.startsWith('/upload/products/')) {
|
||||
if (doc.img && doc.img.startsWith('upload/products/')) {
|
||||
// Rimuovi il prefisso '/upload/products' dal campo `img`
|
||||
doc.imagefile = doc.img.replace(/^\/upload\/products\//, '');
|
||||
doc.imagefile = doc.img.replace(/^\upload\/products\//, '');
|
||||
doc.img = undefined; // Può anche rimuovere il campo img corrente se desiderato
|
||||
await doc.save(); // Salva il documento aggiornato
|
||||
}
|
||||
|
||||
@@ -1919,8 +1919,15 @@ function uploadFile(req, res, version) {
|
||||
let mydircurrent = process.cwd() + '/src/server/router/upload/' + dir;
|
||||
fromfile = mydircurrent + '/' + oldpath;
|
||||
tofile = mydir + '/' + file.originalFilename;
|
||||
|
||||
// ------------
|
||||
// ++TODO: Questo non funziona perché dovrei passargli il nomefile aggiornato a Vue.js
|
||||
// tofile = tools.cleanFileName(tofile)
|
||||
// ------------
|
||||
|
||||
let newname = tofile;
|
||||
file.path = newname;
|
||||
|
||||
console.log('fromfile', fromfile, 'tofile', tofile)
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -5646,7 +5646,7 @@ module.exports = {
|
||||
|
||||
// mystr = t('movement.from') + userfrom + ' ' + t('movement.to') + userto
|
||||
|
||||
return { userfrom: {profile: profilefrom, username: userfrom}, userto: {profile: profileto, username: userto}, tipocontofrom, tipocontoto }
|
||||
return { userfrom: { profile: profilefrom, username: userfrom }, userto: { profile: profileto, username: userto }, tipocontofrom, tipocontoto }
|
||||
},
|
||||
|
||||
ImageDownloader,
|
||||
@@ -5703,8 +5703,20 @@ module.exports = {
|
||||
},
|
||||
// **ADDFIELD_ANNUNCI
|
||||
};
|
||||
|
||||
|
||||
return annunciFields;
|
||||
},
|
||||
},
|
||||
|
||||
// Funzione per pulire il nome del file
|
||||
cleanFileName(filePath) {
|
||||
// Ottieni solo il nome del file dall'intero percorso
|
||||
// const fileName = filePath.split('/').pop();
|
||||
|
||||
// Rimuovi apostrofi e sostituisci gli spazi con underscore
|
||||
const cleanedName = fileName.replace(/'/g, '').replace(/\s+/g, '_');
|
||||
|
||||
// Restituisci il percorso chiaro; puoi decidere di mantenere il resto del percorso
|
||||
return cleanedName;
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.0
|
||||
1.1.3
|
||||
Reference in New Issue
Block a user