From dae26844132e7565a1a1d90fa5fb9632a2ef2270 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 21 Aug 2023 15:44:36 +0200 Subject: [PATCH] luci-lua-runtime: dispatcher.lua: re-add post_on() dispatch action Existing legacy Lua controllers still use the `post_on()` node dispatch action, so restore this functionality. Fixes: #6531 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 18b637fed9f58b7a3f146a004ecd5b0aef2cb058) --- modules/luci-lua-runtime/luasrc/dispatcher.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/luci-lua-runtime/luasrc/dispatcher.lua b/modules/luci-lua-runtime/luasrc/dispatcher.lua index 816c9f35e3..bbe7600c44 100644 --- a/modules/luci-lua-runtime/luasrc/dispatcher.lua +++ b/modules/luci-lua-runtime/luasrc/dispatcher.lua @@ -386,16 +386,20 @@ function call(name, ...) } end -function post(name, ...) +function post_on(params, name, ...) return { ["type"] = "call", ["module"] = __controller, ["function"] = name, ["parameters"] = select('#', ...) > 0 and {...} or nil, - ["post"] = true + ["post"] = params } end +function post(...) + return post_on(true, ...) +end + function view(name) return { ["type"] = "view", -- 2.30.2