forked from Proxmox/proxmox
4865711339
This commit adds template rendering to the `proxmox-notify` crate, based on the `handlebars` crate. Title and body of a notification are rendered using any `properties` passed along with the notification. There are also a few helpers, allowing to render tables from `serde_json::Value`. 'Value' renderers. These can also be used in table cells using the 'renderer' property in a table schema: - {{human-bytes val}} Render bytes with human-readable units (base 2) - {{duration val}} Render a duration (based on seconds) - {{timestamp val}} Render a unix-epoch (based on seconds) There are also a few 'block-level' helpers. - {{table val}} Render a table from given val (containing a schema for the columns, as well as the table data) - {{object val}} Render a value as a pretty-printed json - {{heading_1 val}} Render a top-level heading - {{heading_2 val}} Render a not-so-top-level heading - {{verbatim val}} or {{/verbatim}}<content>{{#verbatim}} Do not reflow text. NOP for plain text, but for HTML output the text will be contained in a <pre> with a regular font. - {{verbatim-monospaced val}} or {{/verbatim-monospaced}}<content>{{#verbatim-monospaced}} Do not reflow text. NOP for plain text, but for HTML output the text will be contained in a <pre> with a monospaced font. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
29 lines
834 B
TOML
29 lines
834 B
TOML
[package]
|
|
name = "proxmox-notify"
|
|
version = "0.1.0"
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
exclude.workspace = true
|
|
|
|
[dependencies]
|
|
handlebars = { workspace = true }
|
|
lazy_static.workspace = true
|
|
log.workspace = true
|
|
openssl.workspace = true
|
|
proxmox-http = { workspace = true, features = ["client-sync"], optional = true }
|
|
proxmox-human-byte.workspace = true
|
|
proxmox-schema = { workspace = true, features = ["api-macro", "api-types"]}
|
|
proxmox-section-config = { workspace = true }
|
|
proxmox-sys = { workspace = true, optional = true }
|
|
proxmox-time.workspace = true
|
|
regex.workspace = true
|
|
serde = { workspace = true, features = ["derive"]}
|
|
serde_json.workspace = true
|
|
|
|
[features]
|
|
default = ["sendmail", "gotify"]
|
|
sendmail = ["dep:proxmox-sys"]
|
|
gotify = ["dep:proxmox-http"]
|