From 9985793fcc9f6e881a9d4a9d5209bc94834d0ee8 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Tue, 17 Sep 2024 17:38:47 +0200 Subject: [PATCH] - Le immagini uploadate non vengono visualizzate subito... cache... aggiungere la versione dell'immagine: vers_img - Aggiunto il Server TESTRISO e TEST_PCB. --- .env.dev.pcb | 3 + .env.dev.riso | 4 +- .env.development | 7 +- .env.prod.pcb | 3 + .env.test.pcb | 7 +- .env.test.risosrv | 6 +- .../2_importa_db_Test_Freeplanet_SuDocker.sh | 78 ++++ admin_scripts/3_DATABASE/dati.txt.js | 361 ++++++++++++++++++ admin_scripts/3_DATABASE/dati_attivitas.js | 92 +++++ admin_scripts/3_DATABASE/dati_mygroups.js | 36 ++ admin_scripts/3_DATABASE/dati_mypages.js | 27 ++ admin_scripts/3_DATABASE/dati_users.js | 334 ++++++++++++++++ deploynode_on_prod_pcb.sh | 1 + deploynode_on_test_pcb.sh | 69 +++- .../dominioinclude_piuchebuono.app.conf | 4 + ...ominioinclude_test.abitaregliiblei.it.conf | 4 +- .../dominioinclude_test.riso.app.conf | 4 + .../nodejs_3000_api.piuchebuono.app.conf | 3 + .../nodejs_virtualhost_ssl_http_https.conf} | 14 +- .../websites_ssl_piuchebuono.app.conf | 3 + .../websites_ssl_test.abitaregliiblei.it.conf | 3 + .../websites_ssl_virtualhost.conf | 30 ++ .../ssl_vhost_api.gruppomacro.app.conf | 23 -- docs/apache2/ssl_vhost_api.riso.app.conf | 34 -- docs/apache2/vhost.ssl_piuchebuono.conf | 22 -- docs/gitlab/aggiungere_a_gitlab.rb.txt | 24 ++ ecosystem.config.testpcb.js | 22 ++ ecosystem.config.testriso.js | 4 +- scripts/docker_copia_da_a.sh | 30 ++ src/server/models/myelem.js | 7 + src/server/models/user.js | 1 + src/server/modules/Mailinabox.js | 14 +- src/server/modules/cloudflare.js | 45 ++- src/server/router/admin_router.js | 2 +- src/server/router/index_router.js | 2 +- src/server/router/users_router.js | 15 +- src/server/server.js | 29 +- src/server/telegram/telegrambot.js | 22 +- src/server/tools/general.js | 32 ++ 39 files changed, 1259 insertions(+), 162 deletions(-) create mode 100644 admin_scripts/3_DATABASE/2_importa_db_Test_Freeplanet_SuDocker.sh create mode 100644 admin_scripts/3_DATABASE/dati.txt.js create mode 100644 admin_scripts/3_DATABASE/dati_attivitas.js create mode 100644 admin_scripts/3_DATABASE/dati_mygroups.js create mode 100644 admin_scripts/3_DATABASE/dati_mypages.js create mode 100644 admin_scripts/3_DATABASE/dati_users.js create mode 100644 docs/apache2/sites-available/dominioinclude_piuchebuono.app.conf create mode 100644 docs/apache2/sites-available/dominioinclude_test.riso.app.conf create mode 100644 docs/apache2/sites-available/nodejs_3000_api.piuchebuono.app.conf rename docs/apache2/{ssl_vhost_api.abitaregliiblei.it.conf => sites-available/nodejs_virtualhost_ssl_http_https.conf} (79%) create mode 100644 docs/apache2/sites-available/websites_ssl_piuchebuono.app.conf create mode 100644 docs/apache2/sites-available/websites_ssl_test.abitaregliiblei.it.conf create mode 100644 docs/apache2/sites-available/websites_ssl_virtualhost.conf delete mode 100644 docs/apache2/ssl_vhost_api.gruppomacro.app.conf delete mode 100644 docs/apache2/ssl_vhost_api.riso.app.conf delete mode 100644 docs/apache2/vhost.ssl_piuchebuono.conf create mode 100644 docs/gitlab/aggiungere_a_gitlab.rb.txt create mode 100755 ecosystem.config.testpcb.js create mode 100644 scripts/docker_copia_da_a.sh diff --git a/.env.dev.pcb b/.env.dev.pcb index 4ebffcd..a0dd199 100644 --- a/.env.dev.pcb +++ b/.env.dev.pcb @@ -41,3 +41,6 @@ FTPSERVER_PWD=ftpmypwd@1A_ AUTH_NEW_SITES=123123123 SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] +MIAB_HOST=box.lamiaposta.org +MIAB_ADMIN_EMAIL=admin@lamiaposta.org +MIAB_ADMIN_PASSWORD=passpao1pabox@1A \ No newline at end of file diff --git a/.env.dev.riso b/.env.dev.riso index b85e237..7d444cb 100644 --- a/.env.dev.riso +++ b/.env.dev.riso @@ -38,4 +38,6 @@ FTPSERVER_HOST=139.162.166.31 FTPSERVER_PORT=21 FTPSERVER_USER=ftpusrsrv_ FTPSERVER_PWD=ftpmypwd@1A_ -AUTH_NEW_SITES=123123123 \ No newline at end of file +AUTH_NEW_SITES=123123123 +SCRIPTS_DIR=admin_scripts +CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] \ No newline at end of file diff --git a/.env.development b/.env.development index 2f79ccc..7c02111 100644 --- a/.env.development +++ b/.env.development @@ -11,14 +11,12 @@ AUTH_MONGODB=1 MONGODB_USER=admin MONGODB_PWD=mypwadmin@1A ENABLE_PUSHNOTIFICATION=1 -URLBASE_APP1=https://localhost -PORT_APP1=8080 SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB HTTPS_LOCALHOST=true DEBUG=0 -DEBUG=0 TESTING_ON=1 LOCALE=1 +PROD=0 DELAY_SENDEMAIL=2000 VAPI_KEY_SUBJECT=mailto:paolo@freeplanet.app PUBLIC_VAPI_KEY=BDncvMiUZmjaCG2Kr1V9N0_33hOG-AuNSbHSvL24y2dzBiUjAxKm02emx5SeJvz2IGmtRf6YqCgopeQwCwUmZw8 @@ -28,7 +26,6 @@ PATH_SERVER_CRT=localhost.crt PATH_SSL_ROOT_PEM=root.pem PATH_SSL_CHAIN_PEM=chain.pem GCM_API_KEY="" -PROD=0 PROJECT_DESCR_MAIN='__PROJECTS' SECRK=Askb38v23jjDFaoskBOWj92axXCQ SECRTK=prova123prova567ASDADASDAS @@ -39,6 +36,8 @@ FTPSERVER_PORT=21 FTPSERVER_USER=ftpusrsrv_ FTPSERVER_PWD=ftpmypwd@1A_ AUTH_NEW_SITES=123123123 +DOMAINS=[{"hostname":"riso.app","port":"3000"}] +SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] MIAB_HOST=box.lamiaposta.org MIAB_ADMIN_EMAIL=admin@lamiaposta.org diff --git a/.env.prod.pcb b/.env.prod.pcb index 0417593..51b68b0 100644 --- a/.env.prod.pcb +++ b/.env.prod.pcb @@ -36,3 +36,6 @@ AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNVZZ DOMAINS=[{"hostname":"piuchebuono.app","port":"3000"},{"hostname":"gruppomacro.app","port":"3010"}] SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] +MIAB_HOST=box.lamiaposta.org +MIAB_ADMIN_EMAIL=admin@lamiaposta.org +MIAB_ADMIN_PASSWORD=passpao1pabox@1A \ No newline at end of file diff --git a/.env.test.pcb b/.env.test.pcb index 0187d4a..33a7e8d 100644 --- a/.env.test.pcb +++ b/.env.test.pcb @@ -7,7 +7,7 @@ PORT=3001 appTelegram_TEST=["17","18"] appTelegram=["17","18"] ENABLE_PUSHNOTIFICATION=1 -DIRECTORY_SERVER=/var/www/test.freeplanet_serverside +DIRECTORY_SERVER=/var/www/nodejs_test.piuchebuono_server SERVERDIR_WEBSITE=test.piuchebuono.app PORT_APP1="0" DOMAIN=mongodb://localhost:32002/ @@ -32,6 +32,9 @@ SECRK=iUUb38v23jjDFaosWj92axkBOXCQ TOKEN_LIFE=2h REFRESH_TOKEN_LIFE=14d AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV -DOMAINS=[{"hostname":"test.piuchebuono.app","port":"3002"},{"hostname":"test.gruppomacro.app","port":"3012"},{"hostname":"test.abitaregliiblei.it","port":"3022"}] +DOMAINS=[{"hostname":"piuchebuono.app","port":"3001"},{"hostname":"gruppomacro.app","port":"3011"}] SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] +MIAB_HOST=box.lamiaposta.org +MIAB_ADMIN_EMAIL=admin@lamiaposta.org +MIAB_ADMIN_PASSWORD=passpao1pabox@1A \ No newline at end of file diff --git a/.env.test.risosrv b/.env.test.risosrv index f7e1c9f..88ef5b8 100644 --- a/.env.test.risosrv +++ b/.env.test.risosrv @@ -4,10 +4,10 @@ PDB=suerteFreePlanet@1A SEND_EMAIL=1 PORT=3001 ENABLE_PUSHNOTIFICATION=1 -DIRECTORY_SERVER=/var/www/testriso.freeplanet_serverside +DIRECTORY_SERVER=/var/www/nodejs_test.riso_server SERVERDIR_WEBSITE=test.riso.app PORT_APP1="0" -DOMAIN=mongodb://localhost:32002/ +DOMAIN=mongodb://localhost:32012/ AUTH_MONGODB=1 MONGODB_USER=admin MONGODB_PWD=mypwadmin@1A @@ -29,7 +29,7 @@ SECRK=iUUb38v23jjDFaosWj92axkBOXCQ TOKEN_LIFE=2h REFRESH_TOKEN_LIFE=14d AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV -DOMAINS=[{"hostname":"test.abitaregliiblei.it","port":"3021"}] +DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}] SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] MIAB_HOST=box.lamiaposta.org diff --git a/admin_scripts/3_DATABASE/2_importa_db_Test_Freeplanet_SuDocker.sh b/admin_scripts/3_DATABASE/2_importa_db_Test_Freeplanet_SuDocker.sh new file mode 100644 index 0000000..dd6d6cd --- /dev/null +++ b/admin_scripts/3_DATABASE/2_importa_db_Test_Freeplanet_SuDocker.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# Definizione delle variabili +FILEZIP="exp_db_test.tar.gz" +DATABASEIN="FreePlanet" +DATABASEOUT="test_FreePlanet" +FILEMONGODBIN="export_database_$DATABASEIN" +FILEMONGODBOUT="export_database_$DATABASEOUT" +MYDOCKER="mongodbtest" +DIR_OUT="/home/test/" +BACKUP_DIR="/home/pcbuser/backups/temp/" +TIMESTAMP=$(date +"%Y%m%d_%H%M%S") + +# Carica le configurazioni +source ~/batch/.my_cfg.ini + +echo "Attenzione: Questo script creerà un backup del database esistente $DATABASEOUT" +echo "e lo sovrascriverà con i dati dal file $FILEZIP." +echo "Vuoi procedere? (Si/No)" +read -r risposta + +if [[ ! $risposta =~ ^[Ss][iI]$ ]]; then + echo "Operazione annullata dall'utente." + exit 0 +fi + +echo "Inizio del processo di importazione del database" +echo "------------------------------------------------" + +# Verifica l'esistenza del file .tar.gz +if [ ! -f "/home/pcbuser/$FILEZIP" ]; then + echo "ERRORE: Il file $FILEZIP non esiste nella directory /home/pcbuser/" + exit 1 +fi + +# Backup del database esistente +echo "Creazione di un backup del database esistente...$DATABASEOUT" +if docker exec "$MYDOCKER" mongodump --username admin --password "$PWDDB_TEST" --authenticationDatabase admin --db "$DATABASEOUT" --out "$BACKUP_DIR$DATABASEOUT_$TIMESTAMP"; then + echo "Backup del database esistente completato con successo in $BACKUP_DIR$DATABASEOUT_$TIMESTAMP" +else + echo "ERRORE: Impossibile creare il backup del database esistente $DATABASEOUT." + exit 1 +fi + +echo "Copiando $FILEZIP nel container $MYDOCKER..." +if docker cp "/home/pcbuser/$FILEZIP" "$MYDOCKER:$DIR_OUT"; then + echo "File copiato con successo." +else + echo "ERRORE: Impossibile copiare il file nel container." + exit 1 +fi + +echo "Estraendo $FILEZIP in $DIR_OUT all'interno del container..." +if docker exec "$MYDOCKER" tar -xvzf "$DIR_OUT$FILEZIP" -C "$DIR_OUT"; then + echo "Estrazione completata con successo." +else + echo "ERRORE: Impossibile estrarre il file nel container." + exit 1 +fi + +echo "Rinominando la directory del database da $FILEMONGODBIN a $FILEMONGODBOUT..." +if docker exec "$MYDOCKER" mv "$DIR_OUT$FILEMONGODBIN" "$DIR_OUT$FILEMONGODBOUT"; then + echo "Directory rinominata con successo." +else + echo "ERRORE: Impossibile rinominare la directory." + exit 1 +fi + +echo "Ripristinando il database MongoDB dal dump..." +if docker exec "$MYDOCKER" mongorestore --username admin --password "$PWDDB_TEST" --authenticationDatabase admin --nsFrom="$DATABASEIN.*" --nsTo="$DATABASEOUT.*" "$DIR_OUT$FILEMONGODBOUT"; then + echo "Database ripristinato con successo." +else + echo "ERRORE: Impossibile ripristinare il database." + exit 1 +fi + +echo "------------------------------------------------" +echo "Processo di importazione del database completato" \ No newline at end of file diff --git a/admin_scripts/3_DATABASE/dati.txt.js b/admin_scripts/3_DATABASE/dati.txt.js new file mode 100644 index 0000000..0776957 --- /dev/null +++ b/admin_scripts/3_DATABASE/dati.txt.js @@ -0,0 +1,361 @@ +db.myelems.insertMany([ + { + "_id": ObjectId("669fbf9dc9d625d0628eb12f"), + "order": 20, + "active": true, + "type": 20, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0, + "containerHtml": "
Abitare Gli Iblei
", + "anim": { + "_id": ObjectId("66e456981e0719a1012121c0"), + "name": "", + "clduration": "", + "cldelay": "", + "timingtype": "ease-in-out" + } + }, { + "_id": ObjectId("669fbfc3c9d625d0628eb131"), + "order": 100, + "active": true, + "type": 145, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0 + }, { + "_id": ObjectId("66db2a45054b3b09f85e6983"), + "order": 26, + "active": true, + "type": 35, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0, + "image": "logo.jpg", + "anim": { + "_id": ObjectId("66db34215740efc77547a93a"), + "name": "", + "clduration": "", + "cldelay": "", + "timingtype": "ease-in-out" + }, + "widthimg": "250px", + "align": 2 + } + , { + "_id": ObjectId("66db38a77e24f4509eef655b"), + "order": 26, + "active": true, + "type": 20, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0, + "containerHtml": "\n\n\n

“Abitare gli Iblei” è una rete aperta che ha lo scopo di riunire tutte quelle persone che vogliono valorizzare e qualificare la vita nel territorio degli Iblei. 

\n    \n   

Chi aderisce alla rete si riconosce in una Carta dei valori comuni e usa la rete per scambiare conoscenze, esperienze, risorse e prodotti sviluppati nell’ambito delle proprie iniziative (profit e non profit) individuali o collettive.

\n\n\n   

L’area territoriale di questa rete è quella dei Monti Iblei orientali e occidentali (Noto, Avola, Canicattini, Siracusa, Palazzolo, Buccheri, Ferla, Modica, …).

\n\n\n   

La rete “Abitare gli Iblei” offre i seguenti servizi utili per il territorio ed i suoi abitanti, frutto di una costruzione collettiva:

\n    \n    \n    \n   

Se vuoi aderire alla rete puoi richiederne la registrazione utilizzando questo Link (Pagina in Costruzione).

\n\n", + "anim": { + "_id": ObjectId("66db393e3b885ccdfaed28d6"), + "name": "", + "clduration": "", + "cldelay": "", + "timingtype": "ease-in-out" + } + } + , { + "_id": ObjectId("66e41cff78c8d880eebfbf1c"), + "order": 32.5, + "active": true, + "type": 20, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0, + "containerHtml": "ORAAAA", + "anim": { + "_id": ObjectId("66e459421e0719a1012123ad"), + "name": "", + "clduration": "", + "cldelay": "", + "timingtype": "ease-in-out" + } + } + , + { + "_id": ObjectId("66e4270d78c8d880eebfbf24"), + "order": 40, + "active": true, + "type": 20, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0, + "containerHtml": "BBB", + "anim": { + "_id": ObjectId("66e4568d1e0719a1012121a6"), + "name": "", + "clduration": "", + "cldelay": "", + "timingtype": "ease-in-out" + } + }, { + "_id": ObjectId("66e45b0c78c8d880eebfbf45"), + "order": 70, + "active": true, + "type": 20, + "path": "home", + "container": "", + "idapp": "19", + "elemsText": [], + "listcards": [], + "list": [], + "__v": 0, + "containerHtml": "AAAA" + }]); + + +db.sites.insert( + /* 1 */ + { + "_id": ObjectId("669fbef7fc704b8912263af9"), + "confpages": { + "font": "", + "col_toolbar": "", + "col_bgfooter": "", + "show_darkopt": false, + "showButtHome": true, + "showProfile": false, + "showUserMenu": true, + "showiscrittiMenu": true, + "showRegButton": true, + "enableReg": false, + "showNL": false, + "sendNewsletter": true, + "showMsgs": false, + "showNotif": true, + "showCoins": false, + "showRIS": false, + "showMenuCoins": false, + "showNameSurname": true, + "showCompetenze": true, + "showConnected": false, + "bookingEvents": false, + "enableEcommerce": false, + "enableAI": false, + "enableGroups": true, + "enableCircuits": false, + "enableProj": false, + "enableTodos": false, + "enableRegByBot": false, + "enableRegMultiChoice": false, + "enableTokenExpired": true, + "enableDebugOn": false, + "enabledRegNeedTelegram": false, + "showViewEventi": false, + "showViewGroups": false, + "showViewCircuits": false, + "showViewUsers": false, + "showViewBooking": false, + "showViewProfile": true, + "showViewCart": false, + "showViewOrders": false, + "enablePwa": true, + "lang": 0, + "videoPromo": "", + "PDFPromo": "" + }, + "confsite": { + "options": 64 + }, + "policy": { + "show": false + }, + "contacts": { + "facebook": "", + "instagram": "", + "whatsapp": "", + "whatsapp_home": false, + "telegram": "", + "youtube": "", + "email": "", + "address": "", + "map": "", + "info2": "", + "cell": "" + }, + "ecomm": { + "enablePreOrders": false, + "NoteExtraOnCart": "" + }, + "name": "Abitare Gli Iblei", + "host": "https://abitaregliiblei.it", + "active": true, + "idapp": "19", + "adminemail": "surya@riso.app", + "__v": 0, + "dir": "/Users/suryapaolo/myproject/newfreeplanet/", + "dir_test": "/Users/suryapaolo/myproject/newfreeplanet/", + "host_test": "https://test.abitaregliiblei.it", + "host_ip": "65.108.222.97", + "host_api_ip": "65.108.222.97", + "host_api": "https://api.abitaregliiblei.it", + "host_testapi": "https://testapi.abitaregliiblei.it", + "host_testapi_ip": "65.108.222.97", + "host_test_ip": "65.108.222.97", + "cf_token": "M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0", + "cf_zoneId": "cd7447660fcc6534ca7ce4c135df1e54", + "enable_servermail_this_domain": "true", + "servermail": "box.lamiaposta.org", + "servermailip": "65.21.63.147", + "enable_servermail": true, + "dkim": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv++u/ysGgAGfOaSCLmNkfnczedXXDRdJUi+M+gZTVk7XfGZLlLWh00xXgOIj1lU4jRgFnQx39SSbsS9foPLMrCXnPcSnPPCUpDbmkKtGlWPZDncOUGIZVpNpFMOBul+p+SckUW7gomayV1dluFw72oNLlc/Y0CVWT5Le0OL66FG7D0", + "manageremail": "reg@abitaregliiblei.it", + "idMyGroup": "AbitareGliIblei" + } +) + +db.users.insert( + { + "_id": ObjectId("669fbef7c9d625d0628eb12d"), + "profile": { + "paymenttypes": [], + "notif_idCities": [], + "notif_provinces": [], + "notif_regions": [], + "notif_sectors": [], + "notif_sector_goods": [], + "img": "", + "nationality": "", + "intcode_cell": "", + "cell": "", + "dateofbirth": null, + "sex": 0, + "country_pay": "", + "email_paypal": "", + "payeer_id": "", + "advcash_id": "", + "revolut": "", + "link_payment": "", + "note_payment": "", + "username_telegram": "", + "teleg_id": 0, + "teleg_checkcode": 0, + "my_dream": "", + "manage_telegram": false, + "admin_telegram": false, + "saw_zoom_presentation": false, + "ask_zoom_partecipato": false, + "saw_and_accepted": 0, + "socio": false, + "socioresidente": false, + "qualified": false, + "qualified_2invitati": false, + "myshares": [], + "friends": [], + "req_friends": [], + "handshake": [], + "mygroups": [], + "mycircuits": [], + "last_circuitpath": "", + "notifs": [ + { + "dir": 1, + "value": 88 + }, + { + "dir": 2, + "value": 4 + }, + { + "dir": 3, + "value": 1 + }, + { + "dir": 4, + "value": 1 + }, + { + "dir": 5, + "value": 1 + }, + { + "dir": 11, + "value": 1 + }, + { + "dir": 12, + "value": 1 + } + ], + "stepTutorial": 0, + "noNameSurname": false, + "noCircuit": false, + "noCircIta": false, + "noFoto": false, + "resid_province": "", + "resid_card": "", + "seen": [], + "bookmark": [], + "favorite": [], + "attend": [], + "version": 10060 + }, + "ipaddr": "::1", + "linkreg": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGFwcCI6IjE5IiwiZW1haWwiOiJ2aW5jZW56b2Zhenppbm81OEBnbWFpbC5jb20iLCJ1c2VybmFtZSI6IkVuem8iLCJpYXQiOjE3MjY0MTM2NTh9.YlgziPXK2ZeWe_buExvHnelMMc", + "lasttimeonline": ISODate("2024-09-15T20:09:41.378Z"), + "date_reg": ISODate("2024-09-15T15:20:58.743Z"), + "aportador_iniziale": "------", + "idMyGroup": "abitaregliiblei", + "useragent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36", + "email": "surya@riso.app", + "username": "admin", + "password": "$2a$12$Dr58jMRtbt6Y3y6MYFopCO07hBo20TlmdzJW.lVvRIhNy7yFFizT2", + "name": "admin", + "index": 1, + "surname": "", + "lang": "it", + "verified_email": true, + "verified_by_aportador": true, + "perm": 3, + "retry_pwd": 0, + "deleted": false, + "lang": "it", + "aportador_solidario": "------", + "tokens": [ + { + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE", + "_id": ObjectId("66e6fcf1ac95a84fd0e11b2c"), + "access": "auth", + "browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4", + "date_login": ISODate("2024-09-15T15:27:45.368Z") + }, + { + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU", + "_id": ObjectId("66e73f04ac95a84fd0e122ae"), + "access": "auth", + "browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4", + "date_login": ISODate("2024-09-15T20:09:40.212Z") + } + ], + }); \ No newline at end of file diff --git a/admin_scripts/3_DATABASE/dati_attivitas.js b/admin_scripts/3_DATABASE/dati_attivitas.js new file mode 100644 index 0000000..deef07c --- /dev/null +++ b/admin_scripts/3_DATABASE/dati_attivitas.js @@ -0,0 +1,92 @@ +db.attivitas.insertMany([ + { + "_id": "66db5bd1c76639f8b2c67e55", + "coordinate_gps": { + "address": "Via Roma, Gaggio Montano, Unione dell'Appennino Bolognese, Bologna, Emilia-Romagna, 40041, Italia", + "type": "Point", + "coordinates": [ + 10.953268, + 44.190335 + ] + }, + "idSkill": 0, + "idCity": [ + 744 + ], + "userId": "66db21115281b23462d496d2", + "idapp": "19", + "descr": "Esempio di Attività", + "idSector": 2, + "note": "Descrizione dell'attività", + "tipodiAttivita": 2, + "createdBy": "paoloar77", + "date_updated": ISODate("2024-09-06T19:45:21.527Z"), + "photos": [], + "date_created": ISODate("2024-09-06T19:45:21.530Z"), + "__v": 0, + "numattend": 0, + "numbook": 0, + "numfav": 0, + "numseen": 2 + }, + { + "_id": "66e2ec7c475c299010b76fe7", + "coordinate_gps": { + "address": "14, Corso Vittorio Emanuele, Noto, Siracusa, Sicilia, 96017, Italia", + "type": "Point", + "coordinates": [ + 15.070645, + 36.890886 + ] + }, + "idSkill": 0, + "idCity": [ + 6908 + ], + "userId": "66e2ead3ee075227efd521ad", + "idapp": "19", + "tipodiAttivita": 1, + "descr": "Esempio 2", + "idSector": 2, + "note": "Descrizione dell'Attività....", + "createdBy": "Paolo7", + "date_updated": ISODate("2024-09-12T13:28:28.593Z"), + "photos": [], + "date_created": ISODate("2024-09-12T13:28:28.597Z"), + "__v": 0, + "numattend": 0, + "numbook": 0, + "numfav": 0, + "numseen": 2 + }, + { + "_id": "66e31772d0acc6ce435a868b", + "coordinate_gps": { + "address": "Via Roma, Anzio, Anzio Colonia, Anzio, Roma, Lazio, 00042, Italia", + "type": "Point", + "coordinates": [ + 12.626422, + 41.448654 + ] + }, + "idSkill": 1, + "idCity": [ + 5903 + ], + "userId": "66db21115281b23462d496d2", + "idapp": "19", + "descr": "prova3", + "tipodiAttivita": 1, + "idSector": 1, + "note": "asdasd", + "createdBy": "paoloar77", + "date_updated": ISODate("2024-09-12T16:31:46.361Z"), + "photos": [], + "date_created": ISODate("2024-09-12T16:31:46.364Z"), + "__v": 0, + "numattend": 0, + "numbook": 0, + "numfav": 0, + "numseen": 1 + } +]); \ No newline at end of file diff --git a/admin_scripts/3_DATABASE/dati_mygroups.js b/admin_scripts/3_DATABASE/dati_mygroups.js new file mode 100644 index 0000000..68f6175 --- /dev/null +++ b/admin_scripts/3_DATABASE/dati_mygroups.js @@ -0,0 +1,36 @@ +db.mygroups.insert( + { + "_id": "66e2e6273eff2ca4e7b2ef92", + "idCity": [ + 6908, + 5634 + ], + "note": "Descrizione...", + "visibility": [ + 0 + ], + "deleted": false, + "groupname": "abitaregliiblei", + "photos": [], + "admins": [ + { + "_id": ObjectId("66e2e6276b502b07f1e89571"), + "username": "paoloar77" + } + ], + "req_users": [], + "blocked": false, + "website": "", + "link_telegram": "", + "userId": "66db21115281b23462d496d2", + "idapp": "19", + "title": "Abitare Gli Iblei", + "descr": "Abitare Gli Iblei", + "idCatGrp": 14, + "createdBy": "paoloar77", + "date_updated": ISODate("2024-09-12T13:01:27.954Z"), + "refused_users": [], + "mycircuits": [], + "date_created": ISODate("2024-09-12T13:01:27.960Z"), + "__v": 0 + }); \ No newline at end of file diff --git a/admin_scripts/3_DATABASE/dati_mypages.js b/admin_scripts/3_DATABASE/dati_mypages.js new file mode 100644 index 0000000..b87a9b0 --- /dev/null +++ b/admin_scripts/3_DATABASE/dati_mypages.js @@ -0,0 +1,27 @@ +db.mypages.insertMany([ + { + "_id": ObjectId("66db21118009ea4503bb6a01"), + "order": 10, + "idapp": "19", + "path": "home", + "active": true, + "title": "Home", + }, + { + "_id": ObjectId("66db21118009ea4503bb6a03"), + "order": 10, + "idapp": "19", + "path": "home_logout", + "active": true, + "title": "Home NoLoggato", + }, + { + "_id": ObjectId("66e322dd5a6360e3b3c71c5a"), + "order": 40, + "idapp": "19", + "path": "presentazione", + "active": true, + "title": "Presentazione", + "inmenu": true, + "icon": "fas fa-info" + }]); \ No newline at end of file diff --git a/admin_scripts/3_DATABASE/dati_users.js b/admin_scripts/3_DATABASE/dati_users.js new file mode 100644 index 0000000..32145c6 --- /dev/null +++ b/admin_scripts/3_DATABASE/dati_users.js @@ -0,0 +1,334 @@ +db.users.insertMany([ + { + "_id": ObjectId("66db21115281b23462d496d2"), + "profile": { + "paymenttypes": [], + "notif_idCities": [], + "notif_provinces": [], + "notif_regions": [], + "notif_sectors": [], + "notif_sector_goods": [], + "myshares": [], + "friends": [], + "req_friends": [], + "handshake": [], + "mygroups": [ + { + "groupname": "abitaregliiblei", + "date": ISODate("2024-09-12T13:01:27.975Z") + } + ], + "mycircuits": [], + "notifs": [ + { + "dir": 1, + "value": 88 + }, + { + "dir": 2, + "value": 4 + }, + { + "dir": 3, + "value": 1 + }, + { + "dir": 4, + "value": 1 + }, + { + "dir": 5, + "value": 1 + }, + { + "dir": 11, + "value": 1 + }, + { + "dir": 12, + "value": 1 + } + ], + "seen": [], + "bookmark": [], + "favorite": [], + "attend": [], + "special_req": true, + "nationality": "IT", + "manage_telegram": true, + "admin_telegram": true, + "teleg_id": 12429864, + "username_telegram": "surya1977", + "version": 10060 + }, + "retry_pwd": 0, + "deleted": false, + "tokens": [ + { + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3Mjc3MjI0NjV9.EOvF89kswT1eqVJCSwVMMI-jB4kokP-aQVhi7xSUods", + "_id": ObjectId("66e87ee1bbe2ce0f77adf6b8"), + "access": "auth", + "browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3MjY1MjAwNjV9.ESvyTWmXhfAQ0i-wwjxZR1A1Y5Bwixb60uG_UcOPQ5Y", + "date_login": ISODate("2024-09-16T18:54:25.147Z") + } + ], + "idapp": "19", + "email": "paolo@riso.app", + "username": "paoloar77", + "password": "$2a$12$rhq.rkdMWP4cE1MOweztiOPeAmwHYVCW9q5vyH4LVGelEssUFRl8C", + "name": "paoloar77", + "index": 1, + "surname": "", + "lang": "it", + "verified_email": true, + "verified_by_aportador": true, + "perm": 3, + "lasttimeonline": ISODate("2024-09-16T18:55:22.278Z"), + "date_reg": ISODate("2024-09-06T15:34:41.673Z"), + "__v": 13, + "useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" + }, + { + "_id": ObjectId("66e49515d18d313a144ead56"), + "profile": { + "paymenttypes": [], + "notif_idCities": [], + "notif_provinces": [], + "notif_regions": [], + "notif_sectors": [], + "notif_sector_goods": [], + "img": "", + "nationality": "", + "intcode_cell": "", + "cell": "", + "dateofbirth": null, + "sex": 0, + "country_pay": "", + "email_paypal": "", + "payeer_id": "", + "advcash_id": "", + "revolut": "", + "link_payment": "", + "note_payment": "", + "username_telegram": "", + "teleg_id": 0, + "teleg_checkcode": 0, + "my_dream": "", + "manage_telegram": false, + "admin_telegram": false, + "saw_zoom_presentation": false, + "ask_zoom_partecipato": false, + "saw_and_accepted": 0, + "socio": false, + "socioresidente": false, + "qualified": false, + "qualified_2invitati": false, + "myshares": [], + "friends": [], + "req_friends": [], + "handshake": [], + "mygroups": [], + "mycircuits": [], + "last_circuitpath": "", + "notifs": [ + { + "dir": 1, + "value": 88 + }, + { + "dir": 2, + "value": 4 + }, + { + "dir": 3, + "value": 1 + }, + { + "dir": 4, + "value": 1 + }, + { + "dir": 5, + "value": 1 + }, + { + "dir": 11, + "value": 1 + }, + { + "dir": 12, + "value": 1 + } + ], + "stepTutorial": 0, + "noNameSurname": false, + "noCircuit": false, + "noCircIta": false, + "noFoto": false, + "resid_province": "", + "resid_card": "", + "seen": [], + "bookmark": [], + "favorite": [], + "attend": [], + "version": 10060 + }, + "retry_pwd": 0, + "deleted": false, + "email": "paolo@freeplanet.app", + "password": "$2a$12$qX5DRHDm9BW/ZTgPvTmP/u7VdaEd5ybfFAmEfqEK2VUAhQGt6DFcO", + "username": "paolotest", + "name": "Paolo", + "surname": "Test", + "idapp": "19", + "lang": "it", + "aportador_solidario": "------", + "tokens": [ + { + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3Mjc1NTY5MTV9.NHnFUXOL0MbjRs9F6HrQsEBRGXG89AsBYP7jU9m8icY", + "_id": ObjectId("66e5f83392c9540e18f89730"), + "access": "auth", + "browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3MjYzNTQ1MTV9.HTr1kNMhBU_38R2Tfy6m22XCbiRh5IsBKC3fl0ipIgM", + "date_login": ISODate("2024-09-14T20:55:15.500Z") + } + ], + "ipaddr": "::1", + "linkreg": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGFwcCI6IjE5IiwiZW1haWwiOiJwYW9sb0BmcmVlcGxhbmV0LmFwcCIsInVzZXJuYW1lIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MjU2NDA1fQ.SoIGdtkoBwJvUtfWdDLpY__cdtkq", + "verified_email": true, + "lasttimeonline": ISODate("2024-09-14T20:55:15.502Z"), + "date_reg": ISODate("2024-09-13T19:40:05.188Z"), + "aportador_iniziale": "------", + "verified_by_aportador": true, + "idMyGroup": "abitaregliiblei", + "index": 2, + "__v": 3, + "perm": 16 + }, + { + "_id": ObjectId("66e6fb5aac95a84fd0e11881"), + "profile": { + "paymenttypes": [], + "notif_idCities": [], + "notif_provinces": [], + "notif_regions": [], + "notif_sectors": [], + "notif_sector_goods": [], + "img": "", + "nationality": "", + "intcode_cell": "", + "cell": "", + "dateofbirth": null, + "sex": 0, + "country_pay": "", + "email_paypal": "", + "payeer_id": "", + "advcash_id": "", + "revolut": "", + "link_payment": "", + "note_payment": "", + "username_telegram": "", + "teleg_id": 0, + "teleg_checkcode": 0, + "my_dream": "", + "manage_telegram": false, + "admin_telegram": false, + "saw_zoom_presentation": false, + "ask_zoom_partecipato": false, + "saw_and_accepted": 0, + "socio": false, + "socioresidente": false, + "qualified": false, + "qualified_2invitati": false, + "myshares": [], + "friends": [], + "req_friends": [], + "handshake": [], + "mygroups": [], + "mycircuits": [], + "last_circuitpath": "", + "notifs": [ + { + "dir": 1, + "value": 88 + }, + { + "dir": 2, + "value": 4 + }, + { + "dir": 3, + "value": 1 + }, + { + "dir": 4, + "value": 1 + }, + { + "dir": 5, + "value": 1 + }, + { + "dir": 11, + "value": 1 + }, + { + "dir": 12, + "value": 1 + } + ], + "stepTutorial": 0, + "noNameSurname": false, + "noCircuit": false, + "noCircIta": false, + "noFoto": false, + "resid_province": "", + "resid_card": "", + "seen": [], + "bookmark": [], + "favorite": [], + "attend": [], + "version": 10060 + }, + "retry_pwd": 0, + "deleted": false, + "email": "vincenzofazzino58@gmail.com", + "password": "$2a$12$z7Xg8QUmTsp8Jcj4SpoCsOVUsj5H7aLiKWS.IP2c/OkApnCUhARzK", + "username": "Enzo", + "name": "Enzo", + "surname": "Fazzino", + "idapp": "19", + "lang": "it", + "aportador_solidario": "------", + "tokens": [ + { + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE", + "_id": ObjectId("66e6fcf1ac95a84fd0e11b2c"), + "access": "auth", + "browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4", + "date_login": ISODate("2024-09-15T15:27:45.368Z") + }, + { + "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU", + "_id": ObjectId("66e73f04ac95a84fd0e122ae"), + "access": "auth", + "browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36", + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4", + "date_login": ISODate("2024-09-15T20:09:40.212Z") + } + ], + "ipaddr": "::1", + "linkreg": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGFwcCI6IjE5IiwiZW1haWwiOiJ2aW5jZW56b2Zhenppbm81OEBnbWFpbC5jb20iLCJ1c2VybmFtZSI6IkVuem8iLCJpYXQiOjE3MjY0MTM2NTh9.YlgziPXK2ZeWe_buExvHnelMMc", + "verified_email": true, + "lasttimeonline": ISODate("2024-09-15T20:09:41.378Z"), + "date_reg": ISODate("2024-09-15T15:20:58.743Z"), + "aportador_iniziale": "------", + "verified_by_aportador": true, + "idMyGroup": "abitaregliiblei", + "index": 3, + "__v": 5, + "useragent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36" + } +]); \ No newline at end of file diff --git a/deploynode_on_prod_pcb.sh b/deploynode_on_prod_pcb.sh index 6c6c9bb..60e533e 100755 --- a/deploynode_on_prod_pcb.sh +++ b/deploynode_on_prod_pcb.sh @@ -20,6 +20,7 @@ SYNC_ITEMS=( "docs" "emails" "plugins" + "admin_scripts" "sass" "src" ) diff --git a/deploynode_on_test_pcb.sh b/deploynode_on_test_pcb.sh index f3407b5..e1b5de9 100755 --- a/deploynode_on_test_pcb.sh +++ b/deploynode_on_test_pcb.sh @@ -2,18 +2,63 @@ source ./.env.test.pcb -echo "Sincronizzazione in corso PCB TEST ... /var/www/$DIRECTORY_SERVER/" +echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/" echo "" -rsync -avz -e 'ssh -p 8822' css pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' docs pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' emails pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' images pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' plugins pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' sass pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' .env.test.pcb pcbuser@pcb:/var/www/$DIRECTORY_SERVER/.env.test -rsync -avz -e 'ssh -p 8822' .env.test.pcb pcbuser@pcb:/var/www/$DIRECTORY_SERVER/ -rsync -avz -e 'ssh -p 8822' package.json pcbuser@pcb:/var/www/$DIRECTORY_SERVER/package.json +#!/bin/bash + +# Configurazione +REMOTE_USER="pcbuser" +REMOTE_HOST="pcb" +REMOTE_PORT="8822" +REMOTE_DIR="$DIRECTORY_SERVER" +SSH_OPTIONS="-p $REMOTE_PORT" + +# Array di cartelle e file da sincronizzare +SYNC_ITEMS=( + "css" + "docs" + "emails" + "plugins" + "admin_scripts" + "sass" + "src" +) + +echo $REMOTE_DIR + +echo "" +echo "*** Copia Cartelle ... " + + +# Esegui rsync per le cartelle +rsync -avz --delete \ + --exclude='src/server/router/upload/' \ + -e "ssh $SSH_OPTIONS" \ + "${SYNC_ITEMS[@]}" \ + "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/" + +echo "" +echo "*** Copia del file .env.test ... " + +# Sincronizza i file specifici +rsync -avz -e "ssh $SSH_OPTIONS" \ + .env.test.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.test" + +echo "" +echo "*** Copia del file package.json ... " +rsync -avz -e "ssh $SSH_OPTIONS" \ + package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json" + +echo "" +echo "*** Copia del file ecosystem.config.testpcb.js in ecosystem.config.js ... " +rsync -avz -e "ssh $SSH_OPTIONS" \ + ecosystem.config.testpcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js" + +# Verifica il risultato +if [ $? -eq 0 ]; then + echo "Sincronizzazione completata con successo. SERVER PCB TEST! " +else + echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli." +fi -echo "Sincronizzazione TERMINATA! - SERVER PCB!" diff --git a/docs/apache2/sites-available/dominioinclude_piuchebuono.app.conf b/docs/apache2/sites-available/dominioinclude_piuchebuono.app.conf new file mode 100644 index 0000000..8449c67 --- /dev/null +++ b/docs/apache2/sites-available/dominioinclude_piuchebuono.app.conf @@ -0,0 +1,4 @@ +Define MIODOMINIO piuchebuono.app +Define MIODOMINIO_COMPLETO piuchebuono.app +Define MIOURL_API api.piuchebuono.app +Define PORTA 3000 \ No newline at end of file diff --git a/docs/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf b/docs/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf index 0dcfb7c..55e2eb9 100644 --- a/docs/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf +++ b/docs/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf @@ -1,4 +1,4 @@ Define MIODOMINIO abitaregliiblei.it Define MIODOMINIO_COMPLETO test.abitaregliiblei.it -Define MIOURL_TESTAPI testapi.abitaregliiblei.it -Define PORTA 3022 \ No newline at end of file +Define MIOURL_API testapi.abitaregliiblei.it +Define PORTA 3021 \ No newline at end of file diff --git a/docs/apache2/sites-available/dominioinclude_test.riso.app.conf b/docs/apache2/sites-available/dominioinclude_test.riso.app.conf new file mode 100644 index 0000000..abb6667 --- /dev/null +++ b/docs/apache2/sites-available/dominioinclude_test.riso.app.conf @@ -0,0 +1,4 @@ +Define MIODOMINIO riso.app +Define MIODOMINIO_COMPLETO test.riso.app +Define MIOURL_API testapi.riso.app +Define PORTA 3005 \ No newline at end of file diff --git a/docs/apache2/sites-available/nodejs_3000_api.piuchebuono.app.conf b/docs/apache2/sites-available/nodejs_3000_api.piuchebuono.app.conf new file mode 100644 index 0000000..b1c1e96 --- /dev/null +++ b/docs/apache2/sites-available/nodejs_3000_api.piuchebuono.app.conf @@ -0,0 +1,3 @@ +Include /etc/apache2/sites-available/dominioinclude_piuchebuono.app.conf + +Include /etc/apache2/sites-available/nodejs_virtualhost_ssl_http_https.conf \ No newline at end of file diff --git a/docs/apache2/ssl_vhost_api.abitaregliiblei.it.conf b/docs/apache2/sites-available/nodejs_virtualhost_ssl_http_https.conf similarity index 79% rename from docs/apache2/ssl_vhost_api.abitaregliiblei.it.conf rename to docs/apache2/sites-available/nodejs_virtualhost_ssl_http_https.conf index bd48c60..636befb 100644 --- a/docs/apache2/ssl_vhost_api.abitaregliiblei.it.conf +++ b/docs/apache2/sites-available/nodejs_virtualhost_ssl_http_https.conf @@ -1,14 +1,11 @@ -Include /etc/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf - # Configurazione per HTTP - ServerName ${MIODOMINIO_COMPLETO} - DocumentRoot /var/www/${MIODOMINIO_COMPLETO} + ServerName ${MIOURL_API} RewriteEngine on # Redirigi tutto il traffico HTTP verso HTTPS - RewriteCond %{SERVER_NAME} =${MIODOMINIO_COMPLETO} [OR] - RewriteCond %{SERVER_NAME} =www.${MIODOMINIO_COMPLETO} + RewriteCond %{SERVER_NAME} =${MIOURL_API} [OR] + RewriteCond %{SERVER_NAME} =www.${MIOURL_API} RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] ErrorLog /var/www/${MIODOMINIO_COMPLETO}/logs/error.log @@ -16,8 +13,7 @@ Include /etc/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf - - ServerName ${MIOURL_TESTAPI} + ServerName ${MIOURL_API} ServerAdmin surya@riso.app SSLEngine On @@ -39,7 +35,7 @@ Include /etc/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf ProxyTimeout 5 - LogLevel debug proxy:trace5 + LogLevel warn ErrorLog /var/www/${MIODOMINIO_COMPLETO}/logs/error.log CustomLog /var/www/${MIODOMINIO_COMPLETO}/logs/access.log combined diff --git a/docs/apache2/sites-available/websites_ssl_piuchebuono.app.conf b/docs/apache2/sites-available/websites_ssl_piuchebuono.app.conf new file mode 100644 index 0000000..f6582a8 --- /dev/null +++ b/docs/apache2/sites-available/websites_ssl_piuchebuono.app.conf @@ -0,0 +1,3 @@ +Include /etc/apache2/sites-available/dominioinclude_piuchebuono.app.conf + +Include /etc/apache2/sites-available/websites_ssl_virtualhost.conf \ No newline at end of file diff --git a/docs/apache2/sites-available/websites_ssl_test.abitaregliiblei.it.conf b/docs/apache2/sites-available/websites_ssl_test.abitaregliiblei.it.conf new file mode 100644 index 0000000..f55da04 --- /dev/null +++ b/docs/apache2/sites-available/websites_ssl_test.abitaregliiblei.it.conf @@ -0,0 +1,3 @@ +Include /etc/apache2/sites-available/dominioinclude_test.abitaregliiblei.it.conf + +Include /etc/apache2/sites-available/websites_ssl_virtualhost.conf diff --git a/docs/apache2/sites-available/websites_ssl_virtualhost.conf b/docs/apache2/sites-available/websites_ssl_virtualhost.conf new file mode 100644 index 0000000..c436992 --- /dev/null +++ b/docs/apache2/sites-available/websites_ssl_virtualhost.conf @@ -0,0 +1,30 @@ + + ServerName ${MIODOMINIO_COMPLETO} + RewriteEngine On + + # Forza la connessione HTTPS + RewriteCond %{HTTPS} off + RewriteRule ^ https://${MIODOMINIO_COMPLETO}%{REQUEST_URI} [L,R=301] + + + + ServerName ${MIODOMINIO_COMPLETO} + DocumentRoot /var/www/${MIODOMINIO_COMPLETO} + ServerAdmin surya@riso.app + SSLEngine On + SSLProtocol -ALL +TLSv1.2 + SSLCompression Off + SSLHonorCipherOrder off + SSLCipherSuite ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128 + SSLVerifyDepth 10 + SSLCertificateFile /etc/letsencrypt/live/${MIODOMINIO}/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/${MIODOMINIO}/privkey.pem + + CGIPassAuth On + Require all granted + AllowOverride All + + LogLevel warn + ErrorLog "/var/www/${MIODOMINIO_COMPLETO}/logs/error.log" + CustomLog "/var/www/${MIODOMINIO_COMPLETO}/logs/access.log" combined + \ No newline at end of file diff --git a/docs/apache2/ssl_vhost_api.gruppomacro.app.conf b/docs/apache2/ssl_vhost_api.gruppomacro.app.conf deleted file mode 100644 index d4fa7ea..0000000 --- a/docs/apache2/ssl_vhost_api.gruppomacro.app.conf +++ /dev/null @@ -1,23 +0,0 @@ - - ServerName api.gruppomacro.app - ServerAdmin surya@riso.app - - SSLEngine On - SSLCertificateFile /etc/letsencrypt/live/gruppomacro.app/cert.pem - SSLCertificateKeyFile /etc/letsencrypt/live/gruppomacro.app/privkey.pem - - ProxyPass / https://localhost:3010/ retry=0 timeout=5 connectiontimeout=2 - ProxyPassReverse / https://localhost:3010/ - - ProxyTimeout 5 - - LogLevel debug proxy:trace5 - ErrorLog "/var/customers/logs/paolouser-error.log" - CustomLog "/var/customers/logs/paolouser-access.log" combined - - - ProxyPassReverse / - SetEnv force-proxy-request-1.0 1 - SetEnv proxy-nokeepalive 1 - - \ No newline at end of file diff --git a/docs/apache2/ssl_vhost_api.riso.app.conf b/docs/apache2/ssl_vhost_api.riso.app.conf deleted file mode 100644 index c3fbc56..0000000 --- a/docs/apache2/ssl_vhost_api.riso.app.conf +++ /dev/null @@ -1,34 +0,0 @@ - - ServerName api.riso.app - ServerAlias www.api.riso.app - ServerAdmin surya@riso.app - - SSLEngine On - SSLProtocol -ALL +TLSv1.2 +TLSv1.3 - SSLCompression Off - SSLHonorCipherOrder off - SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:E> - SSLVerifyDepth 10 - SSLCertificateFile /etc/letsencrypt/live/riso.app/cert.pem - SSLCertificateKeyFile /etc/letsencrypt/live/riso.app/privkey.pem - - ProxyPreserveHost On - SSLProxyEngine On - SSLProxyVerify None - SSLProxyCheckPeerCN Off - SSLProxyCheckPeerName Off - ProxyPass / https://localhost:3005/ retry=0 timeout=5 connectiontimeout=2 - ProxyPassReverse / https://localhost:3005/ - - ProxyTimeout 5 - - LogLevel debug proxy:trace5 - ErrorLog "/var/www/riso.app/logs/error.log" - CustomLog "/var/www/riso.app/logs/access.log" combined - - - ProxyPassReverse / - SetEnv force-proxy-request-1.0 1 - SetEnv proxy-nokeepalive 1 - - \ No newline at end of file diff --git a/docs/apache2/vhost.ssl_piuchebuono.conf b/docs/apache2/vhost.ssl_piuchebuono.conf deleted file mode 100644 index 154eb5d..0000000 --- a/docs/apache2/vhost.ssl_piuchebuono.conf +++ /dev/null @@ -1,22 +0,0 @@ - - ServerName piuchebuono.app - ServerAlias *.piuchebuono.app - ServerAdmin surya@riso.app - SSLEngine On - SSLProtocol -ALL +TLSv1.2 - SSLCompression Off - SSLHonorCipherOrder off - SSLCipherSuite ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128 - SSLVerifyDepth 10 - SSLCertificateFile /etc/letsencrypt/live/piuchebuono.app/cert.pem - SSLCertificateKeyFile /etc/letsencrypt/live/piuchebuono.app/privkey.pem - DocumentRoot "/var/customers/webs/paolouser/piuchebuono.app" - - CGIPassAuth On - Require all granted - AllowOverride All - - LogLevel warn - ErrorLog "/var/customers/logs/paolouser-error.log" - CustomLog "/var/customers/logs/paolouser-access.log" combined - \ No newline at end of file diff --git a/docs/gitlab/aggiungere_a_gitlab.rb.txt b/docs/gitlab/aggiungere_a_gitlab.rb.txt new file mode 100644 index 0000000..cb60e0a --- /dev/null +++ b/docs/gitlab/aggiungere_a_gitlab.rb.txt @@ -0,0 +1,24 @@ +docker exec -it gitlab /bin/bash + +apt-get update +apt-get install nano + +nano /etc/gitlab/gitlab.rb + + +gitlab_rails['smtp_address'] = "smtp.example.com" +gitlab_rails['smtp_port'] = 587 +gitlab_rails['smtp_user_name'] = "tuo_username" +gitlab_rails['smtp_password'] = "tuo_password" +gitlab_rails['smtp_domain'] = "example.com" +gitlab_rails['smtp_enable_starttls_auto'] = true +gitlab_rails['smtp_tls'] = true + + +gitlab_rails['smtp_address'] = "box.lamiaposta.org" +gitlab_rails['smtp_port'] = 465 +gitlab_rails['smtp_user_name'] = "gitlab@riso.app" +gitlab_rails['smtp_password'] = "MYPRISO_1290_1977@!" +gitlab_rails['smtp_domain'] = "lamiaposta.org" +gitlab_rails['smtp_enable_starttls_auto'] = true +gitlab_rails['smtp_tls'] = true \ No newline at end of file diff --git a/ecosystem.config.testpcb.js b/ecosystem.config.testpcb.js new file mode 100755 index 0000000..2c40036 --- /dev/null +++ b/ecosystem.config.testpcb.js @@ -0,0 +1,22 @@ +module.exports = { + apps: [ + { + name: "TEST PiuCheBuono_ServerSide", + script: "/var/www/nodejs_test.piuchebuono_server/src/server/server.js", + ignore_watch: ["node_modules", "logs"], + interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node", + //autorestart: true, + instances: 1, + watch: false, + env: { + "PORT": 0, + "NODE_ENV": "test" + }, + log_file: "logs/combined.test.outerr.log", + error_file: "logs/errtest.log", + out_file: "logs/outtest.log", + merge_logs: true, + log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z" + } + ] +}; \ No newline at end of file diff --git a/ecosystem.config.testriso.js b/ecosystem.config.testriso.js index 48c9841..9d8ad63 100755 --- a/ecosystem.config.testriso.js +++ b/ecosystem.config.testriso.js @@ -1,9 +1,9 @@ module.exports = { - apps : [ + apps: [ { name: "TESTRISO2 FreePlanetServerSide", script: "./src/server/server.js", - ignore_watch : ["node_modules"], + ignore_watch: ["node_modules", "logs"], interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node", watch: false, //autorestart: true, diff --git a/scripts/docker_copia_da_a.sh b/scripts/docker_copia_da_a.sh new file mode 100644 index 0000000..38128ee --- /dev/null +++ b/scripts/docker_copia_da_a.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Ensure two arguments are provided +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +DIR_ORIG=$1 +DIR_DEST=$2 + +# Check if the source directory exists +if [ ! -d "$DIR_ORIG" ]; then + echo "Error: Source directory '$DIR_ORIG' does not exist." + exit 1 +fi + +# Create the destination directory if it doesn't exist +#mkdir -p "$DIR_DEST" + +# Run the Docker command to copy files +docker run --rm -v "$DIR_ORIG":/from -v "$DIR_DEST":/to alpine ash -c "cp -av /from/. /to" + +# Check if the Docker command was successful +if [ $? -eq 0 ]; then + echo "Files copied successfully from '$DIR_ORIG' to '$DIR_DEST'." +else + echo "Error: Failed to copy files." + exit 1 +fi \ No newline at end of file diff --git a/src/server/models/myelem.js b/src/server/models/myelem.js index 0480b8e..0f131c1 100755 --- a/src/server/models/myelem.js +++ b/src/server/models/myelem.js @@ -16,6 +16,7 @@ mongoose.plugin(schema => { const myCard = new Schema( { imagefile: String, + vers_img: Number, alt: String, description: String, style: String, @@ -169,6 +170,9 @@ const MyElemSchema = new Schema({ image: { type: String, }, + vers_img: { + type: Number, + }, listcards: [myCard], catalogo: catalogo, list: [ @@ -176,6 +180,9 @@ const MyElemSchema = new Schema({ imagefile: { type: String }, + vers_img: { + type: Number, + }, order: { type: Number }, diff --git a/src/server/models/user.js b/src/server/models/user.js index 82b208f..fd0ffe4 100755 --- a/src/server/models/user.js +++ b/src/server/models/user.js @@ -1499,6 +1499,7 @@ UserSchema.statics.createNewRequestPwd = function (idapp, email, code) { res.status(400).send(); }); } else { + console.log('findByEmail idapp: ', idapp, 'email', email); return User.findByEmail(idapp, email).then(async (user) => { if (!user) { return { ris: false }; diff --git a/src/server/modules/Mailinabox.js b/src/server/modules/Mailinabox.js index b05da6e..b71c53e 100644 --- a/src/server/modules/Mailinabox.js +++ b/src/server/modules/Mailinabox.js @@ -56,11 +56,15 @@ class Mailinabox { // Trova e stampa il record DKIM const dkimRecord = records.find(record => record.includes('mail._domainkey')); if (dkimRecord) { - const pMatch = dkimRecord.match(/p=([A-Za-z0-9+/]+)/); - if (pMatch && pMatch[1]) { - // console.log('Valore di p nel record DKIM:'); - // console.log(pMatch[1]); - return pMatch[1]; + + const pattern = /p=([A-Za-z0-9+/=]+)(?:"\s*"([A-Za-z0-9+/=]+))?/; + + // Esegui la ricerca + const match = dkimRecord.match(pattern); + + if (match) { + // Concatena le due parti trovate di 'p', la seconda parte è facoltativa + return match[1] + (match[2] || ''); } else { console.log('Record DKIM non trovato.'); } diff --git a/src/server/modules/cloudflare.js b/src/server/modules/cloudflare.js index 7df32f0..a4e5b67 100644 --- a/src/server/modules/cloudflare.js +++ b/src/server/modules/cloudflare.js @@ -57,7 +57,14 @@ class CloudFlare { async findAndUpdateOnSite(domain, zone, apiToken) { try { const Site = require('../models/site'); - const recsite = await Site.findOne({ host: domain }); + + domain = domain.replace(/^https?:\/\//, ''); + + let normalizedDomain = domain.startsWith("http://") || domain.startsWith("https://") ? domain : "https://" + domain; + + // Trova il sito usando il dominio normalizzato + const recsite = await Site.findOne({ host: normalizedDomain }); + if (recsite) { // Aggiorna i parametri token e zoneId @@ -87,7 +94,7 @@ class CloudFlare { let miab = new MailinaboxClass(null); miab.init(); - const dkim = await miab.getDKIMRecord(recsite.host); + const dkim = await miab.getDKIMRecord(recsite.host.replace(/^https?:\/\//, '')); if (dkim) { await Site.findOneAndUpdate({ _id: recsite._id }, { @@ -216,7 +223,12 @@ class CloudFlare { // get the parameters (Token and zoneId on Database) const Site = require('../models/site'); - await Site.findOne({ host: domainrec.name }).lean() + let domain = domainrec.name.replace(/^https?:\/\//, ''); + + let normalizedDomain = domain.startsWith("http://") || domain.startsWith("https://") ? domain : "https://" + domain; + + // Trova il sito usando il dominio normalizzato + await Site.findOne({ host: normalizedDomain }).lean() .then(async (site) => { if (site) { @@ -224,7 +236,7 @@ class CloudFlare { const myarrrecdns = await this.fetchDNSRecords(site.cf_token, site.cf_zoneId); // MX: - let recTypeMX = await myarrrecdns.find((rec) => rec.type === 'MX' && (rec.name === (domainrec.name))); + let recTypeMX = await myarrrecdns.find((rec) => rec.type === 'MX' && (rec.name === (domain))); if (recTypeMX) { if (recTypeMX.content !== site.servermail) { @@ -235,7 +247,7 @@ class CloudFlare { // create a new record const newRecord = { type: 'MX', - name: domainrec.name, + name: domain, content: site.servermail, ttl: 1, proxied: false, @@ -247,7 +259,7 @@ class CloudFlare { // TXT record spf1 : TXT nomedominio v=spf1 a mx:box.lamiaposta.org ip4:65.21.63.147 ~all - let recTypeTXTspf1 = await myarrrecdns.find((rec) => rec.type === 'TXT' && (rec.name === (domainrec.name) && (rec.content.indexOf('v=spf1') > -1))); + let recTypeTXTspf1 = await myarrrecdns.find((rec) => rec.type === 'TXT' && (rec.name === (domain) && (rec.content.indexOf('v=spf1') > -1))); if (site.servermailip) { let contentTXTspf1 = `v=spf1 a mx:${site.servermail} ip4:${site.servermailip} ~all`; @@ -261,7 +273,7 @@ class CloudFlare { // create a new record const newRecord = { type: 'TXT', - name: domainrec.name, + name: domain, content: contentTXTspf1, ttl: 3600, }; @@ -272,7 +284,7 @@ class CloudFlare { // mail._domainkey.nomedominio v=DKIM1; h=sha256; k=rsa; s=email; p= - let nameDkimtoFind = `mail._domainkey.${domainrec.name}`; + let nameDkimtoFind = `mail._domainkey.${domain}`; let recTypeTXTDKIM = await myarrrecdns.find((rec) => rec.type === 'TXT' && (rec.name === nameDkimtoFind)); @@ -299,12 +311,12 @@ class CloudFlare { // DMARC: - let nameDmarctoFind = `_dmarc.${domainrec.name}`; + let nameDmarctoFind = `_dmarc.${domain}`; let recTypeTXTdmarc = await myarrrecdns.find((rec) => rec.type === 'TXT' && (rec.name === (nameDmarctoFind) && (rec.content.indexOf('v=DMARC1') > -1))); if (site.servermailip) { - let contentTXTdmarc = `v=DMARC1; p=quarantine; ruf=mailto:dmarc@${domainrec.name};`; + let contentTXTdmarc = `v=DMARC1; p=quarantine; ruf=mailto:dmarc@${domain};`; if (recTypeTXTdmarc) { if (recTypeTXTdmarc.content !== contentTXTdmarc) { @@ -326,7 +338,7 @@ class CloudFlare { // AutoConfig: let myType = 'CNAME'; - let strfind = `autoconfig.${domainrec.name}`; + let strfind = `autoconfig.${domain}`; let contentExpected = site.servermail; let rectofind = await myarrrecdns.find((rec) => rec.type === 'CNAME' && (rec.name === strfind)); @@ -349,7 +361,7 @@ class CloudFlare { // AutoDiscover: myType = 'CNAME'; - strfind = `autodiscover.${domainrec.name}`; + strfind = `autodiscover.${domain}`; contentExpected = site.servermail; rectofind = await myarrrecdns.find((rec) => rec.type === 'CNAME' && (rec.name === strfind)); @@ -384,7 +396,12 @@ class CloudFlare { // get the parameters (Token and zoneId on Database) const Site = require('../models/site'); - await Site.findOne({ host: domain }).lean() + domain = domain.replace(/^https?:\/\//, ''); + + let normalizedDomain = domain.startsWith("http://") || domain.startsWith("https://") ? domain : "https://" + domain; + + // Trova il sito usando il dominio normalizzato + await Site.findOne({ host: normalizedDomain }).lean() .then(async (site) => { if (site) { @@ -398,7 +415,7 @@ class CloudFlare { let paramexpected = ''; try { - paramexpected = site[paramobj.paramsite]; + paramexpected = site[paramobj.paramsite].replace(/^https?:\/\//, '');; } catch (e) { } diff --git a/src/server/router/admin_router.js b/src/server/router/admin_router.js index 97c4e20..a7583d4 100755 --- a/src/server/router/admin_router.js +++ b/src/server/router/admin_router.js @@ -1229,7 +1229,7 @@ router.post('/cloudflare', authenticate, async (req, res) => { } else if (cmd === "setCorrectIpsOnDNS") { result = await cf.setCorrectIpsOnDNS(record); } else if (cmd === "gettok") { - result = JSON.parse(process.env.CLOUDFLARE_TOKENS); + result = process.env.CLOUDFLARE_TOKENS ? JSON.parse(process.env.CLOUDFLARE_TOKENS) : ''; } return res.send(result); diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js index 4336509..b6bd3dc 100755 --- a/src/server/router/index_router.js +++ b/src/server/router/index_router.js @@ -1917,7 +1917,7 @@ function uploadFile(req, res, version) { // allora mi conviene che lo faccio dopo, manualmente. console.log('Dovresti copiare fromfile', fromfile, 'tofile', tofile); - 'sudo cp -R ' + fromfile + ' ' + tofile + console.log('sudo cp -R ' + fromfile + ' ' + tofile); // await tools.execScriptNoOutput('sudo cp -R ' + fromfile + ' ' + tofile) res.end(); return; diff --git a/src/server/router/users_router.js b/src/server/router/users_router.js index b336379..c68b736 100755 --- a/src/server/router/users_router.js +++ b/src/server/router/users_router.js @@ -636,7 +636,7 @@ router.post('/newtok', async (req, res) => { // Ottieni l'utente in base al refreshtoken const recFound = await User.findOne({ 'tokens.refreshToken': refreshToken }); - console.log('recFound', recFound ? recFound.name : 'NOTFOUND', 'Token=', refreshToken); + // console.log('recFound', recFound ? recFound.name : 'NOTFOUND', 'Token=', refreshToken); if (recFound) { return recFound.generateAuthToken(req) @@ -1429,6 +1429,9 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) { await Province.setCoordinatesOnDB(); } else if (mydata.dbop === 'insertGeojsonToMongoDB') { await City.insertGeojsonToMongoDB('comuni_italia.geojson'); + } else if (mydata.dbop === 'listCollectionsBySize') { + mystr = await tools.listCollectionsBySize(); + ris = { mystr }; } else if (mydata.dbop === 'AbilitaNewsletterALL') { await User.updateMany({ $or: [ @@ -1856,15 +1859,11 @@ router.post('/dbop', authenticate, async (req, res) => { } try { - let ris = await eseguiDbOp(idapp, mydata, locale, req, res); + let risOp = await eseguiDbOp(idapp, mydata, locale, req, res); - if (!ris) { - ris = {}; - } + // ris = await User.updateMyData(ris, idapp, req.user.username); - ris = await User.updateMyData(ris, idapp, req.user.username); - - res.send({ code: server_constants.RIS_CODE_OK, data: ris.data }); + res.send({ code: server_constants.RIS_CODE_OK, data: risOp }); } catch (e) { res.status(400).send({ code: server_constants.RIS_CODE_ERR, msg: e }); diff --git a/src/server/server.js b/src/server/server.js index 9e1fd96..d9f2b78 100755 --- a/src/server/server.js +++ b/src/server/server.js @@ -19,7 +19,7 @@ const { spawn } = require('child_process'); const NUOVO_METODO_TEST = true; -const METODO_MULTI_CORS = false; +const METODO_MULTI_CORS = true; const server_constants = require('./tools/server_constants'); @@ -266,11 +266,14 @@ myLoad().then(ris => { // app.use(throttle(1024 * 128)); // throttling bandwidth -// app.use((req, res, next) => { -// res.header('Access-Control-Allow-Origin', '*') -// res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept') -// next() -// }); +/* +app.use((req, res, next) => { + res.header('Access-Control-Allow-Origin', '*') + res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); + next(); +}); + +*/ async function myLoad() { @@ -748,10 +751,14 @@ function getCredentials(hostname) { };*/ - return { - key: fs.readFileSync(fileprivkey, "utf8"), - cert: fs.readFileSync(filecert, "utf8") - }; + try { + const key = fs.readFileSync(fileprivkey, "utf8"); + const cert = fs.readFileSync(filecert, "utf8"); + return { key, cert }; + } catch (error) { + console.error(`Errore nel caricamento delle credenziali per ${hostname}:`, error); + // Gestisci l'errore, per esempio ritorna null o lancia un'eccezione + } } else { const keyStream = path.resolve(`./${process.env.PATH_CERT_KEY}`); @@ -804,7 +811,7 @@ function startServer(app, port) { const credentials = getCredentials(domains[i].hostname); // console.log('credentials: ', credentials); httpsServer = https.createServer(credentials, app); - console.log('⭐️⭐️⭐️⭐️⭐️ HTTPS server: ' + domains[i].hostname + ' Port:', domains[i].port); + console.log('⭐️⭐️⭐️⭐️⭐️ HTTPS server: ' + domains[i].hostname + ' Port:', domains[i].port + (domains[i].website ? 'WebSite = ' + domains[i].website : '')); httpsServer.listen(domains[i].port); } } else { diff --git a/src/server/telegram/telegrambot.js b/src/server/telegram/telegrambot.js index bb6ba8a..ecf7d71 100755 --- a/src/server/telegram/telegrambot.js +++ b/src/server/telegram/telegrambot.js @@ -487,7 +487,7 @@ const txt = { MSG_ASK_USERNAME_BO: 'Scrivete nel messaggio l\'username (SENZA SPAZI) o la email con cui vi siete registrati sul sito di %s:', MSG_ASK_USERNAME_INVITANTE: 'Scrivi nel messaggio l\'USERNAME TELEGRAM di chi ti ha INVITATO', MSG_NEW_REG: '

⁉️🙈 Per aiuto scrivi sulla Chat RISO
oppure direttamente a Paolo (@surya1977) ☀️.', - MSG_ERRORE_INVITANTE_NOT_FOUND: 'L\'username dell\'invitante appena digitato non sembra essere corretto! Ti ricordo che dev\'essere l\'username con cui si è registrato su RISO', + MSG_ERRORE_INVITANTE_NOT_FOUND: 'L\'username dell\'invitante appena digitato non sembra essere corretto! Ti ricordo che dev\'essere l\'username con cui si è registrato su %s', MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (40 caratteri massimo)', MSG_ERRORE_USERNAME_NOT_FOUND: 'Per Completare la Verifica Telegram BOT, dovete ora scrivere qui sotto nel messaggio l\'Username (senza spazi) OPPURE la email con cui vi siete registrati sul sito', MSG_ERRORE_USERNAME_ANNULLA: 'Inserimento Annullato. Riprovare', @@ -502,12 +502,12 @@ const txt = { MSG_EXIT_TELEGRAM: 'L\'account è stato ora scollegato da questo Telegram BOT.', MSG_APORTADOR_USER_REGISTERED: emo.FIRE + ' Si è appena Registrato "%s" (n. %s)\nInvitato da %s', - MSG_APORTADOR_ASK_CONFIRM: '🆕💥 🧍‍♂️ %s si sta registrando alla App di RISO e ti chiede di poter entrare. Confermi di conoscerla ?', + MSG_APORTADOR_ASK_CONFIRM: '🆕💥 🧍‍♂️ %s si sta registrando alla App %d e ti chiede di poter entrare. Confermi di conoscerla ?', MSG_ACCEPT_NEWENTRY_INGROUP: '❇️👥 🧍‍♂️ Accetta Ingresso nel GRUPPO %s:', MSG_FRIENDS_NOT_ACCEPTED_CONFIRMED: '🚫 Hai rifiutato la richiesta di Amicizia di %s !', MSG_HANDSHAKE_NOT_ACCEPTED_CONFIRMED: '🚫 Hai rifiutato la richiesta di Stretta di mano di %s !', MSG_APORTADOR_CONFIRMED: '✅ %s è stato Abilitato correttamente (da %s)!', - MSG_APORTADOR_DEST_CONFIRMED: '✅ La tua registrazione a RISO è stata accettata da %s!\n' + + MSG_APORTADOR_DEST_CONFIRMED: '✅ La tua registrazione a %s è stata accettata da %s!\n' + 'Vai sulla App oppure clicca qui per entrare\n👉🏻 %s', MSG_GROUP_CONFIRMED: '✅ Sei stato Aggiunto sul Gruppo %s!', MSG_APORTADOR_DEST_NOT_CONFIRMED: emo.EXCLAMATION_MARK + @@ -908,6 +908,8 @@ const MyTelegramBot = { const struserinfomsg = tools.getUserInfoMsg(idapp, myuser); + const nomeapp = myuser.idapp ? tools.getNomeAppByIdApp(myuser.idapp) : tools.getNomeAppByIdApp(idapp); + if (myfunc === shared_consts.CallFunz.REGISTRATION) { cl.setPhotoProfile(myuser, telegid, false); @@ -936,7 +938,7 @@ const MyTelegramBot = { } else { msg_notifpush = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM', myuser.username); - domanda = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM', myuser.username) + '
' + struserinfomsg; + domanda = getstr(langdest, 'MSG_APORTADOR_ASK_CONFIRM', myuser.username, nomeapp) + '
' + struserinfomsg; keyb = cl.getInlineKeyboard(myuser.lang, [ { @@ -1785,7 +1787,7 @@ class Telegram { risp = 'Chissà... Forse si!\nAnche se meglio averne un altro di scorta, nel caso il Principe non sia disponibile.'; } else if (MsgBot.START_INV.find( (rec) => testo.indexOf(rec) > -1)) { - risp = 'Sei già registrato a RISO. Per accedere alla App, aprila dall\'icona sul tuo schermo, oppure vai su https://riso.app ed installa la App.\n\nSe hai dimenticato la password: \n clicca sul menu in basso su "⚒ Strumenti" e poi "🔑 Cambio Password"' + risp = 'Sei già registrato. Per accedere alla App, aprila dall\'icona sul tuo schermo, oppure vai sul sito ed installa la App.\n\nSe hai dimenticato la password: \n clicca sul menu in basso su "⚒ Strumenti" e poi "🔑 Cambio Password"' } else if (MsgBot.COSE_COVID.find( (rec) => testo.indexOf(rec) > -1)) { risp = 'Un \'influenza più "grave", dovuta a paure e a fattori interiori di evoluzione, oltre ad una pulizia del corpo. '; @@ -2791,6 +2793,8 @@ class Telegram { try { let mymsg = msg.text.toString().trim().toLowerCase(); + let nomeapp = tools.getNomeAppByIdApp(this.idapp); + if (!!mymsg) { const rec = this.getRecInMem(msg); let aportador_solidario = rec.aportador_solidario; @@ -2814,12 +2818,12 @@ class Telegram { // rec.status = Status.WAITFOR_USERNAME_INVITANTE; rec.status = Status.SET_USERNAME_INVITANTE; - const str2 = '\n' + getstr(this.getlang(msg), 'MSG_ASK_USERNAME_INVITANTE', tools.getNomeAppByIdApp(this.idapp)); + const str2 = '\n' + getstr(this.getlang(msg), 'MSG_ASK_USERNAME_INVITANTE', nomeapp); if (msg.from.username) console.log(msg.from.username + ' ha digitato: ' + msg.text); - await this.sendMsg(msg.from.id, getstr(this.getlang(msg), 'MSG_ERRORE_INVITANTE_NOT_FOUND') + str2, null); + await this.sendMsg(msg.from.id, getstr(this.getlang(msg), 'MSG_ERRORE_INVITANTE_NOT_FOUND', nomeapp) + str2, null); } } } catch (e) { @@ -4417,11 +4421,13 @@ if (true) { if (changed) { const req = tools.getReqByPar(user.idapp, username_action); + + nomeapp = tools.getNomeAppByIdApp(user.idapp); // await User.setFriendsCmd(req, user.idapp, data.username, userDest.username, shared_consts.FRIENDSCMD.SETFRIEND, null, true); await User.setaportador_solidario(user.idapp, data.username, userDest.username); - const msgOrig = printf(getstr(userDest.lang, 'MSG_APORTADOR_DEST_CONFIRMED'), `${userDest.username}`, + const msgOrig = printf(getstr(userDest.lang, 'MSG_APORTADOR_DEST_CONFIRMED', nomeapp), `${userDest.username}`, tools.getHostByIdApp(user.idapp)); const msgDest = printf(getstr(user.lang, 'MSG_APORTADOR_CONFIRMED'), `${user.username}`, `${userDest.username}`); diff --git a/src/server/tools/general.js b/src/server/tools/general.js index e6a41a1..a4e5352 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -5487,6 +5487,38 @@ module.exports = { } } }, + + async listCollectionsBySize() { + let output = ""; // Variabile per memorizzare l'output + + try { + const conn = mongoose.connection; + + // Ottieni le collezioni e calcola la dimensione + const collections = await conn.db.listCollections().toArray(); + + // Calcola la dimensione per ciascuna collezione + const collectionSizes = await Promise.all(collections.map(async (collection) => { + const stats = await conn.db.collection(collection.name).stats(); + return { name: collection.name, size: stats.size }; + })); + + // Ordina le collezioni per dimensione + collectionSizes.sort((a, b) => b.size - a.size); // Ordine decrescente + + output += "Collezioni ordinate per dimensione:\n"; // Inizio dell'output + collectionSizes.forEach(collection => { + const sizeInMB = (collection.size / (1024 * 1024)).toFixed(2); // Converti in MB + output += `Collezione: ${collection.name}, Dimensione: ${sizeInMB} MB\n`; // Aggiungi all'output + }); + + return output; // Restituisci l'output alla fine + } catch (error) { + console.error("Errore:", error); + return `Errore: ${error.message}`; // Restituisci l'errore come stringa + } + }, + ImageDownloader,