]> git.proxmox.com Git - proxmox.git/commit
notify: switch to file-based templating system
authorLukas Wagner <l.wagner@proxmox.com>
Fri, 19 Apr 2024 14:17:04 +0000 (16:17 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 23 Apr 2024 21:06:52 +0000 (23:06 +0200)
commit1516cc26d2362f71d53c8fdd4ca0a25e18f0414c
tree7d22378e6f2b6e00918e68e33636923ea690cfeb
parent42fb9ed26bc021525889afa491184219edf146b0
notify: switch to file-based templating system

Instead of passing the template strings for subject and body when
constructing a notification, we pass only the name of a template.
When rendering the template, the name of the template is used to find
corresponding template files. For PVE, they are located at
/usr/share/proxmox-ve/templates/default. The `default` part is
the 'template namespace', which is a preparation for user-customizable
and/or translatable notifications.

Previously, the same template string was used to render HTML and
plaintext notifications. This was achieved by providing some template
helpers that 'abstract away' HTML/plaintext formatting. However,
in hindsight this turned out to be pretty finicky. Since the
current changes lay the foundations for user-customizable notification
templates, I ripped these abstractions out. Now there are simply two
templates, one for plaintext, one for HTML.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Folke Gleumes <f.gleumes@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
13 files changed:
proxmox-notify/examples/render.rs [deleted file]
proxmox-notify/src/context/mod.rs
proxmox-notify/src/context/pbs.rs
proxmox-notify/src/context/pve.rs
proxmox-notify/src/context/test.rs
proxmox-notify/src/endpoints/gotify.rs
proxmox-notify/src/endpoints/sendmail.rs
proxmox-notify/src/endpoints/smtp.rs
proxmox-notify/src/lib.rs
proxmox-notify/src/matcher.rs
proxmox-notify/src/renderer/html.rs
proxmox-notify/src/renderer/mod.rs
proxmox-notify/src/renderer/plaintext.rs