aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
Diffstat (limited to 'rules')
-rw-r--r--rules/controller/fuzzy.lua22
1 files changed, 21 insertions, 1 deletions
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
+ },
+}