change notification to managepush

This commit is contained in:
philc 2025-01-29 12:36:52 +01:00
parent d5c27f4f77
commit 608661495b
2 changed files with 20 additions and 10 deletions

View File

@ -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
```
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.

View File

@ -209,8 +209,20 @@ Notifications.sendsms = async (data, tribeId) => {
}
*/
};
Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond) => {
Notifications.managepush = async(data,templatename,tribe,lg)=>{
/**
* 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) => {
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")) {
results.fail.push({ to: emailtosend.to, err: ["errorformat"] });
} else {
emailtosend.templatename=templatename;
emailtosend.lg=lg
emailtosend.subject = Mustache.render(tplemail.subject, email);
emailtosend.html = Mustache.render(tplemail.html, email);
emailtosend.text = Mustache.render(tplemail.text, email);
@ -286,10 +300,12 @@ Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond
//console.log(emailtosend)
sendit = await Notifications.sendmail(emailtosend, tribe);
//const sendit={status:200}
//console.log(sendit)
if (sendit.status == 200) {
results.success.push(emailtosend.to);
} else {
results.fail.push({ tp: emailtosend.to, status: sendit.status });
console.log(sendit)
}
if ((i + 1) % numberpersecond === 0) {
console.log("Prochain lot attend 1 seconde");
@ -308,6 +324,7 @@ Notifications.manageemail = async (data, templatename, tribe, lg,numberpersecond
data: {
emailsucces: results.success.length,
emailfail: results.fail.length,
failsdetail:results.fail,
timems: Date.now() - start,
},
};
@ -432,7 +449,7 @@ Notifications.sendmail = async (data, tribe) => {
data.subject
);
*/
//fs.outputFile(`../${tribe}/template/test.html`, data.html);
fs.outputFile(`../${tribe}/template/${data.templatename}_${data.lg}.html`, data.html);
try {
res = await transporter.sendMail(data);