[Rspamd] domain-wide-footer add jinja templating

This commit is contained in:
FreddleSpl0it 2023-09-12 12:19:46 +02:00
parent f295b8cd91
commit 5ae9605e77
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -505,6 +505,7 @@ rspamd_config:register_symbol({
type = 'prefilter',
callback = function(task)
local lua_mime = require "lua_mime"
local lua_util = require "lua_util"
local rspamd_logger = require "rspamd_logger"
local rspamd_redis = require "rspamd_redis"
local ucl = require "ucl"
@ -542,6 +543,15 @@ rspamd_config:register_symbol({
if footer and type(footer) == "table" and (footer.html or footer.plain) then
rspamd_logger.infox(rspamd_config, "found domain wide footer for user %s: html=%s, plain=%s", uname, footer.html, footer.plain)
local replacements = {
email = uname
}
if footer.html then
footer.html = lua_util.jinja_template(footer.html, replacements, true)
end
if footer.plain then
footer.plain = lua_util.jinja_template(footer.plain, replacements, true)
end
-- add footer
local out = {}