Unsubscribe

This commit is contained in:
Surya Paolo
2023-02-15 21:40:19 +01:00
parent 81d7d32b85
commit a81300e13d
9 changed files with 11777 additions and 95 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"search.useIgnoreFiles": false
}

16
deploynodejs_on_risosrv_test.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
source ./.env.test.risosrv
echo "Sincronizzazione in corso..."
rsync -avz -e 'ssh -p 5522' css root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' docs root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' emails root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' images root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' plugins root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' sass root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' src root@risosrv:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 5522' .env.test.risosrv root@risosrv:/var/www/$SERVERDIR_WEBSITE/.env.test
rsync -avz -e 'ssh -p 5522' package.json root@risosrv:/var/www/$SERVERDIR_WEBSITE/package.json
echo "Sincronizzazione TERMINATA! - SERVER TEST!"

View File

@@ -9,6 +9,7 @@
"watch": "gulp watch",
"test": "export NODE_ENV=development || SET NODE_ENV=development && mocha src/server/**/*.test.js",
"start:prod": "NODE_ENV=production node src/server/server.js",
"starttest": "NODE_ENV=test node src/server/server.js",
"test-watch": "nodemon --exec 'npm test'"
},
"engines": {
@@ -47,6 +48,7 @@
"node-telegram-bot-api": "^0.59.0",
"nodemailer": "^6.7.8",
"npm-check-updates": "^16.1.0",
"pem": "^1.14.6",
"preview-email": "^3.0.7",
"pug": "^3.0.2",
"rate-limiter-flexible": "^2.3.9",

View File

@@ -8,7 +8,7 @@
}
],
"settings": {
"search.useIgnoreFiles": true,
"search.useParentIgnoreFiles": true
"search.useIgnoreFiles": false,
"search.useParentIgnoreFiles": false
}
}

View File

@@ -159,14 +159,6 @@ module.exports = {
transport_preview.sendMail(mailOptions).then(console.log).catch(console.error);
}
},
// getHostByIdApp: function (idapp) {
// if (idapp === 1) {
// let siteport = (process.env.PORT_APP1 !== "0") ? (':' + process.env.PORT_APP1) : "";
// return process.env.URLBASE_APP1 + siteport;
// } else {
// return ""
// }
// },
getlinkReg: function(idapp, idreg) {
const strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `/?idapp=${idapp}&idlink=${idreg}`;

View File

@@ -23,9 +23,14 @@ const bodyParser = require('body-parser');
const path = require('path');
const cron = require('node-cron');
console.log('Starting mongoose...');
require('./db/mongoose');
// console.log('Starting pem...');
// const pem = require('pem')
const { Settings } = require('./models/settings');
// test
@@ -37,9 +42,14 @@ const i18n = require('i18n');
if ((process.env.NODE_ENV === 'production') ||
(process.env.NODE_ENV === 'test')) {
if (false) {
} else {
var privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
var certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
var credentials = {
/*var credentials = {
key: privateKey,
cert: certificate,
ca: [
@@ -47,6 +57,12 @@ if ((process.env.NODE_ENV === 'production') ||
fs.readFileSync(process.env.PATH_SSL_CHAIN_PEM, 'utf8'),
],
};
*/
var credentials = {
key: privateKey,
cert: certificate,
};
}
var https = require('https');
} else {
if (process.env.HTTPS_LOCALHOST === "true") {
@@ -170,6 +186,9 @@ myLoad().then(ris => {
// app.use(express.cookieParser());
app.use(i18n.init);
console.log('Use Routes \...');
// Use Routes
app.use('/', index_router);
app.use('/subscribe', subscribe_router);
@@ -242,12 +261,24 @@ myLoad().then(ris => {
if ((process.env.NODE_ENV === 'production') ||
(process.env.NODE_ENV === 'test') || process.env.HTTPS_LOCALHOST === "true") {
var httpsServer = https.createServer(credentials, app);
if (false) {
/*pem.createCertificate({ days: 1, selfSigned: true }, (err, keys) => {
if (err) {
throw err
}
const httpsServer = https.createServer({ key: keys.clientKey, cert: keys.certificate }, (req, res) => {
res.end('o hai!')
}).listen(port)
}) */
} else {
const httpsServer = https.createServer(credentials, app);
console.log('httpsServer: port ', port);
httpsServer.listen(port);
}
} else {
console.log('httpServer: port ', port);
var httpServer = http.createServer(app);
const httpServer = http.createServer(app);
httpServer.listen(port);
}

View File

@@ -2,11 +2,11 @@ const tools = require('../tools/general');
const appTelegram = [tools.FREEPLANET, tools.RISO];
const appTelegram_TEST = [tools.FREEPLANET, tools.ARCADEI, tools.RISO];
const appTelegram_TEST = [tools.FREEPLANET, tools.RISO];
const appTelegram_DEVELOP = [tools.RISO];
const appTelegramFinti = ['2', tools.CNM, tools.ARCADEI];
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET, tools.FREEPLANET];
const appTelegramDest = [tools.FREEPLANET, tools.FREEPLANET];
const printf = require('util').format;

9
test.http Normal file
View File

@@ -0,0 +1,9 @@
### Init:
get http://localhost:3000/
### Create a new
get https://splendidus.it:3000/
### Create a new
get https://mail.freeplanet.app:3000/

11629
yarn.lock Normal file

File diff suppressed because it is too large Load Diff