- corretto sendemail password... l'ho cambiata. e ho messo dei controlli
This commit is contained in:
BIN
emails/.DS_Store
vendored
BIN
emails/.DS_Store
vendored
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -430,7 +430,7 @@ class GenPdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onlinePdfFromIdCatalog(options) {
|
async onlinePdfFromIdCatalog(options) {
|
||||||
const risout = await GenPdf.onlinePdf(options);
|
const risout = await this.onlinePdf(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async generatePdfFromIdCatalog(options) {
|
async generatePdfFromIdCatalog(options) {
|
||||||
|
|||||||
@@ -64,9 +64,13 @@ const GenPdf = require('../modules/GenPdf');
|
|||||||
|
|
||||||
const genPdf = new GenPdf();
|
const genPdf = new GenPdf();
|
||||||
|
|
||||||
(async () => {
|
let genPdfLaunched = false;
|
||||||
await genPdf.launch();
|
function launchGenPdfIfNeeded() {
|
||||||
})();
|
if (!genPdfLaunched) {
|
||||||
|
genPdfLaunched = true;
|
||||||
|
genPdf.launch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function updateProductInfo(recproductInfoAttuale, product, idapp, mycatstr) {
|
async function updateProductInfo(recproductInfoAttuale, product, idapp, mycatstr) {
|
||||||
if (!recproductInfoAttuale || !mycatstr) return recproductInfoAttuale;
|
if (!recproductInfoAttuale || !mycatstr) return recproductInfoAttuale;
|
||||||
@@ -618,6 +622,8 @@ router.post('/online-pdf', authenticate, async (req, res) => {
|
|||||||
console.log('/online-pdf');
|
console.log('/online-pdf');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
launchGenPdfIfNeeded(); // Ensure GenPdf is launched before proceeding
|
||||||
|
|
||||||
const risout = await GenPdf.onlinePdf(req.body);
|
const risout = await GenPdf.onlinePdf(req.body);
|
||||||
|
|
||||||
return res.status(200).send(risout);
|
return res.status(200).send(risout);
|
||||||
@@ -2641,6 +2647,7 @@ router.post('/generate-pdf', async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
launchGenPdfIfNeeded(); // Ensure GenPdf is launched before proceeding
|
||||||
const pdfPath = await genPdf.generatePdfFromUrl(url, filename);
|
const pdfPath = await genPdf.generatePdfFromUrl(url, filename);
|
||||||
res.download(pdfPath);
|
res.download(pdfPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ router.post('/track-pageview', authenticate_noerror, async (req, res) => {
|
|||||||
|
|
||||||
await pageView.save();
|
await pageView.save();
|
||||||
|
|
||||||
res.status(200).json({ message: 'Visita registrata' });
|
res.status(200).json({ message: '' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Errore nel salvataggio della visita:', error);
|
console.error('Errore nel salvataggio della visita:', error);
|
||||||
res.status(500).json({ error: 'Impossibile registrare la visita' });
|
res.status(500).json({ error: 'Impossibile registrare la visita' });
|
||||||
|
|||||||
@@ -106,6 +106,15 @@ module.exports = {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// se non è presente la password, non inviare l'email e manda messaggio di errore !
|
||||||
|
|
||||||
|
if (!paramemail.transport.options.auth.pass) {
|
||||||
|
let email = paramemail.transport.options.auth.user;
|
||||||
|
|
||||||
|
console.error('❌ Password mancante ! Impossibile inviare le email. user=', email);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// console.table(paramemail.transport);
|
// console.table(paramemail.transport);
|
||||||
|
|
||||||
// console.log('2 . paramemail.transport', paramemail.transport);
|
// console.log('2 . paramemail.transport', paramemail.transport);
|
||||||
@@ -125,9 +134,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
locals: mylocalsconf,
|
locals: mylocalsconf,
|
||||||
}).then((ris) => {
|
}).then((ris) => {
|
||||||
|
if (ris?.response && ris.response.includes('Ok')) {
|
||||||
|
console.log('✅ Email INVIATA')
|
||||||
|
}
|
||||||
// console.log('ris EMAIL', ris);
|
// console.log('ris EMAIL', ris);
|
||||||
return !!ris;
|
return !!ris;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
console.log('❌ Email NON INVIATA!');
|
||||||
console.error('sendEmail_base Error: ', err);
|
console.error('sendEmail_base Error: ', err);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@@ -754,7 +767,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getTransport: (mylocalsconf) => {
|
getTransport: (mylocalsconf) => {
|
||||||
console.log('getTransport');
|
// console.log('getTransport');
|
||||||
|
|
||||||
// Create Transport
|
// Create Transport
|
||||||
let smtpTransport = null;
|
let smtpTransport = null;
|
||||||
|
|||||||
@@ -267,13 +267,13 @@ connectToDatabase(connectionUrl, options)
|
|||||||
|
|
||||||
await tools.getApps();
|
await tools.getApps();
|
||||||
|
|
||||||
|
let miapass = '';
|
||||||
|
|
||||||
if (process.env.PROD !== 1) {
|
if (process.env.PROD !== 1) {
|
||||||
testmsgwebpush();
|
testmsgwebpush();
|
||||||
|
|
||||||
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
||||||
|
|
||||||
let miapass = '';
|
|
||||||
|
|
||||||
if (miapass !== '') {
|
if (miapass !== '') {
|
||||||
let crypt = tools.cryptdata(miapass);
|
let crypt = tools.cryptdata(miapass);
|
||||||
let decrypt = tools.decryptdata(crypt);
|
let decrypt = tools.decryptdata(crypt);
|
||||||
@@ -285,8 +285,24 @@ connectToDatabase(connectionUrl, options)
|
|||||||
mycron();
|
mycron();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
miapass = 'PROVA123@';
|
||||||
|
let crypt = tools.cryptdata(miapass);
|
||||||
|
let decrypt = tools.decryptdata(crypt);
|
||||||
|
|
||||||
telegrambot = require('./telegram/telegrambot');
|
telegrambot = require('./telegram/telegrambot');
|
||||||
|
|
||||||
|
if (decrypt === miapass) {
|
||||||
|
console.log('✅ Decrypt OK');
|
||||||
|
// OK FUNZIONA
|
||||||
|
} else {
|
||||||
|
let msgerr = '❌ ERRORE! la decrittazione non funziona! ';
|
||||||
|
console.error(msgerr);
|
||||||
|
await telegrambot.sendMsgTelegramToTheAdminAllSites(
|
||||||
|
msgerr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await inizia();
|
await inizia();
|
||||||
|
|
||||||
await resetProcessingJob();
|
await resetProcessingJob();
|
||||||
@@ -536,14 +552,14 @@ connectToDatabase(connectionUrl, options)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// console.log('checkdir', folderprof);
|
// console.log('checkdir', folderprof);
|
||||||
if (!await tools.isFileExistsAsync(folderprof)) {
|
if (!(await tools.isFileExistsAsync(folderprof))) {
|
||||||
console.log('*** Creadir', folderprof);
|
console.log('*** Creadir', folderprof);
|
||||||
await fs.mkdirSync(folderprof);
|
await fs.mkdirSync(folderprof);
|
||||||
}
|
}
|
||||||
|
|
||||||
folderprof = dir + 'profile/' + myuser.username + '/' + table;
|
folderprof = dir + 'profile/' + myuser.username + '/' + table;
|
||||||
// console.log('checkdir', folderprof);
|
// console.log('checkdir', folderprof);
|
||||||
if (!await tools.isFileExistsAsync(folderprof)) {
|
if (!(await tools.isFileExistsAsync(folderprof))) {
|
||||||
console.log('creadir', folderprof);
|
console.log('creadir', folderprof);
|
||||||
await fs.mkdirSync(folderprof);
|
await fs.mkdirSync(folderprof);
|
||||||
}
|
}
|
||||||
@@ -559,18 +575,18 @@ connectToDatabase(connectionUrl, options)
|
|||||||
// console.log('file', file);
|
// console.log('file', file);
|
||||||
// console.log('filefrom', filefrom);
|
// console.log('filefrom', filefrom);
|
||||||
|
|
||||||
if (!await tools.isFileExistsAsync(file)) {
|
if (!(await tools.isFileExistsAsync(file))) {
|
||||||
// non esiste
|
// non esiste
|
||||||
console.log('non esiste', file);
|
console.log('non esiste', file);
|
||||||
console.log(' filefrom', filefrom);
|
console.log(' filefrom', filefrom);
|
||||||
console.log(' filefrom2', filefrom2);
|
console.log(' filefrom2', filefrom2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!await tools.isFileExistsAsync(file) && await tools.isFileExistsAsync(filefrom)) {
|
if (!(await tools.isFileExistsAsync(file)) && (await tools.isFileExistsAsync(filefrom))) {
|
||||||
console.log('@@@@@@ copia file:', filefrom, 'a', file);
|
console.log('@@@@@@ copia file:', filefrom, 'a', file);
|
||||||
tools.copy(filefrom, file);
|
tools.copy(filefrom, file);
|
||||||
}
|
}
|
||||||
if (!await tools.isFileExistsAsync(file) && await tools.isFileExistsAsync(filefrom2)) {
|
if (!(await tools.isFileExistsAsync(file)) && (await tools.isFileExistsAsync(filefrom2))) {
|
||||||
console.log('@@@@@@ copia file 2:', filefrom2, 'a', file);
|
console.log('@@@@@@ copia file 2:', filefrom2, 'a', file);
|
||||||
tools.copy(filefrom2, file);
|
tools.copy(filefrom2, file);
|
||||||
}
|
}
|
||||||
@@ -693,10 +709,10 @@ connectToDatabase(connectionUrl, options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verifica esistenza file
|
// Verifica esistenza file
|
||||||
if (!await tools.isFileExistsAsync(keyPath)) {
|
if (!(await tools.isFileExistsAsync(keyPath))) {
|
||||||
throw new Error(`Chiave privata non trovata: ${keyPath}`);
|
throw new Error(`Chiave privata non trovata: ${keyPath}`);
|
||||||
}
|
}
|
||||||
if (!await tools.isFileExistsAsync(certPath)) {
|
if (!(await tools.isFileExistsAsync(certPath))) {
|
||||||
throw new Error(`Certificato non trovato: ${certPath}`);
|
throw new Error(`Certificato non trovato: ${certPath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,8 +788,13 @@ connectToDatabase(connectionUrl, options)
|
|||||||
|
|
||||||
function buildAllowedOrigins(domains, domainsAllowed, isProduction) {
|
function buildAllowedOrigins(domains, domainsAllowed, isProduction) {
|
||||||
if (!isProduction) {
|
if (!isProduction) {
|
||||||
return ['https://localhost:3000', 'https://localhost:8089', 'https://localhost:8084',
|
return [
|
||||||
'https://localhost:8088', 'https://localhost:8099'];
|
'https://localhost:3000',
|
||||||
|
'https://localhost:8089',
|
||||||
|
'https://localhost:8084',
|
||||||
|
'https://localhost:8088',
|
||||||
|
'https://localhost:8099',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseOrigins = domains.flatMap((domain) => [
|
const baseOrigins = domains.flatMap((domain) => [
|
||||||
@@ -804,7 +825,7 @@ connectToDatabase(connectionUrl, options)
|
|||||||
|
|
||||||
const originValidator = (origin, callback) => {
|
const originValidator = (origin, callback) => {
|
||||||
if (!origin) {
|
if (!origin) {
|
||||||
console.log('✅ Origin undefined or empty — allowing');
|
// console.log('✅ Origin undefined or empty — allowing');
|
||||||
return callback(null, true);
|
return callback(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,7 +968,7 @@ connectToDatabase(connectionUrl, options)
|
|||||||
if (scriptProcess) scriptProcess.kill();
|
if (scriptProcess) scriptProcess.kill();
|
||||||
|
|
||||||
const scriptPath = path.join(__dirname, '..', '..', parsed.scriptName);
|
const scriptPath = path.join(__dirname, '..', '..', parsed.scriptName);
|
||||||
if (!await tools.isFileExistsAsync(scriptPath)) {
|
if (!(await tools.isFileExistsAsync(scriptPath))) {
|
||||||
return ws.send(JSON.stringify({ type: 'error', data: 'Script non trovato o non autorizzato' }));
|
return ws.send(JSON.stringify({ type: 'error', data: 'Script non trovato o non autorizzato' }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -361,6 +361,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const user of arrusers) {
|
for (const user of arrusers) {
|
||||||
|
try {
|
||||||
const mytitle = await tools.convertSpecialTags(user, params.title);
|
const mytitle = await tools.convertSpecialTags(user, params.title);
|
||||||
const mycontent = await tools.convertSpecialTags(
|
const mycontent = await tools.convertSpecialTags(
|
||||||
user,
|
user,
|
||||||
@@ -440,6 +441,9 @@ module.exports = {
|
|||||||
console.log('Inviati ', nummsgsent, 'messaggi...');
|
console.log('Inviati ', nummsgsent, 'messaggi...');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Errore Invio Notifica a ', user.username, 'Err:', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user