- Iscrizione Conacreis

- Ordini
- Carrello
This commit is contained in:
Paolo Arena
2021-04-30 01:31:12 +02:00
parent 0b4203067a
commit e05bbb39ee
41 changed files with 1495 additions and 337 deletions

View File

@@ -9,6 +9,9 @@ require('../config/config');
require('../models/subscribers');
const Site = require('../models/site');
const CryptoJS = require('crypto-js');
const Url = require('url-parse');
@@ -42,15 +45,20 @@ const keySize = 256;
const ivSize = 128;
const iterations = 100;
if (process.env.GCM_API_KEY !== "")
if (!!process.env.GCM_API_KEY && process.env.GCM_API_KEY !== "") {
webpush.setGCMAPIKey(process.env.GCM_API_KEY);
webpush.setVapidDetails(subject, publicVapidKey, privateVapidKey);
webpush.setVapidDetails(subject, publicVapidKey, privateVapidKey);
}
// console.log('setVapidDetails... config...');
// To Translate!
textlang = {
const textlang = {
it: {
"L'Email è già stata Verificata": "L'Email è già stata Verificata",
"Nuova Registrazione": "Nuova Registrazione",
@@ -58,6 +66,7 @@ textlang = {
"partecipanti": "partecipanti all'Evento",
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
"partecipanti a Cena Condivisa": "partecipanti a Cena Condivisa",
'TESTO_ASSISTENZA': "<strong><a href=\"%s\">👉 Per entrare nel Sito AYNI</a></strong>\n\n" +
"👉 <strong><a href=\"https://ayni.gifteconomy.app/requestresetpwd\">Hai dimenticato la password?</a></strong>\n\n" +
"👉 Entra nel Canale d'Informazione per Importanti Avvisi!\n<strong><a href=\"%s\">Canale AYNI-BIBLIO</a></strong>\n\n" +
@@ -474,6 +483,7 @@ textlang = {
module.exports = {
MYAPPS: [],
INITDB_FIRSTIME: true,
ACAPO: '\n',
@@ -637,11 +647,11 @@ module.exports = {
},
allfieldBooking: function () {
return ['idapp', 'userId', 'id_bookedevent', 'numpeople', 'numpeopleLunch', 'numpeopleDinner', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
return ['idapp', 'userId', 'id_bookedevent', 'numpeople', 'numpeopleLunch', 'numpeopleDinner', 'numpeopleDinnerShared', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
},
allfieldBookingChange: function () {
return ['numpeople', 'numpeopleLunch', 'numpeopleDinner', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
return ['numpeople', 'numpeopleLunch', 'numpeopleDinner', 'numpeopleDinnerShared', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
},
allfieldProjectWithId: function () {
@@ -844,8 +854,8 @@ module.exports = {
sendNotifToAdmin(title, msg, tag = '') {
const { User } = require('../models/user');
// console.log('nomeapp 1: ' , tools.getNomeAppByIdApp(1));
// console.log('nomeapp 2: ' , tools.getNomeAppByIdApp(2));
// console.log('nomeapp 1: ' , this.getNomeAppByIdApp(1));
// console.log('nomeapp 2: ' , this.getNomeAppByIdApp(2));
User.find({ username: 'paoloarcnm' }).then((arrusers) => {
if (arrusers !== null) {
@@ -906,7 +916,7 @@ module.exports = {
getNomeAppByIdApp: function (idapp) {
const myapp =
MYAPPS.find(item => item.idapp === idapp);
this.getApps().find(item => item.idapp === idapp);
if (myapp)
return myapp.name;
else
@@ -916,7 +926,7 @@ module.exports = {
getHostByIdApp: function (idapp) {
const myapp =
MYAPPS.find(item => item.idapp === idapp);
this.getApps().find(item => item.idapp === idapp);
if (myapp) {
let siteport = (myapp.portapp !== "0") ? (':' + myapp.portapp) : "";
@@ -926,14 +936,14 @@ module.exports = {
},
isAbilitaNave: function (idapp) {
const myapp = MYAPPS.find(item => item.idapp === idapp);
const myapp = this.getApps().find(item => item.idapp === idapp);
return myapp.abilitanave;
},
getdirByIdApp: function (idapp) {
const myapp =
MYAPPS.find(item => item.idapp === idapp);
this.getApps().find(item => item.idapp === idapp);
if (myapp) {
return myapp.dir;
} else
@@ -941,7 +951,7 @@ module.exports = {
},
getAdminEmailByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return myapp.adminemail;
else
@@ -949,7 +959,7 @@ module.exports = {
},
getreplyToEmailByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return myapp.replyTo;
else
@@ -957,7 +967,7 @@ module.exports = {
},
getpathregByIdApp: function (idapp, lang) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return 'registration' + myapp.pathreg_add + '/' + lang;
else
@@ -970,30 +980,31 @@ module.exports = {
},
getManagerEmailByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return myapp.manageremail;
return !!myapp.manageremail ? myapp.manageremail : '';
else
return '';
},
getEmailByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
return (myapp) ? myapp.email_from : ''
},
getPwdByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
return (myapp) ? this.decryptdata(myapp.email_pwd) : ''
},
getTelegramBotNameByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myapp = this.getApps().find((item) => item.idapp === idapp);
return (myapp) ? myapp.telegram_bot_name : ''
},
getTelegramKeyByIdApp: function (idapp) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
const myarr = this.getApps();
const myapp = myarr.find((item) => item.idapp === idapp);
return (myapp) ? myapp.telegram_key : ''
},
@@ -1953,6 +1964,16 @@ module.exports = {
dateToEpochStr(thedate) {
const time = new Date(thedate).getTime();
return new Date(time - (time % 86400000));
},
async loadApps() {
this.MYAPPS = await Site.findAllIdApp(0);
},
getApps() {
if (this.MYAPPS.length <= 0)
this.loadApps();
return this.MYAPPS;
}
};