Versione 1.0.21 - RIS ITALIA
This commit is contained in:
25
.env.test.pcb
Normal file
25
.env.test.pcb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
DATABASE=FreePlanet
|
||||||
|
UDB=paofreeplanet
|
||||||
|
PDB=suerteFreePlanet@1A
|
||||||
|
SEND_EMAIL=1
|
||||||
|
PORT=3001
|
||||||
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
|
DIRECTORY_SERVER=freeplanet_serverside
|
||||||
|
SERVERDIR_WEBSITE=test.freeplanet_server
|
||||||
|
PORT_APP1="0"
|
||||||
|
DOMAIN=mongodb://localhost:27018/
|
||||||
|
SIGNCODE=abc123
|
||||||
|
DEBUG=0
|
||||||
|
LOCALE=0
|
||||||
|
DELAY_SENDEMAIL=1000
|
||||||
|
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
||||||
|
PUBLIC_VAPI_KEY="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
|
||||||
|
PRIVATE_VAPI_KEY="LVpFDJuKscdHuQr5pe20dFuYuWX1-ZRb6x72PP-Pp4I"
|
||||||
|
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||||
|
PATH_CERT_KEY=key.pem
|
||||||
|
PATH_SERVER_CRT=cert.pem
|
||||||
|
PATH_SSL_ROOT_PEM=root.pem
|
||||||
|
PATH_SSL_CHAIN_PEM=chain.pem
|
||||||
|
PROD=0
|
||||||
|
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||||
|
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||||
20
deploynode_on_pcb.sh
Executable file
20
deploynode_on_pcb.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.test.pcb
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso PCB ... /var/www/$SERVERDIR_WEBSITE/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
rsync -avz -e 'ssh -p 8822' css pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' docs pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' emails pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' images pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' plugins pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' sass pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||||
|
rsync -avz -e 'ssh -p 8822' .env.production pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/.env.production
|
||||||
|
rsync -avz -e 'ssh -p 8822' .env.test.pcb pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/.env.test
|
||||||
|
rsync -avz -e 'ssh -p 8822' .env.test.pcb pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/.env.test.pcb
|
||||||
|
rsync -avz -e 'ssh -p 8822' package.json pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/package.json
|
||||||
|
|
||||||
|
echo "Sincronizzazione TERMINATA! - SERVER PCB!"
|
||||||
@@ -25,3 +25,5 @@ Mar 03/10 ORE 22:49: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
|||||||
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
|
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
|
||||||
Sab 04/11 ORE 15:17: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
Sab 04/11 ORE 15:17: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
||||||
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
|
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
|
||||||
|
Sab 02/12 ORE 14:15: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
|
||||||
|
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"test-watch": "nodemon --exec 'npm test'"
|
"test-watch": "nodemon --exec 'npm test'"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.19.0"
|
"node": "^18.17.0"
|
||||||
},
|
},
|
||||||
"author": "Paolo Arena",
|
"author": "Paolo Arena",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -1161,7 +1161,7 @@ CircuitSchema.statics.SetDefMinMaxCollettivi = async function (idapp, valmin, va
|
|||||||
|
|
||||||
CircuitSchema.statics.setFido = async function (idapp, username, circuitName, groupname) {
|
CircuitSchema.statics.setFido = async function (idapp, username, circuitName, groupname) {
|
||||||
|
|
||||||
mycircuit = await Circuit.findOne({ idapp, name: circuitName });
|
mycircuit = await Circuit.findOne({ idapp, name: circuitName }).lean();
|
||||||
if (mycircuit) {
|
if (mycircuit) {
|
||||||
const circuitId = mycircuit._id;
|
const circuitId = mycircuit._id;
|
||||||
let account = null;
|
let account = null;
|
||||||
@@ -1178,7 +1178,7 @@ CircuitSchema.statics.setFido = async function (idapp, username, circuitName, gr
|
|||||||
const accountsuser = await Account.getUserAccounts(idapp, username);
|
const accountsuser = await Account.getUserAccounts(idapp, username);
|
||||||
if (accountsuser) {
|
if (accountsuser) {
|
||||||
// Se lo trovo della mia provincia, prendo quello
|
// Se lo trovo della mia provincia, prendo quello
|
||||||
account = accountsuser.find((account) => account.circuit.strProv === myuser.profile.resid_province && account.circuit.card === myuser.profile.resid_card)
|
account = accountsuser.find((account) => account.circuit.strProv === myuser.profile.resid_province && ((account.circuit.card === myuser.profile.resid_card) || !myuser.profile.resid_card))
|
||||||
if (!account && accountsuser.length > 0) {
|
if (!account && accountsuser.length > 0) {
|
||||||
// Se non lo trovo, prendo il primo in cui sono entrato !
|
// Se non lo trovo, prendo il primo in cui sono entrato !
|
||||||
account = accountsuser[0];
|
account = accountsuser[0];
|
||||||
|
|||||||
@@ -4696,7 +4696,7 @@ UserSchema.statics.calcnumRegUntilDay = async function (idapp) {
|
|||||||
UserSchema.statics.calcRegDaily = async function (idapp) {
|
UserSchema.statics.calcRegDaily = async function (idapp) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
return await User.aggregate(User.getUsersRegDaily(idapp, 90)).then(ris => {
|
return await User.aggregate(User.getUsersRegDaily(idapp, 120)).then(ris => {
|
||||||
// console.table(ris);
|
// console.table(ris);
|
||||||
return ris;
|
return ris;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ router.post('/', async (req, res) => {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (utentenonancoraVerificato) {
|
if (utentenonancoraVerificato) {
|
||||||
if (id_aportador) {
|
if (id_aportador) {
|
||||||
// Se mi sono registrato ma l'invitante non mi abilita, allora il posso registrarmi nuovamente, con lo stesso username e password,
|
// Se mi sono registrato ma l'invitante non mi abilita, allora il posso registrarmi nuovamente, con lo stesso username e password,
|
||||||
@@ -1405,6 +1406,9 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
|
|||||||
} else if (mydata.dbop === 'updateSaldoAndTransato_AllAccounts') {
|
} else if (mydata.dbop === 'updateSaldoAndTransato_AllAccounts') {
|
||||||
|
|
||||||
await Account.updateSaldoAndTransato_AllAccounts(idapp);
|
await Account.updateSaldoAndTransato_AllAccounts(idapp);
|
||||||
|
} else if (mydata.dbop === 'GenerateVapiKey') {
|
||||||
|
|
||||||
|
await tools.generateVapiKey();
|
||||||
|
|
||||||
/*} else if (mydata.dbop === 'visuNave') {
|
/*} else if (mydata.dbop === 'visuNave') {
|
||||||
mystr = await Nave.getNavePos(idapp, parseInt(mydata.riga), parseInt(mydata.col));
|
mystr = await Nave.getNavePos(idapp, parseInt(mydata.riga), parseInt(mydata.col));
|
||||||
@@ -1634,5 +1638,4 @@ router.post('/mgt', authenticate, async (req, res) => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
|
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
|
||||||
|
|
||||||
|
try {
|
||||||
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||||
|
|
||||||
// ++ estrai l'html da mettere sulla email:
|
// ++ estrai l'html da mettere sulla email:
|
||||||
@@ -203,10 +204,15 @@ module.exports = {
|
|||||||
tools.sendNotifToAdmin(mylocalsconf.idapp, true, '++Reg [' + numutenti + '] ' + nometot + aportador);
|
tools.sendNotifToAdmin(mylocalsconf.idapp, true, '++Reg [' + numutenti + '] ' + nometot + aportador);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err sendEmail_Registration', e);
|
||||||
|
}
|
||||||
|
|
||||||
// if (tools.isManagAndAdminDifferent(idapp)) {
|
// if (tools.isManagAndAdminDifferent(idapp)) {
|
||||||
// this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
// this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
sendEmail_IscrizioneConacreis: async function (lang, emailto, iscritto, idapp) {
|
sendEmail_IscrizioneConacreis: async function (lang, emailto, iscritto, idapp) {
|
||||||
|
|
||||||
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ myLoad().then(ris => {
|
|||||||
cert: certificate,
|
cert: certificate,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
// NON USATO !
|
||||||
credentials = {
|
credentials = {
|
||||||
key: privateKey,
|
key: privateKey,
|
||||||
cert: certificate,
|
cert: certificate,
|
||||||
@@ -656,7 +657,6 @@ async function faitest() {
|
|||||||
idapp: '1',
|
idapp: '1',
|
||||||
username: 'paoloar77',
|
username: 'paoloar77',
|
||||||
});
|
});
|
||||||
|
|
||||||
const langdest = 'it';
|
const langdest = 'it';
|
||||||
|
|
||||||
telegrambot.askConfirmationUser(myuser.idapp, shared_consts.CallFunz.REGISTRATION, myuser);
|
telegrambot.askConfirmationUser(myuser.idapp, shared_consts.CallFunz.REGISTRATION, myuser);
|
||||||
|
|||||||
@@ -842,14 +842,19 @@ const MyTelegramBot = {
|
|||||||
const langdest = myuser.lang;
|
const langdest = myuser.lang;
|
||||||
const telegid = myuser.profile.teleg_id;
|
const telegid = myuser.profile.teleg_id;
|
||||||
|
|
||||||
|
if (!userDest) {
|
||||||
|
userDest = myuser.username;
|
||||||
|
}
|
||||||
let userrecDest = await User.getUserShortDataByUsername(idapp, userDest);
|
let userrecDest = await User.getUserShortDataByUsername(idapp, userDest);
|
||||||
let userId = userrecDest._id;
|
let userId = userrecDest._id;
|
||||||
let title = this.getNomeAppByIdApp(idapp);
|
let title = tools.getNomeAppByIdApp(idapp);
|
||||||
let keyb = null;
|
let keyb = null;
|
||||||
|
let openUrl = '';
|
||||||
let domanda = '';
|
let domanda = '';
|
||||||
|
let msg_notifpush = '';
|
||||||
let send_notif = false;
|
let send_notif = false;
|
||||||
let actions = [];
|
let actions = [];
|
||||||
|
let tag = '';
|
||||||
|
|
||||||
const struserinfomsg = tools.getUserInfoMsg(idapp, myuser);
|
const struserinfomsg = tools.getUserInfoMsg(idapp, myuser);
|
||||||
|
|
||||||
@@ -880,6 +885,7 @@ const MyTelegramBot = {
|
|||||||
await setVerifiedReg(myuser.idapp, myuser.lang, myuser.username, userDest);
|
await setVerifiedReg(myuser.idapp, myuser.lang, myuser.username, userDest);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
msg_notifpush = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM', myuser.username);
|
||||||
domanda = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM', myuser.username) + '<br>' + struserinfomsg;
|
domanda = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM', myuser.username) + '<br>' + struserinfomsg;
|
||||||
|
|
||||||
keyb = cl.getInlineKeyboard(myuser.lang, [
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
||||||
@@ -897,6 +903,7 @@ const MyTelegramBot = {
|
|||||||
|
|
||||||
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_GRUPPO) {
|
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_GRUPPO) {
|
||||||
|
|
||||||
|
msg_notifpush = printf(getstr(langdest, 'MSG_ACCEPT_NEWENTRY_INGROUP'), name);
|
||||||
domanda = printf(getstr(langdest, 'MSG_ACCEPT_NEWENTRY_INGROUP'), name) + '<br>' + struserinfomsg;
|
domanda = printf(getstr(langdest, 'MSG_ACCEPT_NEWENTRY_INGROUP'), name) + '<br>' + struserinfomsg;
|
||||||
|
|
||||||
keyb = cl.getInlineKeyboard(myuser.lang, [
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
||||||
@@ -912,6 +919,7 @@ const MyTelegramBot = {
|
|||||||
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_FIDO) {
|
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_FIDO) {
|
||||||
|
|
||||||
if (groupname) {
|
if (groupname) {
|
||||||
|
msg_notifpush = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP', locale: langdest }, groupname);
|
||||||
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP', locale: langdest }, groupname) + '<br>' + struserinfomsg;
|
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP', locale: langdest }, groupname) + '<br>' + struserinfomsg;
|
||||||
|
|
||||||
keyb = cl.getInlineKeyboard(myuser.lang, [
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
||||||
@@ -929,9 +937,10 @@ const MyTelegramBot = {
|
|||||||
send_notif = true;
|
send_notif = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
msg_notifpush = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, myuser.username, name);
|
||||||
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, myuser.username, name) + '<br>' + struserinfomsg;
|
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, myuser.username, name) + '<br>' + struserinfomsg;
|
||||||
|
|
||||||
const keyb = cl.getInlineKeyboard(myuser.lang, [
|
keyb = cl.getInlineKeyboard(myuser.lang, [
|
||||||
{
|
{
|
||||||
text: '✅ Abilita fido a ' + myuser.username,
|
text: '✅ Abilita fido a ' + myuser.username,
|
||||||
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
|
||||||
@@ -947,17 +956,18 @@ const MyTelegramBot = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send_notif) {
|
|
||||||
// SEND PUSH NOTIFICATION
|
|
||||||
await this.sendNotificationToUser(userId, title, descr, openUrl, '', tag, actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invia Msg
|
// Invia Msg
|
||||||
if (domanda) {
|
if (domanda) {
|
||||||
const teleg_id = await User.TelegIdByUsername(idapp, userDest);
|
const teleg_id = await User.TelegIdByUsername(idapp, userDest);
|
||||||
await this.local_sendMsgTelegramByIdTelegram(idapp, teleg_id, domanda, undefined, undefined, true, keyb);
|
await this.local_sendMsgTelegramByIdTelegram(idapp, teleg_id, domanda, undefined, undefined, true, keyb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (send_notif && msg_notifpush) {
|
||||||
|
// SEND PUSH NOTIFICATION
|
||||||
|
await tools.sendNotificationToUser(userId, title, msg_notifpush, openUrl, '', tag, actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error askConfirmationUser', e);
|
console.error('Error askConfirmationUser', e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4304,5 +4304,20 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
generateVapiKey() {
|
||||||
|
const webpush = require('web-push');
|
||||||
|
|
||||||
|
const vapidKeys = webpush.generateVAPIDKeys();
|
||||||
|
|
||||||
|
const msg1 = 'VAPID Public Key:' + vapidKeys.publicKey;
|
||||||
|
const msg2 = 'VAPID Private Key:' + vapidKeys.privateKey;
|
||||||
|
|
||||||
|
|
||||||
|
console.log(msg1);
|
||||||
|
console.log(msg2);
|
||||||
|
return { msg: msg1 + ' ' + msg2 };
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user