- aggiornamento con proj RISO. postcss, pwa.
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
DATABASE=test_PiuCheBuono
|
DATABASE=test_FreePlanet
|
||||||
UDB=paofreeplanet
|
UDB=paofreeplanet
|
||||||
PDB=mypassword@1A
|
PDB=mypassword@1A
|
||||||
SEND_EMAIL=0
|
SEND_EMAIL=0
|
||||||
SEND_EMAIL_ORDERS=1
|
SEND_EMAIL_ORDERS=1
|
||||||
PORT=3000
|
PORT=3000
|
||||||
appTelegram_TEST=["1","17"]
|
appTelegram_TEST=["1","13"]
|
||||||
appTelegram=["1","17"]
|
appTelegram=["1","13"]
|
||||||
appTelegram_DEVELOP=["17"]
|
appTelegram_DEVELOP=["13"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=0
|
AUTH_MONGODB=0
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
@@ -38,9 +38,4 @@ FTPSERVER_PWD=ftpmypwd@1A_
|
|||||||
AUTH_NEW_SITES=123123123
|
AUTH_NEW_SITES=123123123
|
||||||
SCRIPTS_DIR=admin_scripts
|
SCRIPTS_DIR=admin_scripts
|
||||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||||
MIAB_HOST=box.lamiaposta.org
|
|
||||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
|
||||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
|
||||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
|
||||||
SERVER_A_URL="http://51.77.156.69:3000"
|
|
||||||
@@ -30,7 +30,9 @@ const authenticate = (req, res, next) => {
|
|||||||
|
|
||||||
const access = 'auth';
|
const access = 'auth';
|
||||||
|
|
||||||
return User.findByToken(token, access, true).then((ris) => {
|
const idapp = getIdApp(req);
|
||||||
|
|
||||||
|
return User.findByToken(token, access, true, idapp).then((ris) => {
|
||||||
|
|
||||||
if (ris && ris.user && !!ris.user.deleted) {
|
if (ris && ris.user && !!ris.user.deleted) {
|
||||||
if (ris.user.deleted)
|
if (ris.user.deleted)
|
||||||
@@ -70,14 +72,26 @@ const authenticate = (req, res, next) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getIdApp = (req) => {
|
||||||
|
let idapp = null;
|
||||||
|
try {
|
||||||
|
idapp = req.query.idapp;
|
||||||
|
} catch (e) {
|
||||||
|
console.log('IDAPP NON TROVATO !');
|
||||||
|
}
|
||||||
|
return idapp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const authenticate_noerror = (req, res, next) => {
|
const authenticate_noerror = (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const token = req.header('x-auth');
|
const token = req.header('x-auth');
|
||||||
const refreshToken = req.header('x-refrtok');
|
const refreshToken = req.header('x-refrtok');
|
||||||
|
|
||||||
const access = 'auth';
|
const idapp = getIdApp(req);
|
||||||
|
|
||||||
return User.findByToken(token, access, false).then((ris) => {
|
const access = 'auth';
|
||||||
|
return User.findByToken(token, access, false, idapp).then((ris) => {
|
||||||
if (ris.code !== server_constants.RIS_CODE_OK) {
|
if (ris.code !== server_constants.RIS_CODE_OK) {
|
||||||
req.user = null;
|
req.user = null;
|
||||||
req.token = null;
|
req.token = null;
|
||||||
|
|||||||
@@ -731,7 +731,7 @@ UserSchema.statics.isFacilitatore = function (perm) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
UserSchema.statics.findByToken = async function (token, typeaccess, con_auth) {
|
UserSchema.statics.findByToken = async function (token, typeaccess, con_auth, idapp) {
|
||||||
const User = this;
|
const User = this;
|
||||||
let decoded;
|
let decoded;
|
||||||
let code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
let code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||||
@@ -758,10 +758,15 @@ UserSchema.statics.findByToken = async function (token, typeaccess, con_auth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (code === server_constants.RIS_CODE_OK) {
|
if (code === server_constants.RIS_CODE_OK) {
|
||||||
|
|
||||||
user = await User.findOne({
|
user = await User.findOne({
|
||||||
'_id': decoded.smart,
|
'_id': decoded.smart,
|
||||||
'tokens.token': token,
|
tokens: {
|
||||||
'tokens.access': typeaccess,
|
$elemMatch: {
|
||||||
|
token: token,
|
||||||
|
access: typeaccess,
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ router.post('/', authenticate, async (req, res) => {
|
|||||||
// console.log('req.body', req.body)
|
// console.log('req.body', req.body)
|
||||||
|
|
||||||
if (req.body.options !== null) {
|
if (req.body.options !== null) {
|
||||||
|
// Invia una notifica PUSH (asincrona)
|
||||||
tools.sendBackNotif(subscription, req.body.options);
|
tools.sendBackNotif(subscription, req.body.options);
|
||||||
}
|
}
|
||||||
// console.log('Subscription saved... ')
|
// console.log('Subscription saved... ')
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ module.exports = {
|
|||||||
return myrec._doc;
|
return myrec._doc;
|
||||||
},
|
},
|
||||||
|
|
||||||
sendBackNotif: function (subscription, payload) {
|
sendBackNotif: async function (subscription, payload) {
|
||||||
const Subscription = require('../models/subscribers');
|
const Subscription = require('../models/subscribers');
|
||||||
|
|
||||||
// console.log('sendBackNotif:', subscription, payload);
|
// console.log('sendBackNotif:', subscription, payload);
|
||||||
|
|||||||
Reference in New Issue
Block a user