tolta la richiesta di accettazione dei RIS, che ora vengono accettati automaticamente.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
DATABASE=test_PiuCheBuono
|
||||
DATABASE=test_FreePlanet
|
||||
UDB=paofreeplanet
|
||||
PDB=mypassword@1A
|
||||
SEND_EMAIL=0
|
||||
SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","17","18"]
|
||||
appTelegram=["1","17","18"]
|
||||
appTelegram_TEST=["1","13"]
|
||||
appTelegram=["1","13"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
|
||||
@@ -166,3 +166,5 @@ https://t.me/riso_canale/739
|
||||
|
||||
in attesa di riscontri, salutiamo! 🍚💚
|
||||
il gruppo dei facilitatori territoriali riso
|
||||
|
||||
Mer 03/07 ORE 13:13: USER [paoloar77]: ciao
|
||||
|
||||
40
logtrans.txt
40
logtrans.txt
@@ -205,3 +205,43 @@ Ven 31/05 ORE 11:59: [<b>Circuito RIS Rimini</b>]: Inviate Monete da paoloar77 a
|
||||
Saldi:
|
||||
paoloar77: -4.00 RIS]
|
||||
dsadas1: 3.00 RIS]
|
||||
Mer 03/07 ORE 12:44: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 35.00 RIS]
|
||||
SuryaArena: 1.00 RIS]
|
||||
Mer 03/07 ORE 12:53: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 34.00 RIS]
|
||||
SuryaArena: 2.00 RIS]
|
||||
Mer 03/07 ORE 12:53: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 33.00 RIS]
|
||||
SuryaArena: 3.00 RIS]
|
||||
Mer 03/07 ORE 12:59: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 30.00 RIS]
|
||||
SuryaArena: 6.00 RIS]
|
||||
Mer 03/07 ORE 13:01: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 29.00 RIS]
|
||||
SuryaArena: 7.00 RIS]
|
||||
Mer 03/07 ORE 13:09: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 28.00 RIS]
|
||||
SuryaArena: 8.00 RIS]
|
||||
Mer 03/07 ORE 13:13: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 27.00 RIS]
|
||||
SuryaArena: 9.00 RIS]
|
||||
Mer 03/07 ORE 13:14: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 5 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 22.00 RIS]
|
||||
SuryaArena: 14.00 RIS]
|
||||
Mer 03/07 ORE 13:16: [<b>Circuito RIS Bologna</b>]: Inviate Monete da pontiUmani (paoloar77) a SuryaArena 1 RIS [causale: ]
|
||||
Saldi:
|
||||
pontiUmani (paoloar77): -346.00 RIS]
|
||||
SuryaArena: 15.00 RIS]
|
||||
Mer 03/07 ORE 13:20: [<b>Circuito RIS Bologna</b>]: Inviate Monete da pontiUmani (paoloar77) a SuryaArena 3 RIS [causale: ]
|
||||
Saldi:
|
||||
pontiUmani (paoloar77): -349.00 RIS]
|
||||
SuryaArena: 18.00 RIS]
|
||||
10
pcb_agg_server.js.sh
Executable file
10
pcb_agg_server.js.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.prod.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... /var/www/$SERVERDIR_WEBSITE/"
|
||||
echo ""
|
||||
|
||||
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||
|
||||
echo "Sincronizzazione TERMINATA! - SERVER PCB!"
|
||||
@@ -85,16 +85,16 @@
|
||||
"CIRCUIT_SENDCOINSREQ_FROM_GROUP_TO_USER": "il conto %s '%s' (%s) sta inviando <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_FROM_GROUP_TO_YOU": "il conto %s '%s' (%s) ti sta inviando <strong>%s %s</strong> sul '%s'",
|
||||
"CIRCUIT_SENDCOINSREQ_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) sta inviando <strong>%s %s</strong> al conto %s '%s' sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_ME": "Stai inviando <strong>%s %s</strong> a %s sul '%s'. \nIl destinatario deve accettare la transazione.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_GROUP": "Stai inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'. \nIl destinatario deve accettare la transazione.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU": "<strong>%s %s</strong> accettati dal Conto %s '%s' sul '%s' (%s) .",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) ha accettato <strong>%s %s</strong> dal conto %s '%s' sul '%s' (%s).",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_GROUP": "il conto %s '%s' (%s) ha accettato <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_YOU": "<strong>%s %s</strong> accettati da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED": "<strong>%s %s</strong> accettati da %s sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_ME": "Stai inviando <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_GROUP": "Stai inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU": "Hai ricevuto <strong>%s %s</strong> dal Conto %s '%s' sul '%s' (%s) .",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> dal conto %s '%s' sul '%s' (%s).",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_GROUP": "il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_YOU": "Hai ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED": "<strong>%s %s</strong> ricevuti da %s sul '%s'.",
|
||||
"SALDO_UPDATE": "[Saldo <strong>%s %s</strong> sul '%s']",
|
||||
"SALDO_UPDATE_WHO": "[Saldo %s <strong>%s %s</strong> sul '%s']",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "<strong>%s %s</strong> sono stati accettati da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "Hai inviato <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED": "%s %s rifiutati da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED_TO_ME": "%s %s rifiutati da %s sul '%s'.",
|
||||
"CIRCUIT_AMOUNT_EXCEED_FIDO": "L'importo supera la quantità massima concessa per %s",
|
||||
|
||||
@@ -535,7 +535,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
|
||||
} else {
|
||||
newdescr = i18n.__('ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU', qty, symbol, strtipocontoOrig, myorig, circuitname, username_action)
|
||||
+ `\n` + i18n.__('SALDO_UPDATE', recnotif.paramsObj.extrarec.saldoDest, symbol);
|
||||
+ `\n` + i18n.__('SALDO_UPDATE', recnotif.paramsObj.extrarec.saldoDest, symbol, circuitname);
|
||||
}
|
||||
} else {
|
||||
if (groupOComdest) {
|
||||
|
||||
@@ -3222,27 +3222,28 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
await tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, false, true, username_action, extrarec);
|
||||
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REQ) {
|
||||
const onlycheck = false;
|
||||
|
||||
outres = await Circuit.sendCoins(true, idapp, usernameOrig, extrarec);
|
||||
outres = await Circuit.sendCoins(onlycheck, idapp, usernameOrig, extrarec);
|
||||
|
||||
if (outres.cansend) {
|
||||
// Invia una notifica di moneta alla persona
|
||||
const out = await tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, false, true, username_action,
|
||||
extrarec);
|
||||
if (out)
|
||||
outres.result = out.ris;
|
||||
//const out = await tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, false, true, username_action,
|
||||
// extrarec);
|
||||
//if (out)
|
||||
// outres.result = out.ris;
|
||||
} else {
|
||||
outres.cansend = false;
|
||||
}
|
||||
|
||||
ris = true;
|
||||
} else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// } else if ((cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) || (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE)) {
|
||||
// Before to accept, I see if it's already set !
|
||||
|
||||
outres = {
|
||||
/*outres = {
|
||||
cansend: false,
|
||||
errormsg: '',
|
||||
};
|
||||
}; */
|
||||
|
||||
let outcheck = outres;
|
||||
|
||||
@@ -3254,22 +3255,27 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
risStatus = i18n.__('STATUS_REFUSED');
|
||||
}
|
||||
// if (!await SendNotif.checkIfCoinsAlreadySent(extrarec.notifId)) {
|
||||
if (!await Movement.checkIfCoinsAlreadySent(extrarec.notifId)) {
|
||||
//if (!await Movement.checkIfCoinsAlreadySent(extrarec.notifId)) {
|
||||
if (true) {
|
||||
if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT) {
|
||||
outcheck = await Circuit.sendCoins(true, idapp, usernameOrig, extrarec);
|
||||
//outcheck = await Circuit.sendCoins(true, idapp, usernameOrig, extrarec);
|
||||
outcheck.cansend = true;
|
||||
outres.cansend = true;
|
||||
} else {
|
||||
outcheck.cansend = true;
|
||||
outres.cansend = true;
|
||||
}
|
||||
|
||||
if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT && outcheck.cansend) {
|
||||
cmd = shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT;
|
||||
|
||||
/*if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT && outcheck.cansend) {
|
||||
if (!await Movement.checkIfCoinsAlreadySent(extrarec.notifId)) {
|
||||
outres = await Circuit.sendCoins(false, idapp, usernameOrig, extrarec);
|
||||
|
||||
} else {
|
||||
outcheck.cansend = false; //GIA INVIATO
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
if (outcheck.cansend) {
|
||||
// Invia una notifica di moneta (accettata o rifiutata) alla persona
|
||||
|
||||
@@ -12,6 +12,8 @@ const cors = require('cors');
|
||||
// console.log(" 2) fs");
|
||||
const fs = require('fs');
|
||||
|
||||
var https = require('https');
|
||||
|
||||
const NUOVO_METODO_TEST = true;
|
||||
|
||||
const server_constants = require('./tools/server_constants');
|
||||
@@ -30,6 +32,8 @@ const path = require('path');
|
||||
const cron = require('node-cron');
|
||||
console.log('Starting mongoose...');
|
||||
|
||||
const tls = require('tls');
|
||||
|
||||
require('./db/mongoose');
|
||||
|
||||
// console.log('Starting pem...');
|
||||
@@ -250,16 +254,73 @@ myLoad().then(ris => {
|
||||
const keyStream = path.resolve(`./${process.env.PATH_CERT_KEY}`);
|
||||
const certificateStream = path.resolve(`./${process.env.PATH_SERVER_CRT}`);
|
||||
|
||||
const privateKey = fs.readFileSync(keyStream, "utf8");
|
||||
const certificate = fs.readFileSync(certificateStream, "utf8");
|
||||
let privateKey = fs.readFileSync(keyStream, "utf8");
|
||||
let certificate = fs.readFileSync(certificateStream, "utf8");
|
||||
|
||||
let credentials = null;
|
||||
|
||||
|
||||
let domain = 'piuchebuono.app';
|
||||
|
||||
const keyfile = '/etc/letsencrypt/live/' + domain + '/privkey.pem';
|
||||
const certfile = '/etc/letsencrypt/live/' + domain + '/fullchain.pem';
|
||||
|
||||
arrSecureContext = ['piuchebuono.app', 'gruppomacro.app'];
|
||||
|
||||
for (let i = 0; i < arrSecureContext.length; i++) {
|
||||
let secureContext = tls.createSecureContext({
|
||||
key: fs.readFileSync('/etc/letsencrypt/live/' + arrSecureContext[i] + '/privkey.pem'),
|
||||
cert: fs.readFileSync('/etc/letsencrypt/live/' + arrSecureContext[i] + '/fullchain.pem')
|
||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
||||
});
|
||||
credentials = {
|
||||
SNICallback: function (domain, cb) {
|
||||
if (secureContext) {
|
||||
if (cb) {
|
||||
cb(null, secureContext);
|
||||
} else {
|
||||
// compatibility for older versions of node
|
||||
return secureContext;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let secureContext = {
|
||||
'piuchebuono.app': tls.createSecureContext({
|
||||
key: fs.readFileSync('/etc/letsencrypt/live/piuchebuono.app/privkey.pem'),
|
||||
cert: fs.readFileSync('/etc/letsencrypt/live/piuchebuono.app/fullchain.pem')
|
||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
||||
}),
|
||||
'gruppomacro.app': tls.createSecureContext({
|
||||
key: fs.readFileSync('/etc/letsencrypt/live/gruppomacro.app/privkey.pem'),
|
||||
cert: fs.readFileSync('/etc/letsencrypt/live/gruppomacro.app/fullchain.pem')
|
||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
||||
}),
|
||||
}
|
||||
|
||||
if (NUOVO_METODO_TEST) {
|
||||
credentials = {
|
||||
SNICallback: function (domain, cb) {
|
||||
if (secureContext[domain]) {
|
||||
if (cb) {
|
||||
cb(null, secureContext[domain]);
|
||||
} else {
|
||||
// compatibility for older versions of node
|
||||
return secureContext[domain];
|
||||
}
|
||||
} else {
|
||||
throw new Error('No keys/certificates for domain requested');
|
||||
}
|
||||
},
|
||||
// must list a default key and cert because required by tls.createServer()
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
};
|
||||
} else {
|
||||
}
|
||||
|
||||
/*} else {
|
||||
// NON USATO !
|
||||
credentials = {
|
||||
key: privateKey,
|
||||
@@ -271,11 +332,14 @@ myLoad().then(ris => {
|
||||
};
|
||||
}
|
||||
|
||||
var https = require('https');
|
||||
} else {
|
||||
/*} else {
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.HTTPS_LOCALHOST === "true") {
|
||||
var privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
|
||||
var certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
|
||||
privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
|
||||
certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
|
||||
credentials = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
@@ -283,31 +347,18 @@ myLoad().then(ris => {
|
||||
honorCipherOrder: true,
|
||||
secureProtocol: 'TLSv1_2_method',
|
||||
};
|
||||
var https = require('https');
|
||||
|
||||
} else {
|
||||
var http = require('http');
|
||||
}
|
||||
}
|
||||
|
||||
if ((process.env.NODE_ENV === 'production') ||
|
||||
(process.env.NODE_ENV === 'test') || process.env.HTTPS_LOCALHOST === "true") {
|
||||
|
||||
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);
|
||||
const httpServer = http.createServer(app);
|
||||
@@ -316,8 +367,11 @@ myLoad().then(ris => {
|
||||
|
||||
mystart();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// app.use(throttle(1024 * 128)); // throttling bandwidth
|
||||
|
||||
// app.use((req, res, next) => {
|
||||
@@ -447,6 +501,10 @@ async function mycron_everyday() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Crea un file con all'interno il nome del dominio per ogni app:
|
||||
await tools.createFileWithDomainName();
|
||||
|
||||
} catch (e) {
|
||||
console.error('mycron_everyday: ', e);
|
||||
}
|
||||
|
||||
@@ -1125,10 +1125,10 @@ module.exports = {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT_SENT) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_ACCEPTED_SENT;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED;
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE_SENT) {
|
||||
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED_SENT;
|
||||
// } else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE) {
|
||||
// typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED;
|
||||
//} else if (cmd === shared_consts.CIRCUITCMD.SENDCOINS_REFUSE_SENT) {
|
||||
// typeid = shared_consts.TypeNotifs.ID_CIRCUIT_COINS_REFUSED_SENT;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5162,8 +5162,38 @@ module.exports = {
|
||||
console.error('Errore durante la pulizia dell\'HTML:', error);
|
||||
throw error; // Oppure, gestisci l'errore come preferisci
|
||||
}
|
||||
},
|
||||
|
||||
getHostWithNoHttporHttps(url) {
|
||||
try {
|
||||
const parsedUrl = new URL(url);
|
||||
return parsedUrl.host;
|
||||
} catch (error) {
|
||||
console.error('Errore durante la pulizia dell\'HTML:', error);
|
||||
throw error; // Oppure, gestisci l'errore come preferisci
|
||||
}
|
||||
},
|
||||
|
||||
// Crea un file con all'interno il nome del dominio per ogni app:
|
||||
createFileWithDomainName() {
|
||||
const arrapps = getApps();
|
||||
|
||||
const filename = server_constants.FILECONFIG_SERVER;
|
||||
|
||||
for (const app of arrapps) {
|
||||
fs.writeFile(filename, this.getHostWithNoHttporHttps(app.host), function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
if (app.host_test) {
|
||||
fs.writeFile(filename, this.getHostWithNoHttporHttps(app.host_test), function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Scriviere qui SOPRA le funzioni
|
||||
};
|
||||
|
||||
@@ -120,6 +120,8 @@ module.exports = Object.freeze({
|
||||
'surname',
|
||||
'news_on',
|
||||
'profile',
|
||||
]
|
||||
],
|
||||
|
||||
FILECONFIG_SERVER: 'lists_serverconfig.txt',
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user