versione 1.2.14 :
- aggiornati i file di configurazione, ENV e script non funzionanti., package. - corretto custom-service-worker.js con CORS - ottimizzato il server, la chiamata Load iniziale (senza promise, con async/await).
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
DATABASE=test_PiuCheBuono
|
DATABASE=test_FreePlanet
|
||||||
UDB=paofreeplanet
|
UDB=paofreeplanet
|
||||||
PDB=mypassword@1A
|
PDB=mypassword@1A
|
||||||
SEND_EMAIL=0
|
SEND_EMAIL=0
|
||||||
SEND_EMAIL_ORDERS=1
|
SEND_EMAIL_ORDERS=1
|
||||||
PORT=3000
|
PORT=3000
|
||||||
appTelegram_TEST=["1","17"]
|
appTelegram_TEST=["1","13"]
|
||||||
appTelegram=["1","17"]
|
appTelegram=["1","13"]
|
||||||
appTelegram_DEVELOP=["17"]
|
appTelegram_DEVELOP=["13"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=0
|
AUTH_MONGODB=0
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
@@ -38,9 +38,4 @@ FTPSERVER_PWD=ftpmypwd@1A_
|
|||||||
AUTH_NEW_SITES=123123123
|
AUTH_NEW_SITES=123123123
|
||||||
SCRIPTS_DIR=admin_scripts
|
SCRIPTS_DIR=admin_scripts
|
||||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
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
|
|
||||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
|
||||||
SERVER_A_URL="http://51.77.156.69:3000"
|
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
source ./.env.prod.pcb
|
source ./.env.prod.pcb
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
msg="*** SERVER DI ### PRODUZIONE ### PCB **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
msg="*** SERVER DI PRODUZIONE PCB **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||||
|
|
||||||
if [ "$1" = "" ]; then
|
if [ "$1" = "" ]; then
|
||||||
read -p "$msg" risposta
|
read -p "$msg" risposta
|
||||||
@@ -17,7 +19,6 @@ if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
|||||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
# Configurazione
|
# Configurazione
|
||||||
REMOTE_USER="pcbuser"
|
REMOTE_USER="pcbuser"
|
||||||
REMOTE_HOST="pcb"
|
REMOTE_HOST="pcb"
|
||||||
@@ -25,6 +26,10 @@ if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
|||||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
|
||||||
|
CONFIG_JS="ecosystem.config.pcb_prod.js"
|
||||||
|
ENV_FILE=".env.prod.pcb"
|
||||||
|
ENV_OUT=".env.production"
|
||||||
|
|
||||||
# Array di cartelle e file da sincronizzare
|
# Array di cartelle e file da sincronizzare
|
||||||
SYNC_ITEMS=(
|
SYNC_ITEMS=(
|
||||||
"css"
|
"css"
|
||||||
@@ -54,7 +59,8 @@ if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
|||||||
|
|
||||||
# Sincronizza i file specifici
|
# Sincronizza i file specifici
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
.env.prod.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.production"
|
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** Copia del file package.json ... "
|
echo "*** Copia del file package.json ... "
|
||||||
@@ -62,15 +68,15 @@ if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
|||||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** Copia del file ecosystem.config.js ... "
|
echo "*** Copia del file $CONFIG_JS in ecosystem.config.js ... "
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
ecosystem.config.pcb_test.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
$CONFIG_JS "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
# Verifica il risultato
|
# Verifica il risultato
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "Sincronizzazione completata con successo. SERVER PCB! "
|
echo "Sincronizzazione completata con successo. SERVER PCB PRODUZIONE! "
|
||||||
else
|
else
|
||||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -1,839 +0,0 @@
|
|||||||
require('./config/config');
|
|
||||||
require('./config/config');
|
|
||||||
|
|
||||||
// console.log(" lodash");
|
|
||||||
|
|
||||||
console.log(process.versions);
|
|
||||||
|
|
||||||
const _ = require('lodash');
|
|
||||||
// console.log(" cors");
|
|
||||||
const cors = require('cors');
|
|
||||||
|
|
||||||
// console.log(" 2) fs");
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
var https = require('https');
|
|
||||||
|
|
||||||
const NUOVO_METODO_TEST = true;
|
|
||||||
|
|
||||||
const server_constants = require('./tools/server_constants');
|
|
||||||
|
|
||||||
//const throttle = require('express-throttle-bandwidth');
|
|
||||||
// app.use(throttle(1024 * 128)) // throttling bandwidth
|
|
||||||
|
|
||||||
const port = process.env.PORT;
|
|
||||||
|
|
||||||
// var cookieParser = require('cookie-parser')
|
|
||||||
// var csrf = require('csurf')
|
|
||||||
const express = require('express');
|
|
||||||
const bodyParser = require('body-parser');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const cron = require('node-cron');
|
|
||||||
console.log('Starting mongoose...');
|
|
||||||
|
|
||||||
const tls = require('tls');
|
|
||||||
|
|
||||||
require('./db/mongoose');
|
|
||||||
|
|
||||||
// console.log('Starting pem...');
|
|
||||||
|
|
||||||
// const pem = require('pem')
|
|
||||||
|
|
||||||
const { Settings } = require('./models/settings');
|
|
||||||
|
|
||||||
const Site = require('./models/site');
|
|
||||||
|
|
||||||
// test
|
|
||||||
|
|
||||||
const i18n = require('i18n');
|
|
||||||
|
|
||||||
let credentials = null;
|
|
||||||
|
|
||||||
// OBTAIN
|
|
||||||
// https://www.psclistens.com/insight/blog/enabling-a-nodejs-ssl-webserver-using-let-s-encrypt-pem-certificates/
|
|
||||||
|
|
||||||
|
|
||||||
if ((process.env.NODE_ENV === 'production')) {
|
|
||||||
console.log('*** AMBIENTE DI PRODUZIONE (Aprile 2024) !!!!')
|
|
||||||
} else if (process.env.NODE_ENV === 'test') {
|
|
||||||
console.log('*** ### AMBIENTE DI TEST ')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
console.log('DB: ' + process.env.DATABASE);
|
|
||||||
// console.log("PORT: " + port);
|
|
||||||
// console.log("MONGODB_URI: " + process.env.MONGODB_URI);
|
|
||||||
|
|
||||||
var app = express();
|
|
||||||
|
|
||||||
|
|
||||||
let telegrambot = null;
|
|
||||||
|
|
||||||
const tools = require('./tools/general');
|
|
||||||
|
|
||||||
const shared_consts = require('./tools/shared_nodejs');
|
|
||||||
|
|
||||||
var mongoose = require('mongoose').set('debug', false);
|
|
||||||
|
|
||||||
mongoose.set('debug', false);
|
|
||||||
|
|
||||||
const { CfgServer } = require('./models/cfgserver');
|
|
||||||
const { ObjectId } = require('mongodb');
|
|
||||||
|
|
||||||
const populate = require('./populate/populate');
|
|
||||||
const { Circuit } = require('./models/circuit');
|
|
||||||
|
|
||||||
const printf = require('util').format;
|
|
||||||
|
|
||||||
myLoad().then(ris => {
|
|
||||||
|
|
||||||
const { User } = require('./models/user');
|
|
||||||
|
|
||||||
require('./models/todo');
|
|
||||||
require('./models/project');
|
|
||||||
require('./models/subscribers');
|
|
||||||
require('./models/booking');
|
|
||||||
require('./models/sendmsg');
|
|
||||||
require('./models/sendnotif');
|
|
||||||
require('./models/mailinglist');
|
|
||||||
require('./models/newstosent');
|
|
||||||
require('./models/mypage');
|
|
||||||
require('./models/myelem');
|
|
||||||
require('./models/bot');
|
|
||||||
require('./models/calzoom');
|
|
||||||
const mysql_func = require('./mysql/mysql_func');
|
|
||||||
|
|
||||||
const index_router = require('./router/index_router');
|
|
||||||
const push_router = require('./router/push_router');
|
|
||||||
const newsletter_router = require('./router/newsletter_router');
|
|
||||||
const booking_router = require('./router/booking_router');
|
|
||||||
const dashboard_router = require('./router/dashboard_router');
|
|
||||||
const myevent_router = require('./router/myevent_router');
|
|
||||||
const subscribe_router = require('./router/subscribe_router');
|
|
||||||
const sendmsg_router = require('./router/sendmsg_router');
|
|
||||||
const sendnotif_router = require('./router/sendnotif_router');
|
|
||||||
const email_router = require('./router/email_router');
|
|
||||||
const todos_router = require('./router/todos_router');
|
|
||||||
const test_router = require('./router/test_router');
|
|
||||||
const projects_router = require('./router/projects_router');
|
|
||||||
const report_router = require('./router/report_router');
|
|
||||||
const users_router = require('./router/users_router');
|
|
||||||
const reactions_router = require('./router/reactions_router');
|
|
||||||
const mygroups_router = require('./router/mygroups_router');
|
|
||||||
const circuits_router = require('./router/circuits_router');
|
|
||||||
const accounts_router = require('./router/accounts_router');
|
|
||||||
const iscrittiConacreis_router = require('./router/iscrittiConacreis_router');
|
|
||||||
const iscrittiArcadei_router = require('./router/iscrittiArcadei_router');
|
|
||||||
const site_router = require('./router/site_router');
|
|
||||||
const admin_router = require('./router/admin_router');
|
|
||||||
const products_router = require('./router/products_router');
|
|
||||||
const cart_router = require('./router/cart_router');
|
|
||||||
const orders_router = require('./router/orders_router');
|
|
||||||
const city_router = require('./router/city_router');
|
|
||||||
const myskills_router = require('./router/myskills_router');
|
|
||||||
const mygoods_router = require('./router/mygoods_router');
|
|
||||||
const mygen_router = require('./router/mygen_router');
|
|
||||||
const aitools_router = require('./router/aitools_router');
|
|
||||||
|
|
||||||
const { MyEvent } = require('./models/myevent');
|
|
||||||
|
|
||||||
app.use(bodyParser.json({ limit: '50mb' }));
|
|
||||||
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
|
||||||
|
|
||||||
app.use(express.static('views'));
|
|
||||||
|
|
||||||
// app.use(express.static(path.join(__dirname, 'client')));
|
|
||||||
|
|
||||||
app.use(bodyParser.json());
|
|
||||||
|
|
||||||
// app.set('view engine', 'pug');
|
|
||||||
|
|
||||||
// Set static folder
|
|
||||||
// app.use(express.static(path.join(__dirname, 'public')));
|
|
||||||
|
|
||||||
i18n.configure({
|
|
||||||
locales: ['it', 'enUs', 'es', 'fr', 'pt', 'si'],
|
|
||||||
defaultLocale: 'it',
|
|
||||||
// cookie: 'cook',
|
|
||||||
directory: __dirname + '/locales',
|
|
||||||
api: {
|
|
||||||
'__': 'translate',
|
|
||||||
'__n': 'translateN'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(cors({
|
|
||||||
exposedHeaders: ['x-auth', 'x-refrtok'],
|
|
||||||
}));
|
|
||||||
|
|
||||||
app.use(bodyParser.json());
|
|
||||||
|
|
||||||
// app.use(express.cookieParser());
|
|
||||||
app.use(i18n.init);
|
|
||||||
|
|
||||||
console.log('Use Routes \...');
|
|
||||||
|
|
||||||
|
|
||||||
// Use Routes
|
|
||||||
app.use('/', index_router);
|
|
||||||
app.use('/subscribe', subscribe_router);
|
|
||||||
app.use('/sendmsg', sendmsg_router);
|
|
||||||
app.use('/sendnotif', sendnotif_router);
|
|
||||||
app.use('/push', push_router);
|
|
||||||
app.use('/news', newsletter_router);
|
|
||||||
app.use('/booking', booking_router);
|
|
||||||
app.use('/dashboard', dashboard_router);
|
|
||||||
app.use('/event', myevent_router);
|
|
||||||
app.use('/email', email_router);
|
|
||||||
app.use('/todos', todos_router);
|
|
||||||
app.use('/test', test_router);
|
|
||||||
app.use('/projects', projects_router);
|
|
||||||
app.use('/users', users_router);
|
|
||||||
app.use('/reactions', reactions_router);
|
|
||||||
app.use('/mygroup', mygroups_router);
|
|
||||||
app.use('/circuit', circuits_router);
|
|
||||||
app.use('/account', accounts_router);
|
|
||||||
app.use('/iscritti_conacreis', iscrittiConacreis_router);
|
|
||||||
app.use('/iscritti_arcadei', iscrittiArcadei_router);
|
|
||||||
app.use('/report', report_router);
|
|
||||||
app.use('/site', site_router);
|
|
||||||
app.use('/admin', admin_router);
|
|
||||||
app.use('/products', products_router);
|
|
||||||
app.use('/cart', cart_router);
|
|
||||||
app.use('/orders', orders_router);
|
|
||||||
app.use('/city', city_router);
|
|
||||||
app.use('/myskills', myskills_router);
|
|
||||||
app.use('/mygoods', mygoods_router);
|
|
||||||
app.use('/mygen', mygen_router);
|
|
||||||
app.use('/aitools', aitools_router);
|
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
|
||||||
// app.use(function (req, res, next) {
|
|
||||||
// var err = new Error('Not Found');
|
|
||||||
// err.status = 404;
|
|
||||||
// next(err);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// app.set('views', path.join(__dirname, 'views'));
|
|
||||||
// app.set('view engine', 'pug');
|
|
||||||
|
|
||||||
// development error handler
|
|
||||||
// will print stacktrace
|
|
||||||
if (app.get('env') === 'development') {
|
|
||||||
|
|
||||||
app.use(function (err, req, res, next) {
|
|
||||||
console.log('Server Error: ', err.message);
|
|
||||||
// console.trace();
|
|
||||||
res.status(err.status || 500).send({ error: err.message });
|
|
||||||
// res.render('error', {
|
|
||||||
// message: err.message,
|
|
||||||
// error: err
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// require('./telegram/telegrambot');
|
|
||||||
|
|
||||||
// *** DB CONNECTIONS ***
|
|
||||||
// mysql_func.mySqlConn_Shen.connect((err) => {
|
|
||||||
// if (!err)
|
|
||||||
// console.log('DB connection to Shen Database succeded.');
|
|
||||||
// else
|
|
||||||
// console.log('DB connection to Shen Database FAILED \n Error: ' + JSON.stringify(err, undefined, 2));
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
console.log('*** PRODUCTION! ');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((process.env.NODE_ENV === 'production') ||
|
|
||||||
(process.env.NODE_ENV === 'test')) {
|
|
||||||
|
|
||||||
const keyStream = path.resolve(`./${process.env.PATH_CERT_KEY}`);
|
|
||||||
const certificateStream = path.resolve(`./${process.env.PATH_SERVER_CRT}`);
|
|
||||||
|
|
||||||
let privateKey = fs.readFileSync(keyStream, "utf8");
|
|
||||||
let certificate = fs.readFileSync(certificateStream, "utf8");
|
|
||||||
|
|
||||||
let credentials = null;
|
|
||||||
|
|
||||||
|
|
||||||
// arrSecureContext = ['piuchebuono.app', 'gruppomacro.app'];
|
|
||||||
arrSecureContext = ['freeplanet.app', 'riso.app', 'comunitanuovomondo.app'];
|
|
||||||
|
|
||||||
let secureContext = {};
|
|
||||||
|
|
||||||
for (let i = 0; i < arrSecureContext.length; i++) {
|
|
||||||
try {
|
|
||||||
secureContext = {
|
|
||||||
...secureContext,
|
|
||||||
[arrSecureContext[i]]: tls.createSecureContext({
|
|
||||||
key: fs.readFileSync('/etc/letsencrypt/live/' + arrSecureContext[i] + '/privkey.pem'),
|
|
||||||
cert: fs.readFileSync('/etc/letsencrypt/live/' + arrSecureContext[i] + '/fullchain.pem')
|
|
||||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
credentials = {
|
|
||||||
SNICallback: function (domain, cb) {
|
|
||||||
if (secureContext) {
|
|
||||||
if (cb) {
|
|
||||||
cb(null, secureContext);
|
|
||||||
} else {
|
|
||||||
// compatibility for older versions of node
|
|
||||||
return secureContext;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.log('Error: ' + err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
let secureContext = {
|
|
||||||
'piuchebuono.app': tls.createSecureContext({
|
|
||||||
key: fs.readFileSync('/etc/letsencrypt/live/piuchebuono.app/privkey.pem'),
|
|
||||||
cert: fs.readFileSync('/etc/letsencrypt/live/piuchebuono.app/fullchain.pem')
|
|
||||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
|
||||||
}),
|
|
||||||
'gruppomacro.app': tls.createSecureContext({
|
|
||||||
key: fs.readFileSync('/etc/letsencrypt/live/gruppomacro.app/privkey.pem'),
|
|
||||||
cert: fs.readFileSync('/etc/letsencrypt/live/gruppomacro.app/fullchain.pem')
|
|
||||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
|
||||||
}),
|
|
||||||
}*/
|
|
||||||
|
|
||||||
console.log('secureContext', secureContext);
|
|
||||||
|
|
||||||
if (NUOVO_METODO_TEST) {
|
|
||||||
credentials = {
|
|
||||||
SNICallback: function (domain, cb) {
|
|
||||||
if (secureContext[domain]) {
|
|
||||||
if (cb) {
|
|
||||||
cb(null, secureContext[domain]);
|
|
||||||
} else {
|
|
||||||
// compatibility for older versions of node
|
|
||||||
return secureContext[domain];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new Error('No keys/certificates for domain requested');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// must list a default key and cert because required by tls.createServer()
|
|
||||||
key: privateKey,
|
|
||||||
cert: certificate,
|
|
||||||
}
|
|
||||||
|
|
||||||
/*} else {
|
|
||||||
// NON USATO !
|
|
||||||
credentials = {
|
|
||||||
key: privateKey,
|
|
||||||
cert: certificate,
|
|
||||||
ca: [
|
|
||||||
fs.readFileSync(process.env.PATH_SSL_ROOT_PEM, 'utf8'),
|
|
||||||
fs.readFileSync(process.env.PATH_SSL_CHAIN_PEM, 'utf8'),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*} else {
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.HTTPS_LOCALHOST === "true") {
|
|
||||||
privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
|
|
||||||
certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
|
|
||||||
credentials = {
|
|
||||||
key: privateKey,
|
|
||||||
cert: certificate,
|
|
||||||
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384',
|
|
||||||
honorCipherOrder: true,
|
|
||||||
secureProtocol: 'TLSv1_2_method',
|
|
||||||
};
|
|
||||||
|
|
||||||
} else {
|
|
||||||
var http = require('http');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((process.env.NODE_ENV === 'production') ||
|
|
||||||
(process.env.NODE_ENV === 'test') || process.env.HTTPS_LOCALHOST === "true") {
|
|
||||||
|
|
||||||
const httpsServer = https.createServer(credentials, app);
|
|
||||||
|
|
||||||
console.log('httpsServer: port ', port);
|
|
||||||
httpsServer.listen(port);
|
|
||||||
} else {
|
|
||||||
console.log('httpServer: port ', port);
|
|
||||||
const httpServer = http.createServer(app);
|
|
||||||
httpServer.listen(port);
|
|
||||||
}
|
|
||||||
|
|
||||||
mystart();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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()
|
|
||||||
// });
|
|
||||||
|
|
||||||
async function myLoad() {
|
|
||||||
|
|
||||||
return tools.loadApps();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function mystart() {
|
|
||||||
|
|
||||||
// await estraiTutteLeImmagini();
|
|
||||||
|
|
||||||
await tools.getApps();
|
|
||||||
|
|
||||||
if (process.env.PROD !== 1) {
|
|
||||||
|
|
||||||
testmsgwebpush();
|
|
||||||
|
|
||||||
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
|
||||||
|
|
||||||
let miapass = '';
|
|
||||||
|
|
||||||
if (miapass !== '') {
|
|
||||||
let crypt = tools.cryptdata(miapass);
|
|
||||||
let decrypt = tools.decryptdata(crypt);
|
|
||||||
|
|
||||||
console.log('crypted:', crypt);
|
|
||||||
console.log('decrypted:', decrypt);
|
|
||||||
}
|
|
||||||
|
|
||||||
mycron();
|
|
||||||
if (!process.env.VITE_DEBUG) {
|
|
||||||
mycron();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
telegrambot = require('./telegram/telegrambot');
|
|
||||||
|
|
||||||
await inizia();
|
|
||||||
|
|
||||||
await resetProcessingJob();
|
|
||||||
|
|
||||||
populate.popolaTabelleNuove();
|
|
||||||
|
|
||||||
faitest();
|
|
||||||
|
|
||||||
// ----------------- MAILCHIMP -----
|
|
||||||
const querystring = require('querystring');
|
|
||||||
const mailchimpClientId = 'xxxxxxxxxxxxxxxx';
|
|
||||||
|
|
||||||
app.get('/mailchimp/auth/authorize', function (req, res) {
|
|
||||||
res.redirect('https://login.mailchimp.com/oauth2/authorize?' +
|
|
||||||
querystring.stringify({
|
|
||||||
'response_type': 'code',
|
|
||||||
'client_id': mailchimpClientId,
|
|
||||||
'redirect_uri': 'http://127.0.0.1:3000/mailchimp/auth/callback',
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------
|
|
||||||
|
|
||||||
function populateDBadmin() {
|
|
||||||
const cfgserv = [
|
|
||||||
{
|
|
||||||
_id: new ObjectId(),
|
|
||||||
idapp: '9',
|
|
||||||
chiave: 'vers',
|
|
||||||
userId: 'ALL',
|
|
||||||
valore: '0.1.2',
|
|
||||||
}];
|
|
||||||
|
|
||||||
let cfg = new CfgServer(cfgserv[0]).save();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function mycron() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
const sendemail = require('./sendemail');
|
|
||||||
|
|
||||||
const arr = await tools.getApps();
|
|
||||||
|
|
||||||
for (const app of arr) {
|
|
||||||
sendemail.checkifPendingNewsletter(app.idapp);
|
|
||||||
sendemail.checkifSentNewsletter(app.idapp);
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Err mycron', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function mycron_30min() {
|
|
||||||
for (const app of await tools.getApps()) {
|
|
||||||
let enablecrontab = false;
|
|
||||||
|
|
||||||
enablecrontab = await Settings.getValDbSettings(app.idapp,
|
|
||||||
tools.ENABLE_CRONTAB, false);
|
|
||||||
|
|
||||||
if (enablecrontab) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function mycron_everyday() {
|
|
||||||
try {
|
|
||||||
|
|
||||||
const { User } = require('./models/user');
|
|
||||||
|
|
||||||
const arrapps = await tools.getApps();
|
|
||||||
for (const app of arrapps) {
|
|
||||||
|
|
||||||
// Azzera le richieste di password:
|
|
||||||
const usersblocked = await User.find({ idapp: app.idapp, retry_pwd: { $exists: true, $gte: 29 } }).lean();
|
|
||||||
for (const user of usersblocked) {
|
|
||||||
await User.findOneAndUpdate({ _id: user._id }, { $set: { retry_pwd: 20 } });
|
|
||||||
let text = `⚠️⚠️⚠️ L\'utente ${user.username} (${user.name} ${user.surname}) viene sbloccato dal numero massimo di tentativi di richiesta password!\nTelerlo d\'occhio !\n@${user.profile.username_telegram}`;
|
|
||||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(text, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Crea un file con all'interno il nome del dominio per ogni app:
|
|
||||||
await tools.createFileWithDomainName();
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
console.error('mycron_everyday: ', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function testmsgwebpush() {
|
|
||||||
const { User } = require('./models/user');
|
|
||||||
|
|
||||||
// console.log('nomeapp 1: ' , tools.getNomeAppByIdApp(1));
|
|
||||||
// console.log('nomeapp 2: ' , tools.getNomeAppByIdApp(2));
|
|
||||||
|
|
||||||
User.find({ username: 'paoloar77', idapp: '1' }).then(async (arrusers) => {
|
|
||||||
if (arrusers !== null) {
|
|
||||||
for (const user of arrusers) {
|
|
||||||
await tools.sendNotificationToUser(user._id, 'Server',
|
|
||||||
'Il Server è Ripartito', '/', '', 'server', []).then(ris => {
|
|
||||||
if (ris) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// already sent the error on calling sendNotificationToUser
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cron every X minutes
|
|
||||||
cron.schedule('*/1 * * * *', () => {
|
|
||||||
// console.log('Running Cron Job');
|
|
||||||
// if (!process.env.VITE_DEBUG) {
|
|
||||||
mycron();
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cron every X minutes
|
|
||||||
cron.schedule('*/60 * * * *', async () => {
|
|
||||||
if (!process.env.VITE_DEBUG) {
|
|
||||||
mycron_30min();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cron every 21:00 (1 volta al giorno)
|
|
||||||
cron.schedule('0 21 * * *', async () => {
|
|
||||||
mycron_everyday();
|
|
||||||
});
|
|
||||||
|
|
||||||
// mycron_30min();
|
|
||||||
|
|
||||||
// tools.writelogfile('test', 'prova.txt');
|
|
||||||
|
|
||||||
async function resetProcessingJob() {
|
|
||||||
|
|
||||||
const { Newstosent } = require('./models/newstosent');
|
|
||||||
|
|
||||||
arrrec = await Newstosent.find({});
|
|
||||||
|
|
||||||
for (const rec of arrrec) {
|
|
||||||
rec.processing_job = false;
|
|
||||||
await Newstosent.findOneAndUpdate({ _id: rec.id }, { $set: rec }, { new: false }).
|
|
||||||
then((item) => {
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//app.listen(port, () => {
|
|
||||||
// console.log(`Server started at port ${port}`);
|
|
||||||
//});
|
|
||||||
|
|
||||||
async function inizia() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (true) {
|
|
||||||
const url = 'https://raw.githubusercontent.com/matteocontrini/comuni-json/master/comuni.json';
|
|
||||||
const outputPath = './comuni_italia_geojson.json';
|
|
||||||
downloadGeoJSON(url, outputPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
mycron_everyday();
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
|
||||||
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
|
||||||
shared_consts.ADMIN_USER_SERVER,
|
|
||||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
|
||||||
telegrambot.ADMIN_IDTELEGRAM_SERVER,
|
|
||||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}\n` +
|
|
||||||
`🔅 Il Server ${process.env.DATABASE} è appena ripartito!`);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(`Ciao Admin\n` + `🔅🔅🔅 Il Server col BOT di {appname} è appena ripartito!`, false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
await Site.createFirstUserAdmin();
|
|
||||||
|
|
||||||
/*const {Circuit} = require('./models/circuit');
|
|
||||||
|
|
||||||
await Circuit.setDeperimentoOff();
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
// telegrambot.sendMsgTelegramToTheManagers('7', 'PROVAAA!');
|
|
||||||
|
|
||||||
// if (process.env.PROD !== 1) {
|
|
||||||
// const reg = require('./reg/registration');
|
|
||||||
// const link = reg.getlinkregByEmail('7', 'tomasihelen@dasdasgmail.comAAAA' , 'HelenTomasidasdasd');
|
|
||||||
// const link2 = reg.getlinkregByEmail('7', 'tomasihelen@gmail.com' , 'HelenTomasi');
|
|
||||||
// //const link2 = reg.getlinkregByEmail('7', 'elenaliubicich@gmail.com' , 'Elenaliu');
|
|
||||||
//
|
|
||||||
// console.log(link);
|
|
||||||
// console.log(link2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
async function estraiImmagini(table) {
|
|
||||||
const { User } = require('./models/user');
|
|
||||||
|
|
||||||
let idapp = '13';
|
|
||||||
|
|
||||||
let arrlist;
|
|
||||||
|
|
||||||
const globalTables = require('./tools/globalTables');
|
|
||||||
|
|
||||||
|
|
||||||
const mytable = globalTables.getTableByTableName(table);
|
|
||||||
if (!mytable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
console.log('INIZIO - estraiImmagini', table);
|
|
||||||
|
|
||||||
arrlist = await mytable.find({ idapp }).lean();
|
|
||||||
|
|
||||||
let file = '';
|
|
||||||
let filetocheck = '';
|
|
||||||
let dirmain = '';
|
|
||||||
let filefrom = '';
|
|
||||||
let filefrom2 = '';
|
|
||||||
let dir = tools.getdirByIdApp(idapp) + dirmain + '/upload/';
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (!tools.sulServer()) {
|
|
||||||
dirmain = '/public';
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const rec of arrlist) {
|
|
||||||
const myuser = await User.findOne({ idapp, _id: rec.userId }).lean();
|
|
||||||
if (myuser) {
|
|
||||||
const myphotos = rec.photos;
|
|
||||||
|
|
||||||
if (myphotos.length > 0) {
|
|
||||||
let folderprof = dir + 'profile/' + myuser.username;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// console.log('checkdir', folderprof);
|
|
||||||
if (!fs.existsSync(folderprof)) {
|
|
||||||
console.log('*** Creadir', folderprof);
|
|
||||||
fs.mkdirSync(folderprof);
|
|
||||||
}
|
|
||||||
|
|
||||||
folderprof = dir + 'profile/' + myuser.username + '/' + table;
|
|
||||||
// console.log('checkdir', folderprof);
|
|
||||||
if (!fs.existsSync(folderprof)) {
|
|
||||||
console.log('creadir', folderprof);
|
|
||||||
fs.mkdirSync(folderprof);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const photo of myphotos) {
|
|
||||||
|
|
||||||
if (photo.imagefile) {
|
|
||||||
file = dir + 'profile/' + myuser.username + '/' + table + '/' +
|
|
||||||
photo.imagefile;
|
|
||||||
filefrom = dir + 'profile/undefined/' + table + '/' + photo.imagefile;
|
|
||||||
filefrom2 = dir + 'profile/' + myuser.username + '/' + photo.imagefile;
|
|
||||||
|
|
||||||
// console.log('file', file);
|
|
||||||
// console.log('filefrom', filefrom);
|
|
||||||
|
|
||||||
if (!tools.isFileExists(file)) {
|
|
||||||
// non esiste
|
|
||||||
console.log('non esiste', file);
|
|
||||||
console.log(' filefrom', filefrom);
|
|
||||||
console.log(' filefrom2', filefrom2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tools.isFileExists(file) && tools.isFileExists(filefrom)) {
|
|
||||||
console.log('@@@@@@ copia file:', filefrom, 'a', file);
|
|
||||||
tools.copy(filefrom, file);
|
|
||||||
}
|
|
||||||
if (!tools.isFileExists(file) && tools.isFileExists(filefrom2)) {
|
|
||||||
console.log('@@@@@@ copia file 2:', filefrom2, 'a', file);
|
|
||||||
tools.copy(filefrom2, file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log('FINE - estraiImmagini', table);
|
|
||||||
} catch (e) {
|
|
||||||
console.error('e', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function estraiTutteLeImmagini() {
|
|
||||||
|
|
||||||
await estraiImmagini('myskills');
|
|
||||||
await estraiImmagini('mygoods');
|
|
||||||
await estraiImmagini('mybachecas');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function faitest() {
|
|
||||||
// console.log('Fai Test:')
|
|
||||||
|
|
||||||
const testfind = false;
|
|
||||||
|
|
||||||
// const $vers = tools.getVersionint('1.92.45');
|
|
||||||
|
|
||||||
if (true) {
|
|
||||||
// tools.execScript("ls -la");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false) {
|
|
||||||
prova = tools.removeAtChar('@prova');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false) {
|
|
||||||
const prova = tools.getConfSiteOptionEnabledByIdApp('13', shared_consts.ConfSite.Notif_Reg_Push_Admin);
|
|
||||||
console.log('prova', prova);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (testfind) {
|
|
||||||
const { City } = require('./models/city');
|
|
||||||
|
|
||||||
let miacity = 'roma';
|
|
||||||
const ris = await City.findByCity(miacity);
|
|
||||||
|
|
||||||
console.log('ris', ris);
|
|
||||||
}
|
|
||||||
|
|
||||||
const { User } = require('./models/user');
|
|
||||||
|
|
||||||
if (false) {
|
|
||||||
let myuser = await User.findOne({
|
|
||||||
idapp: '1',
|
|
||||||
username: 'paoloar77',
|
|
||||||
});
|
|
||||||
const langdest = 'it';
|
|
||||||
|
|
||||||
telegrambot.askConfirmationUser(myuser.idapp, shared_consts.CallFunz.REGISTRATION, myuser);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false) {
|
|
||||||
|
|
||||||
const user = await User.findOne({
|
|
||||||
idapp: 12,
|
|
||||||
username: 'paolotest1',
|
|
||||||
});
|
|
||||||
|
|
||||||
await sendemail.sendEmail_Registration('it', 'paolo@arcodiluce.it', user,
|
|
||||||
'12', '');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false) {
|
|
||||||
|
|
||||||
const { User } = require('./models/user');
|
|
||||||
|
|
||||||
const idapp = tools.FREEPLANET;
|
|
||||||
const idreg = 0;
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
const user = await User.findOne({
|
|
||||||
idapp,
|
|
||||||
username: 'paoloar773',
|
|
||||||
});
|
|
||||||
|
|
||||||
user.aportador_solidario = 'paoloar77';
|
|
||||||
|
|
||||||
let mylocalsconf = {
|
|
||||||
idapp,
|
|
||||||
dataemail: null,
|
|
||||||
locale: user.lang,
|
|
||||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
|
||||||
strlinksito: tools.getHostByIdApp(idapp),
|
|
||||||
strlinkreg: '',
|
|
||||||
username: user.username,
|
|
||||||
name: user.name,
|
|
||||||
surname: user.surname,
|
|
||||||
forgetpwd: tools.getHostByIdApp(idapp) + '/requestresetpwd',
|
|
||||||
emailto: '',
|
|
||||||
user,
|
|
||||||
};
|
|
||||||
|
|
||||||
await telegrambot.notifyToTelegram(telegrambot.phase.REGISTRATION,
|
|
||||||
mylocalsconf);
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error ' + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { app };
|
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ const auth_default = (req, res, next) => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const authenticate = (req, res, next) => {
|
const authenticate = async (req, res, next) => {
|
||||||
const token = req.header('x-auth');
|
const token = req.header('x-auth');
|
||||||
//const refreshToken = req.header('x-refrtok');
|
//const refreshToken = req.header('x-refrtok');
|
||||||
|
|
||||||
@@ -32,44 +32,38 @@ const authenticate = (req, res, next) => {
|
|||||||
|
|
||||||
const idapp = getIdApp(req);
|
const idapp = getIdApp(req);
|
||||||
|
|
||||||
return User.findByToken(token, access, true, idapp).then((ris) => {
|
try {
|
||||||
|
const ris = await User.findByToken(token, access, true, idapp);
|
||||||
if (ris && ris.user && !!ris.user.deleted) {
|
if (ris && ris.user && !!ris.user.deleted) {
|
||||||
if (ris.user.deleted)
|
if (ris.user.deleted)
|
||||||
ris.user = null;
|
ris.user = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||||
return Promise.reject(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED);
|
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ris.user) {
|
if (!ris.user) {
|
||||||
return Promise.reject(server_constants.RIS_CODE_HTTP_INVALID_TOKEN);
|
return res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!ris.user) {
|
if (!!ris.user) {
|
||||||
|
// crea una funzione per aggiornare il lasttimeonline e useragent
|
||||||
// Save last time online
|
// Save last time online
|
||||||
ris.user.lasttimeonline = new Date();
|
const myuser = await User.updateLastTimeAndUserAgent(ris.user._id, req.get('User-Agent'));
|
||||||
ris.user.retry_pwd = 0
|
req.user = myuser;
|
||||||
ris.user.useragent = req.get('User-Agent');
|
req.token = token;
|
||||||
|
// req.refreshToken = refreshToken;
|
||||||
return ris.user.save().then(() => {
|
req.access = access;
|
||||||
req.user = ris.user;
|
next(); // Esegui il codice successivo
|
||||||
req.token = token;
|
|
||||||
// req.refreshToken = refreshToken;
|
|
||||||
req.access = access;
|
|
||||||
next(); // Esegui il codice successivo
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// tools.mylog('userid', user._id);
|
} catch (e) {
|
||||||
|
tools.mylog("ERR authenticate invalid Token =", e);
|
||||||
}).catch((e) => {
|
|
||||||
if (e === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
if (e === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||||
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||||
}
|
}
|
||||||
tools.mylog("ERR authenticate invalid Token =", e);
|
|
||||||
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getIdApp = (req) => {
|
const getIdApp = (req) => {
|
||||||
@@ -83,44 +77,39 @@ const getIdApp = (req) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const authenticate_noerror = (req, res, next) => {
|
const authenticate_noerror = async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const token = req.header('x-auth');
|
const token = req.header('x-auth');
|
||||||
const refreshToken = req.header('x-refrtok');
|
const refreshToken = req.header('x-refrtok');
|
||||||
|
console.log(' ### Authenticate_noerror: token', !!token);
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
req.user = null;
|
req.user = null;
|
||||||
req.token = null;
|
req.token = null;
|
||||||
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||||
|
console.log(' ## TOKEN INVALIDO ❌ ...');
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
User.findByToken(token, 'auth', false, getIdApp(req))
|
const ris = await User.findByToken(token, 'auth', false, getIdApp(req));
|
||||||
.then((ris) => {
|
|
||||||
if (ris.code !== server_constants.RIS_CODE_OK) {
|
if (ris.code !== server_constants.RIS_CODE_OK) {
|
||||||
req.user = null;
|
req.user = null;
|
||||||
req.token = null;
|
req.token = null;
|
||||||
req.code = ris.code;
|
req.code = ris.code;
|
||||||
} else {
|
} else {
|
||||||
req.user = ris.user;
|
req.user = ris.user;
|
||||||
req.token = token;
|
req.token = token;
|
||||||
req.refreshToken = refreshToken;
|
req.refreshToken = refreshToken;
|
||||||
req.code = ris.code;
|
req.code = ris.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||||
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
next();
|
console.log(' ## NEXT ! AVANTI...');
|
||||||
})
|
next();
|
||||||
.catch((e) => {
|
|
||||||
console.error('Errore durante l\'autenticazione:', e);
|
|
||||||
req.user = null;
|
|
||||||
req.token = null;
|
|
||||||
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Errore nel middleware di autenticazione:', e);
|
console.error('Errore nel middleware di autenticazione:', e);
|
||||||
req.user = null;
|
req.user = null;
|
||||||
|
|||||||
@@ -298,16 +298,16 @@ MyGroupSchema.statics.getArrUsernameFromFieldByGroupname = async function (
|
|||||||
const { User } = require('../models/user');
|
const { User } = require('../models/user');
|
||||||
|
|
||||||
const myobj = {};
|
const myobj = {};
|
||||||
myobj[field + '.' + subfield] = 1;
|
myobj[field] = 1;
|
||||||
|
|
||||||
let arrrec = await User.findOne({
|
const ris = await User.findOne({
|
||||||
idapp,
|
idapp,
|
||||||
groupname,
|
groupname,
|
||||||
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
||||||
}, myobj).then((ris) => ris ? ris._doc[field] : []);
|
}, myobj);
|
||||||
|
|
||||||
if (arrrec.length > 0) {
|
if (ris) {
|
||||||
return arrrec.map(m => m.username);
|
return ris[field].map(m => m.username);
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
@@ -663,13 +663,13 @@ MyGroupSchema.statics.renameCircuitName = async function (idapp, oldcircuitname,
|
|||||||
|
|
||||||
MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
|
MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
|
||||||
|
|
||||||
return await this.findOneAndUpdate({
|
const record = await this.findOneAndUpdate(
|
||||||
idapp, groupname,
|
{ idapp, groupname },
|
||||||
},
|
{ $set: { 'lastdate_reqRisGroup': new Date() } },
|
||||||
{ $set: { 'lastdate_reqRisGroup': new Date() } }, { new: false }).lean().then((record) => {
|
{ new: false }
|
||||||
return !!record;
|
).lean();
|
||||||
});
|
|
||||||
|
|
||||||
|
return !!record; // Restituisce true se il record esiste, false altrimenti
|
||||||
};
|
};
|
||||||
|
|
||||||
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
|
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
|
||||||
|
|||||||
@@ -141,10 +141,10 @@ NewstosentSchema.statics.getlast = async function (idapp) {
|
|||||||
const Newstosent = this;
|
const Newstosent = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const mydoc = await Newstosent.find({ idapp }).sort({ datestartJob: -1 }).limit(1);
|
const mydoc = await Newstosent.findOne({ idapp }).sort({ datestartJob: -1 }).lean();
|
||||||
return mydoc[0]._doc;
|
return mydoc || null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -313,24 +313,21 @@ ProjectSchema.statics.getIdParentByIdProj = function (idProj) {
|
|||||||
|
|
||||||
ProjectSchema.statics.creaProjMain = async function (idapp) {
|
ProjectSchema.statics.creaProjMain = async function (idapp) {
|
||||||
|
|
||||||
const projmain = {
|
return await Project.findOneAndUpdate(
|
||||||
idapp,
|
{ idapp, descr: process.env.PROJECT_DESCR_MAIN },
|
||||||
descr: process.env.PROJECT_DESCR_MAIN,
|
{
|
||||||
longdescr: process.env.PROJECT_DESCR_MAIN,
|
$setOnInsert: {
|
||||||
typeproj: 1,
|
idapp,
|
||||||
id_main_project: null,
|
descr: process.env.PROJECT_DESCR_MAIN,
|
||||||
id_parent: null,
|
longdescr: process.env.PROJECT_DESCR_MAIN,
|
||||||
privacyread: server_constants.Privacy.all
|
typeproj: 1,
|
||||||
};
|
id_main_project: null,
|
||||||
|
id_parent: null,
|
||||||
return await new Project(projmain).save()
|
privacyread: server_constants.Privacy.all
|
||||||
.then(ris => {
|
}
|
||||||
console.log('ris', ris);
|
},
|
||||||
if (!!ris)
|
{ upsert: true, new: true, runValidators: true }
|
||||||
return ris._doc;
|
);
|
||||||
else
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ sendNotifSchema.index({ sender: 1 });*/
|
|||||||
sendNotifSchema.index({ idapp: 1, typedir: 1, typeid: 1, status: 1, sender: 1 });
|
sendNotifSchema.index({ idapp: 1, typedir: 1, typeid: 1, status: 1, sender: 1 });
|
||||||
|
|
||||||
|
|
||||||
sendNotifSchema.statics.setNotifAsRead = function (idapp, username, idnotif) {
|
sendNotifSchema.statics.setNotifAsRead = async function (idapp, username, idnotif) {
|
||||||
const SendNotif = this;
|
const SendNotif = this;
|
||||||
|
|
||||||
if (!username)
|
if (!username)
|
||||||
@@ -133,7 +133,7 @@ sendNotifSchema.statics.setNotifAsRead = function (idapp, username, idnotif) {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if (idnotif) {
|
if (idnotif) {
|
||||||
return SendNotif.findOneAndUpdate({
|
return await SendNotif.findOneAndUpdate({
|
||||||
$and: [
|
$and: [
|
||||||
{ idapp },
|
{ idapp },
|
||||||
{ dest: username },
|
{ dest: username },
|
||||||
@@ -154,11 +154,11 @@ sendNotifSchema.statics.setNotifAsRead = function (idapp, username, idnotif) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sendNotifSchema.statics.getRecNotif = function (id) {
|
sendNotifSchema.statics.getRecNotif = async function (id) {
|
||||||
const SendNotif = this;
|
const SendNotif = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return SendNotif.findById(id).lean();
|
return await SendNotif.findById(id).lean();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
|||||||
|
|
||||||
recnotif.tag = recnotif.tag ? recnotif.tag : tag;
|
recnotif.tag = recnotif.tag ? recnotif.tag : tag;
|
||||||
|
|
||||||
if (!recnotif.descr) {
|
if (!recnotif.descr) {
|
||||||
recnotif.descr = newdescr;
|
recnotif.descr = newdescr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,10 +895,9 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
|
|||||||
|
|
||||||
|
|
||||||
// Cerca il record e se lo trova lo aggiorna
|
// Cerca il record e se lo trova lo aggiorna
|
||||||
const myrec = await SendNotif.findOneAndUpdate(query, { $set: fields_to_update }, {
|
const myrec = await SendNotif.findOneAndUpdate(query,
|
||||||
new: false,
|
{ $set: fields_to_update },
|
||||||
returnNewDocument: true,
|
{ returnDocument: "after" }).lean();
|
||||||
});
|
|
||||||
|
|
||||||
if (myrec) {
|
if (myrec) {
|
||||||
return { myrecout: myrec, save: true };
|
return { myrecout: myrec, save: true };
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const SettingsSchema = new Schema({
|
|||||||
|
|
||||||
SettingsSchema.statics.getFieldsForSearch = function () {
|
SettingsSchema.statics.getFieldsForSearch = function () {
|
||||||
return [{ field: 'key', type: tools.FieldType.string },
|
return [{ field: 'key', type: tools.FieldType.string },
|
||||||
{ field: 'value_str', type: tools.FieldType.string }, { field: 'value_num', type: tools.FieldType.number }]
|
{ field: 'value_str', type: tools.FieldType.string }, { field: 'value_num', type: tools.FieldType.number }]
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsSchema.statics.executeQueryTable = function (idapp, params) {
|
SettingsSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -94,9 +94,9 @@ SettingsSchema.statics.findAllIdApp = async function (idapp, serv, crypted = fal
|
|||||||
try {
|
try {
|
||||||
let myfind = '';
|
let myfind = '';
|
||||||
if (serv) {
|
if (serv) {
|
||||||
myfind = {idapp, serv};
|
myfind = { idapp, serv };
|
||||||
} else
|
} else
|
||||||
myfind = {idapp};
|
myfind = { idapp };
|
||||||
|
|
||||||
// myfind = {...myfind, $or: [{ crypted: { $exists: false } }, { crypted: { $exists: true, $eq: crypted } }]};
|
// myfind = {...myfind, $or: [{ crypted: { $exists: false } }, { crypted: { $exists: true, $eq: crypted } }]};
|
||||||
|
|
||||||
@@ -109,14 +109,14 @@ SettingsSchema.statics.findAllIdApp = async function (idapp, serv, crypted = fal
|
|||||||
if (rec.crypted) {
|
if (rec.crypted) {
|
||||||
rec.value_str = ''
|
rec.value_str = ''
|
||||||
}
|
}
|
||||||
myarr.push({...rec});
|
myarr.push({ ...rec });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
myarr = [...arrorig];
|
myarr = [...arrorig];
|
||||||
}
|
}
|
||||||
|
|
||||||
return myarr;
|
return myarr;
|
||||||
}catch (e) {
|
} catch (e) {
|
||||||
console.error('Settings: findAllIdApp', e);
|
console.error('Settings: findAllIdApp', e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,9 @@ SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
|
|||||||
|
|
||||||
return await myrec.save();
|
return await myrec.save();
|
||||||
} else {
|
} else {
|
||||||
myrec = await Settings.findOneAndUpdate({ idapp, key }, { $set: { value_num: value } }, { new: false });
|
myrec = await Settings.findOneAndUpdate({ idapp, key },
|
||||||
|
{ $set: { value_num: value } },
|
||||||
|
{ new: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
return myrec
|
return myrec
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ StatSchema.statics.calculateStats = async function (idapp) {
|
|||||||
|
|
||||||
if (trova_se_oggi) {
|
if (trova_se_oggi) {
|
||||||
// Aggiorna il record di oggi:
|
// Aggiorna il record di oggi:
|
||||||
const ris = await Stat.findOneAndUpdate({ _id: trova_se_oggi._id }, { $set: datastat }, { new: true });
|
const ris = await Stat.findOneAndUpdate(
|
||||||
|
{ _id: trova_se_oggi._id },
|
||||||
|
{ $set: datastat },
|
||||||
|
{ returnDocument: "after" });
|
||||||
// console.log('ris', ris);
|
// console.log('ris', ris);
|
||||||
} else {
|
} else {
|
||||||
// Aggiungi un nuovo record:
|
// Aggiungi un nuovo record:
|
||||||
|
|||||||
@@ -577,11 +577,11 @@ UserSchema.methods.generateAuthToken = function (req) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.setOnLine = function (idapp, username) {
|
UserSchema.statics.setOnLine = async function (idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return User.findOneAndUpdate({ idapp, username }, { $set: { lasttimeonline: new Date() } });
|
return await User.findOneAndUpdate({ idapp, username }, { $set: { lasttimeonline: new Date() } });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -733,58 +733,41 @@ UserSchema.statics.isFacilitatore = function (perm) {
|
|||||||
|
|
||||||
UserSchema.statics.findByToken = async function (token, typeaccess, con_auth, idapp) {
|
UserSchema.statics.findByToken = async function (token, typeaccess, con_auth, idapp) {
|
||||||
const User = this;
|
const User = this;
|
||||||
let decoded;
|
|
||||||
let code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
let code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||||
let user = null;
|
let user = null;
|
||||||
|
let decoded;
|
||||||
|
|
||||||
|
if (!token) return { user, code };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (token) {
|
decoded = jwt.verify(token, process.env.SIGNCODE);
|
||||||
decoded = jwt.verify(token, process.env.SIGNCODE);
|
code = server_constants.RIS_CODE_OK;
|
||||||
|
} catch (err) {
|
||||||
code = server_constants.RIS_CODE_OK;
|
if (err.expiredAt) {
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
|
|
||||||
if (e.expiredAt) {
|
|
||||||
|
|
||||||
code = server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED;
|
code = server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED;
|
||||||
if (con_auth) {
|
if (con_auth) return { user: null, code };
|
||||||
return { user: null, code };
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Err findByToken:', e);
|
console.error('Err findByToken:', err);
|
||||||
}
|
}
|
||||||
|
return { user: null, code };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code === server_constants.RIS_CODE_OK) {
|
user = await User.findOne({
|
||||||
|
_id: decoded.smart,
|
||||||
user = await User.findOne({
|
tokens: {
|
||||||
'_id': decoded.smart,
|
$elemMatch: {
|
||||||
tokens: {
|
token,
|
||||||
$elemMatch: {
|
access: typeaccess,
|
||||||
token: token,
|
|
||||||
access: typeaccess,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
},
|
||||||
|
}).lean();
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
let check_expiry_date = false
|
const checkExpiry = tools.getEnableTokenExpiredByIdApp(user.idapp);
|
||||||
// Controlla se il sito ha attivo il controllo del Token Scaduto
|
const currentTime = Date.now() / 1000;
|
||||||
if (tools.getEnableTokenExpiredByIdApp(user.idapp)) {
|
if (checkExpiry && decoded.exp < currentTime) {
|
||||||
check_expiry_date = true
|
console.log('Il token è scaduto, generazione del nuovo token...');
|
||||||
}
|
code = server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED;
|
||||||
|
|
||||||
let tempo = Date.now() / 1000;
|
|
||||||
|
|
||||||
if (check_expiry_date && (decoded.exp < tempo)) {
|
|
||||||
console.log('Il token è scaduto, generazione del nuovo token...');
|
|
||||||
code = server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED;
|
|
||||||
} else {
|
|
||||||
// TOKEN ANCORA VALIDO
|
|
||||||
code = server_constants.RIS_CODE_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,7 +788,7 @@ UserSchema.statics.findByTokenAnyAccess = function (token) {
|
|||||||
return User.findOne({
|
return User.findOne({
|
||||||
'_id': decoded.smart,
|
'_id': decoded.smart,
|
||||||
'tokens.token': token,
|
'tokens.token': token,
|
||||||
});
|
}).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.findByCredentials = function (idapp, username, password, pwdcrypted) {
|
UserSchema.statics.findByCredentials = function (idapp, username, password, pwdcrypted) {
|
||||||
@@ -2150,17 +2133,14 @@ UserSchema.statics.getArrUsernameFromFieldByUsername = async function (
|
|||||||
idapp, username, field, subfield) {
|
idapp, username, field, subfield) {
|
||||||
|
|
||||||
const myobj = {};
|
const myobj = {};
|
||||||
myobj[field + '.' + subfield] = 1;
|
myobj[field + '.' + subfield + '.username'] = 1;
|
||||||
|
|
||||||
let arrrec = await User.findOne({
|
const rec = await User.findOne({
|
||||||
idapp, 'username': username,
|
idapp, 'username': username,
|
||||||
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
||||||
}, myobj).then((ris) => ris ? ris._doc[field][subfield] : []);
|
}, myobj);
|
||||||
|
|
||||||
if (arrrec && arrrec.length > 0) {
|
return rec ? rec[field][subfield].map(m => m.username) : [];
|
||||||
return arrrec.map(m => m.username);
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5790,7 +5770,7 @@ UserSchema.statics.getExtraInfoByUsername = async function (idapp, username) {
|
|||||||
|
|
||||||
let myuser = await User.findOne({ idapp, username }).lean();
|
let myuser = await User.findOne({ idapp, username }).lean();
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
myuserextra = await User.addExtraInfo(idapp, myuser, null);
|
myuserextra = await User.addExtraInfo(idapp, myuser);
|
||||||
return myuser.profile;
|
return myuser.profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5816,18 +5796,18 @@ UserSchema.statics.getProfilePerActivitiesByUsername = async function (idapp, us
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, version) {
|
UserSchema.statics.addExtraInfo = async function (idapp, recUser, version) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// tools.startTimeLog('addExtraInfo')
|
// tools.startTimeLog('addExtraInfo')
|
||||||
|
|
||||||
if (version) {
|
if (version && recUser) {
|
||||||
let versattualeuser = 0;
|
let versattualeuser = 0;
|
||||||
if (!recUser.profile.version) {
|
if (!recUser?.profile?.version) {
|
||||||
recUser.version = 0;
|
recUser.version = 0;
|
||||||
versattualeuser = 0;
|
versattualeuser = 0;
|
||||||
} else {
|
} else {
|
||||||
versattualeuser = recUser.profile.version;
|
versattualeuser = recUser.profile?.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
// versattualeuser = 0; // TOGLIERE!
|
// versattualeuser = 0; // TOGLIERE!
|
||||||
@@ -6281,6 +6261,26 @@ UserSchema.statics.getnumAnnunci = async function (idapp) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// crea una funzione per aggiornare il lasttimeonline e useragent
|
||||||
|
UserSchema.statics.updateLastTimeAndUserAgent = async function (id, useragent) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
// cerca lo user by id e aggiorna i campi
|
||||||
|
// e ritorna il nuovo record
|
||||||
|
const ris = await User.findOneAndUpdate(
|
||||||
|
{ _id: id },
|
||||||
|
{
|
||||||
|
$set: {
|
||||||
|
lasttimeonline: new Date(),
|
||||||
|
useragent,
|
||||||
|
retry_pwd: 0
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ returnDocument: "after" }
|
||||||
|
).lean();
|
||||||
|
|
||||||
|
return ris;
|
||||||
|
}
|
||||||
UserSchema.statics.createNewSubRecord = async function (idapp, req) {
|
UserSchema.statics.createNewSubRecord = async function (idapp, req) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,10 @@ async function findOrCreateCatProd(idapp, idArgomento, DescrArgomento) {
|
|||||||
await CatProd.findOneAndUpdate(
|
await CatProd.findOneAndUpdate(
|
||||||
{ _id: reccatprod._id },
|
{ _id: reccatprod._id },
|
||||||
{ $set: { idArgomento } },
|
{ $set: { idArgomento } },
|
||||||
{ new: true, upsert: false }
|
{
|
||||||
|
returnDocument: "after",
|
||||||
|
upsert: false
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -181,25 +181,24 @@ router.put('/:userId', authenticate, async function (req, res, next) {
|
|||||||
const cart = await Cart.getCartByUserId(userId);
|
const cart = await Cart.getCartByUserId(userId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const p = await Product.getProductByID(productId);
|
const myprod = await Product.getProductByID(productId);
|
||||||
|
|
||||||
let newCart = oldCart.add(p, productId, { color, size })
|
let newCart = oldCart.add(myprod, productId, { color, size })
|
||||||
|
|
||||||
//exist cart in databse
|
//exist cart in databse
|
||||||
if (cart.length > 0) {
|
if (cart.length > 0) {
|
||||||
await Cart.updateCartByUserId(
|
try {
|
||||||
userId,
|
const result = await Cart.updateCartByUserId(userId, {
|
||||||
{
|
|
||||||
items: newCart.items,
|
items: newCart.items,
|
||||||
totalQty: newCart.totalQty,
|
totalQty: newCart.totalQty,
|
||||||
totalPrice: newCart.totalPrice,
|
totalPrice: newCart.totalPrice,
|
||||||
totalPriceCalc: newCart.totalPriceCalc,
|
totalPriceCalc: newCart.totalPriceCalc,
|
||||||
userId: userId
|
userId: userId
|
||||||
},
|
});
|
||||||
function (err, result) {
|
res.json(result);
|
||||||
if (err) return next(err)
|
} catch (err) {
|
||||||
res.json(result)
|
return next(err);
|
||||||
})
|
}
|
||||||
} else {
|
} else {
|
||||||
//no cart in database
|
//no cart in database
|
||||||
let newCartobj = {
|
let newCartobj = {
|
||||||
@@ -242,7 +241,7 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
|
|||||||
let idapp = req.body.idapp;
|
let idapp = req.body.idapp;
|
||||||
let cart_id = req.body.cart_id;
|
let cart_id = req.body.cart_id;
|
||||||
let userId = req.params.userId;
|
let userId = req.params.userId;
|
||||||
const user = req.user;
|
|
||||||
let status = req.body.status;
|
let status = req.body.status;
|
||||||
let note = req.body.note;
|
let note = req.body.note;
|
||||||
let options = req.body.options;
|
let options = req.body.options;
|
||||||
|
|||||||
@@ -1807,320 +1807,217 @@ router.get('/loadsite/:userId/:idapp/:vers', authenticate_noerror,
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function load(req, res, version) {
|
async function load(req, res, version = '0') {
|
||||||
|
|
||||||
let userId = '0';
|
|
||||||
try {
|
try {
|
||||||
userId = req.user ? req.user._id.toString() : req.params.userId;
|
console.log(' ... 1) richiesta LOAD');
|
||||||
} catch (e) {
|
|
||||||
console.error('Err userId LOAD', e);
|
|
||||||
userId = '0';
|
|
||||||
}
|
|
||||||
const idapp = req.params.idapp;
|
|
||||||
|
|
||||||
let status = 200
|
// Estrazione e validazione degli input
|
||||||
if (req.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
const userId = req.user ? req.user._id.toString() : req.params.userId || '0';
|
||||||
status = server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED
|
const idapp = req.params.idapp;
|
||||||
}
|
const status = req.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED
|
||||||
|
? server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED
|
||||||
|
: 200;
|
||||||
|
|
||||||
|
// Determina se l'utente ha determinati permessi
|
||||||
|
const gestoredelSito = req.user &&
|
||||||
|
(User.isAdmin(req.user.perm) || User.isManager(req.user.perm) || User.isEditor(req.user.perm))
|
||||||
|
? '1'
|
||||||
|
: '0';
|
||||||
|
|
||||||
if (!version) {
|
const socioresidente = req.user && req.user.profile ? req.user.profile.socioresidente : false;
|
||||||
version = '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
let gestoredelSito = '0';
|
// Costruzione dell'oggetto delle promesse
|
||||||
if (!!req.user) {
|
const promises = {
|
||||||
gestoredelSito = (User.isAdmin(req.user.perm) ||
|
bookedevent: userId !== '0'
|
||||||
User.isManager(req.user.perm) ||
|
? Booking.findAllByUserIdAndIdApp(userId, idapp, gestoredelSito)
|
||||||
User.isEditor(req.user.perm)) ? '1' : '0';
|
: Promise.resolve([]),
|
||||||
}
|
eventlist: MyEvent.findAllIdApp(socioresidente, idapp),
|
||||||
|
operators: Operator.findAllIdApp(idapp),
|
||||||
|
wheres: Where.findAllIdApp(idapp),
|
||||||
|
contribtype: Contribtype.findAllIdApp(idapp),
|
||||||
|
settings: Settings.findAllIdApp(idapp, false, false),
|
||||||
|
permissions: Permission.findAllIdApp(),
|
||||||
|
disciplines: Discipline.findAllIdApp(idapp),
|
||||||
|
newstosent: gestoredelSito
|
||||||
|
? Newstosent.findAllIdApp(idapp)
|
||||||
|
: Promise.resolve([]),
|
||||||
|
mailinglist: Promise.resolve([]),
|
||||||
|
mypage: version > 91
|
||||||
|
? MyPage.findOnlyStruttRec(idapp)
|
||||||
|
: MyPage.findAllIdApp(idapp),
|
||||||
|
gallery: gestoredelSito
|
||||||
|
? Gallery.findAllIdApp(idapp)
|
||||||
|
: Promise.resolve([]),
|
||||||
|
paymenttype: PaymentType.findAllIdApp(idapp),
|
||||||
|
calcstat: req.user
|
||||||
|
? User.calculateStat(idapp, req.user.username)
|
||||||
|
: Promise.resolve(null),
|
||||||
|
calzoom: CalZoom.findAllIdApp(idapp),
|
||||||
|
producers: Producer.findAllIdApp(idapp),
|
||||||
|
cart: req.user
|
||||||
|
? Cart.getCartByUserId(req.user.id, idapp)
|
||||||
|
: Promise.resolve(null),
|
||||||
|
storehouses: Storehouse.findAllIdApp(idapp),
|
||||||
|
departments: Department.findAllIdApp(idapp),
|
||||||
|
orderscart: req.user
|
||||||
|
? (User.isManager(req.user.perm)
|
||||||
|
? OrdersCart.getOrdersCartByUserId('ALL', idapp, 0, false)
|
||||||
|
: OrdersCart.getOrdersCartByUserId(req.user.id, idapp, 0, false))
|
||||||
|
: Promise.resolve(null),
|
||||||
|
groups: Group.findAllIdApp(idapp),
|
||||||
|
resps: User.getusersRespList(idapp),
|
||||||
|
workers: User.getusersWorkersList(idapp),
|
||||||
|
internalpages: MyPage.findInternalPages(idapp),
|
||||||
|
// Campi aggiuntivi per versioni >= 91
|
||||||
|
levels: version >= 91 ? Level.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
skills: version >= 91 ? Skill.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
sectors: version >= 91 ? Sector.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
statusSkills: version >= 91 ? StatusSkill.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
provinces: version >= 91 ? Province.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
catgrps: version >= 91 ? CatGrp.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
adtypes: version >= 91 ? AdType.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
adtypegoods: version >= 91 ? AdTypeGood.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
sectorgoods: version >= 91 ? SectorGood.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
goods: version >= 91 ? Good.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
site: version >= 91 ? Site.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
mygroups: version >= 91 ? MyGroup.findAllGroups(idapp) : Promise.resolve([]),
|
||||||
|
listcircuits: version >= 91 ? Circuit.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
myelems: version >= 91 ? MyElem.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
categories: version >= 91 ? Category.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
providers: version >= 91 ? Provider.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
scontisticas: version >= 91 ? Scontistica.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
gasordines: version >= 91 ? Gasordine.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
products: version >= 91
|
||||||
|
? Product.findAllIdApp(idapp, undefined, undefined, req.user ? User.isManager(req.user.perm) : false)
|
||||||
|
: Promise.resolve([]),
|
||||||
|
productInfos: version >= 91 ? ProductInfo.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
catprods: version >= 91 ? Product.getArrCatProds(idapp, shared_consts.PROD.BOTTEGA) : Promise.resolve([]),
|
||||||
|
subcatprods: version >= 91 ? SubCatProd.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
catprods_gas: version >= 91 ? Product.getArrCatProds(idapp, shared_consts.PROD.GAS) : Promise.resolve([]),
|
||||||
|
catAI: version >= 91 ? CatAI.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
authors: version >= 91 ? Author.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
publishers: version >= 91 ? Publisher.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
myschedas: version >= 91 ? MyElem.findallSchedeTemplate(idapp) : Promise.resolve([]),
|
||||||
|
collane: version >= 91 ? Collana.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
catalogs: version >= 91 ? Catalog.findAllIdApp(idapp) : Promise.resolve([]),
|
||||||
|
catprtotali: version >= 91 ? CatProd.getCatProdWithTitleCount(idapp) : Promise.resolve([]),
|
||||||
|
myuserextra: req.user
|
||||||
|
? User.addExtraInfo(idapp, req.user, version)
|
||||||
|
: Promise.resolve(null)
|
||||||
|
};
|
||||||
|
|
||||||
// var category = req.params.category;
|
// Esecuzione parallela di tutte le promesse
|
||||||
|
const keys = Object.keys(promises);
|
||||||
|
const results = await Promise.all(Object.values(promises));
|
||||||
|
const data = keys.reduce((acc, key, index) => {
|
||||||
|
acc[key] = results[index];
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
// tools.mylog('loadsite : ', req.params);
|
// Aggiornamento delle informazioni dell'utente, se presente
|
||||||
|
|
||||||
|
|
||||||
let bookedevent = [];
|
|
||||||
// let msgs = [];
|
|
||||||
|
|
||||||
let socioresidente = false;
|
|
||||||
|
|
||||||
if (req.user)
|
|
||||||
socioresidente = req.user.profile.socioresidente;
|
|
||||||
|
|
||||||
if (userId !== '0') {
|
|
||||||
// LOGGED WITH USERID
|
|
||||||
bookedevent = Booking.findAllByUserIdAndIdApp(userId, idapp,
|
|
||||||
gestoredelSito);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract all the todos of the userId only
|
|
||||||
const eventlist = MyEvent.findAllIdApp(socioresidente, idapp);
|
|
||||||
const operators = Operator.findAllIdApp(idapp);
|
|
||||||
const internalpages = MyPage.findInternalPages(idapp);
|
|
||||||
const wheres = Where.findAllIdApp(idapp);
|
|
||||||
const contribtype = Contribtype.findAllIdApp(idapp);
|
|
||||||
const paymenttype = PaymentType.findAllIdApp(idapp);
|
|
||||||
const disciplines = Discipline.findAllIdApp(idapp);
|
|
||||||
const myelems = MyElem.findAllIdApp(idapp);
|
|
||||||
const myschedas = MyElem.findallSchedeTemplate(idapp);
|
|
||||||
const settings = Settings.findAllIdApp(idapp, false, false);
|
|
||||||
|
|
||||||
const permissions = Permission.findAllIdApp();
|
|
||||||
|
|
||||||
// const versionstr = User....
|
|
||||||
// let version = tools.getVersionint(versionstr);
|
|
||||||
|
|
||||||
let newstosent = Promise.resolve([]);
|
|
||||||
let mailinglist = Promise.resolve([]);
|
|
||||||
let mypage;
|
|
||||||
if (version > 91)
|
|
||||||
mypage = MyPage.findOnlyStruttRec(idapp);
|
|
||||||
else
|
|
||||||
mypage = MyPage.findAllIdApp(idapp);
|
|
||||||
let calzoom = CalZoom.findAllIdApp(idapp);
|
|
||||||
|
|
||||||
let gallery = Promise.resolve([]);
|
|
||||||
if (gestoredelSito) {
|
|
||||||
gallery = Gallery.findAllIdApp(idapp);
|
|
||||||
}
|
|
||||||
|
|
||||||
let producers = Producer.findAllIdApp(idapp);
|
|
||||||
let groups = Group.findAllIdApp(idapp);
|
|
||||||
|
|
||||||
// ....
|
|
||||||
let resps = User.getusersRespList(idapp);
|
|
||||||
let workers = User.getusersWorkersList(idapp);
|
|
||||||
let storehouses = Storehouse.findAllIdApp(idapp);
|
|
||||||
let providers = Provider.findAllIdApp(idapp);
|
|
||||||
let catprods = Product.getArrCatProds(idapp, shared_consts.PROD.BOTTEGA);
|
|
||||||
let catprtotali = CatProd.getCatProdWithTitleCount(idapp);
|
|
||||||
let collane = Collana.findAllIdApp(idapp);
|
|
||||||
let catalogs = Catalog.findAllIdApp(idapp);
|
|
||||||
let catprods_gas = Product.getArrCatProds(idapp, shared_consts.PROD.GAS);
|
|
||||||
let subcatprods = SubCatProd.findAllIdApp(idapp);
|
|
||||||
let gasordines = Gasordine.findAllIdApp(idapp);
|
|
||||||
let catAI = CatAI.findAllIdApp(idapp);
|
|
||||||
let ismanager = false;
|
|
||||||
try {
|
|
||||||
if (req.user)
|
|
||||||
ismanager = User.isManager(req.user.perm)
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
let products = Product.findAllIdApp(idapp, undefined, undefined, ismanager);
|
|
||||||
let authors = Author.findAllIdApp(idapp);
|
|
||||||
let publishers = Publisher.findAllIdApp(idapp);
|
|
||||||
let productInfos = ProductInfo.findAllIdApp(idapp);
|
|
||||||
let scontisticas = Scontistica.findAllIdApp(idapp);
|
|
||||||
let departments = Department.findAllIdApp(idapp);
|
|
||||||
let categories = Category.findAllIdApp(idapp);
|
|
||||||
|
|
||||||
|
|
||||||
// SKILLS:
|
|
||||||
let levels = Level.findAllIdApp(idapp);
|
|
||||||
let adtypes = AdType.findAllIdApp(idapp);
|
|
||||||
let adtypegoods = AdTypeGood.findAllIdApp(idapp);
|
|
||||||
let skills = Skill.findAllIdApp(idapp);
|
|
||||||
let goods = Good.findAllIdApp(idapp);
|
|
||||||
//let subSkills = SubSkill.findAllIdApp(idapp);
|
|
||||||
let statusSkills = StatusSkill.findAllIdApp(idapp);
|
|
||||||
let sectors = Sector.findAllIdApp(idapp);
|
|
||||||
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
|
||||||
let catgrps = CatGrp.findAllIdApp(idapp);
|
|
||||||
let site = Site.findAllIdApp(idapp);
|
|
||||||
let mygroups = MyGroup.findAllGroups(idapp);
|
|
||||||
let listcircuits = Circuit.findAllIdApp(idapp);
|
|
||||||
let provinces = Province.findAllIdApp(idapp);
|
|
||||||
let cart = null;
|
|
||||||
let orderscart = null;
|
|
||||||
if (gestoredelSito) {
|
|
||||||
newstosent = Newstosent.findAllIdApp(idapp);
|
|
||||||
}
|
|
||||||
|
|
||||||
let calcstat = null;
|
|
||||||
if (req.user) {
|
|
||||||
calcstat = User.calculateStat(idapp, req.user.username);
|
|
||||||
cart = Cart.getCartByUserId(req.user.id, idapp);
|
|
||||||
if (ismanager) {
|
|
||||||
// Prende Tutti gli Ordini !
|
|
||||||
orderscart = OrdersCart.getOrdersCartByUserId('ALL', idapp, 0, false);
|
|
||||||
} else {
|
|
||||||
orderscart = OrdersCart.getOrdersCartByUserId(req.user.id, idapp, 0, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let askedfriends = [];
|
|
||||||
let myuserextra = null;
|
|
||||||
if (req.user) {
|
|
||||||
// askedfriends = User.getAskedFriendsByUsername(idapp, req.user.username);
|
|
||||||
myuserextra = User.addExtraInfo(idapp, req.user._doc, req.user, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.all([
|
|
||||||
bookedevent,
|
|
||||||
eventlist,
|
|
||||||
operators,
|
|
||||||
wheres,
|
|
||||||
contribtype,
|
|
||||||
settings, // 5
|
|
||||||
permissions,
|
|
||||||
disciplines,
|
|
||||||
newstosent,
|
|
||||||
mailinglist,
|
|
||||||
mypage, // 10
|
|
||||||
gallery,
|
|
||||||
paymenttype,
|
|
||||||
calcstat,
|
|
||||||
calzoom,
|
|
||||||
producers, // 15
|
|
||||||
cart,
|
|
||||||
storehouses,
|
|
||||||
departments,
|
|
||||||
orderscart,
|
|
||||||
groups, // 20
|
|
||||||
resps,
|
|
||||||
workers,
|
|
||||||
internalpages,
|
|
||||||
levels,
|
|
||||||
skills, //25
|
|
||||||
//subSkills,
|
|
||||||
myuserextra, // 26
|
|
||||||
sectors, // 27
|
|
||||||
statusSkills, //28
|
|
||||||
provinces,
|
|
||||||
catgrps,
|
|
||||||
adtypes,
|
|
||||||
adtypegoods,
|
|
||||||
sectorgoods,
|
|
||||||
goods,
|
|
||||||
site,
|
|
||||||
mygroups,
|
|
||||||
listcircuits, // 37
|
|
||||||
myelems, // 38
|
|
||||||
categories, // 39
|
|
||||||
providers,
|
|
||||||
scontisticas,
|
|
||||||
gasordines,
|
|
||||||
products,
|
|
||||||
productInfos,
|
|
||||||
catprods, //45
|
|
||||||
subcatprods,
|
|
||||||
catprods_gas, //47
|
|
||||||
catAI,
|
|
||||||
authors,
|
|
||||||
publishers,
|
|
||||||
myschedas,
|
|
||||||
collane,
|
|
||||||
catalogs,
|
|
||||||
catprtotali,
|
|
||||||
]).then((arrdata) => {
|
|
||||||
// console.table(arrdata);
|
|
||||||
let myuser = req.user;
|
let myuser = req.user;
|
||||||
if (myuser) {
|
if (myuser && data.myuserextra) {
|
||||||
try {
|
myuser = data.myuserextra;
|
||||||
myuser = arrdata[26];
|
myuser.password = '';
|
||||||
if (myuser) {
|
myuser.calcstat = data.calcstat;
|
||||||
myuser.password = '';
|
|
||||||
myuser.calcstat = arrdata[13];
|
|
||||||
}
|
|
||||||
} catch (e) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Costruzione dell'oggetto di risposta in base alla versione
|
||||||
|
let responseData;
|
||||||
if (version < 91) {
|
if (version < 91) {
|
||||||
res.status(status).send({
|
responseData = {
|
||||||
bookedevent: arrdata[0],
|
bookedevent: data.bookedevent,
|
||||||
eventlist: arrdata[1],
|
eventlist: data.eventlist,
|
||||||
operators: arrdata[2],
|
operators: data.operators,
|
||||||
wheres: arrdata[3],
|
wheres: data.wheres,
|
||||||
contribtype: arrdata[4],
|
contribtype: data.contribtype,
|
||||||
settings: arrdata[5],
|
settings: data.settings,
|
||||||
permissions: arrdata[6],
|
permissions: data.permissions,
|
||||||
disciplines: arrdata[7],
|
disciplines: data.disciplines,
|
||||||
newstosent: arrdata[8],
|
newstosent: data.newstosent,
|
||||||
mailinglist: arrdata[9],
|
mailinglist: data.mailinglist,
|
||||||
mypage: arrdata[10],
|
mypage: data.mypage,
|
||||||
gallery: arrdata[11],
|
gallery: data.gallery,
|
||||||
paymenttypes: arrdata[12],
|
paymenttypes: data.paymenttype,
|
||||||
calzoom: arrdata[14],
|
calzoom: data.calzoom,
|
||||||
producers: arrdata[15],
|
producers: data.producers,
|
||||||
cart: arrdata[16],
|
cart: data.cart,
|
||||||
storehouses: arrdata[17],
|
storehouses: data.storehouses,
|
||||||
departments: arrdata[18],
|
departments: data.departments,
|
||||||
orders: arrdata[19],
|
orders: data.orderscart,
|
||||||
groups: arrdata[20],
|
groups: data.groups,
|
||||||
resps: arrdata[21],
|
resps: data.resps,
|
||||||
workers: arrdata[22],
|
workers: data.workers,
|
||||||
myuser,
|
myuser,
|
||||||
internalpages: arrdata[23],
|
internalpages: data.internalpages
|
||||||
});
|
};
|
||||||
} else {
|
} else {
|
||||||
res.status(status).send({
|
responseData = {
|
||||||
bookedevent: arrdata[0],
|
bookedevent: data.bookedevent,
|
||||||
eventlist: arrdata[1],
|
eventlist: data.eventlist,
|
||||||
operators: arrdata[2],
|
operators: data.operators,
|
||||||
wheres: arrdata[3],
|
wheres: data.wheres,
|
||||||
contribtype: arrdata[4],
|
contribtype: data.contribtype,
|
||||||
settings: arrdata[5],
|
settings: data.settings,
|
||||||
permissions: arrdata[6],
|
permissions: data.permissions,
|
||||||
disciplines: arrdata[7],
|
disciplines: data.disciplines,
|
||||||
newstosent: arrdata[8],
|
newstosent: data.newstosent,
|
||||||
mailinglist: arrdata[9],
|
mailinglist: data.mailinglist,
|
||||||
mypage: arrdata[10],
|
mypage: data.mypage,
|
||||||
gallery: arrdata[11],
|
gallery: data.gallery,
|
||||||
paymenttypes: arrdata[12],
|
paymenttypes: data.paymenttype,
|
||||||
calzoom: arrdata[14],
|
calzoom: data.calzoom,
|
||||||
producers: arrdata[15],
|
producers: data.producers,
|
||||||
cart: arrdata[16],
|
cart: data.cart,
|
||||||
storehouses: arrdata[17],
|
storehouses: data.storehouses,
|
||||||
departments: arrdata[18],
|
departments: data.departments,
|
||||||
orders: arrdata[19],
|
orders: data.orderscart,
|
||||||
groups: arrdata[20],
|
groups: data.groups,
|
||||||
resps: arrdata[21],
|
resps: data.resps,
|
||||||
workers: arrdata[22],
|
workers: data.workers,
|
||||||
myuser,
|
myuser,
|
||||||
internalpages: arrdata[23],
|
internalpages: data.internalpages,
|
||||||
levels: arrdata[24],
|
levels: data.levels,
|
||||||
skills: arrdata[25],
|
skills: data.skills,
|
||||||
// subSkills: arrdata[26],
|
sectors: data.sectors,
|
||||||
// myuser arrdata[26]
|
statusSkills: data.statusSkills,
|
||||||
sectors: arrdata[27],
|
provinces: data.provinces,
|
||||||
statusSkills: arrdata[28],
|
catgrps: data.catgrps,
|
||||||
provinces: arrdata[29],
|
adtypes: data.adtypes,
|
||||||
catgrps: arrdata[30],
|
adtypegoods: data.adtypegoods,
|
||||||
adtypes: arrdata[31],
|
sectorgoods: data.sectorgoods,
|
||||||
adtypegoods: arrdata[32],
|
goods: data.goods,
|
||||||
sectorgoods: arrdata[33],
|
site: data.site,
|
||||||
goods: arrdata[34],
|
mygroups: data.mygroups,
|
||||||
site: arrdata[35],
|
listcircuits: data.listcircuits,
|
||||||
mygroups: arrdata[36],
|
myelems: data.myelems,
|
||||||
listcircuits: arrdata[37],
|
categories: data.categories,
|
||||||
myelems: arrdata[38],
|
providers: data.providers,
|
||||||
categories: arrdata[39],
|
scontisticas: data.scontisticas,
|
||||||
providers: arrdata[40],
|
gasordines: data.gasordines,
|
||||||
scontisticas: arrdata[41],
|
products: data.products,
|
||||||
gasordines: arrdata[42],
|
productInfos: data.productInfos,
|
||||||
products: arrdata[43],
|
catprods: data.catprods,
|
||||||
productInfos: arrdata[44],
|
subcatprods: data.subcatprods,
|
||||||
catprods: arrdata[45],
|
catprods_gas: data.catprods_gas,
|
||||||
subcatprods: arrdata[46],
|
catAI: data.catAI,
|
||||||
catprods_gas: arrdata[47],
|
|
||||||
catAI: arrdata[48],
|
|
||||||
code: req.code,
|
code: req.code,
|
||||||
authors: arrdata[49],
|
authors: data.authors,
|
||||||
publishers: arrdata[50],
|
publishers: data.publishers,
|
||||||
myschedas: arrdata[51],
|
myschedas: data.myschedas,
|
||||||
collane: arrdata[52],
|
collane: data.collane,
|
||||||
catalogs: arrdata[53],
|
catalogs: data.catalogs,
|
||||||
catprtotali: arrdata[54],
|
catprtotali: data.catprtotali
|
||||||
});
|
};
|
||||||
|
|
||||||
const prova = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch((e) => {
|
console.log(' ... 2) load dati caricati ...');
|
||||||
console.log(e.message);
|
res.status(status).send(responseData);
|
||||||
res.status(400).send(e);
|
} catch (e) {
|
||||||
});
|
console.error('Errore in load:', e);
|
||||||
|
res.status(400).send({ error: e.message });
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res) => {
|
router.get(process.env.LINK_CHECK_UPDATES, authenticate_noerror, async (req, res) => {
|
||||||
const idapp = req.query.idapp;
|
const idapp = req.query.idapp;
|
||||||
|
|||||||
@@ -90,20 +90,19 @@ router.post('/', authenticate, async (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.delete('/del', authenticate, (req, res) => {
|
router.delete('/del', authenticate, async (req, res) => {
|
||||||
// tools.mylog("TOKENREM = " + req.token);
|
// tools.mylog("TOKENREM = " + req.token);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
const browser = req.get('User-Agent');
|
const browser = req.get('User-Agent');
|
||||||
Subscription.findOneAndDelete(
|
return await Subscription.findOneAndDelete(
|
||||||
{ userId: req.user._id, access: req.access, browser }).then(() => {
|
{ userId: req.user._id, access: req.access, browser }).then(() => {
|
||||||
res.status(200).send();
|
res.status(200).send();
|
||||||
}, () => {
|
}, () => {
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error('Err:', e.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ connectToDatabase(connectionUrl, options)
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('------------------------------------------------------------------');
|
console.log('------------------------------------------------------------------');
|
||||||
console.log('--------------- CONNESSIONE AL DB EFFETTUATA ! -----------------');
|
console.log('--------------- CONNESSIONE AL DB EFFETTUATA ! -----------------');
|
||||||
console.log('------------------------------------------------------------------');
|
console.log('------------------------------------------------------------------');
|
||||||
|
|
||||||
const { CfgServer } = require('./models/cfgserver');
|
const { CfgServer } = require('./models/cfgserver');
|
||||||
const { ObjectId } = require('mongodb');
|
const { ObjectId } = require('mongodb');
|
||||||
@@ -792,7 +792,6 @@ connectToDatabase(connectionUrl, options)
|
|||||||
console.log('isProduction', isProduction);
|
console.log('isProduction', isProduction);
|
||||||
|
|
||||||
const NOCORS = false;
|
const NOCORS = false;
|
||||||
const CORS_ENABLE_FOR_ALL_SITES = false;
|
|
||||||
|
|
||||||
const ISDEBUG = false;
|
const ISDEBUG = false;
|
||||||
|
|
||||||
@@ -806,33 +805,55 @@ connectToDatabase(connectionUrl, options)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('WITH CORS')
|
console.log('WITH CORS')
|
||||||
let myorigin = '*';
|
let credentials = true;
|
||||||
let credentials = false;
|
|
||||||
|
|
||||||
const allowedOrigins = domains.flatMap(domain => [
|
let allowedOrigins = null;
|
||||||
`https://${domain.hostname}`,
|
|
||||||
`https://api.${domain.hostname}`,
|
if (!isProduction) {
|
||||||
`https://test.${domain.hostname}`,
|
allowedOrigins = 'http://localhost:3000';
|
||||||
`https://testapi.${domain.hostname}`,
|
|
||||||
`http://${domain.hostname}`,
|
} else {
|
||||||
`http://api.${domain.hostname}`,
|
allowedOrigins = domains.flatMap(domain => [
|
||||||
`http://test.${domain.hostname}`,
|
`https://${domain.hostname}`,
|
||||||
`http://testapi.${domain.hostname}`
|
`https://api.${domain.hostname}`,
|
||||||
]);
|
`https://test.${domain.hostname}`,
|
||||||
|
`https://testapi.${domain.hostname}`,
|
||||||
|
`https://freeplanet.app:3000`,
|
||||||
|
`http://${domain.hostname}`,
|
||||||
|
`http://api.${domain.hostname}`,
|
||||||
|
`http://test.${domain.hostname}`,
|
||||||
|
`http://testapi.${domain.hostname}`
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let myorigin = '*';
|
||||||
|
|
||||||
if (domains.length > 0) {
|
if (domains.length > 0) {
|
||||||
myorigin = function (origin, callback) {
|
myorigin = (origin, callback) => {
|
||||||
// Array di domini consentiti
|
try {
|
||||||
|
// Validazione dell'input
|
||||||
|
if (!origin || typeof origin !== 'string' || !/^https?:\/\/[^\s/$.?#].[^\s]*$/.test(origin)) {
|
||||||
|
console.error('❌ Origine non valida', origin);
|
||||||
|
}
|
||||||
|
|
||||||
// console.log('allowedOrigins', allowedOrigins);
|
// Logging per il debug
|
||||||
|
// console.log('Verifica origine:', origin);
|
||||||
|
|
||||||
// Permetti richieste senza origin (es. mobile apps)
|
// Controllo delle origini consentite
|
||||||
if (!origin || allowedOrigins.includes(origin)) {
|
if (!origin || allowedOrigins.includes(origin)) {
|
||||||
callback(null, true);
|
// console.log('✅ Origine consentita:', origin);
|
||||||
} else {
|
return callback(null, true);
|
||||||
callback(new Error('❌ CORS non permesso per questa origine'));
|
}
|
||||||
|
|
||||||
|
// Blocco delle origini non autorizzate
|
||||||
|
console.warn('❌ Origine bloccata:', origin);
|
||||||
|
callback(new Error('CORS non permesso per questa origine ' + origin));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Errore durante la verifica dell\'origine:', error.message);
|
||||||
|
callback(error);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configurazione CORS dettagliata
|
// Configurazione CORS dettagliata
|
||||||
@@ -861,38 +882,13 @@ connectToDatabase(connectionUrl, options)
|
|||||||
// HO AGGIUNTO QUESTA RIGA PER IL CORS !!!!!!!
|
// HO AGGIUNTO QUESTA RIGA PER IL CORS !!!!!!!
|
||||||
app.use(express.json()); // Middleware per il parsing del corpo JSON
|
app.use(express.json()); // Middleware per il parsing del corpo JSON
|
||||||
|
|
||||||
// Gestione specifica delle richieste OPTIONS
|
app.options('*', cors(corsOptions)); // Gestisce tutte le richieste OPTIONS
|
||||||
/* app.options('*', function (req, res) {
|
|
||||||
const origin = req.headers.origin;
|
|
||||||
if (corsOptions.origin === '*' ||
|
|
||||||
(typeof corsOptions.origin === 'function' &&
|
|
||||||
corsOptions.origin.toString().includes(origin))) {
|
|
||||||
|
|
||||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
|
||||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
|
||||||
res.setHeader('Access-Control-Allow-Headers',
|
|
||||||
'Origin, X-Requested-With, Content-Type, Accept, Authorization, x-auth, x-refrtok');
|
|
||||||
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
||||||
res.setHeader('Access-Control-Expose-Headers', 'x-auth, x-refrtok');
|
|
||||||
res.setHeader('Access-Control-Max-Age', '86400');
|
|
||||||
|
|
||||||
res.status(204).end();
|
|
||||||
} else {
|
|
||||||
res.status(403).end();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
// Middleware per assicurarsi che gli headers CORS siano sempre presenti
|
// Middleware personalizzato per assicurare gli headers CORS
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
let origin = req.headers.origin;
|
const origin = req.headers.origin || '*';
|
||||||
if (!origin) {
|
if (allowedOrigins.includes(origin) || corsOptions.origin === '*') {
|
||||||
origin = '*';
|
// console.log(' ... ORIGIN', origin);
|
||||||
}
|
|
||||||
if (corsOptions.origin === '*' ||
|
|
||||||
(typeof corsOptions.origin === 'function' &&
|
|
||||||
corsOptions.origin.toString().includes(origin))) {
|
|
||||||
|
|
||||||
//console.log('Access-Control-Allow-Origin')
|
|
||||||
res.setHeader('Access-Control-Allow-Origin', origin);
|
res.setHeader('Access-Control-Allow-Origin', origin);
|
||||||
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
||||||
res.setHeader('Access-Control-Expose-Headers', 'x-auth, x-refrtok');
|
res.setHeader('Access-Control-Expose-Headers', 'x-auth, x-refrtok');
|
||||||
@@ -938,20 +934,19 @@ connectToDatabase(connectionUrl, options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isProduction) {
|
if (isProduction) {
|
||||||
for (let i = 0; i < domains.length; i++) {
|
for (let i = 0; i < domains.length; i++) {
|
||||||
const credentials = getCredentials(domains[i].hostname);
|
const mycredentials = getCredentials(domains[i].hostname);
|
||||||
// console.log('credentials: ', credentials);
|
// console.log('credentials: ', credentials);
|
||||||
httpsServer = https.createServer(credentials, app);
|
httpsServer = https.createServer(mycredentials, app);
|
||||||
console.log('⭐️⭐️⭐️⭐️⭐️ HTTPS server: ' + domains[i].hostname + ' Port:', domains[i].port + (domains[i].website ? 'WebSite = ' + domains[i].website : ''));
|
console.log('⭐️⭐️⭐️⭐️⭐️ HTTPS server: ' + domains[i].hostname + ' Port:', domains[i].port + (domains[i].website ? 'WebSite = ' + domains[i].website : ''));
|
||||||
httpsServer.listen(domains[i].port);
|
httpsServer.listen(domains[i].port);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (process.env.HTTPS_LOCALHOST === "true") {
|
if (process.env.HTTPS_LOCALHOST === "true") {
|
||||||
let credentials = null;
|
let mycredentials = null;
|
||||||
try {
|
try {
|
||||||
credentials = {
|
mycredentials = {
|
||||||
key: fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8'),
|
key: fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8'),
|
||||||
cert: fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8'),
|
cert: fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8'),
|
||||||
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384',
|
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384',
|
||||||
@@ -963,8 +958,8 @@ connectToDatabase(connectionUrl, options)
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (credentials) {
|
if (mycredentials) {
|
||||||
httpsServer = https.createServer(credentials, app);
|
httpsServer = https.createServer(mycredentials, app);
|
||||||
console.log('⭐️⭐️⭐️ HTTPS server IN LOCALE : port', port);
|
console.log('⭐️⭐️⭐️ HTTPS server IN LOCALE : port', port);
|
||||||
httpsServer.listen(port);
|
httpsServer.listen(port);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -33,39 +33,36 @@ const { MsgTemplate } = require('../models/msg_template');
|
|||||||
|
|
||||||
const globalTables = require('../tools/globalTables');
|
const globalTables = require('../tools/globalTables');
|
||||||
|
|
||||||
const emoji = require('node-emoji');
|
|
||||||
|
|
||||||
const i18n = require('i18n');
|
const i18n = require('i18n');
|
||||||
|
|
||||||
let url = process.env.URL || 'https://<PUBLIC-URL>';
|
let url = process.env.URL || 'https://<PUBLIC-URL>';
|
||||||
|
|
||||||
const Benvenuto = emoji.get('heartbeat') + emoji.get('heartbeat') +
|
const Benvenuto = '💓💓💓 Benvenuto/a!';
|
||||||
emoji.get('heartbeat') + ' Benvenuto!';
|
|
||||||
|
|
||||||
const emo = {
|
const emo = {
|
||||||
JOY: emoji.get('joy'),
|
JOY: '😂',
|
||||||
JOY2: emoji.get('rolling_on_the_floor_laughing'),
|
JOY2: '🤣',
|
||||||
DANCER: emoji.get('dancer'),
|
DANCER: '💃',
|
||||||
STARS: emoji.get('stars'),
|
STARS: '✨',
|
||||||
FIRE: emoji.get('fire'),
|
FIRE: '🔥',
|
||||||
SUN: emoji.get('sunrise'),
|
SUN: '☀️',
|
||||||
TV: emoji.get('tv'),
|
TV: '📺',
|
||||||
NEWSPAPER: emoji.get('newspaper'),
|
NEWSPAPER: '🗞',
|
||||||
KISS: emoji.get('kiss'),
|
KISS: '😘',
|
||||||
PENCIL: emoji.get('pencil2'),
|
PENCIL: '✏️',
|
||||||
DREAM: emoji.get('beach_with_umbrella'),
|
DREAM: '🏖',
|
||||||
EYES: emoji.get('eyes'),
|
EYES: '😜',
|
||||||
DIZZY: emoji.get('dizzy'),
|
DIZZY: '💫',
|
||||||
ONE_HUNDRED: emoji.get('100'),
|
ONE_HUNDRED: '💯',
|
||||||
SMILE_STAR: emoji.get('star-struck'),
|
SMILE_STAR: '🤩', // Star-struck
|
||||||
LEFT_FACING_FIST: emoji.get('left-facing_fist'),
|
LEFT_FACING_FIST: '🤛', // Left-facing fist
|
||||||
CHECK_VERDE: emoji.get('white_check_mark'),
|
CHECK_VERDE: '✅', // White check mark (verde)
|
||||||
CHECK_GRIGIA: emoji.get('ballot_box_with_check'),
|
CHECK_GRIGIA: '☑️', // Ballot box with check (grigia)
|
||||||
CROSS_ROSSA: emoji.get('x'),
|
CROSS_ROSSA: '❌', // X (rossa)
|
||||||
ENVELOPE: emoji.get('envelope'),
|
ENVELOPE: '✉️', // Envelope
|
||||||
EXCLAMATION_MARK: emoji.get('exclamation'),
|
EXCLAMATION_MARK: '❗', // Exclamation mark
|
||||||
QUESTION_MARK: emoji.get('question'),
|
QUESTION_MARK: '❓', // Question mark
|
||||||
ARROW_RIGHT: emoji.get('arrow_right'),
|
ARROW_RIGHT: '➡️', // Arrow pointing to the right
|
||||||
INVITATI: '',
|
INVITATI: '',
|
||||||
HEART: '❤️',
|
HEART: '❤️',
|
||||||
BLUE_HEART: '💙',
|
BLUE_HEART: '💙',
|
||||||
@@ -229,134 +226,128 @@ const MsgRisp = {
|
|||||||
|
|
||||||
function getemojibynumber(number) {
|
function getemojibynumber(number) {
|
||||||
if (number === 0) {
|
if (number === 0) {
|
||||||
return emoji.get('zero');
|
return '0️⃣'; // zero
|
||||||
} else if (number === 1) {
|
} else if (number === 1) {
|
||||||
return emoji.get('one');
|
return '1️⃣'; // one
|
||||||
} else if (number === 2) {
|
} else if (number === 2) {
|
||||||
return emoji.get('two');
|
return '2️⃣'; // two
|
||||||
} else if (number === 3) {
|
} else if (number === 3) {
|
||||||
return emoji.get('three');
|
return '3️⃣'; // three
|
||||||
} else if (number === 4) {
|
} else if (number === 4) {
|
||||||
return emoji.get('four');
|
return '4️⃣'; // four
|
||||||
} else if (number === 5) {
|
} else if (number === 5) {
|
||||||
return emoji.get('five');
|
return '5️⃣'; // five
|
||||||
} else if (number === 6) {
|
} else if (number === 6) {
|
||||||
return emoji.get('six');
|
return '6️⃣'; // six
|
||||||
} else if (number === 7) {
|
} else if (number === 7) {
|
||||||
return emoji.get('seven');
|
return '7️⃣'; // seven
|
||||||
} else if (number === 8) {
|
} else if (number === 8) {
|
||||||
return emoji.get('height');
|
return '8️⃣'; // eight
|
||||||
} else if (number === 9) {
|
} else if (number === 9) {
|
||||||
return emoji.get('nine');
|
return '9️⃣'; // nine
|
||||||
} else {
|
} else {
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Menu = {
|
const Menu = {
|
||||||
LANG_IT: emoji.get('flag-it') + ' Italiano',
|
LANG_IT: '🇮🇹 Italiano', // Bandiera italiana
|
||||||
LANG_EN: emoji.get('flag-gb') + ' English',
|
LANG_EN: '🇬🇧 English', // Bandiera del Regno Unito
|
||||||
LANG_ES: emoji.get('flag-es') + ' Español',
|
LANG_ES: '🇪🇸 Español', // Bandiera spagnola
|
||||||
LANG_FR: emoji.get('flag-fr') + ' Français',
|
LANG_FR: '🇫🇷 Français', // Bandiera francese
|
||||||
LANG_SI: emoji.get('flag-si') + ' Slovenski',
|
LANG_SI: '🇸🇮 Slovenski', // Bandiera slovena
|
||||||
LANG_PT: emoji.get('flag-pt') + ' Português',
|
LANG_PT: '🇵🇹 Português', // Bandiera portoghese
|
||||||
LANG: emoji.get('globe_with_meridians') + ' Language',
|
LANG: '🌐 Language', // Globo con meridiani
|
||||||
CHAT_PERSONALE: emoji.get('female-office-worker') + emoji.get('computer'),
|
CHAT_PERSONALE: '👩💼💻', // Donna impiegata + computer
|
||||||
EXIT_TELEGRAM: 'exittotelegram',
|
EXIT_TELEGRAM: 'exittotelegram',
|
||||||
MSG_TO_USER: 'sendmsgto',
|
MSG_TO_USER: 'sendmsgto',
|
||||||
ADMIN: emoji.get('information_desk_person') + ' Admin',
|
ADMIN: '💁♀️ Admin', // Persona al banco informazioni
|
||||||
AIUTO: '🔮 Help',
|
AIUTO: '🔮 Help', // Cristallo magico
|
||||||
ALTRO: emoji.get('newspaper') + ' Altro',
|
ALTRO: '📰 Altro', // Giornale
|
||||||
SETPICPROFILE: '🖼 SetPicProfile',
|
SETPICPROFILE: '🖼 SetPicProfile', // Cornice con foto
|
||||||
RESETPWD: '🔑 SetResetPwd',
|
RESETPWD: '🔑 SetResetPwd', // Chiave
|
||||||
// MSG_TO_NAVE: emoji.get('incoming_envelope') + 'Msg_to_Navi',
|
MSG_SI_INVITATI_NO_7REQ_INVITATI: '📩Inv e NO 7 Req', // Busta
|
||||||
// MSG_NO_7_REQ: emoji.get('incoming_envelope') + 'No 7 Req.',
|
MSGSTAFF: '📩 Invia a STAFF', // Busta
|
||||||
// MSG_NO_9_REQ: emoji.get('incoming_envelope') + 'No 9 Req',
|
|
||||||
// NESSUN_IMBARCO_7REQ: emoji.get('incoming_envelope') + 'No Imbarco (7 Req)',
|
|
||||||
MSG_SI_INVITATI_NO_7REQ_INVITATI: emoji.get('incoming_envelope') +
|
|
||||||
'Inv e NO 7 Req',
|
|
||||||
MSGSTAFF: emoji.get('incoming_envelope') + ' Invia a STAFF',
|
|
||||||
MSGAPPARTIENE_CIRCUITI_RIS: 'Invia a Utenti dei Circuiti RIS',
|
MSGAPPARTIENE_CIRCUITI_RIS: 'Invia a Utenti dei Circuiti RIS',
|
||||||
MSGPAOLO: emoji.get('incoming_envelope') + ' Invia a SURYA',
|
MSGPAOLO: '📩 Invia a SURYA', // Busta
|
||||||
RESTART_SRV: emoji.get('incoming_envelope') + 'Restart-NodeJs',
|
RESTART_SRV: '📩Restart-NodeJs', // Busta
|
||||||
REBOOT_SRV: emoji.get('incoming_envelope') + 'Reboot-VPS!',
|
REBOOT_SRV: '📩Reboot-VPS!', // Busta
|
||||||
EXECSH: emoji.get('incoming_envelope') + 'ExecSH',
|
EXECSH: '📩ExecSH', // Busta
|
||||||
LOG_SRV: '🖥Logserver.sh',
|
LOG_SRV: '🖥Logserver.sh', // Monitor
|
||||||
MSGATUTTI: emoji.get('incoming_envelope') + ' Invia a TUTTI',
|
MSGATUTTI: '📩 Invia a TUTTI', // Busta
|
||||||
it: {
|
it: {
|
||||||
ACCEDI: emo.PERSON + ' Accedi',
|
ACCEDI: '👤 Accedi', // Persona
|
||||||
LAVAGNA: emoji.get('om_symbol') + ' Lavagna',
|
LAVAGNA: '🕉 Lavagna', // Simbolo Om
|
||||||
LINK_CONDIVIDERE: emoji.get('link') + ' Link da condividere',
|
LINK_CONDIVIDERE: '🔗 Link da condividere', // Link
|
||||||
ZOOM: emoji.get('information_source') + ' Zoom (Conferenze)',
|
ZOOM: 'ℹ️ Zoom (Conferenze)', // Informazione
|
||||||
INFO: emoji.get('information_source') + ' Informazioni',
|
INFO: 'ℹ️ Informazioni', // Informazione
|
||||||
ASSISTENZA: emoji.get('open_hands') + ' Le Chat',
|
ASSISTENZA: '👐 Le Chat', // Mani aperte
|
||||||
INDIETRO: emoji.get('back') + ' Indietro',
|
INDIETRO: '🔙 Indietro', // Freccia indietro
|
||||||
SI: emoji.get('thumbsup') + ' SI',
|
SI: '👍 SI', // Pollice su
|
||||||
NO: emoji.get('thumbsdown') + ' NO',
|
NO: '👎 NO', // Pollice giù
|
||||||
ESCI_DA_CHAT: emoji.get('incoming_envelope') + ' Esci dalla Conversazione',
|
ESCI_DA_CHAT: '📩 Esci dalla Conversazione', // Busta
|
||||||
NUOVOSITO: '',
|
NUOVOSITO: '',
|
||||||
},
|
},
|
||||||
es: {
|
es: {
|
||||||
ACCEDI: emo.PERSON + ' Entra',
|
ACCEDI: '👤 Entra',
|
||||||
LAVAGNA: emoji.get('om_symbol') + ' Tablero',
|
LAVAGNA: '🕉 Tablero',
|
||||||
LINK_CONDIVIDERE: emoji.get('link') + ' Enlaces para compartir',
|
LINK_CONDIVIDERE: '🔗 Enlaces para compartir',
|
||||||
ZOOM: emoji.get('information_source') + ' Zoom (Conferencias)',
|
ZOOM: 'ℹ️ Zoom (Conferencias)',
|
||||||
INFO: emoji.get('information_source') + ' Información',
|
INFO: 'ℹ️ Información',
|
||||||
ASSISTENZA: emoji.get('open_hands') + ' Chats',
|
ASSISTENZA: '👐 Chats',
|
||||||
INDIETRO: emoji.get('back') + ' Volver',
|
INDIETRO: '🔙 Volver',
|
||||||
SI: emoji.get('thumbsup') + ' SÍ',
|
SI: '👍 SÍ',
|
||||||
NO: emoji.get('thumbsdown') + ' NO',
|
NO: '👎 NO',
|
||||||
ESCI_DA_CHAT: emoji.get('incoming_envelope') + ' Salir de la conversación',
|
ESCI_DA_CHAT: '📩 Salir de la conversación',
|
||||||
},
|
},
|
||||||
fr: {
|
fr: {
|
||||||
ACCEDI: emo.PERSON + ' Entrez',
|
ACCEDI: '👤 Entrez',
|
||||||
LAVAGNA: emoji.get('om_symbol') + ' Tableau de bord',
|
LAVAGNA: '🕉 Tableau de bord',
|
||||||
LINK_CONDIVIDERE: emoji.get('link') + ' Liens à partager',
|
LINK_CONDIVIDERE: '🔗 Liens à partager',
|
||||||
ZOOM: emoji.get('information_source') + ' Zoom (Conférences)',
|
ZOOM: 'ℹ️ Zoom (Conférences)',
|
||||||
INFO: emoji.get('information_source') + ' Informations',
|
INFO: 'ℹ️ Informations',
|
||||||
ASSISTENZA: emoji.get('open_hands') + ' Les chats',
|
ASSISTENZA: '👐 Les chats',
|
||||||
INDIETRO: emoji.get('back') + ' Retour',
|
INDIETRO: '🔙 Retour',
|
||||||
SI: emoji.get('thumbsup') + ' OUI',
|
SI: '👍 OUI',
|
||||||
NO: emoji.get('thumbsdown') + ' NON',
|
NO: '👎 NON',
|
||||||
ESCI_DA_CHAT: emoji.get('incoming_envelope') + ' Quitter la conversation',
|
ESCI_DA_CHAT: '📩 Quitter la conversation',
|
||||||
},
|
},
|
||||||
si: {
|
si: {
|
||||||
ACCEDI: emo.PERSON + ' Prijava',
|
ACCEDI: '👤 Prijava',
|
||||||
LAVAGNA: emoji.get('om_symbol') + ' Tabla',
|
LAVAGNA: '🕉 Tabla',
|
||||||
LINK_CONDIVIDERE: emoji.get('link') + ' Link za vpis oseb',
|
LINK_CONDIVIDERE: '🔗 Link za vpis oseb',
|
||||||
ZOOM: emoji.get('information_source') + ' Zoom (Konference)',
|
ZOOM: 'ℹ️ Zoom (Konference)',
|
||||||
INFO: emoji.get('information_source') + ' Informacije',
|
INFO: 'ℹ️ Informacije',
|
||||||
ASSISTENZA: emoji.get('open_hands') + ' jev klepet',
|
ASSISTENZA: '👐 jev klepet',
|
||||||
INDIETRO: emoji.get('back') + ' Nazaj',
|
INDIETRO: '🔙 Nazaj',
|
||||||
SI: emoji.get('thumbsup') + ' DA',
|
SI: '👍 DA',
|
||||||
NO: emoji.get('thumbsdown') + ' NE',
|
NO: '👎 NE',
|
||||||
ESCI_DA_CHAT: emoji.get('incoming_envelope') + ' Zaprite pogovor',
|
ESCI_DA_CHAT: '📩 Zaprite pogovor',
|
||||||
},
|
},
|
||||||
pt: {
|
pt: {
|
||||||
ACCEDI: emo.PERSON + ' Entre',
|
ACCEDI: '👤 Entre',
|
||||||
LAVAGNA: emoji.get('om_symbol') + ' Tablero',
|
LAVAGNA: '🕉 Tablero',
|
||||||
LINK_CONDIVIDERE: emoji.get('link') + ' Links para compartilhar',
|
LINK_CONDIVIDERE: '🔗 Links para compartilhar',
|
||||||
ZOOM: emoji.get('information_source') + ' Zoom (Conferências)',
|
ZOOM: 'ℹ️ Zoom (Conferências)',
|
||||||
INFO: emoji.get('information_source') + ' Informações',
|
INFO: 'ℹ️ Informações',
|
||||||
ASSISTENZA: emoji.get('open_hands') + ' Chats',
|
ASSISTENZA: '👐 Chats',
|
||||||
INDIETRO: emoji.get('back') + ' Voltar',
|
INDIETRO: '🔙 Voltar',
|
||||||
SI: emoji.get('thumbsup') + ' SIM',
|
SI: '👍 SIM',
|
||||||
NO: emoji.get('thumbsdown') + ' NÃO',
|
NO: '👎 NÃO',
|
||||||
ESCI_DA_CHAT: emoji.get('incoming_envelope') + ' Sair da Conversa',
|
ESCI_DA_CHAT: '📩 Sair da Conversa',
|
||||||
},
|
},
|
||||||
enUs: {
|
enUs: {
|
||||||
ACCEDI: emo.PERSON + ' Enter',
|
ACCEDI: '👤 Enter',
|
||||||
LAVAGNA: emoji.get('om_symbol') + ' DashBoard',
|
LAVAGNA: '🕉 DashBoard',
|
||||||
LINK_CONDIVIDERE: emoji.get('link') + ' Link to Share',
|
LINK_CONDIVIDERE: '🔗 Link to Share',
|
||||||
ZOOM: emoji.get('information_source') + ' Zoom (Conference)',
|
ZOOM: 'ℹ️ Zoom (Conference)',
|
||||||
INFO: emoji.get('information_source') + ' Info',
|
INFO: 'ℹ️ Info',
|
||||||
ASSISTENZA: emoji.get('open_hands') + ' Chats',
|
ASSISTENZA: '👐 Chats',
|
||||||
INDIETRO: emoji.get('back') + ' Back',
|
INDIETRO: '🔙 Back',
|
||||||
SI: emoji.get('thumbsup') + ' YES',
|
SI: '👍 YES',
|
||||||
NO: emoji.get('thumbsdown') + ' NO',
|
NO: '👎 NO',
|
||||||
ESCI_DA_CHAT: emoji.get('incoming_envelope') + ' Exit to the Conversation',
|
ESCI_DA_CHAT: '📩 Exit to the Conversation',
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const CONTA_SOLO = 'contasolo';
|
const CONTA_SOLO = 'contasolo';
|
||||||
@@ -483,8 +474,8 @@ const StatusMSGALL = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const txt = {
|
const txt = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' +
|
MSG_SCEGLI_MENU: '💫' + ' Scegli una voce di menu:' +
|
||||||
emoji.get('dizzy'),
|
'💫',
|
||||||
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_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 <b>l\'USERNAME TELEGRAM</b> di chi ti ha INVITATO',
|
MSG_ASK_USERNAME_INVITANTE: 'Scrivi nel messaggio <b>l\'USERNAME TELEGRAM</b> di chi ti ha INVITATO',
|
||||||
MSG_NEW_REG: '<br><br>⁉️🙈 Per aiuto scrivi sulla <a href="https://t.me/riso_gruppo">Chat RISO</a><br>oppure direttamente a Surya (@surya1977) ☀️.',
|
MSG_NEW_REG: '<br><br>⁉️🙈 Per aiuto scrivi sulla <a href="https://t.me/riso_gruppo">Chat RISO</a><br>oppure direttamente a Surya (@surya1977) ☀️.',
|
||||||
@@ -516,9 +507,9 @@ const txt = {
|
|||||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK + '🚫 %s Non è stato Ammesso !',
|
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK + '🚫 %s Non è stato Ammesso !',
|
||||||
MSG_ISCRITTO_CONACREIS: emo.FIRE + '[%s] Si è appena Iscritto al Conacreis "%s"',
|
MSG_ISCRITTO_CONACREIS: emo.FIRE + '[%s] Si è appena Iscritto al Conacreis "%s"',
|
||||||
MSG_ISCRITTO_ARCADEI: emo.FIRE + '[%s] Si è appena Iscritto ad Arcadei "%s"',
|
MSG_ISCRITTO_ARCADEI: emo.FIRE + '[%s] Si è appena Iscritto ad Arcadei "%s"',
|
||||||
MSG_MSG_SENT: emoji.get('envelope') + ' Messaggi Inviati !',
|
MSG_MSG_SENT: '📨' + ' Messaggi Inviati !',
|
||||||
MSG_MSG_TOSENT: emoji.get('envelope') + ' Messaggi da Inviare',
|
MSG_MSG_TOSENT: '📨' + ' Messaggi da Inviare',
|
||||||
MSG_MSG_INCORSO: emoji.get('envelope') + ' messaggi in corso... Inviati attualmente',
|
MSG_MSG_INCORSO: '📨' + ' messaggi in corso... Inviati attualmente',
|
||||||
MSG_SET_USERNAME_TELEGRAM: '[Prima di continuare con la registrazione in RISO.APP]\n' +
|
MSG_SET_USERNAME_TELEGRAM: '[Prima di continuare con la registrazione in RISO.APP]\n' +
|
||||||
'Segui questi passi per <b>IMPOSTARE UN USERNAME IN TELEGRAM</b>: \n\n' +
|
'Segui questi passi per <b>IMPOSTARE UN USERNAME IN TELEGRAM</b>: \n\n' +
|
||||||
'1. premi sull\'icona con <b>3 linee orizzontali</b>, in alto a sinistra (sull\'iPhone si chiama "Impostazioni").\n' +
|
'1. premi sull\'icona con <b>3 linee orizzontali</b>, in alto a sinistra (sull\'iPhone si chiama "Impostazioni").\n' +
|
||||||
@@ -535,8 +526,8 @@ const txt = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const txt_es = {
|
const txt_es = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Elija un elemento del menú:' +
|
MSG_SCEGLI_MENU: '💫' + ' Elija un elemento del menú:' +
|
||||||
emoji.get('dizzy'),
|
'💫',
|
||||||
MSG_ASK_USERNAME_BO: 'Escriba en el mensaje el nombre de usuario o el correo electrónico con el que se registró en el sitio de %s:',
|
MSG_ASK_USERNAME_BO: 'Escriba en el mensaje el nombre de usuario o el correo electrónico con el que se registró en el sitio de %s:',
|
||||||
MSG_ERRORE_USERNAME: '¡Atención! Debes introducir sólo el nombre de usuario (40 caracteres como máximo)',
|
MSG_ERRORE_USERNAME: '¡Atención! Debes introducir sólo el nombre de usuario (40 caracteres como máximo)',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Para completar la verificación del telegrama BOT, ahora debe escribir en el mensaje el nombre de usuario o el correo electrónico con el que se registró en el sitio.:',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'Para completar la verificación del telegrama BOT, ahora debe escribir en el mensaje el nombre de usuario o el correo electrónico con el que se registró en el sitio.:',
|
||||||
@@ -561,15 +552,15 @@ const txt_es = {
|
|||||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||||
'🚫 %s Non è stato Ammesso !',
|
'🚫 %s Non è stato Ammesso !',
|
||||||
MSG_MSG_SENT: emoji.get('envelope') + ' Mensajes enviados !',
|
MSG_MSG_SENT: '📨' + ' Mensajes enviados !',
|
||||||
MSG_MSG_TOSENT: emoji.get('envelope') + ' Mensajes a enviar',
|
MSG_MSG_TOSENT: '📨' + ' Mensajes a enviar',
|
||||||
MSG_MSG_INCORSO: emoji.get('envelope') +
|
MSG_MSG_INCORSO: '📨' +
|
||||||
' mensajes en progreso... Enviado actualmente',
|
' mensajes en progreso... Enviado actualmente',
|
||||||
};
|
};
|
||||||
|
|
||||||
const txt_fr = {
|
const txt_fr = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + 'Choisissez un élément de menu:' +
|
MSG_SCEGLI_MENU: '💫' + 'Choisissez un élément de menu:' +
|
||||||
emoji.get('dizzy'),
|
'💫',
|
||||||
MSG_ASK_USERNAME_BO: 'Écrivez dans le message l\'username ou l\'e-mail avec lequel vous vous êtes enregistré sur le site de %s: ',
|
MSG_ASK_USERNAME_BO: 'Écrivez dans le message l\'username ou l\'e-mail avec lequel vous vous êtes enregistré sur le site de %s: ',
|
||||||
MSG_ERRORE_USERNAME: 'Attention! Vous devez insérer seulement l’username (40 caractères maximum)',
|
MSG_ERRORE_USERNAME: 'Attention! Vous devez insérer seulement l’username (40 caractères maximum)',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Pour Compléter la Vérification Telegram BOT, vous devez maintenant écrire dans le message ci-dessous l\'Username ou l\'adresse e-mail avec lequel vous vous êtes inscrit sur le site: ',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'Pour Compléter la Vérification Telegram BOT, vous devez maintenant écrire dans le message ci-dessous l\'Username ou l\'adresse e-mail avec lequel vous vous êtes inscrit sur le site: ',
|
||||||
@@ -594,14 +585,14 @@ const txt_fr = {
|
|||||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||||
'🚫 %s Non è stato Ammesso !',
|
'🚫 %s Non è stato Ammesso !',
|
||||||
MSG_MSG_SENT: emoji.get('envelope') + ' Messages envoyés !',
|
MSG_MSG_SENT: '📨' + ' Messages envoyés !',
|
||||||
MSG_MSG_TOSENT: emoji.get('envelope') + ' Messages à envoyer',
|
MSG_MSG_TOSENT: '📨' + ' Messages à envoyer',
|
||||||
MSG_MSG_INCORSO: emoji.get('envelope') +
|
MSG_MSG_INCORSO: '📨' +
|
||||||
' messages en cours... Actuellement envoyé',
|
' messages en cours... Actuellement envoyé',
|
||||||
};
|
};
|
||||||
|
|
||||||
const txt_si = {
|
const txt_si = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + 'Izbirni meni:' + emoji.get('dizzy'),
|
MSG_SCEGLI_MENU: '💫' + 'Izbirni meni:' + '💫',
|
||||||
MSG_ASK_USERNAME_BO: 'Vpiši svoje uporabniško ime in e-naslov s katerimi si se registriral na spletni strani %s: ',
|
MSG_ASK_USERNAME_BO: 'Vpiši svoje uporabniško ime in e-naslov s katerimi si se registriral na spletni strani %s: ',
|
||||||
MSG_ERRORE_USERNAME: 'Pozor! Vpiši samo uporabniško ime (40 znakov) maksimalno',
|
MSG_ERRORE_USERNAME: 'Pozor! Vpiši samo uporabniško ime (40 znakov) maksimalno',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Ponovno preverite telegram BOT Uporabniško ime ali e-poštno sporočilo, s katerim ste registrirali na spletni strani: ',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'Ponovno preverite telegram BOT Uporabniško ime ali e-poštno sporočilo, s katerim ste registrirali na spletni strani: ',
|
||||||
@@ -628,8 +619,8 @@ const txt_si = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const txt_en = {
|
const txt_en = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Choose a menu item:' +
|
MSG_SCEGLI_MENU: '💫' + ' Choose a menu item:' +
|
||||||
emoji.get('dizzy'),
|
'💫',
|
||||||
MSG_ASK_USERNAME_BO: 'Write in the message the username or email with which you registered on the site of %s:',
|
MSG_ASK_USERNAME_BO: 'Write in the message the username or email with which you registered on the site of %s:',
|
||||||
MSG_ERRORE_USERNAME: 'Attention! You must enter only the username (40 characters maximum)',
|
MSG_ERRORE_USERNAME: 'Attention! You must enter only the username (40 characters maximum)',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'To complete the Telegram BOT Verification, you must now write below in the message the Username OR the email with which you registered on the website:',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'To complete the Telegram BOT Verification, you must now write below in the message the Username OR the email with which you registered on the website:',
|
||||||
@@ -655,15 +646,15 @@ const txt_en = {
|
|||||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||||
'🚫 %s Non è stato Ammesso !',
|
'🚫 %s Non è stato Ammesso !',
|
||||||
MSG_MSG_SENT: emoji.get('envelope') + ' Sent Messages !',
|
MSG_MSG_SENT: '📨' + ' Sent Messages !',
|
||||||
MSG_MSG_TOSENT: emoji.get('envelope') + ' Messages to Send',
|
MSG_MSG_TOSENT: '📨' + ' Messages to Send',
|
||||||
MSG_MSG_INCORSO: emoji.get('envelope') +
|
MSG_MSG_INCORSO: '📨' +
|
||||||
' messages in progress... Currently sent',
|
' messages in progress... Currently sent',
|
||||||
};
|
};
|
||||||
|
|
||||||
const txt_pt = {
|
const txt_pt = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Escolha um item do menu:' +
|
MSG_SCEGLI_MENU: '💫' + ' Escolha um item do menu:' +
|
||||||
emoji.get('dizzy'),
|
'💫',
|
||||||
MSG_ASK_USERNAME_BO: 'Escreva na mensagem o nome de usuário ou e-mail com o qual se registrou no site de %s:',
|
MSG_ASK_USERNAME_BO: 'Escreva na mensagem o nome de usuário ou e-mail com o qual se registrou no site de %s:',
|
||||||
MSG_ERRORE_USERNAME: 'Atenção! Você deve inserir apenas o nome de usuário (40 caracteres no máximo)',
|
MSG_ERRORE_USERNAME: 'Atenção! Você deve inserir apenas o nome de usuário (40 caracteres no máximo)',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Para completar a Verificação do Telegrama BOT, você deve agora escrever abaixo na mensagem o Nome de Usuário OU o e-mail com o qual você se registrou no site:',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'Para completar a Verificação do Telegrama BOT, você deve agora escrever abaixo na mensagem o Nome de Usuário OU o e-mail com o qual você se registrou no site:',
|
||||||
@@ -688,9 +679,9 @@ const txt_pt = {
|
|||||||
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
'🚫 Ci dispiace ma non sei stato Verificato correttamente dal tuo invitante %s.<br>Contattalo per farti abilitare !',
|
||||||
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
MSG_APORTADOR_NOT_CONFIRMED: emo.EXCLAMATION_MARK +
|
||||||
'🚫 %s Non è stato Ammesso !',
|
'🚫 %s Non è stato Ammesso !',
|
||||||
MSG_MSG_SENT: emoji.get('envelope') + ' Mensagens Enviadas !',
|
MSG_MSG_SENT: '📨' + ' Mensagens Enviadas !',
|
||||||
MSG_MSG_TOSENT: emoji.get('envelope') + ' Mensagens a enviar',
|
MSG_MSG_TOSENT: '📨' + ' Mensagens a enviar',
|
||||||
MSG_MSG_INCORSO: emoji.get('envelope') +
|
MSG_MSG_INCORSO: '📨' +
|
||||||
' mensagens em progresso... Actualmente enviado',
|
' mensagens em progresso... Actualmente enviado',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1764,7 +1755,7 @@ class Telegram {
|
|||||||
|
|
||||||
risp += '!';
|
risp += '!';
|
||||||
} else if (MsgBot.COME_STAI.includes(testo.replace('?', ''))) {
|
} else if (MsgBot.COME_STAI.includes(testo.replace('?', ''))) {
|
||||||
risp = 'Io Benone Grazie! ' + emoji.get('heartbeat') + ' E tu?';
|
risp = 'Io Benone Grazie! ' + '💓' + ' E tu?';
|
||||||
rec.statusmsg = Status.WAITFOR_RISPOSTA;
|
rec.statusmsg = Status.WAITFOR_RISPOSTA;
|
||||||
rec.msgcodeprec = MsgBot.COME_STAI;
|
rec.msgcodeprec = MsgBot.COME_STAI;
|
||||||
} else if (MsgBot.CHI_SONO_IO.includes(testo.replace('?', ''))) {
|
} else if (MsgBot.CHI_SONO_IO.includes(testo.replace('?', ''))) {
|
||||||
@@ -2284,7 +2275,7 @@ class Telegram {
|
|||||||
|
|
||||||
let index = 1;
|
let index = 1;
|
||||||
downline.downline.forEach((user) => {
|
downline.downline.forEach((user) => {
|
||||||
mystr += emoji.get('star-struck') + ` ${index}°: `;
|
mystr += '🌠' + ` ${index}°: `;
|
||||||
mystr += (user.qualified) ? emo.CHECK_VERDE : emo.CROSS_ROSSA;
|
mystr += (user.qualified) ? emo.CHECK_VERDE : emo.CROSS_ROSSA;
|
||||||
mystr += `${user.name} ${user.surname} (${user.username})\n`;
|
mystr += `${user.name} ${user.surname} (${user.username})\n`;
|
||||||
index++;
|
index++;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.2.2
|
1.2.13
|
||||||
39
yarn.lock
39
yarn.lock
@@ -1899,7 +1899,7 @@ bser@2.1.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
node-int64 "^0.4.0"
|
node-int64 "^0.4.0"
|
||||||
|
|
||||||
bson@^6.10.1, bson@^6.10.3:
|
bson@^6.10.3:
|
||||||
version "6.10.3"
|
version "6.10.3"
|
||||||
resolved "https://registry.yarnpkg.com/bson/-/bson-6.10.3.tgz#5f9a463af6b83e264bedd08b236d1356a30eda47"
|
resolved "https://registry.yarnpkg.com/bson/-/bson-6.10.3.tgz#5f9a463af6b83e264bedd08b236d1356a30eda47"
|
||||||
integrity sha512-MTxGsqgYTwfshYWTRdmZRC+M7FnG1b4y7RO7p2k3X24Wq0yv1m77Wsj0BzlPzd/IowgESfsruQCUToa7vbOpPQ==
|
integrity sha512-MTxGsqgYTwfshYWTRdmZRC+M7FnG1b4y7RO7p2k3X24Wq0yv1m77Wsj0BzlPzd/IowgESfsruQCUToa7vbOpPQ==
|
||||||
@@ -4001,10 +4001,10 @@ gulp-replace@^1.1.4:
|
|||||||
replacestream "^4.0.3"
|
replacestream "^4.0.3"
|
||||||
yargs-parser ">=5.0.0-security.0"
|
yargs-parser ">=5.0.0-security.0"
|
||||||
|
|
||||||
gulp-sass@^6.0.0:
|
gulp-sass@^6.0.1:
|
||||||
version "6.0.0"
|
version "6.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/gulp-sass/-/gulp-sass-6.0.0.tgz#91e651d86baf53bf7de8a537b1a38ea839968a4b"
|
resolved "https://registry.yarnpkg.com/gulp-sass/-/gulp-sass-6.0.1.tgz#28d292b5e9ca143d763e14fce87d6723b6d1b749"
|
||||||
integrity sha512-FGb4Uab4jnH2GnSfBGd6uW3+imvNodAGfsjGcUhEtpNYPVx+TK2tp5uh7MO0sSR7aIf1Sm544werc+zV7ejHHw==
|
integrity sha512-4wonidxB8lGPHvahelpGavUBJAuERSl+OIVxPCyQthK4lSJhZ/u3/qjFcyAtnMIXDl6fXTn34H4BXsN7gt54kQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash.clonedeep "^4.5.0"
|
lodash.clonedeep "^4.5.0"
|
||||||
picocolors "^1.0.0"
|
picocolors "^1.0.0"
|
||||||
@@ -6023,7 +6023,16 @@ mongodb-connection-string-url@^3.0.0:
|
|||||||
"@types/whatwg-url" "^11.0.2"
|
"@types/whatwg-url" "^11.0.2"
|
||||||
whatwg-url "^14.1.0 || ^13.0.0"
|
whatwg-url "^14.1.0 || ^13.0.0"
|
||||||
|
|
||||||
mongodb@^6.14.1, mongodb@~6.14.0:
|
mongodb@^6.14.2:
|
||||||
|
version "6.14.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-6.14.2.tgz#56533105e62ce795cd10a205a6374ecd8d58ad49"
|
||||||
|
integrity sha512-kMEHNo0F3P6QKDq17zcDuPeaywK/YaJVCEQRzPF3TOM/Bl9MFg64YE5Tu7ifj37qZJMhwU1tl2Ioivws5gRG5Q==
|
||||||
|
dependencies:
|
||||||
|
"@mongodb-js/saslprep" "^1.1.9"
|
||||||
|
bson "^6.10.3"
|
||||||
|
mongodb-connection-string-url "^3.0.0"
|
||||||
|
|
||||||
|
mongodb@~6.14.0:
|
||||||
version "6.14.1"
|
version "6.14.1"
|
||||||
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-6.14.1.tgz#ab1084c00eba5f736b9ac8a93055d7d3ad0725a8"
|
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-6.14.1.tgz#ab1084c00eba5f736b9ac8a93055d7d3ad0725a8"
|
||||||
integrity sha512-GnHWIm4GtgREkssWRv9vYKNvqwbLd8WL5hCW3nCqzI2OxEZ6Q5g6vc3J6L1Grz0x1hx1wmYAprLlRr3kzBLcJg==
|
integrity sha512-GnHWIm4GtgREkssWRv9vYKNvqwbLd8WL5hCW3nCqzI2OxEZ6Q5g6vc3J6L1Grz0x1hx1wmYAprLlRr3kzBLcJg==
|
||||||
@@ -6032,12 +6041,12 @@ mongodb@^6.14.1, mongodb@~6.14.0:
|
|||||||
bson "^6.10.3"
|
bson "^6.10.3"
|
||||||
mongodb-connection-string-url "^3.0.0"
|
mongodb-connection-string-url "^3.0.0"
|
||||||
|
|
||||||
mongoose@^8.12.0:
|
mongoose@^8.12.1:
|
||||||
version "8.12.0"
|
version "8.12.1"
|
||||||
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-8.12.0.tgz#1d0313982b1b737a1552e05541980b04a3979375"
|
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-8.12.1.tgz#20fdc9a6cff72b323e438c6b4492cd4d4e1dd989"
|
||||||
integrity sha512-FXZIngJBTt/gvb6uHZHiROy3Mk3EOjNpD0m+GBRfG+twuEntnMjfxwcA94YbYIulf9LkBozt7H8w2OJpqHdUxA==
|
integrity sha512-UW22y8QFVYmrb36hm8cGncfn4ARc/XsYWQwRTaj0gxtQk1rDuhzDO1eBantS+hTTatfAIS96LlRCJrcNHvW5+Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
bson "^6.10.1"
|
bson "^6.10.3"
|
||||||
kareem "2.6.3"
|
kareem "2.6.3"
|
||||||
mongodb "~6.14.0"
|
mongodb "~6.14.0"
|
||||||
mpath "0.9.0"
|
mpath "0.9.0"
|
||||||
@@ -6465,10 +6474,10 @@ open@^10.1.0:
|
|||||||
is-inside-container "^1.0.0"
|
is-inside-container "^1.0.0"
|
||||||
is-wsl "^3.1.0"
|
is-wsl "^3.1.0"
|
||||||
|
|
||||||
openai@^4.86.1:
|
openai@^4.86.2:
|
||||||
version "4.86.1"
|
version "4.87.3"
|
||||||
resolved "https://registry.yarnpkg.com/openai/-/openai-4.86.1.tgz#4147252d5e6255e2ae716ea59b1d4e54a1c1472a"
|
resolved "https://registry.yarnpkg.com/openai/-/openai-4.87.3.tgz#82679f09d91f0e8e9da94b9ee0369c44733577da"
|
||||||
integrity sha512-x3iCLyaC3yegFVZaxOmrYJjitKxZ9hpVbLi+ZlT5UHuHTMlEQEbKXkGOM78z9qm2T5GF+XRUZCP2/aV4UPFPJQ==
|
integrity sha512-d2D54fzMuBYTxMW8wcNmhT1rYKcTfMJ8t+4KjH2KtvYenygITiGBgHoIrzHwnDQWW+C5oCA+ikIR2jgPCFqcKQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "^18.11.18"
|
"@types/node" "^18.11.18"
|
||||||
"@types/node-fetch" "^2.6.4"
|
"@types/node-fetch" "^2.6.4"
|
||||||
|
|||||||
Reference in New Issue
Block a user