From 0ce46aab1e87e09f9f60ced4607eaf4d57e810e4 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Fri, 4 Sep 2020 00:06:49 +0200 Subject: [PATCH] Payeer e AdvCash --- .env.old | 0 docs/query_mongodb.js | 0 documentation/passi.txt | 6 +- emails/admin/registration/esEs/html.pug | 0 emails/admin/registration/esEs/subject.pug | 0 emails/registration/it/textold.pug | 0 src/server/locales/enUs.json | 0 src/server/locales/fr.json | 0 src/server/locales/pt.json | 0 src/server/locales/si.json | 0 src/server/models/flotta.js | 8 + src/server/models/listaingresso.js | 1 + src/server/models/nave.js | 4 + src/server/models/navepersistente.js | 8 + src/server/models/user.js | 233 ++++++++++++++++++++- src/server/router/api/actions.js | 6 +- src/server/router/index_router.js | 104 +++------ src/server/router/site_router.js | 2 +- src/server/router/users_router.js | 15 +- src/server/telegram/telegrambot.js | 112 ++++++++-- src/server/tools/general.js | 34 ++- src/server/tools/shared_nodejs.js | 3 + 22 files changed, 425 insertions(+), 111 deletions(-) mode change 100644 => 100755 .env.old mode change 100644 => 100755 docs/query_mongodb.js mode change 100644 => 100755 documentation/passi.txt mode change 100644 => 100755 emails/admin/registration/esEs/html.pug mode change 100644 => 100755 emails/admin/registration/esEs/subject.pug mode change 100644 => 100755 emails/registration/it/textold.pug mode change 100644 => 100755 src/server/locales/enUs.json mode change 100644 => 100755 src/server/locales/fr.json mode change 100644 => 100755 src/server/locales/pt.json mode change 100644 => 100755 src/server/locales/si.json diff --git a/.env.old b/.env.old old mode 100644 new mode 100755 diff --git a/docs/query_mongodb.js b/docs/query_mongodb.js old mode 100644 new mode 100755 diff --git a/documentation/passi.txt b/documentation/passi.txt old mode 100644 new mode 100755 index 429b72a..366976e --- a/documentation/passi.txt +++ b/documentation/passi.txt @@ -7,6 +7,8 @@ // ++Todo: PRIORITA' ALTA: +- Togliere gli imbarchi: far pagare subito la persona. + - Errore durante la sostituzione... - far pagare direttamente al Sognatore. @@ -23,9 +25,9 @@ QUINDI QUALCUNO HA PRESO IL SUO POSTO. - - 7.64 : NATALINA NON HA LA RITESSITURA !! +- 7.64 : NATALINA NON HA LA RITESSITURA !! - - Controllare che ci sono registrazioni doppie !! (stesso username e stessa email!) +- Controllare che ci sono registrazioni doppie !! (stesso username e stessa email!) - SubAccount: filtro. diff --git a/emails/admin/registration/esEs/html.pug b/emails/admin/registration/esEs/html.pug old mode 100644 new mode 100755 diff --git a/emails/admin/registration/esEs/subject.pug b/emails/admin/registration/esEs/subject.pug old mode 100644 new mode 100755 diff --git a/emails/registration/it/textold.pug b/emails/registration/it/textold.pug old mode 100644 new mode 100755 diff --git a/src/server/locales/enUs.json b/src/server/locales/enUs.json old mode 100644 new mode 100755 diff --git a/src/server/locales/fr.json b/src/server/locales/fr.json old mode 100644 new mode 100755 diff --git a/src/server/locales/pt.json b/src/server/locales/pt.json old mode 100644 new mode 100755 diff --git a/src/server/locales/si.json b/src/server/locales/si.json old mode 100644 new mode 100755 diff --git a/src/server/models/flotta.js b/src/server/models/flotta.js index c24375f..539784f 100755 --- a/src/server/models/flotta.js +++ b/src/server/models/flotta.js @@ -81,6 +81,12 @@ const FlottaSchema = new mongoose.Schema({ revolut: { type: String, }, + payeer_id: { + type: String, + }, + advcash_id: { + type: String, + }, note_payment: { type: String, }, @@ -114,6 +120,8 @@ function getQueryProj(myfilter) { username: 1, 'profile.paymenttypes': 1, 'profile.email_paypal': 1, + 'profile.payeer_id': 1, + 'profile.advcash_id': 1, 'profile.revolut': 1, 'profile.cell': 1, made_gift: 1, diff --git a/src/server/models/listaingresso.js b/src/server/models/listaingresso.js index 489eff1..ac81522 100755 --- a/src/server/models/listaingresso.js +++ b/src/server/models/listaingresso.js @@ -254,6 +254,7 @@ ListaIngressoSchema.statics.addUserInListaIngresso = async function (idapp, user if (!nuovo) { listaingresso = await ListaIngresso.findByUsernameETess(idapp, username, 1); } + // listaingresso = null; // TOGLIEREE if (!listaingresso) { listaingresso = new ListaIngresso({ _id: new ObjectID(), diff --git a/src/server/models/nave.js b/src/server/models/nave.js index 105c46c..e04a9a0 100755 --- a/src/server/models/nave.js +++ b/src/server/models/nave.js @@ -447,6 +447,8 @@ function getQueryProj(myfilter) { 'profile.teleg_id': 1, 'profile.nationality': 1, 'profile.email_paypal': 1, + 'profile.payeer_id': 1, + 'profile.advcash_id': 1, 'profile.revolut': 1, 'profile.link_payment': 1, 'profile.note_payment': 1, @@ -1500,6 +1502,8 @@ NaveSchema.statics.getFlotta = async function (idapp, riga, col_prima, col_ultim if (!!usersognatore) { flotta.link_payment = usersognatore.profile.link_payment; flotta.email_paypal = usersognatore.profile.email_paypal; + flotta.payeer_id = usersognatore.profile.payeer_id; + flotta.advcash_id = usersognatore.profile.advcash_id; flotta.revolut = usersognatore.profile.revolut; flotta.note_payment = usersognatore.profile.note_payment; } diff --git a/src/server/models/navepersistente.js b/src/server/models/navepersistente.js index f44dc2a..3442abe 100755 --- a/src/server/models/navepersistente.js +++ b/src/server/models/navepersistente.js @@ -448,11 +448,15 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function ( if (nuovo) { myflotta.email_paypal = ''; + myflotta.payeer_id = ''; + myflotta.advcash_id = ''; myflotta.revolut = ''; myflotta.link_payment = ''; myflotta.note_payment = ''; if (!!sognatore) { myflotta.email_paypal = sognatore.profile.email_paypal; + myflotta.payeer_id = sognatore.profile.payeer_id; + myflotta.advcash_id = sognatore.profile.advcash_id; myflotta.revolut = sognatore.profile.revolut; myflotta.link_payment = sognatore.profile.link_payment; myflotta.note_payment = sognatore.profile.note_payment; @@ -462,6 +466,10 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function ( if (!!sognatore) { if (!myflotta.email_paypal) myflotta.email_paypal = sognatore.profile.email_paypal; + if (!myflotta.payeer_id) + myflotta.payeer_id = sognatore.profile.payeer_id; + if (!myflotta.advcash_id) + myflotta.advcash_id = sognatore.profile.advcash_id; if (!myflotta.revolut) myflotta.revolut = sognatore.profile.revolut; if (!myflotta.link_payment) diff --git a/src/server/models/user.js b/src/server/models/user.js index a7658cf..3954c8f 100755 --- a/src/server/models/user.js +++ b/src/server/models/user.js @@ -19,6 +19,8 @@ const { ObjectID } = require('mongodb'); const shared_consts = require('../tools/shared_nodejs'); const queryclass = require('../classes/queryclass'); +const telegrambot = require('../telegram/telegrambot'); + mongoose.Promise = global.Promise; mongoose.level = "F"; @@ -185,6 +187,12 @@ const UserSchema = new mongoose.Schema({ email_paypal: { type: String }, + payeer_id: { + type: String + }, + advcash_id: { + type: String + }, revolut: { type: String }, @@ -222,6 +230,9 @@ const UserSchema = new mongoose.Schema({ saw_zoom_presentation: { type: Boolean }, + ask_zoom_partecipato: { + type: Boolean + }, qualified: { type: Boolean }, @@ -296,6 +307,36 @@ UserSchema.statics.setPermissionsById = function (id, perm) { }; +UserSchema.statics.setZoomPresenza = async function (idapp, id, presenza) { + const User = this; + + const telegrambot = require('../telegram/telegrambot'); + + let allData = {}; + allData.myuser = await User.getUserById(idapp, id); + if (!!allData.myuser) + allData.precDataUser = await User.getInfoUser(idapp, allData.myuser.username); + + return await User.findByIdAndUpdate(id, { $set: { 'profile.saw_zoom_presentation': presenza } }) + .then((rec) => { + if (presenza) { + const messaggio = tools.get__('ZOOM_CONFERMATO'); + telegrambot.sendMsgTelegram(rec.idapp, rec.username, messaggio); + telegrambot.sendMsgTelegramToTheManagersAndZoomeri(idapp, `L\'utente ${rec.name} ${rec.surname} (${rec.username}) è stato confermato per aver visto lo Zoom di Benvenuto`); + } else { + telegrambot.sendMsgTelegramToTheManagersAndZoomeri(idapp, `L\'utente ${rec.name} ${rec.surname} (${rec.username}) è stato annullata la sua richiesta per aver visto lo Zoom di Benvenuto! (Non ci risulta)`); + } + + return User.findByIdAndUpdate(id, { $set: { 'profile.ask_zoom_partecipato': false } }) + .then((user) => { + + + User.checkIfSbloccatiRequisiti(idapp, allData, id); + }); + }); + +}; + UserSchema.statics.isAdmin = function (perm) { try { return ((perm & shared_consts.Permissions.Admin) === shared_consts.Permissions.Admin); @@ -320,6 +361,14 @@ UserSchema.statics.isTraduttrici = function (perm) { } }; +UserSchema.statics.isZoomeri = function (perm) { + try { + return ((perm & shared_consts.Permissions.Zoomeri) === shared_consts.Permissions.Zoomeri); + } catch (e) { + return false + } +}; + UserSchema.statics.isTutor = function (perm) { try { return ((perm & shared_consts.Permissions.Tutor) === shared_consts.Permissions.Tutor); @@ -454,10 +503,13 @@ UserSchema.statics.getUserShortDataByUsername = async function (idapp, username) verified_email: 1, 'profile.teleg_id': 1, 'profile.saw_zoom_presentation': 1, + 'profile.ask_zoom_partecipato': 1, 'profile.qualified': 1, 'profile.qualified_2invitati': 1, 'profile.saw_and_accepted': 1, 'profile.email_paypal': 1, + 'profile.payeer_id': 1, + 'profile.advcash_id': 1, 'profile.revolut': 1, 'profile.link_payment': 1, 'profile.note_payment': 1, @@ -505,10 +557,13 @@ UserSchema.statics.getDownlineByUsername = async function (idapp, username, incl verified_email: 1, 'profile.teleg_id': 1, 'profile.saw_zoom_presentation': 1, + 'profile.ask_zoom_partecipato': 1, 'profile.qualified': 1, 'profile.qualified_2invitati': 1, 'profile.saw_and_accepted': 1, 'profile.email_paypal': 1, + 'profile.payeer_id': 1, + 'profile.advcash_id': 1, 'profile.revolut': 1, 'profile.link_payment': 1, 'profile.note_payment': 1, @@ -587,16 +642,14 @@ UserSchema.statics.getQueryQualified = function () { 'profile.teleg_id': { $gt: 1 }, 'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED, 'profile.saw_zoom_presentation': true, - 'profile.my_dream': { $exists: true }, $or: [ + { 'profile.link_payment': { $exists: true } }, { 'profile.email_paypal': { $exists: true } }, + { 'profile.payeer_id': { $exists: true } }, + { 'profile.advcash_id': { $exists: true } }, { 'profile.revolut': { $exists: true } }, ], // 'profile.paymenttypes': { "$in": ['paypal'] }, - $and: [ - { "$expr": { "$gt": [{ "$strLenCP": "$profile.my_dream" }, 10] } }, - // { "$expr": { "$gt": [{ "$strLenCP": "$profile.email_paypal" }, 6] } } - ], // $where: "this.profile.paymenttypes.length >= 1", }] } @@ -700,6 +753,7 @@ UserSchema.statics.isUserQualified9 = async function (idapp, username) { }; +/* UserSchema.statics.getnumPaymentOk = function (idapp) { const User = this; @@ -719,6 +773,7 @@ UserSchema.statics.getnumPaymentOk = function (idapp) { ] }); }; +*/ UserSchema.statics.getUsersNationalityQuery = function (idapp) { const query = [ @@ -1148,6 +1203,8 @@ UserSchema.statics.getRecByIndOrder = async function (idapp, ind_order) { surname: 1, 'profile.teleg_id': 1, 'profile.email_paypal': 1, + 'profile.payeer_id': 1, + 'profile.advcash_id': 1, 'profile.revolut': 1, 'profile.link_payment': 1, 'profile.note_payment': 1, @@ -1184,6 +1241,33 @@ UserSchema.statics.getusersManagers = async function (idapp) { }); }; +UserSchema.statics.getusersManagersAndZoomeri = async function (idapp) { + const User = this; + + return await User.find( + { + idapp, + or: [ + { 'profile.manage_telegram': true }, + { + perm: + { + $bit: + + Number(shared_consts.Permissions.Zoomeri) + + } + } + ], + }, + { 'profile.teleg_id': 1 }) + .then((arrrec) => { + return (!!arrrec) ? arrrec : null; + }).catch((e) => { + console.error('getusersManagers', e); + }); +}; + UserSchema.statics.getUsersTelegALL = async function (idapp, username) { const User = this; @@ -1302,6 +1386,8 @@ UserSchema.statics.getFieldsForSearch = function () { { field: 'email', type: tools.FieldType.string }, { field: 'profile.cell', type: tools.FieldType.string }, { field: 'profile.email_paypal', type: tools.FieldType.string }, + { field: 'profile.payeer_id', type: tools.FieldType.string }, + { field: 'profile.advcash_id', type: tools.FieldType.string }, { field: 'profile.revolut', type: tools.FieldType.string }, { field: 'profile.link_payment', type: tools.FieldType.string }, { field: 'profile.teleg_id', type: tools.FieldType.number }, @@ -2105,6 +2191,143 @@ UserSchema.statics.NessunaNavePresenteByUsername = async function (idapp, userna }; +UserSchema.statics.getInfoUser = async function (idapp, username) { + return { + username, + is7req: await User.isUserQualified7(idapp, username), + is9req: await User.isUserQualified9(idapp, username), + } + +} + +UserSchema.statics.checkIfSbloccatiRequisiti = async function (idapp, allData, id) { + const User = this; + + const telegrambot = require('../telegram/telegrambot'); + + if (!allData.myuser) + return false; + + if (await Nave.checkIfNaveExist(idapp, allData.myuser.username)) { + // Se già sei dentro la Nave, allora sei OK + return true; //TOGLEREE + } + + // Controlla se Sblocca i 7 requisiti + const is7req = await User.isUserQualified7(idapp, allData.myuser.username); + const is9req = await User.isUserQualified9(idapp, allData.myuser.username); + + const userlista = await ListaIngresso.getListaTessByUsername(idapp, allData.myuser.username); + //if (userlista.length > 0) { //TOGLIERE + if (userlista.length === 0) { + // Se non sono ancora dentro alla lista, allora controllo + + if (!!allData.precDataUser) { + if ((!allData.precDataUser.is7req && is7req) && !await User.isUserAlreadyQualified(idapp, allData.myuser.username)) { + + await User.setUserQualified(idapp, allData.myuser.username); + // ORA HAI I 7 REQUISITI ! + // const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_7_REQUISITI', allData.myuser.lang); + // telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, true); // Anche a STAFF + + // Aggiungilo alla ListaIngresso + risingr = await ListaIngresso.addUserInListaIngresso(idapp, allData.myuser.username, allData.myuser.aportador_iniziale, allData.myuser.lang, true, false); + } + } + } + + if (!!allData.precDataUser) { + if ((!allData.precDataUser.is9req && is9req) && !await User.isUserAlreadyQualified_2Invitati(idapp, allData.myuser.username)) { + await User.setUserQualified_2Invitati(idapp, allData.myuser.username); + // ORA HAI I 9 REQUISITI ! + const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.myuser.lang); + telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, false); // Anche a STAFF + } + + } + + // CHECK APORTADOR SOLIDARIO: + if (!!allData.useraportador) { + /* + const is9reqAportador = await User.isUserQualified9(idapp, allData.myuser.aportador_solidario); + + if (!allData.precDataAportador.is9req && is9reqAportador) { + // ORA HAI I 9 REQUISITI ! + const msgtext = telegrambot.getCiao(idapp, allData.myuser.aportador_solidario, allData.useraportador.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.useraportador.lang); + telegrambot.sendMsgTelegram(idapp, allData.myuser.aportador_solidario, msgtext, true); // Anche a STAFF + } + */ + } + +}; + + +UserSchema.statics.mettiSognoePaypal = async function (idapp, modifica) { + const User = this; + + let num = 0; + + arrusers = await User.find({ + 'idapp': idapp, + $or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }, + { subaccount: { $exists: false } }, { subaccount: { $exists: true, $eq: false } }] + }); + + for (const rec of arrusers) { + + if (rec.profile.saw_zoom_presentation) { + aggiornato = false; + my_dream_ok = !!rec.profile.my_dream; + if (my_dream_ok) + my_dream_ok = rec.profile.my_dream.length >= 8; + + if (!my_dream_ok) { + if (modifica) { + rec.profile.my_dream = '............'; + aggiornato = true; + } + num++; + } + revolut_ok = !!rec.profile.revolut; + paypal_ok = !!rec.profile.email_paypal; + + if (paypal_ok) + paypal_ok = rec.profile.email_paypal.length > 8; + + if ((!revolut_ok) && (!paypal_ok)) { + if (modifica) { + rec.profile.email_paypal = rec.email; + aggiornato = true; + } + num++; + } + + if (aggiornato && modifica) { + + let allData = {}; + allData.myuser = await User.getUserById(idapp, rec.id); + if (!!allData.myuser) + allData.precDataUser = await User.getInfoUser(idapp, allData.myuser.username); + else + allData.precDataUser = null; + + + const risupd = await User.findByIdAndUpdate(rec._id, { + 'profile.email_paypal': rec.profile.email_paypal, + 'profile.my_dream': rec.profile.my_dream + }, { new: false }); + + if (risupd) { + await User.checkIfSbloccatiRequisiti(idapp, allData, rec.id); + } + } + } + } + + return { num }; + +}; + UserSchema.statics.flagUtentiNaviNonPresenti = async function (idapp) { const User = this; diff --git a/src/server/router/api/actions.js b/src/server/router/api/actions.js index 822a8b7..7b5dee6 100755 --- a/src/server/router/api/actions.js +++ b/src/server/router/api/actions.js @@ -15,6 +15,10 @@ const telegrambot = require('../../telegram/telegrambot'); module.exports = { doOtherThingsAfterDeleted: async function (tablename, rec, notifBot, req) { try { + + const { User } = require('../../models/user'); + const telegrambot = require('../../telegram/telegrambot'); + let ris = null; const { ListaIngresso } = require('../../models/listaingresso'); @@ -73,7 +77,7 @@ module.exports = { addtext = 'Eliminato il Record "' + nomerecord + '" dalla tabella ' + tablename + '\n' + 'Eseguito da ' + req.user.name + ' ' + req.user.surname + ' \n'; - await telegrambot.sendMsgTelegramToTheManagers(idapp, addtext); + await telegrambot.sendMsgTelegramToTheManagers(rec.idapp, addtext); } } diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js index c760cb2..9b5dfc2 100755 --- a/src/server/router/index_router.js +++ b/src/server/router/index_router.js @@ -65,8 +65,11 @@ UserCost = { 'profile.teleg_id', 'profile.saw_zoom_presentation', 'profile.saw_and_accepted', + 'profile.revolut', + 'profile.payeer_id', + 'profile.advcash_id', + 'profile.link_payment', 'profile.email_paypal', - 'profile.my_dream', 'profile.paymenttypes'] }; @@ -289,70 +292,6 @@ router.post('/gettable', authenticate, (req, res) => { }); -async function checkIfSbloccatiRequisiti(idapp, allData, id) { - - if (!allData.myuser) - return false; - - if (await Nave.checkIfNaveExist(idapp, allData.myuser.username)) { - // Se già sei dentro la Nave, allora sei OK - return true; - } - - // Controlla se Sblocca i 7 requisiti - const is7req = await User.isUserQualified7(idapp, allData.myuser.username); - const is9req = await User.isUserQualified9(idapp, allData.myuser.username); - - const userlista = await ListaIngresso.getListaTessByUsername(idapp, allData.myuser.username); - if (userlista.length === 0) { - // Se non sono ancora dentro alla lista, allora controllo - - if (!!allData.precDataUser) { - if ((!allData.precDataUser.is7req && is7req) && !await User.isUserAlreadyQualified(idapp, allData.myuser.username)) { - await User.setUserQualified(idapp, allData.myuser.username); - // ORA HAI I 7 REQUISITI ! - // const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_7_REQUISITI', allData.myuser.lang); - // telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, true); // Anche a STAFF - - // Aggiungilo alla ListaIngresso - risingr = await ListaIngresso.addUserInListaIngresso(idapp, allData.myuser.username, allData.myuser.aportador_iniziale, allData.myuser.lang, true, false); - } - } - } - - if (!!allData.precDataUser) { - if ((!allData.precDataUser.is9req && is9req) && !await User.isUserAlreadyQualified_2Invitati(idapp, allData.myuser.username)) { - await User.setUserQualified_2Invitati(idapp, allData.myuser.username); - // ORA HAI I 9 REQUISITI ! - const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.myuser.lang); - telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, false); // Anche a STAFF - } - - } - - // CHECK APORTADOR SOLIDARIO: - if (!!allData.useraportador) { - /* - const is9reqAportador = await User.isUserQualified9(idapp, allData.myuser.aportador_solidario); - - if (!allData.precDataAportador.is9req && is9reqAportador) { - // ORA HAI I 9 REQUISITI ! - const msgtext = telegrambot.getCiao(idapp, allData.myuser.aportador_solidario, allData.useraportador.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.useraportador.lang); - telegrambot.sendMsgTelegram(idapp, allData.myuser.aportador_solidario, msgtext, true); // Anche a STAFF - } - */ - } - -} - -async function getInfoUser(idapp, username) { - return { - username, - is7req: await User.isUserQualified7(idapp, username), - is9req: await User.isUserQualified9(idapp, username), - } - -} router.patch('/setlang', authenticate, async (req, res) => { const username = req.body.data.username; @@ -407,7 +346,7 @@ router.patch('/chval', authenticate, async (req, res) => { allData = {}; allData.myuser = await User.getUserById(idapp, id); if (!!allData.myuser) - allData.precDataUser = await getInfoUser(idapp, allData.myuser.username); + allData.precDataUser = await User.getInfoUser(idapp, allData.myuser.username); else allData.precDataUser = null; // allData.useraportador = await ListaIngresso.getUserByInvitante_Username(idapp, allData.myuser.aportador_solidario); @@ -513,7 +452,7 @@ router.patch('/chval', authenticate, async (req, res) => { if (mydata.table === 'users') { if (camporequisiti) { - await checkIfSbloccatiRequisiti(idapp, allData, id); + await User.checkIfSbloccatiRequisiti(idapp, allData, id); } } @@ -524,6 +463,14 @@ router.patch('/chval', authenticate, async (req, res) => { } if (mydata.table === 'users') { + if ('saw_zoom_presentation' in fieldsvalue) { + if (fieldsvalue['saw_zoom_presentation']) { + const messaggio = tools.get__('ZOOM_CONFERMATO'); + await telegrambot.sendMsgTelegram(idapp, myuser.username, messaggio); + await telegrambot.sendMsgTelegramToTheManagersAndZoomeri(idapp, `L\'utente ${rec.name} ${rec.surname} (${rec.username}) è stato confermato per aver visto lo Zoom di Benvenuto`); + } + } + if ('aportador_solidario' in fieldsvalue) { ind_order_ingr = mydata.ind_order_ingr; // SERVE SE CI METTO LE MINUSCOLE/MAIUSCOLE SBAGLIATE in invitante_username! @@ -760,8 +707,11 @@ router.patch('/callfunz', authenticate, async (req, res) => { // ELIMINO LA LISTAINGRESSO CHE STO SOSTITUENDO (SOLO SE NON VIENE USATA DA ALTRA NAVE!) let eliminatoingr = await ListaIngresso.eliminaListaIngresso(idapp, mianavedasost.ind_order, req, mianavedasost.num_tess); - if (!eliminatoingr){ - return res.send({ code: server_constants.RIS_CODE_ERR, msg: 'La Sostituzione non può avvenire ! Contattare Paolo. (ind_order=' + mianavedasost.ind_order + ')' }); + if (!eliminatoingr) { + return res.send({ + code: server_constants.RIS_CODE_ERR, + msg: 'La Sostituzione non può avvenire ! Contattare Paolo. (ind_order=' + mianavedasost.ind_order + ')' + }); } } } @@ -937,6 +887,17 @@ router.patch('/callfunz', authenticate, async (req, res) => { } } + } else if (mydata.myfunc === shared_consts.CallFunz.ZOOM_GIA_PARTECIPATO) { + + if (!!myuser.username) { + FormDaMostrare = telegrambot.getFormDaMostrare(idapp, mydata.myfunc, myuser); + + await telegrambot.sendMsgTelegramToTheManagers(idapp, `L\'utente ${myuser.name} ${myuser.surname} (${myuser.username}) ha detto di aver già visto lo Zoom di Benvenuto`, false, FormDaMostrare); + + const ris = await User.findByIdAndUpdate(myuser.id, { $set: { 'profile.ask_zoom_partecipato': true } }); + if (ris) + return res.send({ code: server_constants.RIS_CODE_OK, msg: '' }); + } } return res.send({ code: server_constants.RIS_CODE_ERR }); @@ -1036,7 +997,10 @@ router.delete('/delrec/:table/:id', authenticate, async (req, res) => { if (cancellato) { // Do extra things after deleted - return actions.doOtherThingsAfterDeleted(tablename, myrec, notifBot, req); + ris = await actions.doOtherThingsAfterDeleted(tablename, myrec, notifBot, req); + if (!!ris) { + return res.send({ code: server_constants.RIS_CODE_OK, msg: '' }); + } } res.send({ code: server_constants.RIS_CODE_ERR, msg: '' }); diff --git a/src/server/router/site_router.js b/src/server/router/site_router.js index a6251bc..ada3ed1 100755 --- a/src/server/router/site_router.js +++ b/src/server/router/site_router.js @@ -33,7 +33,7 @@ router.post('/load', async (req, res) => { num_teleg_pending: await User.getUsersTelegramPending(idapp), // num_qualificati: await User.getNumUsersQualified(idapp, 2), // num_requisiti: await User.getNumUsersQualified(idapp, 0), - num_modalita_pagamento: await User.getnumPaymentOk(idapp), + // num_modalita_pagamento: await User.getnumPaymentOk(idapp), num_part_zoom: await User.getUsersZoom(idapp), num_part_accepted: await User.getSaw_and_Accepted(idapp), arr_nations: await User.findAllDistinctNationality(idapp), diff --git a/src/server/router/users_router.js b/src/server/router/users_router.js index 9e6795a..48c2072 100755 --- a/src/server/router/users_router.js +++ b/src/server/router/users_router.js @@ -68,11 +68,10 @@ router.post('/', async (req, res) => { return 1; } - if (tools.blockwords(body.username)) { - tools.writeIPToBan(user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' + user.surname); - await tools.snooze(100000); - res.status(400).send({ code: server_constants.RIS_CODE_USERNAME_NOT_VALID, msg: '' }); - return 1; + if (tools.blockwords(body.username) || tools.blockwords(body.name) || tools.blockwords(body.surname)) { + // tools.writeIPToBan(user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' + user.surname); + await tools.snooze(5000); + return res.status(404).send(); } @@ -168,6 +167,8 @@ router.post('/', async (req, res) => { user.profile.saw_and_accepted = recorig.profile.saw_and_accepted; user.profile.my_dream = recorig.profile.my_dream; user.profile.email_paypal = recorig.profile.email_paypal; + user.profile.payeer_id = recorig.profile.payeer_id; + user.profile.advcash_id = recorig.profile.advcash_id; user.profile.revolut = recorig.profile.revolut; user.profile.link_payment = recorig.profile.link_payment; user.profile.note_payment = recorig.profile.note_payment; @@ -507,6 +508,10 @@ async function eseguiDbOp(idapp, mydata, locale) { ris = await User.flagUtentiNaviNonPresenti(idapp); } else if (mydata.dbop === 'generaFlotte') { ris = await NavePersistente.generaFlotte(idapp); + } else if (mydata.dbop === 'mettiSognoePaypal') { + ris = await User.mettiSognoePaypal(idapp, true); + } else if (mydata.dbop === 'mettiSognoePaypalView') { + ris = await User.mettiSognoePaypal(idapp, false); } else if (mydata.dbop === 'addNavePerUtentiNaviNonPresenti') { ris = await User.addNavePerUtentiNaviNonPresenti(idapp); } else if (mydata.dbop === 'creaTessituraeConv') { diff --git a/src/server/telegram/telegrambot.js b/src/server/telegram/telegrambot.js index 0e15d61..c4f3ced 100755 --- a/src/server/telegram/telegrambot.js +++ b/src/server/telegram/telegrambot.js @@ -244,8 +244,13 @@ const NOME_COGNOME = 'nomecognome'; const CHEDI_SE_IMBARCARTI = 'chiedi_se_imbarcarti'; const InlineCmd = { - VOGLIO_IMBARCARMI: 'voglio_imbarcarmi', - NON_VOGLIO_IMBARCARMI: 'non_voglio_imbarcarmi' + VOGLIO_IMBARCARMI: 'w_imb', + NON_VOGLIO_IMBARCARMI: 'nw_imb' +}; + +const InlineZoomConferma = { + CONFERMA_ZOOM_PRESENZA: 'conf_pres', + NON_CONFERMA_ZOOM_PRESENZA: 'nonconf_pres' }; const SendMsgCmd = [CONTA_SOLO, RICEVI_EMAIL, NOME_COGNOME, CHEDI_SE_IMBARCARTI]; @@ -473,6 +478,30 @@ module.exports = { REGISTRATION: 1 }, + getFormDaMostrare: function (idapp, myfunc, myuser) { + + FormDaMostrare = null; + + const cl = getclTelegByidapp(idapp); + + if (myfunc === shared_consts.CallFunz.ZOOM_GIA_PARTECIPATO) { + FormDaMostrare = cl.getInlineKeyboard(myuser.lang, [ + { + text: 'Conferma Presenza Zoom', + // callback_data: { action: InlineZoomConferma.CONFERMA_ZOOM_PRESENZA, username: myuser.username } + callback_data: InlineZoomConferma.CONFERMA_ZOOM_PRESENZA + '|' + myuser.username + }, + { + text: 'Annulla Presenza Zoom', + // callback_data: { action: InlineZoomConferma.NON_CONFERMA_ZOOM_PRESENZA, username: myuser.username } + callback_data: InlineZoomConferma.NON_CONFERMA_ZOOM_PRESENZA + '|' + myuser.username + }, + ]); + } + + return FormDaMostrare; + }, + getCiao: function (idapp, username, lang) { return tools.gettranslate('CIAO', lang) + ' ' + username + '!\n'; }, @@ -511,7 +540,7 @@ module.exports = { }, - sendMsgTelegramToTheManagers: async function (idapp, text, onlyintofile) { + sendMsgTelegramToTheManagers: async function (idapp, text, onlyintofile, MyForm = null) { tools.writeManagersLog(text); @@ -519,8 +548,26 @@ module.exports = { const usersmanagers = await User.getusersManagers(idapp); if (usersmanagers) { for (const rec of usersmanagers) { - await this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + ': ' + text, undefined, undefined, true); - await tools.snooze(200) + await this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + ': ' + text, undefined, undefined, true, MyForm); + await tools.snooze(100) + } + } + } + return true + + }, + + sendMsgTelegramToTheManagersAndZoomeri: async function (idapp, text, onlyintofile, MyForm = null) { + + tools.writeManagersLog(text); + + if (!onlyintofile) { + // const usersmanagers = await User.getusersManagersAndZoomeri(idapp); + const usersmanagers = await User.getusersManagers(idapp); + if (usersmanagers) { + for (const rec of usersmanagers) { + await this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + ': ' + text, undefined, undefined, true, MyForm); + await tools.snooze(100) } } } @@ -560,6 +607,10 @@ module.exports = { msg = msg.replace('{link_paypalme}', user.profile.link_payment); if (!!user.profile.revolut) msg = msg.replace('{revolut}', user.profile.revolut); + if (!!user.profile.payeer_id) + msg = msg.replace('{payeer_id}', user.profile.payeer_id); + if (!!user.profile.advcash_id) + msg = msg.replace('{advcash_id}', user.profile.advcash_id); if (!!user.profile.email_paypal) msg = msg.replace('{email_paypal}', user.profile.email_paypal); if (!!user.profile.note_payment) @@ -691,7 +742,7 @@ module.exports = { strout += '\n (' + index + ') ' + user.name + ' ' + user.surname + ':'; if (mydata.inviareale) { await this.sendMsgTelegramByIdTelegram(idapp, idteleg, mymsg, undefined, undefined, true); - await tools.snooze(300); + await tools.snooze(100); strout += ' -> (MSG OK)'; if (mydata.inviaemail && !!user.email) { @@ -836,7 +887,7 @@ module.exports = { return ris; }, - sendMsgTelegramByIdTelegram: async function (idapp, idtelegram, text, message_id, chat_id, ripr_menuPrec) { + sendMsgTelegramByIdTelegram: async function (idapp, idtelegram, text, message_id, chat_id, ripr_menuPrec, MyForm = null) { if (!idtelegram) return; @@ -844,7 +895,7 @@ module.exports = { if (cl && idtelegram) { let myform = null; - return await cl.sendMsg(idtelegram, text, null, null, message_id, chat_id, ripr_menuPrec) + return await cl.sendMsg(idtelegram, text, null, MyForm, message_id, chat_id, ripr_menuPrec) } } @@ -912,7 +963,7 @@ async function local_sendMsgTelegramToTheManagers(idapp, text, msg, username_bo) if (cl && idtelegram) { await cl.sendMsg(idtelegram, text, undefined, undefined, undefined, undefined, true) } - await tools.snooze(300) + await tools.snooze(100) } } return true @@ -1357,7 +1408,6 @@ class Telegram { ispayment(user) { if (user) { - let ispaypal = false; if (!!user.profile.paymenttypes) { /*if (user.profile.paymenttypes.includes('paypal')) { if (user.profile.email_paypal) { @@ -1737,7 +1787,7 @@ class Telegram { let help = ""; let helpaperta = true; - if (tools.isMonToSat() && tools.isBetweenTwoTime('8:00:00', '19:50:00')) { + if (tools.isMonToFri() && tools.isBetweenTwoTime('9:00:00', '19:00:00')) { help = '✅ ' + this.getlink('help'); } else { help = "🔴 [ORA CHIUSA - NOW CLOSED]"; @@ -2021,11 +2071,13 @@ class Telegram { FormDaMostrare = this.getInlineKeyboard(lang, [ { text: Menu[lang].SI, - callback_data: { action: InlineCmd.VOGLIO_IMBARCARMI, username: utente.username } + // callback_data: { action: InlineCmd.VOGLIO_IMBARCARMI, username: utente.username } + callback_data: InlineCmd.VOGLIO_IMBARCARMI + '|' + utente.username }, { text: Menu[lang].NO, - callback_data: { action: InlineCmd.NON_VOGLIO_IMBARCARMI, username: utente.username } + // callback_data: { action: InlineCmd.NON_VOGLIO_IMBARCARMI, username: utente.username } + callback_data: InlineCmd.NON_VOGLIO_IMBARCARMI + '|' + utente.username }, ]); inviaveramente = true; @@ -2053,16 +2105,16 @@ class Telegram { // break; } - await tools.snooze(300); + await tools.snooze(100); nummsgsent++; } if (!SendMsgCmd.includes(cmd)) { - if ((nummsgsent % 50) === 0) { - myid = await this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(this.getlang(msg), 'MSG_MSG_INCORSO'), null, { message_id: myid }); - await tools.snooze(300) + if ((nummsgsent % 100) === 0) { + myid = await this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(this.getlang(msg), 'MSG_MSG_INCORSO'), null, null, myid); + await tools.snooze(100) } } } @@ -2404,6 +2456,7 @@ class Telegram { return res; } catch (e) { + console.error(e); return 0 } } @@ -2627,7 +2680,22 @@ if (!tools.testing()) { const myclTelegram = getclTelegBytoken(bot.token); - const data = callbackQuery.data; + let dataarr = []; + let data = { + action: 0, + username: '' + }; + + const datastr = callbackQuery.data; + if (!!datastr) { + dataarr = datastr.split("|"); + if (!!dataarr) { + data = { + action: dataarr[0], + username: dataarr[1], + } + } + } const msg = callbackQuery.message; const opts = { chat_id: msg.chat.id, @@ -2654,6 +2722,14 @@ if (!tools.testing()) { const msgadd = '[' + user.username + '] ' + user.name + ' ' + user.surname + ' ha risposto che NON VUOLE IMBARCARSI !'; await local_sendMsgTelegramToTheManagers(user.idapp, msgadd, msg, false); // Anche a STAFF + } else if (data.action === InlineZoomConferma.CONFERMA_ZOOM_PRESENZA) { + + await User.setZoomPresenza(user.idapp, user._id, true); + + } else if (data.action === InlineZoomConferma.NON_CONFERMA_ZOOM_PRESENZA) { + + await User.setZoomPresenza(user.idapp, user._id, false); + } } } diff --git a/src/server/tools/general.js b/src/server/tools/general.js index 0c7be4e..39790aa 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -55,10 +55,10 @@ textlang = { "partecipanti": "partecipanti", 'TESTO_ASSISTENZA': "👉 Per entrare nel Sito AYNI\n\n" + "👉 Hai dimenticato la password?\n\n" + + "👉 Entra nel Canale d'Informazione per Importanti Avvisi!\nCanale AYNI-BIBLIO\n\n" + "👉 Chat AYNI - EMPOWER: Entra ⛩ nella nostra Community chat\n%s\n\n" + - "👉 Canale News e Informazioni AYNI-BIBLIO\n\n" + - "👉 PER AIUTO: Leggi le Domande più Frequenti:\n%s\n\n" + - "Chat di Supporto 'AYNI - HELP'\nDa Lunedì al Sabato (8:00 - 20:00)\n%s\n" + + "👉 PER AIUTO: Leggi le Domande più Frequenti:\n%s\nOppure chiedi prima al tuo Invitante!\n\n" + + "SOLO se non trovi la risposta che ti serve puoi accedere alla Chat di Supporto 'AYNI - HELP'\nDa Lunedì al Venerdí (9:00 - 19:00)\n%s\n" + "1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto Esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.", 'BENVENUTO': "Benvenuto", 'TUE_NAVI': "Ecco le tue Navi programmate", @@ -117,6 +117,7 @@ textlang = { 'NAVE': 'NAVE', 'MSG_SEND_FROM': 'Msg Inviato da', 'VUOI_IMBARCARTI': 'Attenzione! Ci risulta che attualmente non ti è stato assegnato Nessun Imbarco.\nQuesto può essere dovuto ad un errore durante la fase di aggiornamento del sito, oppure perchè tu stesso hai cancellato l\'imbarco.\n\nVuoi Aggiungerti ora al prossimo Imbarco per continuare nel tuo Viaggio in AYNI? ', + 'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!', }, si: { "Email je že bila preverjena": "Email je že bila preverjenaL'Email è già stata Verificata", @@ -185,6 +186,7 @@ textlang = { 'NAVE': 'LADJE', 'MSG_SEND_FROM': 'sporočilo, ki ga je poslal', 'VUOI_IMBARCARTI': 'Pozor! Opazili smo, da ti trenutno ni bila dodeljena Nobena ladjica.\nTo je lahko posledica napake med fazo posodabljanja spletnega mesta ali ker si sam zbrisal svoj vpis.\n\nAli želiš nadaljevati plovbo, če želiš nadaljevati potovanje z AYNI ?', + 'ZOOM_CONFERMATO': 'Potrjeno je bilo, da ste videli dobrodošlico video konference!', }, es: { "L'Email è già stata Verificata": "El correo electrónico ya ha sido verificado", @@ -195,7 +197,7 @@ textlang = { "¿Olvidó su contraseña para acceder al sitio?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\n" + "Chat AYNI BOT (este):\nhttps://t.me/notevoleaynibot\n\n" + "Chat AYNI - EMPOWER: Entra en ⛩ en nuestra comunidad de chat:\n%s\n\n" + - "Chat de ayuda y soporte: 'AYNI - HELP'\nDe lunes a sábado (8:00 - 21:00)\n%s\n" + + "Chat de ayuda y soporte: 'AYNI - HELP'\nDe lunes a viernes (9:00 - 19:00)\n%s\n" + "1 - Haga su pregunta y pida ayuda.\n2 - Después de que consigas ayuda, sal de la sala de chat.\nPuedes volver cuando necesites ayuda..", 'BENVENUTO': "Bienvenido", 'TUE_NAVI': "Aquí están sus naves programadas", @@ -251,6 +253,7 @@ textlang = { 'NAVE': 'NAVE', 'MSG_SEND_FROM': 'Mensaje enviado por', 'VUOI_IMBARCARTI': '¡Atención! Entendemos que actualmente no está asignado a No Boarding.\nEsto puede deberse a un error durante la fase de actualización del sitio web, o porque usted mismo ha cancelado el embarque.\n\n¿Quieres añadirte ahora al próximo embarque para continuar tu viaje en AYNI?', + 'ZOOM_CONFERMATO': '¡Se ha confirmado que ha visto la Video Conferencia de Bienvenida!', }, enUs: { "partecipanti": "participants", @@ -258,7 +261,7 @@ textlang = { "https://ayni.gifteconomy.app/requestresetpwd\nChat AYNI BOT (this one):\nhttps://t.me/notevoleaynibot\n\n" + "Chat AYNI - EMPOWER: Enter ⛩ into our chat community:\n%s\n\n" + "Canale News AYNI-BIBLIO:\n%s\n\n" + - "Help and Support Chat: 'AYNI - HELP'.\nMonday to Saturday (8:00 - 20:00)\n%s\n" + + "Help and Support Chat: 'AYNI - HELP'.\nMonday to Friday (9:00 - 19:00)\n%s\n" + "1 - Ask your question and ask for assistance.\n2 - After receiving help, exit the chat.\nYou can come back whenever you need help.", 'BENVENUTO': "Welcome", 'TUE_NAVI': "Here are your programmed ships", @@ -314,6 +317,7 @@ textlang = { 'NAVE': 'SHIP', 'MSG_SEND_FROM': 'Msg sent by', 'VUOI_IMBARCARTI': 'Attention! We understand that you have No Boarding assigned.\nThis may be due to an error during the site update phase, or because you have cancelled boarding yourself.\n\nDo you want to add now to the Next Boarding to continue your AYNI Trip?', + 'ZOOM_CONFERMATO': 'You have been confirmed to have seen the Welcome Video Conference!', }, fr: { "L'Email è già stata Verificata": "Le courrier électronique a déjà été vérifié", @@ -325,7 +329,7 @@ textlang = { "Chat AYNI BOT (ce):\nhttps://t.me/notevoleaynibot\n\n" + "Chat AYNI - EMPOWER : Entrez ⛩ dans notre Community chat:\n%s\n\n" + "Canale News AYNI-BIBLIO:\n%s\n\n" + - "Chat d’Aide et de Support: 'AYNI - HELP'\nDu lundi au samedi (8:00 - 20:00)\n%s\n" + + "Chat d’Aide et de Support: 'AYNI - HELP'\nDu lundi au Vendredi (9:00 - 19:00)\n%s\n" + "1 - Posez votre question et demandez d’être assisté.\n2 - Après avoir reçu l’aide, quittez le groupe.\nVous pourrez y entrer chaque fois qu’il vous sera nécessaire.", 'BENVENUTO': "Bienvenue", 'TUE_NAVI': "Voici vos navires programmés", @@ -381,6 +385,7 @@ textlang = { 'NAVE': 'NAVIRE', 'MSG_SEND_FROM': 'Message envoyé par', 'VUOI_IMBARCARTI': 'Attention ! Nous comprenons que vous n\'êtes actuellement pas affecté Pas d\'embarquement.\nCela peut être dû à une erreur lors de la phase de mise à jour du site, ou parce que vous avez vous-même annulé l\'embarquement.\n\nVoulez-vous vous ajouter maintenant au prochain embarquement pour continuer votre voyage AYNI ? ', + 'ZOOM_CONFERMATO': 'Vous avez été confirmé comme ayant vu la vidéoconférence de bienvenue !', }, pt: { "L'Email è già stata Verificata": "", @@ -392,7 +397,7 @@ textlang = { "Chat AYNI BOT (isto):\nhttps://t.me/notevoleaynibot\n\n" + "Chat AYNI - EMPOWER: Entrar em ⛩ na nossa comunidade de chat:%s\n\n" + "Canale News AYNI-BIBLIO:\n%s\n\n" + - "Chat de Ajuda e Suporte: 'AYNI - HELP'.\nDe segunda a sábado (8:00 - 20:00 ITALY)\n%s\n" + + "Chat de Ajuda e Suporte: 'AYNI - HELP'.\nDe segunda a Sexta (9:00 - 19:00 ITALY)\n%s\n" + "1 - Faça a sua pergunta e peça ajuda.\n2 - Depois de receber ajuda, saia do chat.\nPode voltar sempre que precisar de o fazer..", 'BENVENUTO': "Bem-vindo", 'TUE_NAVI': "Aqui estão os seus navios programados", @@ -448,6 +453,7 @@ textlang = { 'NAVE': 'NAVE', 'MSG_SEND_FROM': 'Mensagem enviada por', 'VUOI_IMBARCARTI': 'Atenção! Compreendemos que actualmente não lhe é atribuído Sem Embarque.\nIsto pode ser devido a um erro durante a fase de actualização do site, ou porque você mesmo cancelou o embarque.\n\nDeseja juntar-se agora ao próximo embarque para continuar a sua viagem AYNI?', + 'ZOOM_CONFERMATO': 'Foi-lhe confirmado que assistiu à Conferência de Vídeo de Boas-vindas!', }, }; @@ -1006,6 +1012,8 @@ module.exports = { filtriadded.push({ 'profile.qualified': true }); if (params.filterand.includes(shared_consts.FILTER_USER_NO_ZOOM)) filtriadded.push({ 'profile.saw_zoom_presentation': false }); + if (params.filterand.includes(shared_consts.FILTER_ASK_ZOOM_VISTO)) + filtriadded.push({ 'profile.ask_zoom_partecipato': false }); if (params.filterand.includes(shared_consts.FILTER_USER_NO_INVITANTE)) filtriadded.push({ aportador_solidario: { $exists: false } @@ -1184,6 +1192,11 @@ module.exports = { return dayOfWeek >= 1 && dayOfWeek <= 6 }, + isMonToFri() { + const dayOfWeek = new Date(new Date()).getDay(); + return dayOfWeek >= 1 && dayOfWeek <= 5 + }, + // var startTime = '15:10:10'; // var endTime = '22:30:00'; isBetweenTwoTime(startTime, endTime) { @@ -1740,8 +1753,11 @@ module.exports = { }, blockwords(mystr) { - if (mystr.includes('ttp')) { - return true; + const arrwords = ['http', 'Http', 'Asasfasfas', '://', 'mrbit']; + for (const myword of arrwords) { + if (mystr.includes(myword)) { + return true; + } } return false; diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js index da2895b..cea2644 100755 --- a/src/server/tools/shared_nodejs.js +++ b/src/server/tools/shared_nodejs.js @@ -22,6 +22,7 @@ module.exports = { FILTER_NASCOSTI: 4096, FILTER_NAVI_NON_PRESENTI: 8192, FILTER_QUALIFIED: 16384, + FILTER_ASK_ZOOM_VISTO: 32768, Permissions: { Admin: 1, @@ -29,6 +30,7 @@ module.exports = { Teacher: 4, Tutor: 8, Traduttrici: 16, + Zoomeri: 32, }, MessageOptions: { @@ -53,6 +55,7 @@ module.exports = { DAMMI_PRIMO_UTENTE_LIBERO: 390, GET_VALBYTABLE: 400, SET_VALBYTABLE: 410, + ZOOM_GIA_PARTECIPATO: 510 }, fieldsUserToChange() {