aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
Diffstat (limited to 'rules')
-rw-r--r--rules/bitcoin.lua3
-rw-r--r--rules/controller/fuzzy.lua22
2 files changed, 23 insertions, 2 deletions
diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua
index 6a70721f8..bc8c65805 100644
--- a/rules/bitcoin.lua
+++ b/rules/bitcoin.lua
@@ -183,8 +183,9 @@ local btc_bleach_re = [[/\b(?:(?:[a-zA-Z]\w+:)|(?:bc1))?[qpzry9x8gf2tvdw0s3jn54k
config.regexp['BITCOIN_ADDR'] = {
description = 'Message has a valid bitcoin wallet address',
- -- Use + operator to ensure that each expression is always evaluated
re = string.format('(%s) + (%s) > 0', normal_wallet_re, btc_bleach_re),
+ -- Disable optimizations for this expression to get all addresses
+ expression_flags = { 'noopt' },
re_conditions = {
[normal_wallet_re] = function(task, txt, s, e)
local len = e - s
diff --git a/rules/controller/fuzzy.lua b/rules/controller/fuzzy.lua
index 193e6fd4c..06f5d43d9 100644
--- a/rules/controller/fuzzy.lua
+++ b/rules/controller/fuzzy.lua
@@ -37,10 +37,30 @@ local function handle_gen_fuzzy(task, conn, req_params)
end
end
+local function handle_fuzzy_storages(_task, conn)
+ if type(rspamd_plugins.fuzzy_check) == 'table'
+ and type(rspamd_plugins.fuzzy_check.list_storages) == 'function' then
+ local ok, result = pcall(rspamd_plugins.fuzzy_check.list_storages, rspamd_config)
+
+ if ok then
+ conn:send_ucl({ success = true, storages = result })
+ else
+ conn:send_error(500, 'cannot list fuzzy storages')
+ end
+ else
+ conn:send_error(404, 'fuzzy_check is not enabled')
+ end
+end
+
return {
hashes = {
handler = handle_gen_fuzzy,
need_task = true,
enable = false
},
-} \ No newline at end of file
+ storages = {
+ handler = handle_fuzzy_storages,
+ need_task = false,
+ enable = false
+ },
+}