change notification to managepush
This commit is contained in:
parent
d5c27f4f77
commit
608661495b
@ -106,13 +106,6 @@ Until the web interface allow it here are usefull process to:
|
|||||||
```
|
```
|
||||||
cd .. && . setup.sh smatchit https://admin.smatchit.io https://gitea.ndda.fr/smatchit/smatchit 1234
|
cd .. && . setup.sh smatchit https://admin.smatchit.io https://gitea.ndda.fr/smatchit/smatchit 1234
|
||||||
```
|
```
|
||||||
To conf a new website
|
|
||||||
* Update in adminapi/objects/tribes/itm/tribename.json add domaine name in dns
|
|
||||||
* Create a folder in tribename/objects/wwws/itm/webname/src and /dist
|
|
||||||
* from adminapi/apxtri/setup/nginx.wwwscf create file tribename/nginx/website.tribename.townname.nation.name.conf
|
|
||||||
* add in tribename/objects/wwws/itm/websitename.json the localdb to send to front
|
|
||||||
* Then conf website test domain and use sudo certbot --nginx -d domainename to get ssl and access in https
|
|
||||||
|
|
||||||
|
|
||||||
If you want to contribute fixing bug, add new features in adminapi please push in your branch and send an email to support@need-data.com.
|
If you want to contribute fixing bug, add new features in adminapi please push in your branch and send an email to support@need-data.com.
|
||||||
|
|
||||||
|
@ -209,8 +209,20 @@ Notifications.sendsms = async (data, tribeId) => {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
Notifications.managepush = async(data,templatename,tribe,lg)=>{
|
||||||
Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond) => {
|
/**
|
||||||
|
* TODO
|
||||||
|
* open templatename get tplemail.notif renderit with data and push it
|
||||||
|
* with tribe parameter
|
||||||
|
*/
|
||||||
|
return {
|
||||||
|
status: 200,
|
||||||
|
ref: "Wwws",
|
||||||
|
msg: "pushmsgTODO",
|
||||||
|
data: {tribe,templatename},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond=10) => {
|
||||||
const sleep = (ms) => {
|
const sleep = (ms) => {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
};
|
};
|
||||||
@ -269,6 +281,8 @@ Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond
|
|||||||
if (!Checkjson.testformat(emailtosend.to, "email")) {
|
if (!Checkjson.testformat(emailtosend.to, "email")) {
|
||||||
results.fail.push({ to: emailtosend.to, err: ["errorformat"] });
|
results.fail.push({ to: emailtosend.to, err: ["errorformat"] });
|
||||||
} else {
|
} else {
|
||||||
|
emailtosend.templatename=templatename;
|
||||||
|
emailtosend.lg=lg
|
||||||
emailtosend.subject = Mustache.render(tplemail.subject, email);
|
emailtosend.subject = Mustache.render(tplemail.subject, email);
|
||||||
emailtosend.html = Mustache.render(tplemail.html, email);
|
emailtosend.html = Mustache.render(tplemail.html, email);
|
||||||
emailtosend.text = Mustache.render(tplemail.text, email);
|
emailtosend.text = Mustache.render(tplemail.text, email);
|
||||||
@ -286,10 +300,12 @@ Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond
|
|||||||
//console.log(emailtosend)
|
//console.log(emailtosend)
|
||||||
sendit = await Notifications.sendmail(emailtosend, tribe);
|
sendit = await Notifications.sendmail(emailtosend, tribe);
|
||||||
//const sendit={status:200}
|
//const sendit={status:200}
|
||||||
|
//console.log(sendit)
|
||||||
if (sendit.status == 200) {
|
if (sendit.status == 200) {
|
||||||
results.success.push(emailtosend.to);
|
results.success.push(emailtosend.to);
|
||||||
} else {
|
} else {
|
||||||
results.fail.push({ tp: emailtosend.to, status: sendit.status });
|
results.fail.push({ tp: emailtosend.to, status: sendit.status });
|
||||||
|
console.log(sendit)
|
||||||
}
|
}
|
||||||
if ((i + 1) % numberpersecond === 0) {
|
if ((i + 1) % numberpersecond === 0) {
|
||||||
console.log("Prochain lot attend 1 seconde");
|
console.log("Prochain lot attend 1 seconde");
|
||||||
@ -308,6 +324,7 @@ Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond
|
|||||||
data: {
|
data: {
|
||||||
emailsucces: results.success.length,
|
emailsucces: results.success.length,
|
||||||
emailfail: results.fail.length,
|
emailfail: results.fail.length,
|
||||||
|
failsdetail:results.fail,
|
||||||
timems: Date.now() - start,
|
timems: Date.now() - start,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -432,7 +449,7 @@ Notifications.sendmail = async (data, tribe) => {
|
|||||||
data.subject
|
data.subject
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
//fs.outputFile(`../${tribe}/template/test.html`, data.html);
|
fs.outputFile(`../${tribe}/template/${data.templatename}_${data.lg}.html`, data.html);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
res = await transporter.sendMail(data);
|
res = await transporter.sendMail(data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user