ver: 0.1.2
Created Test Environment test.freeplanet.app and Server: /var/www/test.freeplanet_server
This commit is contained in:
@@ -141,7 +141,7 @@ async function SendMsgToParam(idapp, params) {
|
|||||||
|
|
||||||
async function SendMsgTo(idapp, username, params) {
|
async function SendMsgTo(idapp, username, params) {
|
||||||
|
|
||||||
return await User.find({ idapp, username }).then((arrusers) => {
|
return User.find({ idapp, username }).then((arrusers) => {
|
||||||
if (arrusers !== null) {
|
if (arrusers !== null) {
|
||||||
for (const user of arrusers) {
|
for (const user of arrusers) {
|
||||||
tools.sendNotificationToUser(user._id, params.title, params.content, params.openUrl, params.openUrl2, params.tag, params.actions)
|
tools.sendNotificationToUser(user._id, params.title, params.content, params.openUrl, params.openUrl2, params.tag, params.actions)
|
||||||
@@ -165,6 +165,8 @@ router.post('/send', authenticate, async (req, res) => {
|
|||||||
const idapp = req.body.idapp;
|
const idapp = req.body.idapp;
|
||||||
const params = req.body.params;
|
const params = req.body.params;
|
||||||
|
|
||||||
|
// console.log('params', params);
|
||||||
|
|
||||||
let nummsg = 0;
|
let nummsg = 0;
|
||||||
|
|
||||||
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) && !User.isTutor(req.user.perm))) {
|
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) && !User.isTutor(req.user.perm))) {
|
||||||
|
|||||||
@@ -751,23 +751,16 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
console.log('************ INVIO WEBPUSH.SENDNOTIFICATION N° ', conta, '/', trovati, 'A', subscription.browser);
|
console.log('************ INVIO WEBPUSH.SENDNOTIFICATION N° ', conta, '/', trovati, 'A', subscription.browser);
|
||||||
// console.log('vapidDetails', pushOptions.vapidDetails);
|
|
||||||
|
|
||||||
// payload.title = process.env.URLBASE_APP1 + ' Msg n° ' + conta + '/' + trovati;
|
|
||||||
// payload.message += subscription.browser ;
|
|
||||||
|
|
||||||
const pushPayload = JSON.stringify(payload);
|
const pushPayload = JSON.stringify(payload);
|
||||||
|
|
||||||
// console.log('A1) SUBS: pushSubscription', pushSubscription);
|
|
||||||
// console.log('A2) OPZIONI: pushOptions', pushOptions);
|
|
||||||
// console.log('A3) MSG_TO_SEND: pushPayload', pushPayload);
|
|
||||||
|
|
||||||
webpush.sendNotification(
|
webpush.sendNotification(
|
||||||
pushSubscription,
|
pushSubscription,
|
||||||
pushPayload,
|
pushPayload,
|
||||||
// pushOptions
|
pushOptions
|
||||||
).then((value) => {
|
).then((value) => {
|
||||||
console.log('Invio Push', value);
|
// console.log('Invio Push', value);
|
||||||
resolve({
|
resolve({
|
||||||
status: true,
|
status: true,
|
||||||
endpoint: subscription.endpoint,
|
endpoint: subscription.endpoint,
|
||||||
@@ -1807,38 +1800,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table === 'listaingressos') {
|
|
||||||
if ('invitante_username' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ('username' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ('note' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (table === 'navi') {
|
|
||||||
if ('date_made_gift' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ('made_gift' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ('note' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (table === 'navepersistente') {
|
|
||||||
if ('link_chat' in fieldsvalue) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (table === 'flotte') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user