From 4ad9619bfb78396114aac0fbd641c24790a86244 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 11 Oct 2021 11:56:14 -0700 Subject: [PATCH] Email device connect/disconnect notifications now work. --- emails/device-notify.html | 36 +++++++++++ emails/device-notify.txt | 22 +++++++ emails/translations/device-notify_cs.html | 36 +++++++++++ emails/translations/device-notify_cs.txt | 22 +++++++ emails/translations/device-notify_de.html | 36 +++++++++++ emails/translations/device-notify_de.txt | 22 +++++++ emails/translations/device-notify_es.html | 36 +++++++++++ emails/translations/device-notify_es.txt | 22 +++++++ emails/translations/device-notify_fi.html | 36 +++++++++++ emails/translations/device-notify_fi.txt | 22 +++++++ emails/translations/device-notify_fr.html | 36 +++++++++++ emails/translations/device-notify_fr.txt | 22 +++++++ emails/translations/device-notify_hi.html | 36 +++++++++++ emails/translations/device-notify_hi.txt | 22 +++++++ emails/translations/device-notify_it.html | 36 +++++++++++ emails/translations/device-notify_it.txt | 22 +++++++ emails/translations/device-notify_ja.html | 36 +++++++++++ emails/translations/device-notify_ja.txt | 22 +++++++ emails/translations/device-notify_ko.html | 36 +++++++++++ emails/translations/device-notify_ko.txt | 22 +++++++ emails/translations/device-notify_nl.html | 36 +++++++++++ emails/translations/device-notify_nl.txt | 22 +++++++ emails/translations/device-notify_pl.html | 36 +++++++++++ emails/translations/device-notify_pl.txt | 22 +++++++ emails/translations/device-notify_pt-br.html | 36 +++++++++++ emails/translations/device-notify_pt-br.txt | 22 +++++++ emails/translations/device-notify_pt.html | 36 +++++++++++ emails/translations/device-notify_pt.txt | 22 +++++++ emails/translations/device-notify_ru.html | 36 +++++++++++ emails/translations/device-notify_ru.txt | 22 +++++++ emails/translations/device-notify_sv.html | 36 +++++++++++ emails/translations/device-notify_sv.txt | 22 +++++++ emails/translations/device-notify_tr.html | 36 +++++++++++ emails/translations/device-notify_tr.txt | 22 +++++++ emails/translations/device-notify_zh-chs.html | 36 +++++++++++ emails/translations/device-notify_zh-chs.txt | 22 +++++++ emails/translations/device-notify_zh-cht.html | 36 +++++++++++ emails/translations/device-notify_zh-cht.txt | 22 +++++++ meshmail.js | 62 +++++++++++++++++-- package.json | 15 +---- translate/translate.js | 2 + translate/translate.json | 60 ++++++++++++++++++ 42 files changed, 1223 insertions(+), 18 deletions(-) create mode 100644 emails/device-notify.html create mode 100644 emails/device-notify.txt create mode 100644 emails/translations/device-notify_cs.html create mode 100644 emails/translations/device-notify_cs.txt create mode 100644 emails/translations/device-notify_de.html create mode 100644 emails/translations/device-notify_de.txt create mode 100644 emails/translations/device-notify_es.html create mode 100644 emails/translations/device-notify_es.txt create mode 100644 emails/translations/device-notify_fi.html create mode 100644 emails/translations/device-notify_fi.txt create mode 100644 emails/translations/device-notify_fr.html create mode 100644 emails/translations/device-notify_fr.txt create mode 100644 emails/translations/device-notify_hi.html create mode 100644 emails/translations/device-notify_hi.txt create mode 100644 emails/translations/device-notify_it.html create mode 100644 emails/translations/device-notify_it.txt create mode 100644 emails/translations/device-notify_ja.html create mode 100644 emails/translations/device-notify_ja.txt create mode 100644 emails/translations/device-notify_ko.html create mode 100644 emails/translations/device-notify_ko.txt create mode 100644 emails/translations/device-notify_nl.html create mode 100644 emails/translations/device-notify_nl.txt create mode 100644 emails/translations/device-notify_pl.html create mode 100644 emails/translations/device-notify_pl.txt create mode 100644 emails/translations/device-notify_pt-br.html create mode 100644 emails/translations/device-notify_pt-br.txt create mode 100644 emails/translations/device-notify_pt.html create mode 100644 emails/translations/device-notify_pt.txt create mode 100644 emails/translations/device-notify_ru.html create mode 100644 emails/translations/device-notify_ru.txt create mode 100644 emails/translations/device-notify_sv.html create mode 100644 emails/translations/device-notify_sv.txt create mode 100644 emails/translations/device-notify_tr.html create mode 100644 emails/translations/device-notify_tr.txt create mode 100644 emails/translations/device-notify_zh-chs.html create mode 100644 emails/translations/device-notify_zh-chs.txt create mode 100644 emails/translations/device-notify_zh-cht.html create mode 100644 emails/translations/device-notify_zh-cht.txt diff --git a/emails/device-notify.html b/emails/device-notify.html new file mode 100644 index 00000000..e4974408 --- /dev/null +++ b/emails/device-notify.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, click here within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/device-notify.txt b/emails/device-notify.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/device-notify.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_cs.html b/emails/translations/device-notify_cs.html new file mode 100644 index 00000000..a6af319d --- /dev/null +++ b/emails/translations/device-notify_cs.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, klikněte zde within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_cs.txt b/emails/translations/device-notify_cs.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_cs.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_de.html b/emails/translations/device-notify_de.html new file mode 100644 index 00000000..a9d03aca --- /dev/null +++ b/emails/translations/device-notify_de.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, hier klicken within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_de.txt b/emails/translations/device-notify_de.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_de.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_es.html b/emails/translations/device-notify_es.html new file mode 100644 index 00000000..a5268960 --- /dev/null +++ b/emails/translations/device-notify_es.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, haz clic aquí within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_es.txt b/emails/translations/device-notify_es.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_es.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_fi.html b/emails/translations/device-notify_fi.html new file mode 100644 index 00000000..3f5301cd --- /dev/null +++ b/emails/translations/device-notify_fi.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, klikkaa tästä within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_fi.txt b/emails/translations/device-notify_fi.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_fi.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_fr.html b/emails/translations/device-notify_fr.html new file mode 100644 index 00000000..a7cf1b7d --- /dev/null +++ b/emails/translations/device-notify_fr.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, cliquez ici within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_fr.txt b/emails/translations/device-notify_fr.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_fr.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_hi.html b/emails/translations/device-notify_hi.html new file mode 100644 index 00000000..6e3984db --- /dev/null +++ b/emails/translations/device-notify_hi.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, यहाँ क्लिक करें within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_hi.txt b/emails/translations/device-notify_hi.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_hi.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_it.html b/emails/translations/device-notify_it.html new file mode 100644 index 00000000..fc128de9 --- /dev/null +++ b/emails/translations/device-notify_it.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, clicca qui within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_it.txt b/emails/translations/device-notify_it.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_it.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_ja.html b/emails/translations/device-notify_ja.html new file mode 100644 index 00000000..dd38dbf6 --- /dev/null +++ b/emails/translations/device-notify_ja.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, ここをクリック within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_ja.txt b/emails/translations/device-notify_ja.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_ja.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_ko.html b/emails/translations/device-notify_ko.html new file mode 100644 index 00000000..5fdfc09c --- /dev/null +++ b/emails/translations/device-notify_ko.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, 여기를 클릭하십시오. within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_ko.txt b/emails/translations/device-notify_ko.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_ko.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_nl.html b/emails/translations/device-notify_nl.html new file mode 100644 index 00000000..18ba39f8 --- /dev/null +++ b/emails/translations/device-notify_nl.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, Klik hier within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_nl.txt b/emails/translations/device-notify_nl.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_nl.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_pl.html b/emails/translations/device-notify_pl.html new file mode 100644 index 00000000..0e5035ac --- /dev/null +++ b/emails/translations/device-notify_pl.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, kliknij tutaj within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_pl.txt b/emails/translations/device-notify_pl.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_pl.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_pt-br.html b/emails/translations/device-notify_pt-br.html new file mode 100644 index 00000000..1cf8bc17 --- /dev/null +++ b/emails/translations/device-notify_pt-br.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, Clique aqui within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_pt-br.txt b/emails/translations/device-notify_pt-br.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_pt-br.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_pt.html b/emails/translations/device-notify_pt.html new file mode 100644 index 00000000..1cf8bc17 --- /dev/null +++ b/emails/translations/device-notify_pt.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, Clique aqui within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_pt.txt b/emails/translations/device-notify_pt.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_pt.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_ru.html b/emails/translations/device-notify_ru.html new file mode 100644 index 00000000..3fe1439d --- /dev/null +++ b/emails/translations/device-notify_ru.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, кликните сюда within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_ru.txt b/emails/translations/device-notify_ru.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_ru.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_sv.html b/emails/translations/device-notify_sv.html new file mode 100644 index 00000000..5c782b03 --- /dev/null +++ b/emails/translations/device-notify_sv.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, Klicka här within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_sv.txt b/emails/translations/device-notify_sv.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_sv.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_tr.html b/emails/translations/device-notify_tr.html new file mode 100644 index 00000000..a01a3c4e --- /dev/null +++ b/emails/translations/device-notify_tr.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, buraya Tıkla within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_tr.txt b/emails/translations/device-notify_tr.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_tr.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_zh-chs.html b/emails/translations/device-notify_zh-chs.html new file mode 100644 index 00000000..7bb6fd6a --- /dev/null +++ b/emails/translations/device-notify_zh-chs.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, 点击这里 within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_zh-chs.txt b/emails/translations/device-notify_zh-chs.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_zh-chs.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/emails/translations/device-notify_zh-cht.html b/emails/translations/device-notify_zh-cht.html new file mode 100644 index 00000000..c17cccd9 --- /dev/null +++ b/emails/translations/device-notify_zh-cht.html @@ -0,0 +1,36 @@ +
[[[SERVERNAME]]] - Device Notification
+
+ + + + +
+ [[[SERVERNAME]]] - Device Notification +
+ +

+ The folloing devices have changed their connection state. +

+
+ +

+ Connected devices: +

+

+[[[CONNECTIONS]]] +

+
+ +

+ Disconnected devices: +

+

+[[[DISCONNECTIONS]]] +

+
+ +

+ To unsubscribe, 點擊這裡 within 1 hour of getting this message. +

+
+
\ No newline at end of file diff --git a/emails/translations/device-notify_zh-cht.txt b/emails/translations/device-notify_zh-cht.txt new file mode 100644 index 00000000..22799dbb --- /dev/null +++ b/emails/translations/device-notify_zh-cht.txt @@ -0,0 +1,22 @@ +[[[SERVERNAME]]] - Device Notification +~ +The folloing devices have changed their connection state. +~ +~ +~ +Connected devices: +~ +~[[[CONNECTIONS]]] +~ +~ +~ +~ +Disconnected devices: +~ +~[[[DISCONNECTIONS]]] +~ +~ +~ + +To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]] +~ \ No newline at end of file diff --git a/meshmail.js b/meshmail.js index d32323e5..9bea875c 100644 --- a/meshmail.js +++ b/meshmail.js @@ -337,6 +337,53 @@ module.exports.CreateMeshMail = function (parent, domain) { }); }; + // Send device connect/disconnect notification mail + obj.sendDeviceNotifyMail = function (domain, username, email, connections, disconnections, language, loginkey) { + obj.checkEmail(email, function (checked) { + if (checked) { + parent.debug('email', "Sending device notification to " + email); + + if ((parent.certificates == null) || (parent.certificates.CommonName == null) || (parent.certificates.CommonName.indexOf('.') == -1)) { + parent.debug('email', "Error: Server name not set."); // If the server name is not set, email not possible. + return; + } + + var template = getTemplate('device-notify', domain, language); + if ((template == null) || (template.htmlSubject == null) || (template.txtSubject == null)) { + parent.debug('email', "Error: Failed to get mail template."); // No email template found + return; + } + + // Set all the template replacement options and generate the final email text (both in txt and html formats). + var optionsHtml = { username: username, email: email, servername: domain.title ? domain.title : 'MeshCentral', header: true, footer: false }; + var optionsTxt = { username: username, email: email, servername: domain.title ? domain.title : 'MeshCentral', header: true, footer: false }; + if ((connections == null) || (connections.length == 0)) { + optionsHtml.connections = false; + optionsTxt.connections = false; + } else { + optionsHtml.connections = connections.join('
\r\n'); + optionsTxt.connections = connections.join('\r\n'); + } + if ((disconnections == null) || (disconnections.length == 0)) { + optionsHtml.disconnections = false; + optionsTxt.disconnections = false; + } else { + optionsHtml.disconnections = disconnections.join('
\r\n'); + optionsTxt.disconnections = disconnections.join('\r\n'); + } + + // Get from field + var from = null; + if (obj.config.sendgrid && (typeof obj.config.sendgrid.from == 'string')) { from = obj.config.sendgrid.from; } + else if (obj.config.smtp && (typeof obj.config.smtp.from == 'string')) { from = obj.config.smtp.from; } + + // Send the email + obj.pendingMails.push({ to: email, from: from, subject: mailReplacements(template.htmlSubject, domain, optionsTxt), text: mailReplacements(template.txt, domain, optionsTxt), html: mailReplacements(template.html, domain, optionsHtml) }); + sendNextMail(); + } + }); + }; + // Send out the next mail in the pending list function sendNextMail() { if ((obj.sendingMail == true) || (obj.pendingMails.length == 0)) { return; } @@ -463,7 +510,7 @@ module.exports.CreateMeshMail = function (parent, domain) { // Add the user and start a timer if (obj.deviceNotifications[user._id] == null) { obj.deviceNotifications[user._id] = { nodes: {} }; - obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 20000); + obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 5 * 60 * 1000); // 5 minute before email is sent } // Add the device @@ -527,7 +574,7 @@ module.exports.CreateMeshMail = function (parent, domain) { // Add the user and start a timer if (obj.deviceNotifications[user._id] == null) { obj.deviceNotifications[user._id] = { nodes: {} }; - obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 20000); + obj.deviceNotifications[user._id].timer = setTimeout(function () { sendDeviceNotifications(user._id); }, 5 * 60 * 1000); // 5 minute before email is sent } // Add the device @@ -617,9 +664,16 @@ module.exports.CreateMeshMail = function (parent, domain) { connections.sort(sortCollator.compare); disconnections.sort(sortCollator.compare); - // TODO: Send the email - //console.log('sendDeviceNotifications', connections, disconnections); + // Get the user and domain + const user = parent.webserver.users[userid]; + if ((user == null) || (user.email == null) || (user.emailVerified !== true)) return; + const domain = obj.parent.config.domains[user.domain]; + if (domain == null) return; + // Send the email + obj.sendDeviceNotifyMail(domain, user.name, user.email, connections, disconnections, 'us-en', null); + + // Clean up delete obj.deviceNotifications[userid]; } diff --git a/package.json b/package.json index bbe305be..59c4d3a4 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,6 @@ "sample-config-advanced.json" ], "dependencies": { - "archiver": "^4.0.2", - "archiver-zip-encrypted": "^1.0.10", "body-parser": "^1.19.0", "cbor": "~5.2.0", "compression": "^1.7.4", @@ -45,24 +43,13 @@ "express": "^4.17.0", "express-handlebars": "^3.1.0", "express-ws": "^4.0.0", - "image-size": "^1.0.0", "ipcheck": "^0.1.0", - "loadavg-windows": "^1.1.1", "minimist": "^1.2.0", - "mongodb": "^4.1.0", "multiparty": "^4.2.1", "nedb": "^1.8.0", "node-forge": "^0.10.0", - "node-rdpjs-2": "^0.3.5", - "node-windows": "^1.0.0-beta.6", - "nodemailer": "^6.6.5", - "otplib": "^10.2.3", - "saslprep": "^1.0.3", - "ssh2": "^1.4.0", - "web-push": "^3.4.5", "ws": "^5.2.3", - "yauzl": "^2.10.0", - "yubikeyotp": "^0.2.0" + "yauzl": "^2.10.0" }, "repository": { "type": "git", diff --git a/translate/translate.js b/translate/translate.js index 4588c041..2e761dfc 100644 --- a/translate/translate.js +++ b/translate/translate.js @@ -44,11 +44,13 @@ var meshCentralSourceFiles = [ "../emails/account-login.html", "../emails/account-reset.html", "../emails/mesh-invite.html", + "../emails/device-notify.html", "../emails/account-check.txt", "../emails/account-invite.txt", "../emails/account-login.txt", "../emails/account-reset.txt", "../emails/mesh-invite.txt", + "../emails/device-notify.txt", "../emails/sms-messages.txt", '../agents/agent-translations.json' ]; diff --git a/translate/translate.json b/translate/translate.json index cb00d44a..48c7184b 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -14242,6 +14242,13 @@ "default.handlebars->37->2673" ] }, + { + "en": "Connected devices:", + "xloc": [ + "device-notify.html->2->5->1", + "device-notify.txt" + ] + }, { "cs": "Připojeno hned", "de": "Jetzt verbunden", @@ -19269,6 +19276,13 @@ "xterm.handlebars->9->1" ] }, + { + "en": "Disconnected devices:", + "xloc": [ + "device-notify.html->2->7->1", + "device-notify.txt" + ] + }, { "cs": "Zavrhnout", "de": "Verwerfen", @@ -56354,6 +56368,13 @@ "default.handlebars->37->1590" ] }, + { + "en": "The folloing devices have changed their connection state.", + "xloc": [ + "device-notify.html->2->3->1", + "device-notify.txt" + ] + }, { "cs": "Níže jsou uvedena požadovaná zveřejnění součástí a softwaru s otevřeným zdrojovým kódem začleněných do tohoto softwaru.", "de": "Im Folgenden sind die erforderlichen Angaben zu Open Source-Komponenten und -Software aufgeführt, die in dieser Software enthalten sind.", @@ -57612,6 +57633,18 @@ "agentinvite.handlebars->container->column_l->5->linuxtab->9" ] }, + { + "en": "To unsubscribe,", + "xloc": [ + "device-notify.html->2->9->1" + ] + }, + { + "en": "To unsubscribe, load this link within 1 hour of getting this message: [[[SERVERURL]]][[[UNSUBSCRIBELINK]]]", + "xloc": [ + "device-notify.txt" + ] + }, { "cs": "Oznámení přípitku", "de": "Toastbenachrichtigung", @@ -64580,6 +64613,18 @@ "sms-messages.txt" ] }, + { + "en": "[[[CONNECTIONS]]]", + "xloc": [ + "device-notify.html->2->5->3->0" + ] + }, + { + "en": "[[[DISCONNECTIONS]]]", + "xloc": [ + "device-notify.html->2->7->3->0" + ] + }, { "cs": "[[[SERVERNAME]]]", "de": "[[[SERVERNAME]]]", @@ -64707,6 +64752,14 @@ "mesh-invite.html->2->1->1->0->1->1" ] }, + { + "en": "[[[SERVERNAME]]] - Device Notification", + "xloc": [ + "device-notify.html->0", + "device-notify.html->2->1->1->0->1->1", + "device-notify.txt" + ] + }, { "cs": "[[[SERVERNAME]]] - Ověření e-mailem", "de": "[[[SERVERNAME]]] - E-Mail-Überprüfung", @@ -65149,6 +65202,7 @@ "zh-chs": "点击这里", "zh-cht": "點擊這裡", "xloc": [ + "device-notify.html->2->9->1->1", "mesh-invite.html->2->15->1->1" ] }, @@ -67022,6 +67076,12 @@ "zh-chs": "v0.8.0", "zh-cht": "v0.8.0" }, + { + "en": "within 1 hour of getting this message.", + "xloc": [ + "device-notify.html->2->9->1" + ] + }, { "cs": "{0}", "de": "{0}",