Aggiunte opzioni per il Gestore: richiede che l'invitante confermi la Reg, Notifica sul BOT , Notifica all'Admin la Reg.

This commit is contained in:
paoloar77
2022-02-27 16:56:02 +01:00
parent 2749506de7
commit 8d98726f1f
9 changed files with 175 additions and 85 deletions

View File

@@ -31,6 +31,7 @@ const webpush = require('web-push');
const FILELOG = 'filelog.txt';
const FILEEVENTS = 'logevents.txt';
const FILEMANAGERS = 'logmanagers.txt';
const FILEERRLOGIN = 'errlogin.txt';
const FILESOSTITUZIONI = 'log_sostituzioni.txt';
const FILEIP_TO_BAN = 'log_iptoban.txt';
const FILENAVE = 'logNave.txt';
@@ -878,8 +879,7 @@ module.exports = {
let actions = [];
if (cmd) {
if (cmd === shared_consts.GROUPSCMD.REQGROUP) {
descr = printf(this.get__('RICHIESTA_GRUPPO', lang), groupname,
arradmins.username);
descr = printf(this.get__('RICHIESTA_GRUPPO', lang), groupname, arradmins.username);
openUrl = '/grp/' + groupname;
tag = 'reqgroups';
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_USER) {
@@ -1046,8 +1046,7 @@ module.exports = {
getHostByIdApp: function(idapp) {
const myapp =
this.getApps().find(item => item.idapp === idapp);
const myapp = this.getApps().find(item => item.idapp === idapp);
if (myapp) {
let siteport = (myapp.portapp && myapp.portapp !== '0') ? (':' +
myapp.portapp) : '';
@@ -1061,6 +1060,36 @@ module.exports = {
return '';
},
getConfSiteOptionEnabledByIdApp: function(idapp, option) {
const myapp = this.getApps().find(item => item.idapp === idapp);
if (myapp) {
if (myapp.hasOwnProperty('confsite')) {
if (myapp.confsite.hasOwnProperty('options')) {
return this.isBitActive(myapp.confsite.options, option);
}
}
}
return false;
},
getConfParamSiteByIdApp: function(idapp, field) {
const myapp = this.getApps().find(item => item.idapp === idapp);
if (myapp) {
if (myapp.hasOwnProperty('confsite')) {
if (myapp.confsite.hasOwnProperty(field)) {
return myapp.confsite[field];
}
}
}
return false;
},
isAbilitaNave: function(idapp) {
const myapp = this.getApps().find(item => item.idapp === idapp);
return myapp.abilitanave;
@@ -1107,12 +1136,7 @@ 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;
}
return tools.getConfSiteOptionEnabledByIdApp(idapp, shared_consts.ConfSite.Need_Aportador_On_DataReg_To_Verify_Reg);
},
isManagAndAdminDifferent(idapp) {
@@ -2087,12 +2111,16 @@ module.exports = {
// if (err) throw err;
// console.log('Saved!');
// });
try {
mystr = this.getstrDateTimeShort(new Date(), 'it') + ': ' + mystr;
mystr = this.getstrDateTimeShort(new Date(), 'it') + ': ' + mystr;
const stream = fs.createWriteStream(filename, {flags: 'a'});
stream.write('\n' + mystr);
stream.end();
}catch (e) {
}
const stream = fs.createWriteStream(filename, {flags: 'a'});
stream.write('\n' + mystr);
stream.end();
},
readlogfile(idapp, filename) {
@@ -2115,6 +2143,9 @@ module.exports = {
writeManagersLog(mystr) {
this.writelogfile(mystr, FILEMANAGERS);
},
writeErrorLog(mystr) {
this.writelogfile(mystr, FILEERRLOGIN);
},
writeSostituzioniLog(mystr) {
this.writelogfile(mystr, FILESOSTITUZIONI);
@@ -2542,4 +2573,15 @@ module.exports = {
return process.env.LOCALE !== '1';
},
refreshAllTablesInMem(idapp, table){
const telegrambot = require('../telegram/telegrambot');
if (table === shared_consts.TAB_MYBOTS) {
telegrambot.reloadMenuBot(idapp);
} else if (table === shared_consts.TAB_SITES) {
telegrambot.reloadSites();
}
}
};