- Le immagini uploadate non vengono visualizzate subito... cache... aggiungere la versione dell'immagine: vers_img

- Aggiunto il Server TESTRISO e TEST_PCB.
This commit is contained in:
Surya Paolo
2024-09-17 17:38:47 +02:00
parent dcc2a0ec08
commit 9985793fcc
39 changed files with 1259 additions and 162 deletions

View File

@@ -19,7 +19,7 @@ const { spawn } = require('child_process');
const NUOVO_METODO_TEST = true;
const METODO_MULTI_CORS = false;
const METODO_MULTI_CORS = true;
const server_constants = require('./tools/server_constants');
@@ -266,11 +266,14 @@ myLoad().then(ris => {
// app.use(throttle(1024 * 128)); // throttling bandwidth
// app.use((req, res, next) => {
// res.header('Access-Control-Allow-Origin', '*')
// res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
// next()
// });
/*
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
*/
async function myLoad() {
@@ -748,10 +751,14 @@ function getCredentials(hostname) {
};*/
return {
key: fs.readFileSync(fileprivkey, "utf8"),
cert: fs.readFileSync(filecert, "utf8")
};
try {
const key = fs.readFileSync(fileprivkey, "utf8");
const cert = fs.readFileSync(filecert, "utf8");
return { key, cert };
} catch (error) {
console.error(`Errore nel caricamento delle credenziali per ${hostname}:`, error);
// Gestisci l'errore, per esempio ritorna null o lancia un'eccezione
}
} else {
const keyStream = path.resolve(`./${process.env.PATH_CERT_KEY}`);
@@ -804,7 +811,7 @@ function startServer(app, port) {
const credentials = getCredentials(domains[i].hostname);
// console.log('credentials: ', credentials);
httpsServer = https.createServer(credentials, app);
console.log('⭐️⭐️⭐️⭐️⭐️ HTTPS server: ' + domains[i].hostname + ' Port:', domains[i].port);
console.log('⭐️⭐️⭐️⭐️⭐️ HTTPS server: ' + domains[i].hostname + ' Port:', domains[i].port + (domains[i].website ? 'WebSite = ' + domains[i].website : ''));
httpsServer.listen(domains[i].port);
}
} else {