clean notification with last folder change

This commit is contained in:
2024-03-19 09:10:07 +01:00
parent dbd8cf72a0
commit b1a6948398
8 changed files with 47 additions and 31 deletions

View File

@@ -18,7 +18,7 @@ const log = conf.api.activelog.includes(currentmod);
const Notifications = {};
Notifications.get = (alias, tribeId) => {
const notiffile = `../../../${req.params.tribeId}/notifications/${req.params.alias}.json`;
const notiffile = `../../${req.params.tribeId}/notifications/${req.params.alias}.json`;
const msg = fs.existsSync(notiffile) ? fs.readJSONSync(notiffile) : {};
return {
status: 200,
@@ -43,7 +43,7 @@ Notifications.registertolist = (key, typekey, tribe, mlist, srckey, uuid) => {
data: { fielderr: typekey, format: typekey }
};
const destin = `../../../${tribe}/objects/maillinglists/${typekey}_${mlist}.json`;
const destin = `../../${tribe}/objects/maillinglists/${typekey}_${mlist}.json`;
if (!fs.existsSync(destin)){
console.log(`######## Attention tentative d'ecriture non autorisé,le fichier n'existe pas ${destin} créer le à la main vide {}`)
return {status:406,ref:"Notifications",msg:"destinnotallow",data:{destin}}
@@ -116,11 +116,11 @@ Notifications.sendsms = async (data, tribeId) => {
let confsms = conf.sms;
if (
fs.existsSync(
`../../../itm/${req.session.header.xtribe}.json`
`../../itm/${req.session.header.xtribe}.json`
)
) {
const conftrib = fs.readJSONSync(
`../../../itm/${req.session.header.xtribe}.json`
`../../itm/${req.session.header.xtribe}.json`
);
if (conftrib.sms) confsms = conftrib.sms;
}
@@ -225,7 +225,7 @@ Notifications.sendmail = async (data, tribe) => {
};
}
let confsmtp = conf.smtp;
const conftribfile = `../../../itm/${tribe}.json`;
const conftribfile = `../../itm/${tribe}.json`;
if (fs.existsSync(conftribfile)) {
const conftrib = fs.readJSONSync(conftribfile);
confsmtp = conftrib.smtp;