modif notif
This commit is contained in:
@@ -14,7 +14,7 @@ SEE README.md to start
|
||||
const apxtri = {};
|
||||
|
||||
apxtri.main = async () => {
|
||||
if (!fs.existsSync("/etc/nginx/nginx.conf")) {
|
||||
if (process.env.NODE_MODE !== 'dev' && !fs.existsSync("/etc/nginx/nginx.conf")) {
|
||||
console.log(
|
||||
"\x1b[31m Check documentation, nginx have to be installed on this server first, no /etc/nginx/nginx.conf available, install then rerun yarn command."
|
||||
);
|
||||
@@ -275,9 +275,7 @@ apxtri.runexpress = async (tribesdns, conf) => {
|
||||
app.disable("x-powered-by"); // for security
|
||||
app.locals.tribeids = tribeIds;
|
||||
const currentmod = "apxtri";
|
||||
const log = process.env.ACTIVELOG.split(',')
|
||||
? process.env.ACTIVELOG.split(',').includes(currentmod)
|
||||
: false;
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
console.log(
|
||||
currentmod,
|
||||
" Allowed DOMs to access to this apxtri server:",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const path=require('path')
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod='checkHeaders';
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod)
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false : false
|
||||
/**
|
||||
* @api {get} / - CheckHeaders
|
||||
* @apiGroup Middlewares
|
||||
@@ -19,7 +19,7 @@ const log = process.env.ACTIVELOG.split(',').includes(currentmod)
|
||||
* @apiHeader {integer} xtrkversion a version number link to tracking system
|
||||
* @apiHeaderExample {json} Headeconst conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod='checkHeaders';
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod)r-Example for anonymous:
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : falser-Example for anonymous:
|
||||
* {
|
||||
* "xtrkversion":1,
|
||||
* "xtribe":"smatchit",
|
||||
|
||||
@@ -8,7 +8,7 @@ const openpgp = require("openpgp");
|
||||
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod='isAuthenticated';
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod)
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false
|
||||
/**
|
||||
* @api {get} / - isAuthenticated
|
||||
* @apiGroup Middlewares
|
||||
|
||||
@@ -7,7 +7,7 @@ const Odmdb = require(`./Odmdb.js`);
|
||||
const Checkjson = require(`./Checkjson`);
|
||||
const conf = require(`../../objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Articles";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
|
||||
|
||||
const Articles={}
|
||||
|
||||
@@ -9,7 +9,7 @@ const Checkjson = require(`./Checkjson.js`);
|
||||
const nodemailer = require("nodemailer");
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Notifications";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
/**
|
||||
* To manage any communication between Pagan
|
||||
* mayor druid emailing/sms/paper from tribe register smtp, simcard, mail api to Person(s) / Pagan(s)
|
||||
@@ -440,21 +440,27 @@ Notifications.sendmail = async (data, tribe) => {
|
||||
//console.log(confsmtp);
|
||||
const transporter = await nodemailer.createTransport(confsmtp);
|
||||
if (data.filelist) {
|
||||
data.attachments = [];
|
||||
data.attachments = data.attachments || [];
|
||||
let missingfile = [];
|
||||
data.filelist.forEach((fo) => {
|
||||
if (fs.existsSync(fo.pathfile)) {
|
||||
data.attachments.push({
|
||||
filename: fo.filename || path.basename(fo.pathfile),
|
||||
path: fo.pathfile,
|
||||
contentType: fo.contenttype || 'application/octet-stream'
|
||||
});
|
||||
} else {
|
||||
missingfile.push(fo.pathfile);
|
||||
}
|
||||
});
|
||||
if (missingk.length > 0) {
|
||||
return {
|
||||
status: 428,
|
||||
ref: "Notifications",
|
||||
msg: "missingdata",
|
||||
data: { missingk: missingk },
|
||||
};
|
||||
});
|
||||
if (missingfile.length > 0) {
|
||||
return {
|
||||
status: 428,
|
||||
ref: "Notifications",
|
||||
msg: "missingfiles",
|
||||
data: { missingfiles: missingfile },
|
||||
};
|
||||
}
|
||||
}
|
||||
//console.log("data:", data);
|
||||
let res;
|
||||
|
||||
@@ -7,7 +7,7 @@ const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const Checkjson = require(`./Checkjson.js`);
|
||||
const { promiseHooks } = require("v8");
|
||||
const currentmod = "Odmdb";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
/**
|
||||
* This manage Objects for indexing, searching, checking and act to CRUD
|
||||
* @objectPathName = objectpath/objectname
|
||||
|
||||
@@ -10,7 +10,7 @@ const Odmdb = require("./Odmdb.js");
|
||||
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Pagans";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
/**
|
||||
* Pagan Management numeric Identity and Person (Person = Pagan Id + tribe)
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@ const Odmdb = require("./Odmdb.js");
|
||||
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Pagans";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
/**
|
||||
* Pagan Management numeric Identity and Person (Person = Pagan Id + tribe)
|
||||
*
|
||||
|
||||
@@ -12,7 +12,7 @@ const readlineSync = require("readline-sync");
|
||||
const Odmdb = require("./Odmdb.js");
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Wwws";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
const Wwws = {};
|
||||
|
||||
Wwws.getwco = (wconame, ctx) => {
|
||||
|
||||
@@ -9,7 +9,7 @@ const Articles = require(`../models/Articles`);
|
||||
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Articles";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const isAuthenticated = require("../middlewares/isAuthenticated.js");
|
||||
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Pagans";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const conf = require(`../../../adminapi/objects/tribes/itm/adminapi.json`);
|
||||
const currentmod = "Trackings";
|
||||
const log = process.env.ACTIVELOG.split(',').includes(currentmod);
|
||||
const log = process.env.ACTIVELOG ? process.env.ACTIVELOG.split(',').includes(currentmod) : false;
|
||||
const Odmdb = require("../models/Odmdb.js");
|
||||
// Middlewares
|
||||
const checkHeaders = require("../middlewares/checkHeaders");
|
||||
|
||||
Reference in New Issue
Block a user