- corretto sendemail password... l'ho cambiata. e ho messo dei controlli

This commit is contained in:
Surya Paolo
2025-07-29 12:53:28 +02:00
parent f26ae170bb
commit 32210bb96a
10 changed files with 1918 additions and 1693 deletions

View File

@@ -64,9 +64,13 @@ const GenPdf = require('../modules/GenPdf');
const genPdf = new GenPdf();
(async () => {
await genPdf.launch();
})();
let genPdfLaunched = false;
function launchGenPdfIfNeeded() {
if (!genPdfLaunched) {
genPdfLaunched = true;
genPdf.launch();
}
}
async function updateProductInfo(recproductInfoAttuale, product, idapp, mycatstr) {
if (!recproductInfoAttuale || !mycatstr) return recproductInfoAttuale;
@@ -618,6 +622,8 @@ router.post('/online-pdf', authenticate, async (req, res) => {
console.log('/online-pdf');
try {
launchGenPdfIfNeeded(); // Ensure GenPdf is launched before proceeding
const risout = await GenPdf.onlinePdf(req.body);
return res.status(200).send(risout);
@@ -2641,6 +2647,7 @@ router.post('/generate-pdf', async (req, res) => {
}
try {
launchGenPdfIfNeeded(); // Ensure GenPdf is launched before proceeding
const pdfPath = await genPdf.generatePdfFromUrl(url, filename);
res.download(pdfPath);
} catch (error) {