- 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

@@ -267,13 +267,13 @@ connectToDatabase(connectionUrl, options)
await tools.getApps();
let miapass = '';
if (process.env.PROD !== 1) {
testmsgwebpush();
// tools.sendNotifToAdmin('Riparti', 'Riparti');
let miapass = '';
if (miapass !== '') {
let crypt = tools.cryptdata(miapass);
let decrypt = tools.decryptdata(crypt);
@@ -285,8 +285,24 @@ connectToDatabase(connectionUrl, options)
mycron();
}
miapass = 'PROVA123@';
let crypt = tools.cryptdata(miapass);
let decrypt = tools.decryptdata(crypt);
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 resetProcessingJob();
@@ -536,14 +552,14 @@ connectToDatabase(connectionUrl, options)
try {
// console.log('checkdir', folderprof);
if (!await tools.isFileExistsAsync(folderprof)) {
if (!(await tools.isFileExistsAsync(folderprof))) {
console.log('*** Creadir', folderprof);
await fs.mkdirSync(folderprof);
}
folderprof = dir + 'profile/' + myuser.username + '/' + table;
// console.log('checkdir', folderprof);
if (!await tools.isFileExistsAsync(folderprof)) {
if (!(await tools.isFileExistsAsync(folderprof))) {
console.log('creadir', folderprof);
await fs.mkdirSync(folderprof);
}
@@ -559,18 +575,18 @@ connectToDatabase(connectionUrl, options)
// console.log('file', file);
// console.log('filefrom', filefrom);
if (!await tools.isFileExistsAsync(file)) {
if (!(await tools.isFileExistsAsync(file))) {
// non esiste
console.log('non esiste', file);
console.log(' filefrom', filefrom);
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);
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);
tools.copy(filefrom2, file);
}
@@ -693,10 +709,10 @@ connectToDatabase(connectionUrl, options)
}
// Verifica esistenza file
if (!await tools.isFileExistsAsync(keyPath)) {
if (!(await tools.isFileExistsAsync(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}`);
}
@@ -772,8 +788,13 @@ connectToDatabase(connectionUrl, options)
function buildAllowedOrigins(domains, domainsAllowed, isProduction) {
if (!isProduction) {
return ['https://localhost:3000', 'https://localhost:8089', 'https://localhost:8084',
'https://localhost:8088', 'https://localhost:8099'];
return [
'https://localhost:3000',
'https://localhost:8089',
'https://localhost:8084',
'https://localhost:8088',
'https://localhost:8099',
];
}
const baseOrigins = domains.flatMap((domain) => [
@@ -804,7 +825,7 @@ connectToDatabase(connectionUrl, options)
const originValidator = (origin, callback) => {
if (!origin) {
console.log('✅ Origin undefined or empty — allowing');
// console.log('✅ Origin undefined or empty — allowing');
return callback(null, true);
}
@@ -947,7 +968,7 @@ connectToDatabase(connectionUrl, options)
if (scriptProcess) scriptProcess.kill();
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' }));
}