notifications

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2025-01-16 17:01:27 +01:00
parent 61b48a2580
commit 9d29d8ce0f
6 changed files with 39 additions and 39 deletions

View File

@@ -23,10 +23,10 @@ In addition, the notifications service supports custom templates. Custom email t
{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/html/email.html.tmpl
{NOTIFICATIONS_EMAIL_TEMPLATE_PATH}/templates/html/img/
```
The source templates provided by ocis you can derive from are located in the following base folder [https://github.com/owncloud/ocis/tree/master/services/notifications/pkg/email/templates](https://github.com/owncloud/ocis/tree/master/services/notifications/pkg/email/templates) with subfolders `templates/text` and `templates/html`.
The source templates provided by OpenCloud you can derive from are located in the following base folder [https://github.com/opencloud-eu/opencloud/tree/master/services/notifications/pkg/email/templates](https://github.com/opencloud-eu/opencloud/tree/master/services/notifications/pkg/email/templates) with subfolders `templates/text` and `templates/html`.
- [text/email.text.tmpl](https://github.com/owncloud/ocis/blob/master/services/notifications/pkg/email/templates/text/email.text.tmpl)
- [html/email.html.tmpl](https://github.com/owncloud/ocis/blob/master/services/notifications/pkg/email/templates/html/email.html.tmpl)
- [text/email.text.tmpl](https://github.com/opencloud-eu/opencloud/blob/master/services/notifications/pkg/email/templates/text/email.text.tmpl)
- [html/email.html.tmpl](https://github.com/opencloud-eu/opencloud/blob/master/services/notifications/pkg/email/templates/html/email.html.tmpl)
### Templates subfolder hierarchy
```text
@@ -43,7 +43,7 @@ templates
```
Custom email templates referenced via `NOTIFICATIONS_EMAIL_TEMPLATE_PATH` must also be located in subfolder `templates/text` and `templates/html` and must have the same names as the embedded templates. It is important that the names of these files and folders match the embedded ones.
The `templates/html` subfolder contains a default HTML template provided by ocis. When using a custom HTML template, hosted images can either be linked with standard HTML code like ```<img src="https://raw.githubusercontent.com/owncloud/core/master/core/img/logo-mail.gif" alt="logo-mail"/>``` or embedded as a CID source ```<img src="cid:logo-mail.gif" alt="logo-mail"/>```. In the latter case, image files must be located in the `templates/html/img` subfolder. Supported embedded image types are png, jpeg, and gif.
The `templates/html` subfolder contains a default HTML template provided by OpenCloud. When using a custom HTML template, hosted images can either be linked with standard HTML code like ```<img src="https://raw.githubusercontent.com/opencloud-eu/opencloud/master/opencloud/img/logo-mail.gif" alt="logo-mail"/>``` or embedded as a CID source ```<img src="cid:logo-mail.gif" alt="logo-mail"/>```. In the latter case, image files must be located in the `templates/html/img` subfolder. Supported embedded image types are png, jpeg, and gif.
Consider that embedding images via a CID resource may not be fully supported in all email web clients.
## Sending Grouped Emails
@@ -54,7 +54,7 @@ Grouped events are stored for the TTL defined in `OC_PERSISTENT_STORE_TTL`. This
Grouped events that have passed the TTL are removed automatically without further notice or sending!
To initiate sending grouped emails like via a cron job, use the `ocis notifications send-email` command. Note that the command mandatory requires at least one option which is `--daily` or `--weekly`. Note that both options can be used together.
To initiate sending grouped emails like via a cron job, use the `opencloud notifications send-email` command. Note that the command mandatory requires at least one option which is `--daily` or `--weekly`. Note that both options can be used together.
### Storing
@@ -92,7 +92,7 @@ For example, for the language `de`, one needs to place the corresponding transla
<!-- also see the userlog readme -->
Important: For the time being, the embedded ownCloud Web frontend only supports the main language code but does not handle any territory. When strings are available in the language code `language_territory`, the web frontend does not see it as it only requests `language`. In consequence, any translations made must exist in the requested `language` to avoid a fallback to the default.
Important: For the time being, the embedded OpenCloud Web frontend only supports the main language code but does not handle any territory. When strings are available in the language code `language_territory`, the web frontend does not see it as it only requests `language`. In consequence, any translations made must exist in the requested `language` to avoid a fallback to the default.
### Translation Rules

View File

@@ -11,7 +11,7 @@ func Test_appendSender(t *testing.T) {
a mail.Address
}
a1, err := mail.ParseAddress("ownCloud <noreply@example.com>")
a1, err := mail.ParseAddress("OpenCloud <noreply@example.com>")
if err != nil {
t.Error(err)
}
@@ -29,25 +29,25 @@ func Test_appendSender(t *testing.T) {
{
name: "empty sender",
sender: "",
want1: `"ownCloud" <noreply@example.com>`,
want1: `"OpenCloud" <noreply@example.com>`,
want2: `<noreply@example.com>`,
},
{
name: "not empty sender",
sender: `Joe Q. Public`,
want1: `"Joe Q. Public via ownCloud" <noreply@example.com>`,
want1: `"Joe Q. Public via OpenCloud" <noreply@example.com>`,
want2: `"Joe Q. Public via" <noreply@example.com>`,
},
{
name: "sender whit comma and semicolon",
sender: `Joe, Q; Public:`,
want1: `"Joe, Q; Public: via ownCloud" <noreply@example.com>`,
want1: `"Joe, Q; Public: via OpenCloud" <noreply@example.com>`,
want2: `"Joe, Q; Public: via" <noreply@example.com>`,
},
{
name: "sender with quotes",
sender: `Joe Q. "Public"`,
want1: `"Joe Q. \"Public\" via ownCloud" <noreply@example.com>`,
want1: `"Joe Q. \"Public\" via OpenCloud" <noreply@example.com>`,
want2: `"Joe Q. \"Public\" via" <noreply@example.com>`,
},
}

View File

@@ -18,7 +18,7 @@ type Config struct {
Log *Log `yaml:"log"`
Debug Debug `yaml:"debug"`
WebUIURL string `yaml:"ocis_url" env:"OC_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the oCIS Web UI, used e.g. when sending notification eMails" introductionVersion:"pre5.0"`
WebUIURL string `yaml:"opencloud_url" env:"OC_URL;NOTIFICATIONS_WEB_UI_URL" desc:"The public facing URL of the OpenCloud Web UI, used e.g. when sending notification eMails" introductionVersion:"pre5.0"`
Notifications Notifications `yaml:"notifications"`
GRPCClientTLS shared.GRPCClientTLS `yaml:"grpc_client_tls"`
@@ -44,7 +44,7 @@ type Notifications struct {
type SMTP struct {
Host string `yaml:"smtp_host" env:"NOTIFICATIONS_SMTP_HOST" desc:"SMTP host to connect to." introductionVersion:"pre5.0"`
Port int `yaml:"smtp_port" env:"NOTIFICATIONS_SMTP_PORT" desc:"Port of the SMTP host to connect to." introductionVersion:"pre5.0"`
Sender string `yaml:"smtp_sender" env:"NOTIFICATIONS_SMTP_SENDER" desc:"Sender address of emails that will be sent (e.g. 'ownCloud <noreply@example.com>'." introductionVersion:"pre5.0"`
Sender string `yaml:"smtp_sender" env:"NOTIFICATIONS_SMTP_SENDER" desc:"Sender address of emails that will be sent (e.g. 'OpenCloud <noreply@example.com>'." introductionVersion:"pre5.0"`
Username string `yaml:"smtp_username" env:"NOTIFICATIONS_SMTP_USERNAME" desc:"Username for the SMTP host to connect to." introductionVersion:"pre5.0"`
Password string `yaml:"smtp_password" env:"NOTIFICATIONS_SMTP_PASSWORD" desc:"Password for the SMTP host to connect to." introductionVersion:"pre5.0"`
Insecure bool `yaml:"insecure" env:"NOTIFICATIONS_SMTP_INSECURE" desc:"Allow insecure connections to the SMTP server." introductionVersion:"pre5.0"`

View File

@@ -25,8 +25,8 @@
<br>
<br>
--- <br>
ownCloud - Store. Share. Work.<br>
<a href="https://owncloud.com">https://owncloud.com</a>
OpenCloud - a safe home for all your data<br>
<a href="https://opencloud.eu">https://opencloud.eu</a>
</footer>
</td>
</tr>

View File

@@ -6,5 +6,5 @@
{{end}}
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu

View File

@@ -37,14 +37,14 @@ var _ = Describe("Notifications", func() {
Id: &user.UserId{
OpaqueId: "sharer",
},
Mail: "sharer@owncloud.com",
Mail: "sharer@opencloud.eu",
DisplayName: "Dr. S. Harer",
}
sharee = &user.User{
Id: &user.UserId{
OpaqueId: "sharee",
},
Mail: "sharee@owncloud.com",
Mail: "sharee@opencloud.eu",
DisplayName: "Eric Expireling",
}
resourceid = &provider.ResourceId{
@@ -118,8 +118,8 @@ Click here to view it: files/shares/with-me
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedSender: sharer.GetDisplayName(),
done: make(chan struct{}),
@@ -143,8 +143,8 @@ Even though this share has been revoked you still might have access through othe
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedSender: sharer.GetDisplayName(),
done: make(chan struct{}),
@@ -168,8 +168,8 @@ Click here to view it: f/spaceid
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedSender: sharer.GetDisplayName(),
done: make(chan struct{}),
@@ -195,8 +195,8 @@ Click here to check it: f/spaceid
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedSender: sharer.GetDisplayName(),
done: make(chan struct{}),
@@ -219,8 +219,8 @@ Even though this membership has expired you still might have access through othe
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedSender: sharer.GetDisplayName(),
done: make(chan struct{}),
@@ -245,14 +245,14 @@ var _ = Describe("Notifications X-Site Scripting", func() {
Id: &user.UserId{
OpaqueId: "sharer",
},
Mail: "sharer@owncloud.com",
Mail: "sharer@opencloud.eu",
DisplayName: "Dr. O'reilly",
}
sharee = &user.User{
Id: &user.UserId{
OpaqueId: "sharee",
},
Mail: "sharee@owncloud.com",
Mail: "sharee@opencloud.eu",
DisplayName: "<script>alert('Eric Expireling');</script>",
}
resourceid = &provider.ResourceId{
@@ -331,8 +331,8 @@ Click here to view it: files/shares/with-me
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedHTMLBody: `<!DOCTYPE html>
<html>
@@ -361,8 +361,8 @@ https://owncloud.com
<br>
<br>
--- <br>
ownCloud - Store. Share. Work.<br>
<a href="https://owncloud.com">https://owncloud.com</a>
OpenCloud - a safe home for all your data<br>
<a href="https://opencloud.eu">https://opencloud.eu</a>
</footer>
</td>
</tr>
@@ -399,8 +399,8 @@ Click here to view it: f/spaceid
---
ownCloud - Store. Share. Work.
https://owncloud.com
OpenCloud - a safe home for all your data
https://opencloud.eu
`,
expectedSender: sharer.GetDisplayName(),
expectedHTMLBody: `<!DOCTYPE html>
@@ -430,8 +430,8 @@ https://owncloud.com
<br>
<br>
--- <br>
ownCloud - Store. Share. Work.<br>
<a href="https://owncloud.com">https://owncloud.com</a>
OpenCloud - a safe home for all your data<br>
<a href="https://opencloud.eu">https://opencloud.eu</a>
</footer>
</td>
</tr>