Lista Amici
Richieste di Fiducia Accettati Rifiutati
This commit is contained in:
@@ -35,12 +35,18 @@ const SiteSchema = new Schema({
|
|||||||
host: {
|
host: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
host_test: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
portapp: {
|
portapp: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
dir: {
|
dir: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
dir_test: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
email_from: {
|
email_from: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
@@ -53,9 +59,18 @@ const SiteSchema = new Schema({
|
|||||||
telegram_bot_name: {
|
telegram_bot_name: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
telegram_key_test: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
telegram_bot_name_test: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
pathreg_add: {
|
pathreg_add: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
ask_to_verify_reg: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
who: {
|
who: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ const UserSchema = new mongoose.Schema({
|
|||||||
},
|
},
|
||||||
verified_by_aportador: {
|
verified_by_aportador: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
|
||||||
},
|
},
|
||||||
aportador_iniziale: {
|
aportador_iniziale: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -158,6 +157,15 @@ const UserSchema = new mongoose.Schema({
|
|||||||
sospeso: {
|
sospeso: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
blocked: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
|
username_who_block: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
date_blocked: {
|
||||||
|
type: Date,
|
||||||
|
},
|
||||||
non_voglio_imbarcarmi: {
|
non_voglio_imbarcarmi: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
@@ -303,6 +311,7 @@ const UserSchema = new mongoose.Schema({
|
|||||||
description: {type: String},
|
description: {type: String},
|
||||||
rating: {type: Number},
|
rating: {type: Number},
|
||||||
}],
|
}],
|
||||||
|
friends: [], // username
|
||||||
},
|
},
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -1193,6 +1202,109 @@ UserSchema.statics.getUserProfileByUsername = async function(idapp, username) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getUsernameFriendsByUsername = async function(
|
||||||
|
idapp, username) {
|
||||||
|
|
||||||
|
return User.findOne({
|
||||||
|
idapp, 'username': username,
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
}, {'profile.friends': 1}).then((rec) => rec ? rec._doc.profile.friends : []);
|
||||||
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.setFriendsCmd = async function(idapp, usernameOrig, usernameDest, cmd, value) {
|
||||||
|
|
||||||
|
let ris = null;
|
||||||
|
let update = { };
|
||||||
|
if (cmd === shared_consts.FRIENDSCMD.SETTRUST) {
|
||||||
|
|
||||||
|
return User.updateOne({idapp, username: usernameDest},
|
||||||
|
{ $set: { verified_by_aportador: value } }, { new: false } );
|
||||||
|
|
||||||
|
} else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) {
|
||||||
|
// Aggiungo l'Amicizia a me
|
||||||
|
const foundIfAlreadyFriend = await User.findOne({
|
||||||
|
idapp,
|
||||||
|
members: {
|
||||||
|
$elemMatch: { 'profile.friends': usernameOrig }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
update = { $push: { 'profile.friends': [usernameOrig] } };
|
||||||
|
if (!foundIfAlreadyFriend) {
|
||||||
|
ris = await User.updateOne({idapp, username: usernameOrig}, update);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Controlla se lui aveva già la mia amicizia
|
||||||
|
const foundIfAlreadyFriend2 = await User.findOne({
|
||||||
|
members: {
|
||||||
|
$elemMatch: { 'profile.friends': usernameOrig }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
update = { $push: { 'profile.friends': [usernameOrig] } };
|
||||||
|
if (!foundIfAlreadyFriend) {
|
||||||
|
ris = await User.updateOne({idapp, username: usernameOrig}, update);
|
||||||
|
}
|
||||||
|
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS) {
|
||||||
|
// Rimuovo l'Amicizia da lui
|
||||||
|
await User.updateOne({idapp, username: usernameDest}, { $pullAll: { 'profile.friends': [usernameOrig] } });
|
||||||
|
// Rimuovo l'Amicizia da me
|
||||||
|
ris = await User.updateOne({idapp, username: usernameOrig}, { $pullAll: { 'profile.friends': [usernameDest] } });
|
||||||
|
} else if (cmd === shared_consts.FRIENDSCMD.BLOCK_USER) {
|
||||||
|
// Rimuovo l'Amicizia da lui
|
||||||
|
await User.updateOne({idapp, username: usernameDest}, { $pullAll: { 'profile.friends': [usernameOrig] } });
|
||||||
|
// Rimuovo l'Amicizia da me
|
||||||
|
await User.updateOne({idapp, username: usernameOrig}, { $pullAll: { 'profile.friends': [usernameDest] } });
|
||||||
|
|
||||||
|
// Blocco la persona
|
||||||
|
ris = await User.updateOne({idapp, username: usernameDest}, { $set: { blocked: true, sospeso: true, username_who_block: usernameOrig, date_blocked: new Date() } });
|
||||||
|
}
|
||||||
|
|
||||||
|
return ris;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
UserSchema.statics.getFriendsByUsername = async function(idapp, username) {
|
||||||
|
|
||||||
|
const whatToShow = {
|
||||||
|
username: 1,
|
||||||
|
aportador_solidario: 1,
|
||||||
|
name: 1,
|
||||||
|
surname: 1,
|
||||||
|
deleted: 1,
|
||||||
|
sospeso: 1,
|
||||||
|
verified_email: 1,
|
||||||
|
verified_by_aportador: 1,
|
||||||
|
'profile.nationality': 1,
|
||||||
|
'profile.biografia': 1,
|
||||||
|
'profile.username_telegram': 1,
|
||||||
|
'profile.img': 1,
|
||||||
|
'profile.sex': 1,
|
||||||
|
'profile.dateofbirth': 1,
|
||||||
|
'profile.born_city': 1,
|
||||||
|
'profile.born_province': 1,
|
||||||
|
'profile.born_country': 1,
|
||||||
|
email: 1,
|
||||||
|
date_reg: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
const arrUsernameFriends = await User.getUsernameFriendsByUsername(idapp, username);
|
||||||
|
|
||||||
|
const listFriends = await User.find({
|
||||||
|
idapp,
|
||||||
|
username: {$in: arrUsernameFriends},
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
}, whatToShow);
|
||||||
|
|
||||||
|
const listTrusted = await User.find({
|
||||||
|
idapp, aportador_solidario: username,
|
||||||
|
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||||
|
}, whatToShow);
|
||||||
|
|
||||||
|
return ({listFriends, listTrusted});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.getAportadorSolidarioByUsername = async function(
|
UserSchema.statics.getAportadorSolidarioByUsername = async function(
|
||||||
idapp, username) {
|
idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|||||||
@@ -17,4 +17,18 @@ router.get('/:idapp/:email', (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post('/ck', (req, res) => {
|
||||||
|
const idapp = req.body.idapp;
|
||||||
|
var email = req.body.email;
|
||||||
|
|
||||||
|
User.findByEmail(idapp, email).then((user) => {
|
||||||
|
if (!user) {
|
||||||
|
return res.status(404).send();
|
||||||
|
}
|
||||||
|
res.status(200).send();
|
||||||
|
}).catch((e) => {
|
||||||
|
res.status(400).send();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ router.post('/gettable', authenticate, (req, res) => {
|
|||||||
return res.send(ris);
|
return res.send(ris);
|
||||||
|
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e.message);
|
console.log('gettable: ' + e.message);
|
||||||
res.status(400).send(e);
|
res.status(400).send(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -601,6 +601,13 @@ router.patch('/chval', authenticate, async (req, res) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mydata.table === shared_consts.TAB_SITES) {
|
||||||
|
if (shared_consts.SITES_KEY_TO_CRYPTED in fieldsvalue) {
|
||||||
|
fieldsvalue[shared_consts.SITES_KEY_TO_CRYPTED] = tools.cryptdata(fieldsvalue[shared_consts.SITES_KEY_TO_CRYPTED]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
await mytable.findByIdAndUpdate(id, {$set: fieldsvalue}).then(async (rec) => {
|
await mytable.findByIdAndUpdate(id, {$set: fieldsvalue}).then(async (rec) => {
|
||||||
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
@@ -1559,8 +1566,9 @@ function uploadFile(req, res, version) {
|
|||||||
form.parse(req);
|
form.parse(req);
|
||||||
|
|
||||||
let dirmain = '/statics';
|
let dirmain = '/statics';
|
||||||
|
console.log('process.env.PROD', process.env.PROD);
|
||||||
if (version > 0) {
|
if (version > 0) {
|
||||||
if (process.env.PROD === 1) {
|
if (process.env.PROD === '1') {
|
||||||
dirmain = '';
|
dirmain = '';
|
||||||
} else {
|
} else {
|
||||||
dirmain = '/public';
|
dirmain = '/public';
|
||||||
|
|||||||
@@ -107,6 +107,12 @@ router.post('/', async (req, res) => {
|
|||||||
user.lasttimeonline = new Date();
|
user.lasttimeonline = new Date();
|
||||||
user.date_reg = new Date();
|
user.date_reg = new Date();
|
||||||
user.aportador_iniziale = user.aportador_solidario;
|
user.aportador_iniziale = user.aportador_solidario;
|
||||||
|
|
||||||
|
if (!tools.getAskToVerifyReg(body.idapp)) {
|
||||||
|
// Se non devo chiedere di verificare all'Invitato, allora lo verifico direttamente
|
||||||
|
user.verified_by_aportador = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* if (user.idapp === tools.AYNI) {
|
/* if (user.idapp === tools.AYNI) {
|
||||||
user.profile.paymenttypes = ['paypal'];
|
user.profile.paymenttypes = ['paypal'];
|
||||||
} */
|
} */
|
||||||
@@ -319,7 +325,7 @@ router.patch('/:id', authenticate, (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/profile', (req, res) => {
|
router.post('/profile', authenticate, (req, res) => {
|
||||||
const username = req.body['username'];
|
const username = req.body['username'];
|
||||||
idapp = req.body.idapp;
|
idapp = req.body.idapp;
|
||||||
locale = req.body.locale;
|
locale = req.body.locale;
|
||||||
@@ -470,6 +476,45 @@ router.post('/import_extralist', async (req, res) => {
|
|||||||
res.send(ris);
|
res.send(ris);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.post('/friends', authenticate, (req, res) => {
|
||||||
|
const username = req.user.username;
|
||||||
|
idapp = req.body.idapp;
|
||||||
|
locale = req.body.locale;
|
||||||
|
|
||||||
|
return User.getFriendsByUsername(idapp, username).then((ris) => {
|
||||||
|
res.send(ris);
|
||||||
|
}).catch((e) => {
|
||||||
|
tools.mylog('ERRORE IN Profile: ' + e.message);
|
||||||
|
res.status(400).send();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/friends/cmd', authenticate, (req, res) => {
|
||||||
|
const usernameLogged = req.user.username;
|
||||||
|
const idapp = req.body.idapp;
|
||||||
|
const locale = req.body.locale;
|
||||||
|
const usernameOrig = req.body.usernameOrig;
|
||||||
|
const usernameDest = req.body.usernameDest;
|
||||||
|
const cmd = req.body.cmd;
|
||||||
|
const value = req.body.value;
|
||||||
|
|
||||||
|
if (!User.isAdmin(req.user.perm) || !User.isManager(req.user.perm)) {
|
||||||
|
// If without permissions, exit
|
||||||
|
if (usernameOrig !== usernameLogged) {
|
||||||
|
return res.status(404).send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return User.setFriendsCmd(idapp, usernameOrig, usernameDest, cmd, value).then((ris) => {
|
||||||
|
res.send(ris);
|
||||||
|
}).catch((e) => {
|
||||||
|
tools.mylog('ERRORE IN Friends/cmd: ' + e.message);
|
||||||
|
res.status(400).send();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
async function eseguiDbOp(idapp, mydata, locale) {
|
async function eseguiDbOp(idapp, mydata, locale) {
|
||||||
|
|
||||||
let ris = await User.DbOp(idapp, mydata);
|
let ris = await User.DbOp(idapp, mydata);
|
||||||
|
|||||||
@@ -553,7 +553,8 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
mylocalsconf.dataemail.disclaimer_out = !!mylocalsconf.dataemail.disclaimer ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer) : '';
|
mylocalsconf.dataemail.disclaimer_out = !!mylocalsconf.dataemail.disclaimer ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer) : '';
|
||||||
mylocalsconf.dataemail.disc_bottom_out = !!mylocalsconf.dataemail.disc_bottom ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom) : '';
|
mylocalsconf.dataemail.disc_bottom_out = !!mylocalsconf.dataemail.disc_bottom ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom) : '';
|
||||||
mylocalsconf.dataemail.templ.testoheadermail_out = !!mylocalsconf.dataemail.templ.testoheadermail ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail) : '';
|
if (mylocalsconf.dataemail.templ)
|
||||||
|
mylocalsconf.dataemail.templ.testoheadermail_out = !!mylocalsconf.dataemail.templ.testoheadermail ? this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail) : '';
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error replacefields: ' + e)
|
console.error('Error replacefields: ' + e)
|
||||||
}
|
}
|
||||||
@@ -872,29 +873,34 @@ module.exports = {
|
|||||||
|
|
||||||
const myarrevents = await MyEvent.getLastEvents(idapp);
|
const myarrevents = await MyEvent.getLastEvents(idapp);
|
||||||
const myemail = await Settings.getValDbSettings(idapp, 'EMAIL_TEST');
|
const myemail = await Settings.getValDbSettings(idapp, 'EMAIL_TEST');
|
||||||
mylocalsconf = {
|
if (myemail) {
|
||||||
idapp,
|
mylocalsconf = {
|
||||||
locale: lang,
|
idapp,
|
||||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
locale: lang,
|
||||||
arrevents: myarrevents,
|
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||||
name: 'TestNome',
|
arrevents: myarrevents,
|
||||||
surname: 'TestCognome',
|
name: 'TestNome',
|
||||||
emailto: myemail,
|
surname: 'TestCognome',
|
||||||
baseurl: tools.getHostByIdApp(idapp),
|
subject: '',
|
||||||
hashemail: tools.getHash(myemail),
|
emailto: myemail,
|
||||||
};
|
baseurl: tools.getHostByIdApp(idapp),
|
||||||
|
hashemail: tools.getHash(myemail),
|
||||||
|
};
|
||||||
|
|
||||||
console.log('myarrevents');
|
console.log('myarrevents');
|
||||||
console.table(mylocalsconf.arrevents);
|
console.table(mylocalsconf.arrevents);
|
||||||
|
|
||||||
mylocalsconf.dataemail = await this.getdataemail(idapp);
|
mylocalsconf.dataemail = await this.getdataemail(idapp);
|
||||||
|
|
||||||
this.replacefields(mylocalsconf);
|
this.replacefields(mylocalsconf);
|
||||||
|
|
||||||
const smtpTransport = this.getTransport(mylocalsconf);
|
const smtpTransport = this.getTransport(mylocalsconf);
|
||||||
|
|
||||||
console.log('-> Invio Email TEST a', mylocalsconf.emailto, 'previewonly', previewonly);
|
console.log('-> Invio Email TEST a', mylocalsconf.emailto, 'previewonly',
|
||||||
return this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf, '', smtpTransport, previewonly);
|
previewonly);
|
||||||
|
return this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto,
|
||||||
|
mylocalsconf, '', smtpTransport, previewonly);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ async function mystart() {
|
|||||||
|
|
||||||
|
|
||||||
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
||||||
// sendemail.testemail('2', 'it');
|
|
||||||
|
|
||||||
let miapass = '';
|
let miapass = '';
|
||||||
|
|
||||||
@@ -378,16 +378,12 @@ async function inizia() {
|
|||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
await telegrambot.sendMsgTelegram(tools.FREEPLANET, telegrambot.ADMIN_USER_SERVER, `Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
await telegrambot.sendMsgTelegram(tools.FREEPLANET, telegrambot.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 {
|
} else {
|
||||||
|
|
||||||
// if (process.env.NODE_ENV === 'production') {
|
// await telegrambot.sendMsgTelegram(tools.FREEPLANET, telegrambot.ADMIN_USER_SERVER, `Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
||||||
await telegrambot.sendMsgTelegram(tools.CNM, telegrambot.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!`);
|
||||||
await telegrambot.sendMsgTelegramByIdTelegram(tools.CNM, telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
|
|
||||||
|
|
||||||
// await telegrambot.sendMsgTelegramByIdTelegram('2', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
|
|
||||||
|
|
||||||
testo = 'Ciao Paolo!';
|
|
||||||
myid = await telegrambot.sendMsgTelegramByIdTelegram(tools.CNM, telegrambot.ADMIN_IDTELEGRAM_SERVER, testo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -409,7 +405,7 @@ async function inizia() {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
async function faitest() {
|
async function faitest() {
|
||||||
console.log('Fai Test:')
|
// console.log('Fai Test:')
|
||||||
|
|
||||||
const testfind = false;
|
const testfind = false;
|
||||||
|
|
||||||
@@ -424,6 +420,21 @@ async function faitest() {
|
|||||||
console.log('ris', ris);
|
console.log('ris', ris);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false) {
|
||||||
|
// const {User} = require('./models/user');
|
||||||
|
/*
|
||||||
|
const user = await User.findOne({
|
||||||
|
idapp: 12,
|
||||||
|
username: 'paoloar77',
|
||||||
|
});
|
||||||
|
|
||||||
|
await sendemail.sendEmail_Registration('it', 'paolo@freeplanet.app', user,
|
||||||
|
'12', '');
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (false) {
|
if (false) {
|
||||||
|
|
||||||
const { User } = require('./models/user');
|
const { User } = require('./models/user');
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -384,6 +384,7 @@ module.exports = {
|
|||||||
FREEPLANET: '1',
|
FREEPLANET: '1',
|
||||||
AYNI: '7',
|
AYNI: '7',
|
||||||
CNM: '10',
|
CNM: '10',
|
||||||
|
PDNM: '12',
|
||||||
|
|
||||||
HELP_CHAT: '',
|
HELP_CHAT: '',
|
||||||
TYPECONF_ZOOM: 'zoom',
|
TYPECONF_ZOOM: 'zoom',
|
||||||
@@ -918,7 +919,7 @@ module.exports = {
|
|||||||
const myapp =
|
const myapp =
|
||||||
this.getApps().find(item => item.idapp === idapp);
|
this.getApps().find(item => item.idapp === idapp);
|
||||||
if (myapp)
|
if (myapp)
|
||||||
return myapp.name;
|
return ((process.env.NODE_ENV === 'test') ? 'Test: ' : '') + myapp.name;
|
||||||
else
|
else
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
@@ -928,9 +929,13 @@ module.exports = {
|
|||||||
const myapp =
|
const myapp =
|
||||||
this.getApps().find(item => item.idapp === idapp);
|
this.getApps().find(item => item.idapp === idapp);
|
||||||
if (myapp) {
|
if (myapp) {
|
||||||
let siteport = (myapp.portapp !== '0') ? (':' + myapp.portapp) : '';
|
let siteport = (myapp.portapp && myapp.portapp !== '0') ? (':' + myapp.portapp) : '';
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'test')
|
||||||
|
return myapp.host_test + siteport;
|
||||||
|
else
|
||||||
|
return myapp.host + siteport;
|
||||||
|
|
||||||
return myapp.host + siteport;
|
|
||||||
} else
|
} else
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
@@ -945,7 +950,10 @@ module.exports = {
|
|||||||
const myapp =
|
const myapp =
|
||||||
this.getApps().find(item => item.idapp === idapp);
|
this.getApps().find(item => item.idapp === idapp);
|
||||||
if (myapp) {
|
if (myapp) {
|
||||||
return myapp.dir;
|
if (process.env.NODE_ENV === 'test')
|
||||||
|
return (myapp) ? myapp.dir_test : '';
|
||||||
|
else
|
||||||
|
return (myapp) ? myapp.dir : '';
|
||||||
} else
|
} else
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
@@ -977,6 +985,15 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getAskToVerifyReg: function(idapp) {
|
||||||
|
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||||
|
if (myapp) {
|
||||||
|
return myapp.ask_to_verify_reg;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
isManagAndAdminDifferent(idapp) {
|
isManagAndAdminDifferent(idapp) {
|
||||||
const manag = this.getManagerEmailByIdApp(idapp);
|
const manag = this.getManagerEmailByIdApp(idapp);
|
||||||
return (manag !== this.getAdminEmailByIdApp(idapp)) && (manag !== '');
|
return (manag !== this.getAdminEmailByIdApp(idapp)) && (manag !== '');
|
||||||
@@ -1002,13 +1019,19 @@ module.exports = {
|
|||||||
|
|
||||||
getTelegramBotNameByIdApp: function(idapp) {
|
getTelegramBotNameByIdApp: function(idapp) {
|
||||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||||
return (myapp) ? myapp.telegram_bot_name : '';
|
if (process.env.NODE_ENV === 'test')
|
||||||
|
return (myapp) ? myapp.telegram_bot_name_test : '';
|
||||||
|
else
|
||||||
|
return (myapp) ? myapp.telegram_bot_name : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getTelegramKeyByIdApp: function(idapp) {
|
getTelegramKeyByIdApp: function(idapp) {
|
||||||
const myarr = this.getApps();
|
const myarr = this.getApps();
|
||||||
const myapp = myarr.find((item) => item.idapp === idapp);
|
const myapp = myarr.find((item) => item.idapp === idapp);
|
||||||
return (myapp) ? myapp.telegram_key : '';
|
if (process.env.NODE_ENV === 'test')
|
||||||
|
return (myapp) ? myapp.telegram_key_test : '';
|
||||||
|
else
|
||||||
|
return (myapp) ? myapp.telegram_key : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getLookup: function(params, num, pass_proj) {
|
getLookup: function(params, num, pass_proj) {
|
||||||
@@ -1069,10 +1092,7 @@ module.exports = {
|
|||||||
throw new Error('endRow must be number');
|
throw new Error('endRow must be number');
|
||||||
}
|
}
|
||||||
|
|
||||||
let newvers = true;
|
let newvers = !!params.lookup1;
|
||||||
|
|
||||||
if (params.lk_LF)
|
|
||||||
newvers = false;
|
|
||||||
|
|
||||||
let query = [];
|
let query = [];
|
||||||
|
|
||||||
@@ -1236,8 +1256,10 @@ module.exports = {
|
|||||||
filtriadded.push(...params.filtersearch);
|
filtriadded.push(...params.filtersearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filtriadded.length > 0)
|
if (filtriadded) {
|
||||||
query.push({$match: {$and: filtriadded}});
|
if (filtriadded.length > 0)
|
||||||
|
query.push({$match: {$and: filtriadded}});
|
||||||
|
}
|
||||||
|
|
||||||
if (idapp > 0) {
|
if (idapp > 0) {
|
||||||
query.push({$match: {idapp}});
|
query.push({$match: {idapp}});
|
||||||
@@ -1275,8 +1297,10 @@ module.exports = {
|
|||||||
const q4 = this.getLookup(params.lookup4, 4, proj);
|
const q4 = this.getLookup(params.lookup4, 4, proj);
|
||||||
if (q4) query = [...query, ...q4];
|
if (q4) query = [...query, ...q4];
|
||||||
|
|
||||||
if (params.filtersearch2.length > 0) {
|
if (params.filtersearch2) {
|
||||||
query.push({$match: {$and: params.filtersearch2}});
|
if (params.filtersearch2.length > 0) {
|
||||||
|
query.push({$match: {$and: params.filtersearch2}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1779,12 +1803,16 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
cryptdata(mydata) {
|
cryptdata(mydata) {
|
||||||
|
if (mydata === '')
|
||||||
|
return '';
|
||||||
// Encrypt
|
// Encrypt
|
||||||
//return CryptoJS.AES.encrypt(JSON.stringify(mydata), process.env.SECRK);
|
//return CryptoJS.AES.encrypt(JSON.stringify(mydata), process.env.SECRK);
|
||||||
return this.encrypt(mydata, process.env.SECRK);
|
return this.encrypt(mydata, process.env.SECRK);
|
||||||
},
|
},
|
||||||
|
|
||||||
decryptdata(mydatacrypted) {
|
decryptdata(mydatacrypted) {
|
||||||
|
if (mydatacrypted === '')
|
||||||
|
return '';
|
||||||
// Decrypt
|
// Decrypt
|
||||||
// const bytes = CryptoJS.AES.decrypt(mydatacrypted.toString(), process.env.SECRK);
|
// const bytes = CryptoJS.AES.decrypt(mydatacrypted.toString(), process.env.SECRK);
|
||||||
// return JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
|
// return JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
|
||||||
|
|||||||
@@ -32,15 +32,24 @@ module.exports = {
|
|||||||
|
|
||||||
FILTER_MYSKILL_SKILL: 1,
|
FILTER_MYSKILL_SKILL: 1,
|
||||||
|
|
||||||
|
FRIENDSCMD: {
|
||||||
|
SETTRUST: 121,
|
||||||
|
SETFRIEND: 132,
|
||||||
|
REMOVE_FROM_MYFRIENDS: 144,
|
||||||
|
BLOCK_USER: 155,
|
||||||
|
},
|
||||||
|
|
||||||
REPORT_FILT_RESP: 1,
|
REPORT_FILT_RESP: 1,
|
||||||
REPORT_FILT_ATTIVITA: 2,
|
REPORT_FILT_ATTIVITA: 2,
|
||||||
|
|
||||||
TAB_COUNTRY: 'countries',
|
TAB_COUNTRY: 'countries',
|
||||||
TAB_PHONES: 'phones',
|
TAB_PHONES: 'phones',
|
||||||
TAB_SETTINGS: 'settings',
|
TAB_SETTINGS: 'settings',
|
||||||
|
TAB_SITES: 'sites',
|
||||||
TAB_MYBOTS: 'mybots',
|
TAB_MYBOTS: 'mybots',
|
||||||
|
|
||||||
KEY_TO_CRYPTED: ['PWD_FROM'],
|
KEY_TO_CRYPTED: ['PWD_FROM'],
|
||||||
|
SITES_KEY_TO_CRYPTED: ['email_pwd'],
|
||||||
|
|
||||||
TablePickup: ['countries', 'phones'],
|
TablePickup: ['countries', 'phones'],
|
||||||
TableCities: ['citta', 'province'],
|
TableCities: ['citta', 'province'],
|
||||||
|
|||||||
28
yarn.lock
28
yarn.lock
@@ -6491,15 +6491,15 @@ mongodb-connection-string-url@^2.0.0:
|
|||||||
"@types/whatwg-url" "^8.2.1"
|
"@types/whatwg-url" "^8.2.1"
|
||||||
whatwg-url "^9.1.0"
|
whatwg-url "^9.1.0"
|
||||||
|
|
||||||
mongodb@3.6.11:
|
mongodb@3.7.3:
|
||||||
version "3.6.11"
|
version "3.7.3"
|
||||||
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-3.6.11.tgz#8a59a0491a92b00a8c925f72ed9d9a5b054aebb2"
|
resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-3.7.3.tgz#b7949cfd0adc4cc7d32d3f2034214d4475f175a5"
|
||||||
integrity sha512-4Y4lTFHDHZZdgMaHmojtNAlqkvddX2QQBEN0K//GzxhGwlI9tZ9R0vhbjr1Decw+TF7qK0ZLjQT292XgHRRQgw==
|
integrity sha512-Psm+g3/wHXhjBEktkxXsFMZvd3nemI0r3IPsE0bU+4//PnvNWKkzhZcEsbPcYiWqe8XqXJJEg4Tgtr7Raw67Yw==
|
||||||
dependencies:
|
dependencies:
|
||||||
bl "^2.2.1"
|
bl "^2.2.1"
|
||||||
bson "^1.1.4"
|
bson "^1.1.4"
|
||||||
denque "^1.4.1"
|
denque "^1.4.1"
|
||||||
optional-require "^1.0.3"
|
optional-require "^1.1.8"
|
||||||
safe-buffer "^5.1.2"
|
safe-buffer "^5.1.2"
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
saslprep "^1.0.0"
|
saslprep "^1.0.0"
|
||||||
@@ -6520,16 +6520,16 @@ mongoose-legacy-pluralize@1.0.2:
|
|||||||
resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4"
|
resolved "https://registry.yarnpkg.com/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz#3ba9f91fa507b5186d399fb40854bff18fb563e4"
|
||||||
integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==
|
integrity sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==
|
||||||
|
|
||||||
mongoose@^5.13.9:
|
mongoose@^5.13.13:
|
||||||
version "5.13.9"
|
version "5.13.14"
|
||||||
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.13.9.tgz#4421a13566daea8fcc80149734c76e5641f477ce"
|
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-5.13.14.tgz#ffc9704bd022dd018fbddcbe27dc802c77719fb4"
|
||||||
integrity sha512-JbLw5ie0LJxm7V9LoNxRY//6cyFJf0cOpON2TWUWvF9pabil6ArfECL3xHV2N+mwwO4gXiIa+c0pwTzDUVTgqw==
|
integrity sha512-j+BlQjjxgZg0iWn42kLeZTB91OejcxWpY2Z50bsZTiKJ7HHcEtcY21Godw496GMkBqJMTzmW7G/kZ04mW+Cb7Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/bson" "1.x || 4.0.x"
|
"@types/bson" "1.x || 4.0.x"
|
||||||
"@types/mongodb" "^3.5.27"
|
"@types/mongodb" "^3.5.27"
|
||||||
bson "^1.1.4"
|
bson "^1.1.4"
|
||||||
kareem "2.3.2"
|
kareem "2.3.2"
|
||||||
mongodb "3.6.11"
|
mongodb "3.7.3"
|
||||||
mongoose-legacy-pluralize "1.0.2"
|
mongoose-legacy-pluralize "1.0.2"
|
||||||
mpath "0.8.4"
|
mpath "0.8.4"
|
||||||
mquery "3.2.5"
|
mquery "3.2.5"
|
||||||
@@ -7026,10 +7026,10 @@ optional-require@1.0.x:
|
|||||||
resolved "https://registry.yarnpkg.com/optional-require/-/optional-require-1.0.3.tgz#275b8e9df1dc6a17ad155369c2422a440f89cb07"
|
resolved "https://registry.yarnpkg.com/optional-require/-/optional-require-1.0.3.tgz#275b8e9df1dc6a17ad155369c2422a440f89cb07"
|
||||||
integrity sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==
|
integrity sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==
|
||||||
|
|
||||||
optional-require@^1.0.3:
|
optional-require@^1.1.8:
|
||||||
version "1.1.7"
|
version "1.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/optional-require/-/optional-require-1.1.7.tgz#9ab5b254f59534108d4b2201d9ae96a063abc015"
|
resolved "https://registry.yarnpkg.com/optional-require/-/optional-require-1.1.8.tgz#16364d76261b75d964c482b2406cb824d8ec44b7"
|
||||||
integrity sha512-cIeRZocXsZnZYn+SevbtSqNlLbeoS4mLzuNn4fvXRMDRNhTGg0sxuKXl0FnZCtnew85LorNxIbZp5OeliILhMw==
|
integrity sha512-jq83qaUb0wNg9Krv1c5OQ+58EK+vHde6aBPzLvPPqJm89UQWsvSuFy9X/OSNJnFeSOKo7btE0n8Nl2+nE+z5nA==
|
||||||
dependencies:
|
dependencies:
|
||||||
require-at "^1.0.6"
|
require-at "^1.0.6"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user