Disabled debug Mongoose
Updated modules fixed tests
This commit is contained in:
@@ -20,7 +20,7 @@ const { ObjectID } = require('mongodb');
|
||||
|
||||
const shared_consts = require('./shared_nodejs');
|
||||
|
||||
const mongoose = require('mongoose');
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Subscription = mongoose.model('subscribers');
|
||||
|
||||
const server_constants = require('./server_constants');
|
||||
@@ -34,7 +34,7 @@ const FILEMANAGERS = 'logmanagers.txt';
|
||||
const FILESOSTITUZIONI = 'log_sostituzioni.txt';
|
||||
const FILEIP_TO_BAN = 'log_iptoban.txt';
|
||||
const FILENAVE = 'logNave.txt';
|
||||
const subject = process.env.URLBASE_APP1;
|
||||
const subject = process.env.VAPI_KEY_SUBJECT;
|
||||
const publicVapidKey = process.env.PUBLIC_VAPI_KEY;
|
||||
const privateVapidKey = process.env.PRIVATE_VAPI_KEY;
|
||||
|
||||
@@ -734,7 +734,7 @@ module.exports = {
|
||||
|
||||
const vapidHeaders = webpush.getVapidHeaders(
|
||||
audience,
|
||||
process.env.URLBASE_APP1,
|
||||
process.env.VAPI_KEY_SUBJECT,
|
||||
process.env.PUBLIC_VAPI_KEY,
|
||||
process.env.PRIVATE_VAPI_KEY,
|
||||
'aes128gcm'
|
||||
@@ -742,7 +742,7 @@ module.exports = {
|
||||
|
||||
const pushOptions = {
|
||||
vapidDetails: {
|
||||
subject: process.env.URLBASE_APP1,
|
||||
subject: process.env.VAPI_KEY_SUBJECT,
|
||||
privateKey: process.env.PRIVATE_VAPI_KEY,
|
||||
publicKey: process.env.PUBLIC_VAPI_KEY,
|
||||
},
|
||||
@@ -767,12 +767,14 @@ module.exports = {
|
||||
pushPayload,
|
||||
// pushOptions
|
||||
).then((value) => {
|
||||
console.log('Invio Push', value);
|
||||
resolve({
|
||||
status: true,
|
||||
endpoint: subscription.endpoint,
|
||||
data: value
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.error('err Push', err.message)
|
||||
reject({
|
||||
status: false,
|
||||
endpoint: subscription.endpoint,
|
||||
@@ -780,7 +782,7 @@ module.exports = {
|
||||
});
|
||||
});
|
||||
}).catch(error => {
|
||||
console.log('ERROR: sendNotificationToUser', error.data.body)
|
||||
console.log('ERROR: sendNotificationToUser', error)
|
||||
});
|
||||
});
|
||||
// q.allSettled(parallelSubscriptionCalls).then((pushResults) => {
|
||||
@@ -854,7 +856,7 @@ module.exports = {
|
||||
// console.log('nomeapp 1: ' , this.getNomeAppByIdApp(1));
|
||||
// console.log('nomeapp 2: ' , this.getNomeAppByIdApp(2));
|
||||
|
||||
User.find({ username: 'paoloarcnm' }).then((arrusers) => {
|
||||
User.find({ username: 'paoloar77', idapp: '1' }).then((arrusers) => {
|
||||
if (arrusers !== null) {
|
||||
for (const user of arrusers) {
|
||||
this.sendNotificationToUser(user._id, title, msg, '/', '', tag, [])
|
||||
@@ -965,10 +967,13 @@ module.exports = {
|
||||
|
||||
getpathregByIdApp: function (idapp, lang) {
|
||||
const myapp = this.getApps().find((item) => item.idapp === idapp);
|
||||
if (myapp)
|
||||
return 'registration' + myapp.pathreg_add + '/' + lang;
|
||||
else
|
||||
return '';
|
||||
if (myapp) {
|
||||
const addstr = myapp.pathreg_add ? myapp.pathreg_add : '';
|
||||
|
||||
return 'registration' + addstr + '/' + lang;
|
||||
} else {
|
||||
return 'registration' + '/' + lang;
|
||||
}
|
||||
},
|
||||
|
||||
isManagAndAdminDifferent(idapp) {
|
||||
@@ -1992,6 +1997,7 @@ module.exports = {
|
||||
|
||||
async loadApps() {
|
||||
this.MYAPPS = await Site.findAllIdApp(0);
|
||||
// console.log('this.MYAPPS', this.MYAPPS);
|
||||
},
|
||||
getApps() {
|
||||
if (this.MYAPPS.length <= 0)
|
||||
|
||||
Reference in New Issue
Block a user