Files
freeplanet_serverside/src/server/tools/general.js

2008 lines
73 KiB
JavaScript
Raw Normal View History

const os = require("os");
2018-12-24 20:31:02 +01:00
const fs = require('fs');
2021-02-18 12:19:35 +01:00
const path = require('path');
require('../config/config');
require('../models/subscribers');
const Site = require('../models/site');
const CryptoJS = require('crypto-js');
const Url = require('url-parse');
const { ObjectID } = require('mongodb');
const shared_consts = require('./shared_nodejs');
const mongoose = require('mongoose');
const Subscription = mongoose.model('subscribers');
const server_constants = require('./server_constants');
// SETTINGS WebPush Configuration
const webpush = require('web-push');
const FILELOG = 'filelog.txt';
const FILEEVENTS = 'logevents.txt';
const FILEMANAGERS = 'logmanagers.txt';
const FILESOSTITUZIONI = 'log_sostituzioni.txt';
2020-07-13 23:35:05 +02:00
const FILEIP_TO_BAN = 'log_iptoban.txt';
const FILENAVE = 'logNave.txt';
const subject = process.env.URLBASE_APP1;
const publicVapidKey = process.env.PUBLIC_VAPI_KEY;
const privateVapidKey = process.env.PRIVATE_VAPI_KEY;
2020-03-21 10:28:26 +01:00
const FIELDS_REGEX = ['username', 'name', 'surname'];
// Code goes here
const keySize = 256;
const ivSize = 128;
const iterations = 100;
if (!!process.env.GCM_API_KEY && process.env.GCM_API_KEY !== "") {
webpush.setGCMAPIKey(process.env.GCM_API_KEY);
webpush.setVapidDetails(subject, publicVapidKey, privateVapidKey);
}
// console.log('setVapidDetails... config...');
// To Translate!
const textlang = {
it: {
"L'Email è già stata Verificata": "L'Email è già stata Verificata",
"Nuova Registrazione": "Nuova Registrazione",
"Effettuata una Nuova Registrazione": "Effettuata una Nuova Registrazione",
2021-02-18 12:19:35 +01:00
"partecipanti": "partecipanti all'Evento",
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
"partecipanti a Cena Condivisa": "partecipanti a Cena Condivisa",
2020-05-10 21:07:51 +02:00
'TESTO_ASSISTENZA': "<strong><a href=\"%s\">👉 Per entrare nel Sito AYNI</a></strong>\n\n" +
2020-12-21 02:16:42 +01:00
"👉 <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" +
"👉 <strong>Chat AYNI - EMPOWER</strong>: Entra ⛩ nella nostra Community chat\n%s\n\n" +
"👉 <strong>PER AIUTO</strong>: Leggi le Domande più Frequenti:\n%s\n<b>Oppure chiedi prima al tuo Invitante!</b>\n\n" +
"SOLO se non trovi la risposta che ti serve puoi accedere alla Chat di Supporto <strong>'AYNI - HELP'</strong>\n<strong>Da Lunedì al Venerdí (9:00 - 19:00)</strong>\n%s\n" +
"1 - Fai la tua <strong>domanda</strong> e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto <strong>Esci dalla chat</strong>.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
'BENVENUTO': "Benvenuto",
2020-03-25 09:25:31 +01:00
'TUE_NAVI': "Ecco le tue Navi programmate",
'HAI_I_7_REQUISITI': 'PRIMI PASSI OK!\nHai i Primi 7 Requisiti per Entrare nella Lista d\'Imbarco!',
'NON_HAI_I_7_REQUISITI': 'Attenzione!\nAncora non hai i 7 Requisiti per Entrare nella Lista d\'Imbarco!',
'HAI_I_9_REQUISITI': 'COMPLIMENTI!\nHai Completato TUTTI i 9 Passi della Guida! Grazie per Aiutare AYNI ad Espandersi!',
2020-04-24 10:29:25 +02:00
'NON_HAI_I_9_REQUISITI': 'Ricqorda che puoi Aiutare a far Crescere ed Espandere il Movimento, Condividendo con chiunque questo nostro viaggio!',
'INFO_LA_MIA_LAVAGNA': '✨ Lista dei Passi: ✨ \n',
2020-05-11 22:43:14 +02:00
'INFO_LAVAGNA_SITO_COMPLETARE': 'Per completare tutti i requisiti vai sul sito:\n%s\nPer vedere lo stato della tua Nave e dei tuoi invitati:\n 👉🏻 <a href="%s">Entra nella tua Lavagna</a>.\n',
'INFO_LAVAGNA_SITO': 'Per vedere in dettaglio lo <strong>STATO della tua Nave</strong>, sul sito AYNI\n 👉🏻 <a href="%s">Entra nella tua Lavagna</a>.\n',
2020-04-24 10:29:25 +02:00
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n\n%s',
'INFO_LINK_ZOOM': 'Link da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
2020-05-04 19:34:41 +02:00
'ZOOM_CONFERENCE': 'Ecco il programma delle Conferenze (Zoom) aperti a TUTTI:',
"NON_VERIF": "Non Verificata",
"VERIF": "Verificata",
'EMAIL': "Email",
'BOT': "AYNI BOT",
2020-04-07 14:34:29 +02:00
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**\ne clicca sul bottone **\"Verifica Registrazione\"**",
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
2020-07-02 22:00:58 +02:00
'PAYMENTS': 'Modalità di Pagamento',
'INVITATI': 'persone registrate che hai invitato',
'INVITATI_ATTIVI': 'Invitati con i 7 Requisiti',
'NONREG': 'Invitati non Registrati',
2020-07-02 22:00:58 +02:00
'CLICCA_PER_ZOOM': 'AL GIORNO E ORA INDICATA, PER ENTRARE NELLA VIDEO-CONFERENZA, CLICCA SUL LINK INDICATO',
'CLICCA_ENTRA': 'CLICCA QUI PER ENTRARE !',
'ZOOM_INIZIATO': 'QUESTA CONFERENZA E\' INIZIATA!',
'SCEGLI_VOCE': 'scegli una voce:',
'INVITATI_LISTA': 'I Tuoi Invitati (in verde con almeno i primi 7 Requisiti)',
'CIAO': 'Ciao',
2020-05-11 22:43:14 +02:00
'ADDED_TOLISTAINGRESSO': '<strong>Complimenti! 🎊</strong>\nSei stato aggiunto alla <strong>Lista D\'Imbarco</strong> !\nNei prossimi giorni riceverai un messaggio qui quando la tua Nave sarà pronta a partire.\nRicorda che per salire di graduatoria, puoi condividere il Movimento con i tuoi amici ❤️.',
'REGALATO_INVITANTE': 'da fare.... 😍🎊 Hai ricevuto in Regalo un Invitato {invitato} da parte di {mittente} !',
'NO_PROG': 'Attualmente non sei ancora dentro alla Lista d\'Imbarco!',
2020-05-10 21:07:51 +02:00
'SEND_LINK_CHAT_DONATORI': 'Ciao %s!\nLa tua NAVE sta finalmente Salpando!\nEntra nella Gift Chat della nave {%s} cliccando qui: %s',
'SEND_LINK_CHAT_SOGNATORE': 'Ciao %s!\nOggi Diventi Sognatore !!! 🎊🎊🎊 Entra nella Gift Chat della nave {%s} cliccando qui: %s',
'ENTRA_GIFT_CHAT': 'Entra nella Gift Chat',
'DATA_PART_NAVE': 'data di Partenza della Nave:',
2020-03-31 20:34:24 +02:00
'SOGNATORE': 'SOGNATORE',
'INTERMEDIO': 'Intermedio',
2020-03-31 20:34:24 +02:00
'MEDIATORE': 'MEDIATORE',
'DONATORI': 'DONATORI',
'RITESSITURA': 'RITESSITURA',
'NAVE COMPLETATA': 'NAVE COMPLETATA',
'Doni Effettuati': 'Doni Effettuati',
'Tutor che affianchèra il Mediatore': 'Tutor che affianchèra il Mediatore',
2020-07-02 22:00:58 +02:00
'APERTURA_CHIUSURA_GIFT_CHAT': '%s: Apertura GIFT CHAT\n%s Chiusura GIFT CHAT\nNota Bene: Hai tempo 3 giorni dall\'apertura per entrare in Chat ed effettuare il tuo Dono, dopodichè effettueremo la sostituzione.',
2020-03-31 20:34:24 +02:00
'Giorno di Apertura GIFT CHAT': 'Giorno di Apertura GIFT CHAT',
2020-07-02 22:00:58 +02:00
'Giorno in cui Inviare il DONO': 'Hai 3 giorni di tempo per inviare il tuo dono.\nGiorno di Chiusura',
2020-05-10 21:07:51 +02:00
'SPOSTATO': 'Sei stato Spostato in una Nuova Nave !',
2020-03-31 20:34:24 +02:00
'Note': 'Note',
'TEMPORANEA': 'TEMPORANEA',
'NAVE': 'NAVE',
2020-04-07 14:34:29 +02:00
'MSG_SEND_FROM': 'Msg Inviato da',
'VUOI_IMBARCARTI': 'Attenzione! Ci risulta che attualmente non ti è stato assegnato <strong>Nessun Imbarco</strong>.\nQuesto può essere dovuto ad un errore durante la fase di aggiornamento del sito, oppure perchè tu stesso hai cancellato l\'imbarco.\n\n<strong>Vuoi Aggiungerti ora al prossimo Imbarco per continuare nel tuo Viaggio in AYNI</strong>? ',
2020-09-04 00:06:49 +02:00
'ZOOM_CONFERMATO': 'Sei stato confermato ad aver visto la Video Conferenza di Benvenuto!',
2020-03-31 20:34:24 +02:00
},
si: {
"Email je že bila preverjena": "Email je že bila preverjenaL'Email è già stata Verificata",
"Nuova Registrazione": "Nova Registracija",
"Effettuata una Nuova Registrazione": "Izpelji novo Registracijo",
"partecipanti": "Udeleženci",
2021-02-18 12:19:35 +01:00
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
2020-05-10 21:07:51 +02:00
'TESTO_ASSISTENZA': "Za vstop na spletno stran:\n%s\n\n" +
2020-12-21 02:16:42 +01:00
"Si pozabil geslo za vstop na stran?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\n" +
"Klepet AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\n" +
"Klepet AYNI - EMPOWER: Vstopi ⛩ v našo Skupnost klepet:\n%s\n\n" +
"Canal News AYNI-BIBLIO:\n%s\n\n" +
"Klepet za Pomoč in Suport: 'AYNI - HELP'\n%s\n" +
"1 - Postavi svoje vprašanje in prosi za asistenco.\n2 - KO si sprejel pomoč, izstopi iz klepeta.\n " +
"Vstopil boš lahko vedno, ko boš potreboval pomoč.",
2020-03-31 20:34:24 +02:00
'BENVENUTO': "Dobrodošel",
'TUE_NAVI': "Tvoje programirane Ladje",
'HAI_I_7_REQUISITI': 'PRVI KORAKI OK!\nIzpolnjuješ Prvih 7 Zahtev za vstop na Listo d\'Vkrcanje!',
'NON_HAI_I_7_REQUISITI': 'Pozor!\nŠe vedno nimaš izpolnjenih 7 Zahtev za vstop na listo\'Vkrcanje!',
'HAI_I_9_REQUISITI': 'ČESTITAMO!\nIzpolnil si VSEH 9 korakov v navodilih! Hvala ker pomagaš k širitvi AYNI !',
'NON_HAI_I_9_REQUISITI': 'Zapomni si, če želiš Pomagati Rasti in Širit Gibanje, lahko to storiš z delitvijo med ljudmi!',
'INFO_LA_MIA_LAVAGNA': '✨ Seznam Krajev: ✨ \n',
2020-05-11 22:43:14 +02:00
'INFO_LAVAGNA_SITO_COMPLETARE': 'Da izpolneš vse zahteve, pojdi na spletno stran:\n%s\nDa pogledaš status svoje Ladje in status svojih povabljencev, klikni na levi strani zgoraj na tri črte in izberi "Tabla".\n👉🏻 <a href="%s">Table</a>',
2020-03-31 20:34:24 +02:00
'INFO_LAVAGNA_SITO': 'Da lahko podrobno pogledaš status svoje Ladje,na spletni strani AYNI, klikni, na levi strani zgoraj, na tri črtice in izberi "Tabla".\n',
2020-04-24 10:29:25 +02:00
'INFO_LINK_DA_CONDIVIDERE': 'Link, ki ga deliš svojim povabljencem, da se lahko registrirajo na spletni strani Ayni:\n\n%s',
'INFO_LINK_ZOOM': 'Link, ki ga deliš za udeležbo na Zoom (Konferenca OnLine):\n%s',
2020-03-31 20:34:24 +02:00
'ZOOM_CONFERENCE': 'Tu najdeš datume prihajajočih Zoom-ov:',
"NON_VERIF": "Ni Preverjena",
"VERIF": "Preverjena",
'EMAIL': "Email",
'BOT': "AYNI BOT",
'EMAIL_NON_VERIF': "Email ni preverjen\npojdi v svoj poštni nabiralnik in najdi**\"Potrditev Registracije na Ayni\"**<br>e klikni na gumb **\"Potrdi Registracijo\"**",
'TELEGRAM_NOT_CONNECTED': "Telegram ni povezan s tvojim računom!",
'NESSUN_INVITATO': 'Nisi povabil nikogar',
'ZOOM_PARTECIPATO': 'Udeležba na vsaj 1 Konferenci (Zoom-u)',
'LINEE_GUIDA': 'Sprejemam pogoje poslovanja',
'VIDEO_INTRO': 'Pogledal sem video AYNI',
'SCRITTO_SOGNO': 'Sem zapisal Sanje',
2020-07-02 22:00:58 +02:00
'PAYMENTS': 'Načini Plačila',
2020-03-31 20:34:24 +02:00
'INVITATI': 'registrirane osebe, ki si povabil',
'INVITATI_ATTIVI': 'Povabljenci s 7 Zahtevami',
'NONREG': 'Neregistrirani povabljenci',
'CLICCA_PER_ZOOM': 'NA DOLOČENO URO IN DATUM, ZA VSTOP V VIDEO KONFERENCO,KLIKNI TU',
'CLICCA_ENTRA': 'KLIKNI TU ZA VSTOP !',
'ZOOM_INIZIATO': 'TA KONFERENCA JE\' PRIČELA!',
2020-04-07 14:34:29 +02:00
'SCEGLI_VOCE': 'Izberi eno možnost:',
2020-03-31 20:34:24 +02:00
'INVITATI_LISTA': 'Tvoji povabljenci (v zelenem, s izpolnjenimi vsaj 7-imi zahtevami)',
'CIAO': 'Zdravo',
'ADDED_TOLISTAINGRESSO': 'Si bil dodan na Seznam oseb, ki bodo vstopile v Listo D\'Vkrcanje !',
'NO_PROG': 'Trenutno še nisi na Listi d\'Vkrcanja!',
'SEND_LINK_CHAT_DONATORI': 'Zdravo %s!\nTvoja LADJA bo končno Izplula!\nVstopi v Darilni (Gift) klepet s klikom tu: %s',
2020-05-10 21:07:51 +02:00
'SEND_LINK_CHAT_SOGNATORE': 'Zdravo %s!\nDanes Postajaš Sanjač !!! 🎊🎊🎊 Vstopi v Darilni Klepet {%s} s klikom tu: %s',
'ENTRA_GIFT_CHAT': 'Vstopi v Darilni Klepet',
'DATA_PART_NAVE': 'Datum odhoda ladje:',
2020-03-31 20:34:24 +02:00
'SOGNATORE': 'Sanjača',
'INTERMEDIO': 'POTNIK',
2020-03-31 20:34:24 +02:00
'MEDIATORE': 'MEDIATOR',
'DONATORI': 'DONATOR',
2020-04-07 14:34:29 +02:00
'RITESSITURA': 'Avtomatičen Vpis',
2020-03-31 20:34:24 +02:00
'NAVE COMPLETATA': 'LADJE DOSTAVLJEN',
'Doni Effettuati': 'Darila narejena',
'Tutor che affianchèra il Mediatore': 'Tutor, ki bo podpiral Mediatorja',
2020-07-02 22:00:58 +02:00
'APERTURA_CHIUSURA_GIFT_CHAT': '%s: Apertura GIFT CHAT\n%s Zapiranje DARILNEGA KLEPETA\nBodi pozoren: Časa imaš 3 dni od odprtja za vstop v Klepet- ladjico in izpeljati svoje Vplačilo, po tem času bomo izvedli zamenjavo',
2020-05-10 21:07:51 +02:00
'SPOSTATO': 'Prestavljen si v Novo Ladjico !',
2020-03-31 20:34:24 +02:00
'Note': 'Opombe',
'TEMPORANEA': 'ZAČASNA',
'NAVE': 'LADJE',
2020-04-07 14:34:29 +02:00
'MSG_SEND_FROM': 'sporočilo, ki ga je poslal',
'VUOI_IMBARCARTI': 'Pozor! Opazili smo, da ti trenutno ni bila dodeljena <strong>Nobena ladjica</strong>.\nTo je lahko posledica napake med fazo posodabljanja spletnega mesta ali ker si sam zbrisal svoj vpis.\n\n<strong>Ali želiš nadaljevati plovbo, če želiš nadaljevati potovanje z AYNI </strong>?',
2020-09-04 00:06:49 +02:00
'ZOOM_CONFERMATO': 'Potrjeno je bilo, da ste videli dobrodošlico video konference!',
},
es: {
2020-03-31 20:34:24 +02:00
"L'Email è già stata Verificata": "El correo electrónico ya ha sido verificado",
"Nuova Registrazione": "Nuevo Registro",
"Effettuata una Nuova Registrazione": "Se ha realizado un nuevo registro",
"partecipanti": "participantes",
2021-02-18 12:19:35 +01:00
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
2020-05-10 21:07:51 +02:00
'TESTO_ASSISTENZA': "Para entrar en el sitio de AYNI:\n%s\n\n" +
2020-12-21 02:16:42 +01:00
"¿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 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..",
2020-03-31 20:34:24 +02:00
'BENVENUTO': "Bienvenido",
'TUE_NAVI': "Aquí están sus naves programadas",
'HAI_I_7_REQUISITI': '¡LOS PRIMEROS PASOS ESTÁN BIEN!\nTiene los primeros 7 requisitos para entrar en la lista de embarque!',
'NON_HAI_I_7_REQUISITI': '¡Atención!\nTodavía no tienes los 7 requisitos para entrar en la lista de embarque!',
'HAI_I_9_REQUISITI': '¡FELICITACIONES!\n¡Has completado los 9 pasos de la Guía! Gracias por ayudar a AYNI a expandirse!',
'NON_HAI_I_9_REQUISITI': 'Recuerda que puedes ayudar a que el Movimiento crezca y se expanda compartiendo nuestro viaje con todos.!',
'INFO_LA_MIA_LAVAGNA': '✨ Lista de pasos: ✨ \n',
2020-05-11 22:43:14 +02:00
'INFO_LAVAGNA_SITO_COMPLETARE': 'Para completar todos los requisitos vaya al sitio:\n%s\nPara ver el estado de su nave y sus invitados,👉🏻 <a href="%s">Pizarra</a>.\n',
2020-03-31 20:34:24 +02:00
'INFO_LAVAGNA_SITO': 'Para ver en detalle el estado de su nave, en el sitio web de AYNI, haga clic en las 3 líneas de la parte superior izquierda y vaya a "Pizarra"..\n',
2020-04-24 10:29:25 +02:00
'INFO_LINK_DA_CONDIVIDERE': 'Enlaces para compartir con sus invitados para que se registren en el sitio web de Ayni:\n\n%s',
'INFO_LINK_ZOOM': 'Enlaces para compartir para participar en el Zoom (Conferencia en línea):\n%s',
2020-03-31 20:34:24 +02:00
'ZOOM_CONFERENCE': 'Aquí puedes encontrar las fechas de programación en el Zoom:',
"NON_VERIF": "No verificado",
"VERIF": "Verificado",
'EMAIL': "Email",
'BOT': "AYNI BOT",
2020-03-31 20:34:24 +02:00
'EMAIL_NON_VERIF': "Correo electrónico no verificado\nlea su buzón y encuentre **\"Confirmar Registro a Ayni \"** <marca>y haga clic en el botón **\"Verificar Registro \"**.",
'TELEGRAM_NOT_CONNECTED': "Telegram no asociado a su cuenta!",
'NESSUN_INVITATO': 'No invitaste a nadie',
'ZOOM_PARTECIPATO': 'Participación en al menos 1 Conferencia (Zoom)',
'LINEE_GUIDA': 'Directrices aceptadas',
'VIDEO_INTRO': 'Ver el video de AYNI',
'SCRITTO_SOGNO': 'Escribiste tu sueño',
2020-07-02 22:00:58 +02:00
'PAYMENTS': 'Métodos de pago',
2020-03-31 20:34:24 +02:00
'INVITATI': 'las personas registradas que usted invitó',
'INVITATI_ATTIVI': 'Invitado con los 7 requisitos',
'NONREG': 'Invitados no registrados',
'CLICCA_PER_ZOOM': 'AL DÍA Y HORA INDICADOS, PARA ENTRAR EN LA VIDEOCONFERENCIA, PULSE AQUÍ',
'CLICCA_ENTRA': 'HAGA CLIC AQUÍ PARA ENTRAR !',
'ZOOM_INIZIATO': 'ESTA CONFERENCIA HA COMENZADO!',
'SCEGLI_VOCE': 'elegir una voz:',
'INVITATI_LISTA': 'Sus invitados (en verde con al menos los 7 primeros requisitos)',
'CIAO': 'Hola',
'ADDED_TOLISTAINGRESSO': 'Has sido añadido a la lista de personas que entrarán en Lista de embarque!',
2020-03-31 20:34:24 +02:00
'NO_PROG': 'Actualmente no está en la lista de embarque.!',
'SEND_LINK_CHAT_DONATORI': 'Hola %s!\n¡Tu barco por fin está navegando!\nEntra en el Gift Chat haciendo clic aquí: %s',
2020-05-10 21:07:51 +02:00
'SEND_LINK_CHAT_SOGNATORE': '¡Hola!\n¡Hoy te conviertes en un soñador! 🎊🎊🎊 Entre en el Chat de Regalos de la nave {%s} haciendo clic aquí: %s',
'ENTRA_GIFT_CHAT': 'Entre en el Chat de Regalos',
'DATA_PART_NAVE': 'fecha de salida de la nave:',
2020-03-31 20:34:24 +02:00
'SOGNATORE': 'SOÑADOR',
'INTERMEDIO': 'Intermedio',
2020-03-31 20:34:24 +02:00
'MEDIATORE': 'MEDIATOR',
'DONATORI': 'DONANTES',
'RITESSITURA': 'RETEJIDO',
'NAVE COMPLETATA': 'NAVE COMPLETADA',
'Doni Effettuati': 'Regalos Realizados',
'Tutor che affianchèra il Mediatore': 'Tutor de apoyo al Donante',
2020-07-02 22:00:58 +02:00
'APERTURA_CHIUSURA_GIFT_CHAT': '%s: Apertura del CHAT DE REGALOS\n%s Cierre del CHAT DE REGALOS\nNota: Tienes 3 días desde la apertura para entrar en el Chat y hacer tu Regalo, después de lo cual haremos el reemplazo',
2020-05-10 21:07:51 +02:00
'SPOSTATO': 'Has sido trasladado a una nueva nave !',
2020-03-31 20:34:24 +02:00
'Note': 'Notas',
'TEMPORANEA': 'TEMPORAL',
'NAVE': 'NAVE',
2020-04-07 14:34:29 +02:00
'MSG_SEND_FROM': 'Mensaje enviado por',
'VUOI_IMBARCARTI': '¡Atención! Entendemos que actualmente no está asignado a <strong>No Boarding</strong>.\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?',
2020-09-04 00:06:49 +02:00
'ZOOM_CONFERMATO': '¡Se ha confirmado que ha visto la Video Conferencia de Bienvenida!',
},
2020-03-31 20:34:24 +02:00
enUs: {
"partecipanti": "participants",
2021-02-18 12:19:35 +01:00
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
2020-05-10 21:07:51 +02:00
'TESTO_ASSISTENZA': "To enter the AYNI Site:\n%s\n\nForgot your password to access the site?\n" +
2020-12-21 02:16:42 +01:00
"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 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.",
2020-03-31 20:34:24 +02:00
'BENVENUTO': "Welcome",
'TUE_NAVI': "Here are your programmed ships",
'HAI_I_7_REQUISITI': 'FIRST STEPS OK!\nYou have the First 7 Requirements to Enter the Boarding List!',
'NON_HAI_I_7_REQUISITI': 'Attention!\nYou still do not have the 7 requirements to enter the boarding list!',
'HAI_I_9_REQUISITI': 'CONGRATULATIONS!\nYou have completed ALL 9 steps of the Guide! Thank you for Helping AYNI Expand!',
'NON_HAI_I_9_REQUISITI': 'Remember that you can help the Movement grow and expand by sharing our journey with everyone.!',
'INFO_LA_MIA_LAVAGNA': '✨ Step List: ✨ \n',
2020-05-11 22:43:14 +02:00
'INFO_LAVAGNA_SITO_COMPLETARE': 'To complete all the requirements go to the site:%s\nTo see the status of your Ship and your guests\n👉🏻 <a href="%s">Dashboard</a>\n',
2020-03-31 20:34:24 +02:00
'INFO_LAVAGNA_SITO': 'To see in detail the status of your ship, on the AYNI website, click on the 3 lines at the top left and go to "Blackboard".\n',
2020-04-24 10:29:25 +02:00
'INFO_LINK_DA_CONDIVIDERE': 'Links to share with your guests to have them register on Ayni\'s website:\n\n%s',
'INFO_LINK_ZOOM': 'Links to share to participate in Zoom (Online Conference):\n%s',
2020-03-31 20:34:24 +02:00
'ZOOM_CONFERENCE': 'Here you can find the Zoom Conference Planning:',
"NON_VERIF": "Not Verified",
"VERIF": "Verified",
'EMAIL': "Email",
'BOT': "AYNI BOT",
'EMAIL_NON_VERIF': "Email Not Verified\nread your mailbox and find **\"Confirm Registration to Ayni \"**<br>and click on the button **\"Verify Registration \"**.",
'TELEGRAM_NOT_CONNECTED': "Telegram not associated with your account!",
'NESSUN_INVITATO': 'You didn\'t invite anyone',
'ZOOM_PARTECIPATO': 'Participation in at least 1 Conference (Zoom)',
'LINEE_GUIDA': 'Guidelines Accepted',
'VIDEO_INTRO': 'Seen the AYNI Video',
'SCRITTO_SOGNO': 'You wrote your Dream',
2020-07-02 22:00:58 +02:00
'PAYMENTS': 'Methods of Payment',
2020-03-31 20:34:24 +02:00
'INVITATI': 'registered people you invited',
'INVITATI_ATTIVI': 'Guests with the 7 Requirements',
'NONREG': 'Non-registered Guests',
'CLICCA_PER_ZOOM': 'TO THE DAY AND TIME INDICATED, TO ENTER THE VIDEO-CONFERENCE, CLICK HERE',
'CLICCA_ENTRA': 'CLICK HERE TO ENTER !',
'ZOOM_INIZIATO': 'THIS CONFERENCE HAS BEGUN!',
'SCEGLI_VOCE': 'choose a menu item:',
'INVITATI_LISTA': 'Your Guests (in green with at least the first 7 requirements)',
'CIAO': 'Hi',
'ADDED_TOLISTAINGRESSO': 'You have been added to the List of people who will enter the Boarding List!',
'NO_PROG': 'You are not currently on the boarding list.!',
'SEND_LINK_CHAT_DONATORI': 'Hi %s!\nYour ship is finally sailing!\nEnter the Gift Chat by clicking here: %s',
2020-05-10 21:07:51 +02:00
'SEND_LINK_CHAT_SOGNATORE': 'Hello %s!\nToday you become a Dreamer! 🎊🎊🎊 Enter the ship\'s Gift Chat {%s} by clicking here: %s',
'ENTRA_GIFT_CHAT': 'Enter the ship\'s Gift Chat',
'DATA_PART_NAVE': 'date of departure of the ship:',
2020-03-31 20:34:24 +02:00
'SOGNATORE': 'DREAMER',
'INTERMEDIO': 'Intermediate',
2020-03-31 20:34:24 +02:00
'MEDIATORE': 'MEDIATOR',
'DONATORI': 'DONOR',
'RITESSITURA': 'RE-ENTER',
'NAVE COMPLETATA': 'SHIP COMPLETED',
'Doni Effettuati': 'Gifts Made',
'Tutor che affianchèra il Mediatore': 'Tutor supporting the Mediator',
2020-07-02 22:00:58 +02:00
'APERTURA_CHIUSURA_GIFT_CHAT': '%s: Opening GIFT CHAT\n%s Closing GIFT CHAT\nNote: You have 3 days from the opening to enter the Chat and make your Gift, after which we will make the replacement.',
2020-05-10 21:07:51 +02:00
'SPOSTATO': 'You\'ve been moved to a New Ship !',
2020-03-31 20:34:24 +02:00
'Note': 'Note',
'TEMPORANEA': 'TEMPORARY',
'NAVE': 'SHIP',
2020-04-07 14:34:29 +02:00
'MSG_SEND_FROM': 'Msg sent by',
'VUOI_IMBARCARTI': 'Attention! We understand that you have <strong>No Boarding</strong> assigned.\nThis may be due to an error during the site update phase, or because you have cancelled boarding yourself.\n\n<strong>Do you want to add now to the Next Boarding to continue your AYNI Trip</strong>?',
2020-09-04 00:06:49 +02:00
'ZOOM_CONFERMATO': 'You have been confirmed to have seen the Welcome Video Conference!',
2020-03-31 20:34:24 +02:00
},
fr: {
"L'Email è già stata Verificata": "Le courrier électronique a déjà été vérifié",
"Nuova Registrazione": "Nouvelle inscription",
"Effettuata una Nuova Registrazione": "Un nouvel enregistrement a été effectué",
"partecipanti": "participants",
2021-02-18 12:19:35 +01:00
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
2020-05-10 21:07:51 +02:00
'TESTO_ASSISTENZA': "Pour entrer sur le site AYNI:\n%s\n\n" +
2020-12-21 02:16:42 +01:00
"Vous avez oublié votre mot de passe pour accéder au site ?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\n" +
"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 dAide 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 laide, quittez le groupe.\nVous pourrez y entrer chaque fois quil vous sera nécessaire.",
2020-03-31 20:34:24 +02:00
'BENVENUTO': "Bienvenue",
'TUE_NAVI': "Voici vos navires programmés",
'HAI_I_7_REQUISITI': 'PREMIÈRES ÉTAPES OK!\nvous avez les 7 premiers Requis pour Entrer dans la liste d\'embarquement!',
'NON_HAI_I_7_REQUISITI': '\'Attention!\nVous ne remplissez pas encore les 7 conditions pour figurer sur la liste d\'embarquement!',
'HAI_I_9_REQUISITI': 'FÉLICITATIONS!\n!Vous avez franchi les 9 étapes de la conduite ! Merci d\'avoir aidé AYNI à se développer!',
'NON_HAI_I_9_REQUISITI': 'N\'oubliez pas que vous pouvez aider le Mouvement à grandir et à se développer en partageant notre voyage avec tout le monde.!',
'INFO_LA_MIA_LAVAGNA': '✨ Liste des étapes: ✨ \n',
2020-05-11 22:43:14 +02:00
'INFO_LAVAGNA_SITO_COMPLETARE': 'Pour remplir toutes les conditions, rendez-vous sur le site:\n%s\nPour voir le statut de votre navire et de vos invités\n 👉🏻 <a href="%s">Tableau</a>.\n',
'INFO_LAVAGNA_SITO': 'Pour voir en détail le statut de votre navire, sur le site de l\'AYNI, cliquez sur les 3 lignes en haut à gauche et allez sur "Tableau".\n',
2020-04-24 10:29:25 +02:00
'INFO_LINK_DA_CONDIVIDERE': 'Liens à partager avec vos invités pour qu\'ils s\'inscrivent sur le site web d\'Ayni:\n\n%s',
'INFO_LINK_ZOOM': 'Liens à partager pour participer à Zoom (Conférence en ligne):\n%s',
2020-03-31 20:34:24 +02:00
'ZOOM_CONFERENCE': 'Vous trouverez ici les dates de programmation sur Zoom:',
"NON_VERIF": "Non vérifié",
"VERIF": "Vérifié",
'EMAIL': "Courriel",
'BOT': "AYNI BOT",
'EMAIL_NON_VERIF': "Courriel non vérifié\nlisez votre boîte aux lettres et trouvez **\"Confirmer l'inscription à Ayni \"**<br>et cliquez sur le bouton **\"Vérifier l'inscription \"**.",
'TELEGRAM_NOT_CONNECTED': "Télégramme non associé à votre compte!",
'NESSUN_INVITATO': 'Vous n\'avez invité personne',
'ZOOM_PARTECIPATO': 'Participation à au moins 1 conférence (Zoom)',
'LINEE_GUIDA': 'Lignes directrices acceptées',
'VIDEO_INTRO': 'Voir la vidéo AYNI',
'SCRITTO_SOGNO': 'Vous avez écrit votre rêve',
2020-07-02 22:00:58 +02:00
'PAYMENTS': 'Modes de paiement',
2020-03-31 20:34:24 +02:00
'INVITATI': 'personnes inscrites que vous avez invitées',
'INVITATI_ATTIVI': 'Invité avec les 7 exigences',
'NONREG': 'Invités non enregistrés',
'CLICCA_PER_ZOOM': 'AU JOUR ET À L\'HEURE INDIQUÉS, POUR ENTRER DANS LA VIDÉOCONFÉRENCE, CLIQUEZ ICI',
'CLICCA_ENTRA': 'CLIQUEZ ICI POUR ENTRER !',
'ZOOM_INIZIATO': 'CETTE CONFÉRENCE A COMMENCÉ!',
'SCEGLI_VOCE': 'choisir une voix:',
'INVITATI_LISTA': 'Vos invités (en vert avec au moins les 7 premières exigences)',
'CIAO': 'Salut',
'ADDED_TOLISTAINGRESSO': 'Vous avez été ajouté à la liste d\'embarquement !',
'NO_PROG': 'Vous n\'êtes pas encore sur la liste d\'embarquement.!',
'SEND_LINK_CHAT_DONATORI': 'Salut %s!\nVotre SHIP prend enfin la mer.!\nEntrez dans le Chat Cadeau en cliquant ici: %s',
2020-05-10 21:07:51 +02:00
'SEND_LINK_CHAT_SOGNATORE': 'Bonjour %s !\nAujourd\'hui, vous devenez un Rêveur ! 🎊🎊🎊 Entrez dans le chat des cadeaux du navire {%s} en cliquant ici : %s',
'ENTRA_GIFT_CHAT': 'Entrez dans le chat des cadeaux',
'DATA_PART_NAVE': 'la date de départ du navire:',
2020-03-31 20:34:24 +02:00
'SOGNATORE': 'Rêveur',
'INTERMEDIO': 'Intermediaire',
2020-03-31 20:34:24 +02:00
'MEDIATORE': 'Médiateur',
'DONATORI': 'DONATEUR',
'RITESSITURA': 'RETESSITURA',
'NAVE COMPLETATA': 'NAVIRE COMPLÉTÉ',
'Doni Effettuati': 'Don effectués',
'Tutor che affianchèra il Mediatore': 'Le tuteur qui soutient le Mediateur',
2020-07-02 22:00:58 +02:00
'APERTURA_CHIUSURA_GIFT_CHAT': '%s : Chat d\'ouverture\n%s Clôture du GIFT CHAT\nNote: Vous avez 3 jours à partir de l\'ouverture pour entrer dans le Chat et faire votre Cadeau, après quoi nous ferons le remplacement',
2020-05-10 21:07:51 +02:00
'SPOSTATO': 'Vous avez été transféré sur un nouveau navire !',
2020-03-31 20:34:24 +02:00
'Note': 'Notes',
'TEMPORANEA': 'TEMPORAIRE',
'NAVE': 'NAVIRE',
2020-04-07 14:34:29 +02:00
'MSG_SEND_FROM': 'Message envoyé par',
'VUOI_IMBARCARTI': 'Attention ! Nous comprenons que vous n\'êtes actuellement pas affecté <strong>Pas d\'embarquement</strong>.\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\n<strong>Voulez-vous vous ajouter maintenant au prochain embarquement pour continuer votre voyage AYNI</strong> ? ',
2020-09-04 00:06:49 +02:00
'ZOOM_CONFERMATO': 'Vous avez été confirmé comme ayant vu la vidéoconférence de bienvenue !',
2020-03-31 20:34:24 +02:00
},
pt: {
"L'Email è già stata Verificata": "",
2020-05-04 19:34:41 +02:00
"Nuova Registrazione": "Novo Registo",
"Effettuata una Nuova Registrazione": "Foi efectuado um novo registo",
"partecipanti": "participantes",
2021-02-18 12:19:35 +01:00
"partecipanti a Pranzo": "partecipanti a Pranzo",
"partecipanti a Cena": "partecipanti a Cena",
2020-05-10 21:07:51 +02:00
'TESTO_ASSISTENZA': "Para entrar no site do AYNI:\n%s\n\n" +
2020-12-21 02:16:42 +01:00
"Esqueceu sua senha para acessar o site?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\n" +
"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 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..",
2020-05-04 19:34:41 +02:00
'BENVENUTO': "Bem-vindo",
'TUE_NAVI': "Aqui estão os seus navios programados",
'HAI_I_7_REQUISITI': 'PRIMEIROS PASSOS OK!\nVocê tem os 7 primeiros requisitos para entrar na lista de embarque!',
'NON_HAI_I_7_REQUISITI': 'Atenção!\nVocê ainda não tem os 7 requisitos para entrar na lista de embarque!',
'HAI_I_9_REQUISITI': 'FELICITAÇÕES!\nVocê completou TODAS as 9 etapas da condução! Obrigado por ajudar a AYNI a expandir!',
'NON_HAI_I_9_REQUISITI': 'Lembre-se que pode ajudar o Movimento a crescer e expandir-se, partilhando a nossa jornada com todos!',
'INFO_LA_MIA_LAVAGNA': '✨ Lista de etapas: ✨ \n',
2020-05-11 22:43:14 +02:00
'INFO_LAVAGNA_SITO_COMPLETARE': 'Para completar todos os requisitos ir para o sitio:\n%s\nPara ver o estado do seu navio e dos seus convidados:\n 👉🏻 <a href="%s">Entre no seu Tablero</a>.\n',
2020-05-04 19:34:41 +02:00
'INFO_LAVAGNA_SITO': 'Para ver em detalhe o estado do seu navio, no site da AYNI, clique nas 3 linhas no canto superior esquerdo e vá para "DashBoard"..\n',
'INFO_LINK_DA_CONDIVIDERE': 'Links para partilhar com os seus convidados para que se registem no website da Ayni:\n\n%s',
'INFO_LINK_ZOOM': 'Links para partilhar para participar na Zoom (Conferência Online):\n%s',
'ZOOM_CONFERENCE': 'Aqui está o programa das Conferências (Zoom) aberto a TODOS:',
"NON_VERIF": "Não verificado",
"VERIF": "Verificado",
'EMAIL': "Email",
'BOT': "AYNI BOT",
2020-05-04 19:34:41 +02:00
'EMAIL_NON_VERIF': "Email Não verificado\nleia a sua caixa de correio e encontre **\"Confirmar o registo à Ayni\"**<br>e clique no botão **\"Verificação do registo\"**",
'TELEGRAM_NOT_CONNECTED': "Telegrama não associado à sua conta!",
'NESSUN_INVITATO': 'Você não convidou ninguém',
'ZOOM_PARTECIPATO': 'Participação em pelo menos 1 Conferência (Zoom)',
'LINEE_GUIDA': 'Directrizes Aceites',
'VIDEO_INTRO': 'Ver o vídeo do AYNI',
'SCRITTO_SOGNO': 'Você escreveu o seu sonho',
2020-07-02 22:00:58 +02:00
'PAYMENTS': 'Formas de pagamento',
2020-05-04 19:34:41 +02:00
'INVITATI': 'pessoas registadas que convidou',
'INVITATI_ATTIVI': 'Convidado com os 7 Requisitos',
'NONREG': 'Convidados não registados',
'CLICCA_PER_ZOOM': 'PARA O DIA E HORA INDICADOS, PARA ENTRAR NA VÍDEO-CONFERÊNCIA, CLIQUE AQUI',
'CLICCA_ENTRA': 'CLIQUE AQUI PARA ENTRAR !',
'ZOOM_INIZIATO': 'ESTA CONFERÊNCIA JÁ COMEÇOU!',
'SCEGLI_VOCE': 'escolha uma voz:',
'INVITATI_LISTA': 'Os seus convidados (em verde com, pelo menos, os 7 primeiros requisitos)',
'CIAO': 'Olá',
'ADDED_TOLISTAINGRESSO': 'Foi acrescentado à Lista de Embarque !',
'NO_PROG': 'Actualmente, ainda não consta da lista de embarque.!',
'SEND_LINK_CHAT_DONATORI': 'Olà %s!\nO seu SHIP está finalmente a zarpar.!\nEntre no Gift Chat, clicando aqui: %s',
2020-05-10 21:07:51 +02:00
'SEND_LINK_CHAT_SOGNATORE': 'Olá %s!\nHoje você se torna um sonhador! 🎊🎊🎊 Entre no Gift Chat do navio {%s} clicando aqui: %s',
'ENTRA_GIFT_CHAT': 'Entre no Gift Chat do navio',
'DATA_PART_NAVE': 'data de partida do navio:',
2020-03-31 20:34:24 +02:00
'SOGNATORE': 'SONHEIROS',
'INTERMEDIO': 'Intermediar',
2020-03-31 20:34:24 +02:00
'MEDIATORE': 'MEDIATOR',
'DONATORI': 'DONATORES',
'RITESSITURA': 'ENTRE EM',
'NAVE COMPLETATA': 'NAVIO COMPLETADO',
'Doni Effettuati': 'Regalo Feitos',
'Tutor che affianchèra il Mediatore': 'Tutor que apoia o Mediator',
2020-07-02 22:00:58 +02:00
'APERTURA_CHIUSURA_GIFT_CHAT': '%s: Abertura do GIFT CHAT\n%s Fechamento GIFT CHAT\nNota: Você tem 3 dias desde a abertura para entrar no Chat e fazer o seu Presente, depois do qual faremos o substituição.',
2020-05-10 21:07:51 +02:00
'SPOSTATO': 'Você foi transferido para um novo navio !',
2020-03-31 20:34:24 +02:00
'Note': 'Notas',
'TEMPORANEA': 'TEMPORÁRIO',
'NAVE': 'NAVE',
2020-04-07 14:34:29 +02:00
'MSG_SEND_FROM': 'Mensagem enviada por',
'VUOI_IMBARCARTI': 'Atenção! Compreendemos que actualmente não lhe é atribuído <strong>Sem Embarque</strong>.\nIsto pode ser devido a um erro durante a fase de actualização do site, ou porque você mesmo cancelou o embarque.\n\n<strong>Deseja juntar-se agora ao próximo embarque para continuar a sua viagem AYNI</strong>?',
2020-09-04 00:06:49 +02:00
'ZOOM_CONFERMATO': 'Foi-lhe confirmado que assistiu à Conferência de Vídeo de Boas-vindas!',
2020-03-31 20:34:24 +02:00
},
};
2018-12-24 20:31:02 +01:00
module.exports = {
MYAPPS: [],
INITDB_FIRSTIME: true,
ACAPO: '\n',
ENABLE_CRONTAB: 'CRONTAB',
UPDATE_GRADUATORIA: 'UPDATE_GRAD',
LANGADMIN: 'it',
AYNI: '7',
2021-02-24 04:48:31 +01:00
CNM: '10',
2020-07-02 22:00:58 +02:00
HELP_CHAT: 'https://t.me/joinchat/AL2qKE80rxDkgbeMGO-0bw',
TYPECONF_ZOOM: 'zoom',
TYPECONF_JITSI: 'jitsi',
APORTADOR_NONE: '------',
TYPE_PROJECT: 1,
TYPE_TODO: 2,
TipoMsg: {
SEND_LINK_CHAT_DONATORI: 1,
2020-03-25 09:25:31 +01:00
SEND_MSG: 2,
SEND_MSG_SINGOLO: 3,
2020-04-24 10:29:25 +02:00
SEND_TO_ALL: 10,
SEND_MSG_EFFETTUA_IL_DONO: 1000,
SEND_MSG_SOLLECITO_DONATORI_NO_DONO: 1005,
SEND_MSG_A_MEDIATORI: 1010,
SEND_MSG_A_SOGNATORE: 1020,
SEND_MSG_A_UTENTE_SOSTITUITO: 1030,
SEND_MSG_DONO_RICEVUTO_CORRETTAMENTE: 1040,
2020-07-02 22:00:58 +02:00
SEND_MSG_DONO_NON_RICEVUTO: 1050,
},
Placca: {
DONATORI: 1,
TUTTI: 2,
2020-05-11 22:43:14 +02:00
STR_SOGNATORE: '<strong>Sognatore</strong>',
STR_MEDIATORE: '<strong>Mediatore</strong>',
STR_MEDIATORI: '<strong>Mediatori</strong>',
STR_DONATORI: '<strong>Donatori</strong>',
SOGNATORE: 'E1 🌈 ',
MEDIATORE: 'A1 💦 ',
SONOFUOCO: 0,
SONOACQUA: 3,
2020-03-21 10:28:26 +01:00
SONOTERRA: 2,
SONOARIA: 1,
},
FieldType: {
boolean: 1,
date: 2,
string: 4,
binary: 8,
html: 16,
select: 32,
number: 64,
typeinrec: 128,
multiselect: 256,
password: 512,
listimages: 1024,
2020-04-07 14:34:29 +02:00
exact: 2048,
2021-02-18 12:19:35 +01:00
image: 3000,
nationality: 4096,
intcode: 5000,
multioption: 6000,
onlydate: 7000,
hours: 8000
},
MAX_PHASES: 5,
FIRST_PROJ: '__PROJECTS',
EXECUTE_CALCPROJ: true,
gettranslate(text, lang) {
try {
return textlang[lang][text]
2020-01-21 01:37:15 +01:00
} catch (e) {
return textlang['it'][text]
}
},
2020-03-31 20:34:24 +02:00
getlangbyres(res) {
// ++Todo: res estrarre la lingua
let lang = '';
try {
lang = res.lang
} catch (e) {
}
if (!lang) {
lang = 'it';
}
return lang
},
get__(text, lang) {
try {
return textlang[lang][text]
2020-01-21 01:37:15 +01:00
} catch (e) {
return textlang['it'][text]
}
},
getres__(text, res) {
2020-04-07 14:34:29 +02:00
let lang = this.getlangbyres(res);
try {
return textlang[lang][text]
2020-01-21 01:37:15 +01:00
} catch (e) {
return textlang['it'][text]
}
},
2018-12-24 20:31:02 +01:00
getHostname: function () {
return os.hostname()
},
testing: function () {
return (process.env.TESTING_ON === '1')
},
mylog: function (...args) {
if (!this.testing())
console.log(args)
},
mylogoff: function (...args) {
// doing nothing
},
mylogshow: function (...args) {
console.log(args)
},
2019-02-13 18:47:58 +01:00
mylogserr: function (...args) {
console.error(args)
},
allfieldSendMsg: function () {
return ['userId', 'source', 'dest', 'message', 'datemsg', 'read', 'deleted', 'origin', 'idapp', 'status', 'options']
},
allfieldTodo: function () {
2021-03-30 02:23:38 +02:00
return ['userId', 'pos', 'category', 'descr', 'note', 'priority', 'statustodo', 'assignedToUsers', 'created_at', 'groupId', 'modify_at',
2021-02-11 02:20:35 +01:00
'completed_at', 'expiring_at', 'enableExpiring', 'progress', 'modified', 'phase', 'assigned_to_userId', 'assignedToUsers', 'hoursplanned', 'hoursworked', 'start_date', 'themecolor', 'themebgcolor']
},
allfieldMyEvent: function () {
return ['userId',]
},
allfieldTodoWithId: function () {
return ['_id', ...this.allfieldTodo()]
},
2019-03-28 12:58:58 +01:00
// #TODO Projects++ Add fields ...
allfieldProject: function () {
return ['idapp', 'userId', 'respUsername', 'viceRespUsername', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'groupId', 'hoursplanned', 'hoursleft', 'themecolor', 'themebgcolor', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
2021-03-17 02:24:11 +01:00
, 'privacyread', 'privacywrite', 'tipovisu', 'view']
},
allfieldBooking: function () {
return ['idapp', 'userId', 'id_bookedevent', 'numpeople', 'numpeopleLunch', 'numpeopleDinner', 'numpeopleDinnerShared', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
},
allfieldBookingChange: function () {
return ['numpeople', 'numpeopleLunch', 'numpeopleDinner', 'numpeopleDinnerShared', 'msgbooking', 'modified', 'infoevent', 'datebooked', 'booked']
2019-03-28 12:58:58 +01:00
},
allfieldProjectWithId: function () {
return ['_id', ...this.allfieldProject()]
},
jsonCopy(src) {
return JSON.parse(JSON.stringify(src))
},
CloneRecordToNew(src) {
const myrec = Object.assign({}, src);
delete myrec._doc['_id'];
myrec._id = new ObjectID();
return myrec._doc
},
sendBackNotif: function (subscription, payload) {
2019-02-13 18:47:58 +01:00
console.log('sendBackNotif:', subscription, payload);
// Pass object into sendNotification
2020-04-24 10:29:25 +02:00
return webpush.sendNotification(subscription, JSON.stringify(payload))
.catch(err => {
if (err.statusCode === 410) {
// Gone: is not valid anymore (Expired probably!), so I have to delete from my db
return Subscription.findOneAndRemove({ _id: subscription._id })
} else {
console.log('Subscription is no longer valid: ', err);
}
})
2020-04-24 10:29:25 +02:00
.then(ris => {
// console.log('ris', ris)
})
.catch(err => console.error(err))
},
2020-04-24 10:29:25 +02:00
sendNotificationToUser: function (userId, title, content, openUrl, openUrl2, tag, actions) {
let payload = {
2020-04-24 10:29:25 +02:00
actions,
title: title,
2020-04-24 10:29:25 +02:00
content,
url: openUrl,
2020-04-24 10:29:25 +02:00
url2: openUrl2,
tag,
// ttl: req.body.ttl,
// icon: req.body.icon,
// image: req.body.image,
// badge: req.body.badge,
// tag: req.body.tag
};
return Subscription.find({ userId }, (err, subscriptions) => {
if (err) {
console.error(`Error occurred while getting subscriptions`);
// res.status(500).json({
// error: 'Technical error occurred'
// });
//++ Rimuovi questo record !?
return false;
} else {
let conta = 0;
let parallelSubscriptionCalls = subscriptions.map((subscription) => {
const trovati = subscriptions.length;
return new Promise((resolve, reject) => {
const pushSubscription = {
endpoint: subscription.endpoint,
keys: {
p256dh: subscription.keys.p256dh,
auth: subscription.keys.auth
}
};
conta++;
const parse = require('url-parse');
const parsedUrl = parse(subscription.endpoint);
const audience = parsedUrl.protocol + '//' + parsedUrl.hostname;
const vapidHeaders = webpush.getVapidHeaders(
audience,
process.env.URLBASE_APP1,
process.env.PUBLIC_VAPI_KEY,
process.env.PRIVATE_VAPI_KEY,
'aes128gcm'
);
const pushOptions = {
vapidDetails: {
subject: process.env.URLBASE_APP1,
privateKey: process.env.PRIVATE_VAPI_KEY,
publicKey: process.env.PUBLIC_VAPI_KEY,
},
TTL: payload.ttl,
headers: vapidHeaders
};
console.log('************ INVIO WEBPUSH.SENDNOTIFICATION N° ', conta, '/', trovati, 'A', subscription.browser);
// console.log('vapidDetails', pushOptions.vapidDetails);
2020-04-24 10:29:25 +02:00
// payload.title = process.env.URLBASE_APP1 + ' Msg n° ' + conta + '/' + trovati;
// payload.message += subscription.browser ;
const pushPayload = JSON.stringify(payload);
// console.log('A1) SUBS: pushSubscription', pushSubscription);
// console.log('A2) OPZIONI: pushOptions', pushOptions);
// console.log('A3) MSG_TO_SEND: pushPayload', pushPayload);
webpush.sendNotification(
pushSubscription,
pushPayload,
// pushOptions
).then((value) => {
resolve({
status: true,
endpoint: subscription.endpoint,
data: value
});
}).catch((err) => {
reject({
status: false,
endpoint: subscription.endpoint,
data: err
});
});
}).catch(error => {
2019-03-04 17:28:41 +01:00
console.log('ERROR: sendNotificationToUser', error.data.body)
});
});
// q.allSettled(parallelSubscriptionCalls).then((pushResults) => {
// console.info(pushResults);
// });
// res.json({
// data: 'Push triggered'
// });
return true;
}
});
},
// **********************
// SORT WITH PREV_ID
// **********************
/* mapSort: function (linkedList) {
let sortedList = [];
let remainingList = [];
var map = new Map();
var currentId = null;
// console.log('linkedList', linkedList);
// index the linked list by previous_item_id
for (var i = 0; i < linkedList.length; i++) {
var item = linkedList[i];
if (item.id_prev === server_constants.LIST_START) {
// first item
currentId = item._id.toString();
// console.log('currentId', currentId);
sortedList.push(item);
} else {
map.set(item.id_prev.toString(), i);
}
}
let conta = 0;
while (conta < linkedList.length) {
// get the item with a previous item ID referencing the current item
var nextItem = linkedList[map.get(currentId)];
if (nextItem === undefined) {
} else {
sortedList.push(nextItem);
currentId = nextItem._id.toString();
}
conta++;
}
if (linkedList.length > sortedList.length) {
// If are not in the list, I'll put at the bottom of the list
// console.log('ATTENZIONE !!! ', sortedList.length, linkedList.length);
for (const itemlinked of linkedList) {
const elemtrov = sortedList.find((item) => item._id === itemlinked._id);
if (elemtrov === undefined) {
sortedList.push(itemlinked);
}
}
}
// console.log('DOPO sortedList', sortedList);
return sortedList;
},
*/
2021-03-17 02:24:11 +01:00
sendNotifToAdmin(title, msg, tag = '') {
const { User } = require('../models/user');
// console.log('nomeapp 1: ' , this.getNomeAppByIdApp(1));
// console.log('nomeapp 2: ' , this.getNomeAppByIdApp(2));
2021-03-17 02:24:11 +01:00
User.find({ username: 'paoloarcnm' }).then((arrusers) => {
if (arrusers !== null) {
for (const user of arrusers) {
this.sendNotificationToUser(user._id, title, msg, '/', '', tag, [])
.then(ris => {
if (ris) {
} else {
// already sent the error on calling sendNotificationToUser
}
})
}
}
});
},
checkUserOk(userpassed, userauth, res) {
this.mylog('checkUserOk', userpassed, userauth);
if (String(userpassed) !== String(userauth)) {
// I'm trying to write something not mine!
this.mylog('userId = ', userpassed, 'req.user._id', userauth);
return { exit: true, ret: res.status(404).send({ code: server_constants.RIS_CODE_TODO_CREATING_NOTMYUSER }) }
} else {
return { exit: false, ret: false }
}
},
convertHTMLtoText(myhtml) {
let msg = myhtml;
msg = msg.replace('&quot;', '"');
msg = msg.replace('&gt;', '>');
msg = msg.replace('&lt;', '<');
msg = msg.replace('&amp;', '&');
msg = msg.replace('<br>', '\n');
return msg
},
convertTexttoHtml(myhtml) {
// let msg = myhtml;
// msg = msg.replace('\n', '<br>');
// return msg
return myhtml;
},
removeSpecialCharForEmail(myhtml) {
let msg = myhtml;
msg = msg.replace(/"/g, '\'');
return msg
},
getNomeAppByIdApp: function (idapp) {
const myapp =
this.getApps().find(item => item.idapp === idapp);
if (myapp)
return myapp.name;
else
return '';
},
getHostByIdApp: function (idapp) {
const myapp =
this.getApps().find(item => item.idapp === idapp);
if (myapp) {
let siteport = (myapp.portapp !== "0") ? (':' + myapp.portapp) : "";
return myapp.host + siteport;
} else
return '';
},
isAbilitaNave: function (idapp) {
const myapp = this.getApps().find(item => item.idapp === idapp);
return myapp.abilitanave;
},
getdirByIdApp: function (idapp) {
const myapp =
this.getApps().find(item => item.idapp === idapp);
if (myapp) {
return myapp.dir;
} else
return '';
},
getAdminEmailByIdApp: function (idapp) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return myapp.adminemail;
else
return '';
},
getreplyToEmailByIdApp: function (idapp) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return myapp.replyTo;
else
return '';
},
getpathregByIdApp: function (idapp, lang) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return 'registration' + myapp.pathreg_add + '/' + lang;
else
return '';
},
isManagAndAdminDifferent(idapp) {
const manag = this.getManagerEmailByIdApp(idapp);
return (manag !== this.getAdminEmailByIdApp(idapp)) && (manag !== '');
},
getManagerEmailByIdApp: function (idapp) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
if (myapp)
return !!myapp.manageremail ? myapp.manageremail : '';
else
return '';
},
getEmailByIdApp: function (idapp) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
return (myapp) ? myapp.email_from : ''
},
getPwdByIdApp: function (idapp) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
return (myapp) ? this.decryptdata(myapp.email_pwd) : ''
},
getTelegramBotNameByIdApp: function (idapp) {
const myapp = this.getApps().find((item) => item.idapp === idapp);
return (myapp) ? myapp.telegram_bot_name : ''
},
getTelegramKeyByIdApp: function (idapp) {
const myarr = this.getApps();
const myapp = myarr.find((item) => item.idapp === idapp);
return (myapp) ? myapp.telegram_key : ''
},
getQueryTable(idapp, params) {
// console.log('idapp', idapp);
// console.table(params);
if (typeof params.startRow !== 'number') {
throw new Error('startRow must be number')
} else if (typeof params.endRow !== 'number') {
throw new Error('endRow must be number')
}
let query = [];
if (params.filter && params.fieldsearch) {
2020-03-21 10:28:26 +01:00
let myregexp = {};
myregexp = new RegExp(params.filter.trim().replace(' ', '|'), "ig");
const myfilters = [];
2020-03-21 10:28:26 +01:00
params.fieldsearch.forEach((rec) => {
const data = {};
2020-04-07 14:34:29 +02:00
if (rec.type === this.FieldType.exact) {
data[rec.field] = params.filter.trim();
2020-04-24 10:29:25 +02:00
} else if (rec.type === this.FieldType.string) {
2020-03-21 10:28:26 +01:00
data[rec.field] = myregexp;
2021-02-18 12:19:35 +01:00
} else if ((rec.type === this.FieldType.number) || (rec.type === this.FieldType.hours)) {
data[rec.field] = parseFloat(params.filter.trim());
2020-03-21 10:28:26 +01:00
}
myfilters.push(data);
});
query = [
{ $match: { $or: myfilters } },
]
}
let filtriadded = [];
// if (params.table === 'extralist') {
// if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_DELETED))
// filtriadded.push({ deleted: true });
// else
// filtriadded.push({ deleted: { $exists: false } });
// }
if (params.filterand) {
if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_NOT_REGISTERED))
filtriadded.push({ registered: false });
if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_NOT_CONTACTED)) {
filtriadded.push({ contacted: { $exists: false } });
}
if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_WITH_NOTE))
filtriadded.push({
'note': { $exists: true },
"$expr": { "$gt": [{ "$strLenCP": "$note" }, 1] }
});
if (params.filterand.includes(shared_consts.FILTER_QUALIFIED))
filtriadded.push({ 'profile.qualified': true });
if (params.filterand.includes(shared_consts.FILTER_USER_NO_ZOOM))
filtriadded.push({ 'profile.saw_zoom_presentation': false });
2020-09-04 00:06:49 +02:00
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 }
});
if (params.filterand.includes(shared_consts.FILTER_USER_NO_TELEGRAM_ID))
filtriadded.push({ 'profile.teleg_id': { $lt: 1 } });
if (params.filterand.includes(shared_consts.FILTER_USER_CODICE_AUTH_TELEGRAM))
filtriadded.push({ 'profile.teleg_checkcode': { $gt: 1 } });
if (params.filterand.includes(shared_consts.FILTER_USER_NO_EMAIL_VERIFICATA))
filtriadded.push({ verified_email: false });
if (params.filterand.includes(shared_consts.FILTER_USER_NO_DREAM))
filtriadded.push({
'profile.my_dream': {
$exists: false
}
});
if (params.filterand.includes(shared_consts.FILTER_USER_TELEGRAM_BLOCKED))
filtriadded.push({ 'profile.teleg_id_old': { $gt: 1 } });
if (params.filterand.includes(shared_consts.FILTER_ATTIVI))
filtriadded.push({
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
});
2021-02-11 02:20:35 +01:00
// Hours
if (params.filterand.includes(shared_consts.FILTER_HOURS_ALL))
filtriadded.push(
{
idapp,
todoId: params.codeId,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
);
else if (params.filterand.includes(shared_consts.FILTER_HOURS_MYLIST))
filtriadded.push(
{
idapp,
2021-02-24 04:48:31 +01:00
userId: params.userId,
2021-02-11 02:20:35 +01:00
todoId: params.codeId,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
);
if (params.filterand.includes(shared_consts.FILTER_NASCOSTI))
filtriadded.push({
deleted: { $exists: true, $eq: true }
});
if (params.filterand.includes(shared_consts.FILTER_NAVI_NON_PRESENTI))
filtriadded.push({
navinonpresenti: { $exists: true, $eq: true },
$or: [{ subaccount: { $exists: false } }, { subaccount: { $exists: true, $eq: false } }]
});
2021-06-04 10:07:57 +02:00
// Iscritti Conacreis
if (params.filterand.includes(shared_consts.FILTER_MISSING_PAYMENT))
filtriadded.push({
$or: [{ ha_pagato: { $exists: false } }, { ha_pagato: { $exists: true, $lt: 1 } }]
});
if (params.filterand.includes(shared_consts.FILTER_TO_MAKE_MEMBERSHIP_CARD))
filtriadded.push({
$or: [{ codiceConacreis: { $exists: false } }, { codiceConacreis: { $exists: true, $eq: '' } }]
});
if (params.filterand.includes(shared_consts.FILTER_MEMBERSHIP_CARD_OK))
filtriadded.push({
codiceConacreis: { $exists: true },
"$expr": { "$gt": [{ "$strLenCP": "$codiceConacreis" }, 0] }
});
}
if (filtriadded.length > 0)
query.push({ $match: { $and: filtriadded } });
if (idapp > 0) {
query.push({ $match: { idapp } });
}
// console.log('QUERYMATCH', query[0].$match.or);
// console.log('filter', params.filter);
if (params.sortBy) {
// maybe we want to sort by blog title or something
const mysort = { $sort: params.sortBy };
// console.log('sortBy', params.sortBy);
// console.table(mysort);
query.push(mysort)
}
let numrowend = params.endRow - params.startRow;
if (numrowend < 0)
numrowend = 1;
2021-02-25 02:59:25 +01:00
let mylkLF = params.lk_LF;
if (params.af_objId_tab) {
query.push(
{ "$addFields": { "myId": { "$toObjectId": '$' + params.lk_LF } } }
);
mylkLF = 'myId';
}
2021-02-11 02:20:35 +01:00
if (params.lk_tab) {
query.push(
{
$lookup: {
from: params.lk_tab,
2021-02-25 02:59:25 +01:00
localField: mylkLF, // field in my collection
2021-02-11 02:20:35 +01:00
foreignField: params.lk_FF, // field in the 'from' collection
as: params.lk_as
}
},
{
$replaceRoot: { newRoot: { $mergeObjects: [{ $arrayElemAt: ['$' + params.lk_as, 0] }, "$$ROOT"] } }
},
{ $project: params.lk_proj }
);
}
query.push(
{
$group: {
_id: null,
// get a count of every result that matches until now
count: { $sum: 1 },
// keep our results for the next operation
results: { $push: '$$ROOT' }
}
},
// and finally trim the results to within the range given by start/endRow
{
$project: {
count: 1,
rows: { $slice: ['$results', params.startRow, numrowend] }
}
}
);
2019-12-31 00:44:53 +01:00
// console.log('query', query);
return query;
},
2021-02-24 04:48:31 +01:00
async executeQueryTable(mythistable, idapp, params) {
let query = this.getQueryTable(idapp, params);
2021-02-24 04:48:31 +01:00
const [ris] = await mythistable.aggregate(query);
if (ris) {
// console.table(ris.rows);
// console.log('ROW ', ris.count);
return ({ count: ris.count, rows: ris.rows })
} else {
return ({ count: 0, rows: [] })
}
},
async DuplicateAllRecords(mythistable, idapporig, idappdest) {
console.log(mythistable.name);
const numrec = await mythistable.findAllIdApp(idappdest).then((arrrec) => {
if (arrrec && arrrec.length > 1) {
return arrrec.length; // Has Already set
} else {
return 0;
}
});
// Before check if exist more than 1 record in the destination,
// if Yes don't copy
if (numrec <= 0) {
return await mythistable.findAllIdApp(idapporig).then(async (arrrec) => {
let num = 0;
for (let ind = 0; ind < arrrec.length; ind++) {
let newrec = new mythistable(arrrec[ind]._doc);
newrec._id = new ObjectID();
newrec.idapp = idappdest;
await newrec.save((err, rec) => {
if (rec) {
num++;
}
});
}
return num;
});
}
},
isBitActive(bit, whattofind) {
return ((bit & whattofind) === whattofind)
},
SetBit(myval, bit) {
myval = myval & bit;
return myval
},
async snooze(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
IncDateNow(secs) {
let mydate = new Date(new Date().getTime() + secs);
// console.log('mydate', mydate);
return mydate
},
2020-07-13 23:35:05 +02:00
isdiffSecDateLess(mydatediffstr, secs) {
let mydate = new Date();
// console.log('mydate', mydate);
let mydata2 = new Date(mydatediffstr);
let ris = ((mydate.getTime() - mydata2.getTime()) / 1000);
return (ris < secs);
},
2020-03-21 10:28:26 +01:00
AddDate(mydate, days) {
let date = new Date(mydate);
date.setTime(date.getTime() + days * 86400000);
return date;
},
2020-05-10 21:07:51 +02:00
isMonToSat() {
const dayOfWeek = new Date(new Date()).getDay();
return dayOfWeek >= 1 && dayOfWeek <= 6
},
2020-09-04 00:06:49 +02:00
isMonToFri() {
const dayOfWeek = new Date(new Date()).getDay();
return dayOfWeek >= 1 && dayOfWeek <= 5
},
2020-05-10 21:07:51 +02:00
// var startTime = '15:10:10';
// var endTime = '22:30:00';
isBetweenTwoTime(startTime, endTime) {
currentDate = new Date();
startDate = new Date(currentDate.getTime());
startDate.setHours(startTime.split(":")[0]);
startDate.setMinutes(startTime.split(":")[1]);
startDate.setSeconds(startTime.split(":")[2]);
endDate = new Date(currentDate.getTime());
endDate.setHours(endTime.split(":")[0]);
endDate.setMinutes(endTime.split(":")[1]);
endDate.setSeconds(endTime.split(":")[2]);
valid = startDate < currentDate && endDate > currentDate;
return valid;
},
getlimiti(mypos) {
if (mypos.col < 0) {
mypos.col = 0;
}
if (mypos.riga < 0) {
mypos.riga = 0;
mypos.col = 0;
}
return mypos;
},
2020-03-21 10:28:26 +01:00
getRigaColByPosUp(mypos) {
2020-03-25 18:26:51 +01:00
if (mypos.numup > 0) {
mypos.riga = mypos.riga - mypos.numup;
mypos.col = Math.ceil(mypos.col / (Math.pow(2, mypos.numup)));
}
if (mypos.numup < 0) {
mypos.riga = mypos.riga - mypos.numup;
mypos.col = Math.ceil(mypos.col * (Math.pow(2, -mypos.numup)));
}
2020-05-04 19:34:41 +02:00
if (mypos.riga < 1) {
mypos.riga = 1;
}
if (mypos.col < 1) {
mypos.col = 1;
}
2020-03-21 10:28:26 +01:00
},
2020-05-10 21:07:51 +02:00
getRigaColGenerica(idapp, riga, col, numup) {
mypos = {
idapp,
riga,
col,
numup
};
if (idapp === this.AYNI) {
2020-05-10 21:07:51 +02:00
this.getRigaColByPosUp(mypos);
ris = this.getlimiti(mypos);
}
return ris;
},
getRigaColSognatoreByDonatore(idapp, riga, col) {
return this.getRigaColGenerica(idapp, riga, col, 6);
},
getRigaColMediatoreByFuoco(idapp, riga, col) {
return this.getRigaColGenerica(idapp, riga, col, 3);
},
getRigaColSognatoreByMediatore(idapp, riga, col) {
return this.getRigaColGenerica(idapp, riga, col, 3);
},
2020-01-21 01:37:15 +01:00
appendLeadingZeroes(n) {
if (n <= 9) {
return "0" + n;
}
return n
},
2020-07-02 22:00:58 +02:00
getWeekDayByLangByNumCar(date, lang, num) {
2020-05-04 19:34:41 +02:00
if (!lang)
lang = 'it';
const dayOfWeek = new Date(date).getDay();
const myday = {
it: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
enUs: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
fr: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
es: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'iernes', 'Sábado'],
pt: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
de: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
si: ['Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'četrtek', 'Petek', 'Sobota'],
2020-07-02 22:00:58 +02:00
};
if (num > 0) {
return isNaN(dayOfWeek) ? '' : myday[lang][dayOfWeek].substring(0, num)
} else {
return isNaN(dayOfWeek) ? '' : myday[lang][dayOfWeek]
2020-05-04 19:34:41 +02:00
}
2020-07-02 22:00:58 +02:00
},
2021-02-24 04:48:31 +01:00
isSunday(mydate) {
const dayOfWeek = new Date(mydate).getDay()
return dayOfWeek === 0
},
isMonday(mydate) {
const dayOfWeek = new Date(mydate).getDay()
return dayOfWeek === 1
},
2021-03-17 02:24:11 +01:00
isSundayDate(mydate) {
const dayOfWeek = mydate.getDay()
return dayOfWeek === 0
},
isMondayDate(mydate) {
const dayOfWeek = mydate.getDay()
return dayOfWeek === 1
},
2020-07-02 22:00:58 +02:00
getWeekDayByLang(date, lang) {
return this.getWeekDayByLangByNumCar(date, lang, 3)
},
2020-05-04 19:34:41 +02:00
2020-07-02 22:00:58 +02:00
getWeekDayByLangTot(date, lang) {
return this.getWeekDayByLangByNumCar(date, lang, 0)
2020-05-04 19:34:41 +02:00
},
2020-01-21 01:37:15 +01:00
getWeekDay(date) {
//Create an array containing each day, starting with Sunday.
const weekdays = [
"Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedí", "Venerdì", "Sabato"
];
//Use the getDay() method to get the day.
const day = date.getDay();
//Return the element that corresponds to that index.
return weekdays[day];
},
2020-05-04 19:34:41 +02:00
getstrDateTimeShort(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
2020-05-04 19:34:41 +02:00
return this.getWeekDayByLang(mydate, lang) + ' ' + this.appendLeadingZeroes(mydate.getDate()) + '/' + this.appendLeadingZeroes(mydate.getMonth() + 1) + ' ORE ' + this.appendLeadingZeroes(mydate.getHours()) + ':' + this.appendLeadingZeroes(mydate.getMinutes());
} else {
return '';
}
},
2020-05-04 19:34:41 +02:00
getstrDateShort(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
2020-05-04 19:34:41 +02:00
return this.getWeekDayByLang(mydate, lang).substring(0, 3) + ' ' + this.appendLeadingZeroes(mydate.getDate()) + '/' + this.appendLeadingZeroes(mydate.getMonth() + 1);
} else {
return '';
}
},
2021-06-04 10:07:57 +02:00
getstrDate_DD_MM_YYYY(mydate) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return this.appendLeadingZeroes(mydate.getDate()) + '/' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '/' + this.appendLeadingZeroes(mydate.getFullYear());
} else {
return '';
}
},
2021-02-24 04:48:31 +01:00
getstrDateYYYY_MM_DD(mydate) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return mydate.getFullYear() + '-' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '-' + this.appendLeadingZeroes(mydate.getDate())
} else {
return '';
}
},
2021-03-17 02:24:11 +01:00
getstrUTCDateYYYY_MM_DD(mydate) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return mydate.getUTCFullYear() + '-' + this.appendLeadingZeroes(mydate.getUTCMonth() + 1) + '-' + this.appendLeadingZeroes(mydate.getUTCDate())
} else {
return '';
}
},
2020-05-04 19:34:41 +02:00
getstrDateLong(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
2020-05-04 19:34:41 +02:00
return this.getWeekDayByLang(mydate, lang) + ' ' + this.appendLeadingZeroes(mydate.getDate()) + '/' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '/' + mydate.getFullYear();
} else {
return '';
}
2020-01-21 01:37:15 +01:00
},
2020-07-02 22:00:58 +02:00
getstrDateLongTot(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return this.getWeekDayByLangTot(mydate, lang) + ' ' + this.appendLeadingZeroes(mydate.getDate()) + '/' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '/' + mydate.getFullYear();
} else {
return '';
}
},
getstrDateLongFile(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return mydate.getFullYear() + '-' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '-' + this.appendLeadingZeroes(mydate.getDate()) + ' (' + this.getWeekDayByLang(mydate, lang) + ')'
} else {
return '';
}
},
2020-07-02 22:00:58 +02:00
getlinkzoom(rec) {
if (rec === null) {
rec = {
typeconf: this.TYPECONF_ZOOM,
id_conf_zoom: '',
}
}
let typeconf = rec.typeconf;
if (typeconf === '')
typeconf = this.TYPECONF_ZOOM;
let mylink = 'https://zoom.us/j/';
if (typeconf === this.TYPECONF_JITSI)
mylink = 'https://meet.jit.si/';
if (rec.id_conf_zoom === '') {
rec.id_conf_zoom = '6668882000';
}
return mylink + rec.id_conf_zoom
2020-01-21 01:37:15 +01:00
},
getmd5(mystr) {
return CryptoJS.MD5(mystr.toLowerCase()).toString();
},
getHash(mystr) {
return CryptoJS.SHA512(mystr, { outputLength: 256 }).toString();
},
encrypt(msg, pass) {
var salt = CryptoJS.lib.WordArray.random(128 / 8);
var key = CryptoJS.PBKDF2(pass, salt, {
keySize: keySize / 32,
iterations: iterations
});
var iv = CryptoJS.lib.WordArray.random(128 / 8);
var encrypted = CryptoJS.AES.encrypt(msg, key, {
iv: iv,
padding: CryptoJS.pad.Pkcs7,
mode: CryptoJS.mode.CBC
});
// salt, iv will be hex 32 in length
// append them to the ciphertext for use in decryption
var transitmessage = salt.toString() + iv.toString() + encrypted.toString();
return transitmessage;
},
decrypt(transitmessage, pass) {
var salt = CryptoJS.enc.Hex.parse(transitmessage.substr(0, 32));
var iv = CryptoJS.enc.Hex.parse(transitmessage.substr(32, 32))
var encrypted = transitmessage.substring(64);
var key = CryptoJS.PBKDF2(pass, salt, {
keySize: keySize / 32,
iterations: iterations
});
var decrypted = CryptoJS.AES.decrypt(encrypted, key, {
iv: iv,
padding: CryptoJS.pad.Pkcs7,
mode: CryptoJS.mode.CBC
});
return decrypted;
},
cryptdata(mydata) {
// Encrypt
//return CryptoJS.AES.encrypt(JSON.stringify(mydata), process.env.SECRK);
return this.encrypt(mydata, process.env.SECRK);
},
decryptdata(mydatacrypted) {
// Decrypt
// const bytes = CryptoJS.AES.decrypt(mydatacrypted.toString(), process.env.SECRK);
// return JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
return this.decrypt(mydatacrypted, process.env.SECRK).toString(CryptoJS.enc.Utf8);
},
BoolToInt(mybool) {
return (mybool) ? -1 : 0
},
StrToBool(mystr) {
return (mystr === '-1') ? true : false
},
writelogfile(mystr, filename) {
// fs.appendFile(FILELOG, mystr, function (err) {
// if (err) throw err;
// console.log('Saved!');
// });
mystr = this.getstrDateTimeShort(new Date(), 'it') + ': ' + mystr;
const stream = fs.createWriteStream(filename, { flags: 'a' });
stream.write('\n' + mystr);
stream.end();
},
readlogfile(idapp, filename) {
2020-07-02 22:00:58 +02:00
try {
return fs.readFileSync(idapp + '/' + filename, 'utf8');
2020-07-02 22:00:58 +02:00
} catch (e) {
return '';
}
},
writelog(mystr) {
this.writelogfile(mystr, FILELOG);
},
writeEventsLog(mystr) {
this.writelogfile(mystr, FILEEVENTS);
},
writeManagersLog(mystr) {
this.writelogfile(mystr, FILEMANAGERS);
},
writeSostituzioniLog(mystr) {
this.writelogfile(mystr, FILESOSTITUZIONI);
},
2020-07-13 23:35:05 +02:00
writeIPToBan(mystr) {
this.writelogfile(mystr, FILEIP_TO_BAN);
},
writeFlottaLog(idapp, mystr, riga, col) {
this.mkdirpath(idapp + '/');
this.writelogfile(mystr, idapp + '/' + riga + '_' + col + '.txt');
},
readFlottaLog(idapp, riga, col) {
const nomefile = riga + '_' + col + '.txt';
return this.readlogfile(idapp, nomefile);
},
writeNaveLog(mystr) {
this.writelogfile(mystr, FILENAVE);
},
move(oldPath, newPath, callback) {
fs.rename(oldPath, newPath, function (err) {
if (err) {
if (err.code === 'EXDEV') {
copy();
} else {
callback(err);
}
return;
}
callback();
});
function copy() {
const readStream = fs.createReadStream(oldPath);
const writeStream = fs.createWriteStream(newPath);
readStream.on('error', callback);
writeStream.on('error', callback);
readStream.on('close', function () {
fs.unlink(oldPath, callback);
});
readStream.pipe(writeStream);
}
},
2019-12-28 02:16:29 +01:00
delete(path, callback) {
fs.unlink(path, function (err) {
if (err) {
console.error(err);
callback(err);
return
}
callback();
});
},
mkdirpath(dirPath) {
// if (!fs.accessSync(dirPath, fs.constants.R_OK | fs.constants.W_OK)) {
if (!fs.existsSync(dirPath)) {
try {
fs.mkdirSync(dirPath, { recursive: true });
2020-12-21 02:16:42 +01:00
} catch (e) {
2021-02-18 12:19:35 +01:00
if (dirPath !== path.dirname(dirPath)) {
const myname = path.dirname(dirPath);
this.mkdirpath(myname);
// this.mkdirpath(dirPath);
}
}
}
},
2019-12-28 02:16:29 +01:00
extractNameAndSurnameByComplete(name_complete) {
const suffissoCognome = ['Del', 'La', 'De', 'Lo'];
let campi = name_complete.split(" ");
let namesurname = {
name: '',
surname: '',
};
if (campi.length === 2) {
namesurname.name = campi[0];
namesurname.surname = campi[1];
2020-01-21 01:37:15 +01:00
} else if (campi.length === 3) {
if (suffissoCognome.includes(campi[1])) {
namesurname.name = campi[0];
namesurname.surname = campi[1] + " " + campi[2];
} else {
namesurname.name = campi[0] + " " + campi[1];
namesurname.surname = campi[2];
}
2020-01-21 01:37:15 +01:00
} else if (campi.length === 4) {
namesurname.name = campi[0] + " " + campi[1];
namesurname.surname = campi[2] + " " + campi[3];
2020-01-21 01:37:15 +01:00
} else if (campi.length > 4) {
namesurname.name = campi[0] + " " + campi[1];
namesurname.surname = " " + campi[2];
for (let ind = 3; ind < campi.length; ind++) {
namesurname.surname += " " + campi[ind];
}
}
return namesurname
},
getiPAddressUser(req) {
try {
const striniziale = '::ffff:';
if (req.ip.indexOf(striniziale) >= 0) {
return req.ip.substring(striniziale.length)
} else {
return req.ip; // Express
}
} catch (e) {
return ''
}
},
removespaces(mystr) {
return mystr.replace(/\s+/g, '')
},
ModificheConsentite(table, fieldsvalue, idrec, user) {
2021-01-18 00:48:17 +01:00
if (table === 'sharewithus') {
return true;
}
2021-02-18 12:19:35 +01:00
if (table === 'hours') {
return true;
}
if (table === 'users') {
if ('aportador_solidario' in fieldsvalue) {
return true;
}
if ('ALL' in fieldsvalue) {
//++Todo: Cancellalo solo se sono io il creatore dell'utente ... o se posso!
return true
}
}
2020-05-10 21:07:51 +02:00
if (table === 'listaingressos') {
if ('invitante_username' in fieldsvalue) {
return true;
}
if ('username' in fieldsvalue) {
return true;
}
if ('note' in fieldsvalue) {
return true;
}
2020-05-10 21:07:51 +02:00
}
2020-03-21 10:28:26 +01:00
if (table === 'navi') {
if ('date_made_gift' in fieldsvalue) {
return true;
}
if ('made_gift' in fieldsvalue) {
return true;
}
if ('note' in fieldsvalue) {
return true;
}
2020-03-21 10:28:26 +01:00
}
2020-03-25 18:26:51 +01:00
if (table === 'navepersistente') {
if ('link_chat' in fieldsvalue) {
return true;
}
}
if (table === 'flotte') {
return true;
}
2020-03-21 10:28:26 +01:00
return false;
},
NotifyIfDelRecord(table) {
if ((table === 'users') || (table === 'extralist') || (table === 'listaingressos') || (table === 'graduatorias')) {
return true;
}
return false;
},
getFirstWord(mystr) {
const myarr = mystr.split(" ");
if (myarr.length > 0)
return myarr[0];
else
return mystr
},
getFirst2Car(mystr) {
if (!!mystr)
return mystr.substring(0, 2) + '.';
else
return ''
},
getmaxcol(riga) {
return Math.pow(2, riga - 1);
},
getPrimoFuocoByIndCol(col) {
// let ris = Math.ceil(col - (col % 8)) + 1;
let ris = ((Math.ceil(col / 8) - 1) * 8) + 1;
if (ris <= 0)
ris = 1;
return ris
},
getPrimaColFlotta(col) {
// let ris = Math.ceil(col - (col % 8)) + 1;
let ris = ((Math.ceil(col / 64) - 1) * 64) + 1;
if (ris <= 0)
ris = 1;
return ris
},
getStrMsgByTipoMsg(tipomsg) {
let mystr = '';
if (tipomsg === this.TipoMsg.SEND_MSG_EFFETTUA_IL_DONO)
mystr = 'Inviato Messaggio per Effettuare il Dono a Tutta la Flotta';
else if (tipomsg === this.TipoMsg.SEND_MSG_SOLLECITO_DONATORI_NO_DONO)
mystr = 'Inviato Messaggio per RICORDARE di Effettuare il Dono a chi ancora non l\'ha fatto';
else if (tipomsg === this.TipoMsg.SEND_MSG_A_MEDIATORI)
mystr = 'Inviato Messaggio ai Mediatori';
else if (tipomsg === this.TipoMsg.SEND_MSG_A_SOGNATORE)
mystr = 'Inviato Messaggio al Sognatore';
else if (tipomsg === this.TipoMsg.SEND_MSG_A_UTENTE_SOSTITUITO)
mystr = 'Inviato Messaggio all\'utente Sostituito';
else if (tipomsg === this.TipoMsg.SEND_MSG_DONO_RICEVUTO_CORRETTAMENTE)
mystr = 'Inviato Messaggio Dono Ricevuto Correttamente';
return mystr;
2020-07-02 22:00:58 +02:00
},
getflagtelegrambyLang(lang) {
if (lang === 'it')
return '🇮🇹';
else if (lang === 'si')
return '🇸🇮';
else if (lang === 'es')
return '🇪🇸';
else if (lang === 'enUs')
return '🇬🇧';
else if (lang === 'uk')
return '🇬🇧';
else if (lang === 'fr')
return '🇫🇷';
2020-07-13 23:35:05 +02:00
},
2020-07-13 23:35:05 +02:00
blockwords(mystr) {
2020-09-04 00:06:49 +02:00
const arrwords = ['http', 'Http', 'Asasfasfas', '://', 'mrbit'];
for (const myword of arrwords) {
if (mystr.includes(myword)) {
return true;
}
2020-07-13 23:35:05 +02:00
}
2020-07-13 23:35:05 +02:00
return false;
},
isAlphaNumeric(str) {
let code, i, len;
for (i = 0, len = str.length; i < len; i++) {
code = str.charCodeAt(i);
if (!(code > 47 && code < 58) && // numeric (0-9)
!(code > 64 && code < 91) && // upper alpha (A-Z)
!(code > 96 && code < 123)) { // lower alpha (a-z)
return false;
}
}
return true;
2020-12-21 02:16:42 +01:00
},
categorizeQueryString(queryObj) {
let query = {}
let order = {}
//extract query, order, filter value
for (const i in queryObj) {
if (queryObj[i]) {
// extract order
if (i === 'order') {
order['sort'] = queryObj[i]
continue
}
// extract range
if (i === 'range') {
let range_arr = []
let query_arr = []
// multi ranges
if (queryObj[i].constructor === Array) {
for (const r of queryObj[i]) {
range_arr = r.split('-')
query_arr.push({
price: { $gt: range_arr[0], $lt: range_arr[1] }
})
}
}
// one range
if (queryObj[i].constructor === String) {
range_arr = queryObj[i].split('-')
query_arr.push({
price: { $gt: range_arr[0], $lt: range_arr[1] }
})
}
Object.assign(query, { $or: query_arr })
delete query[i]
continue
}
query[i] = queryObj[i]
}
}
return { query, order }
},
2021-02-24 04:48:31 +01:00
dateToEpoch(thedate) {
const time = new Date(thedate).getTime();
return time - (time % 86400000);
},
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;
2021-05-10 01:50:40 +02:00
},
getPaymentTypesById(idmetodo) {
return shared_consts.PaymentTypes[idmetodo]
},
2021-02-24 04:48:31 +01:00
};