From 177489521d1a74e6b2ae36b0d3b92c6aa2821453 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Tue, 28 Sep 2021 23:46:14 +0200 Subject: [PATCH] ver: 0.1.2 Created Test Environment test.freeplanet.app and Server: /var/www/test.freeplanet_server --- src/server/router/push_router.js | 4 ++- src/server/tools/general.js | 43 ++------------------------------ 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/server/router/push_router.js b/src/server/router/push_router.js index 21fb80f..4e5d327 100755 --- a/src/server/router/push_router.js +++ b/src/server/router/push_router.js @@ -141,7 +141,7 @@ async function SendMsgToParam(idapp, 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) { for (const user of arrusers) { 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 params = req.body.params; + // console.log('params', params); + let nummsg = 0; if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) && !User.isTutor(req.user.perm))) { diff --git a/src/server/tools/general.js b/src/server/tools/general.js index cbe610a..e82ce83 100755 --- a/src/server/tools/general.js +++ b/src/server/tools/general.js @@ -751,23 +751,16 @@ module.exports = { }; 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); - // console.log('A1) SUBS: pushSubscription', pushSubscription); - // console.log('A2) OPZIONI: pushOptions', pushOptions); - // console.log('A3) MSG_TO_SEND: pushPayload', pushPayload); - webpush.sendNotification( pushSubscription, pushPayload, - // pushOptions + pushOptions ).then((value) => { - console.log('Invio Push', value); + // console.log('Invio Push', value); resolve({ status: true, 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; },