luci-lua-runtime: dispatcher.lua: re-add post_on() dispatch action
authorJo-Philipp Wich <jo@mein.io>
Mon, 21 Aug 2023 13:44:36 +0000 (15:44 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 21 Aug 2023 13:44:36 +0000 (15:44 +0200)
Existing legacy Lua controllers still use the `post_on()` node dispatch
action, so restore this functionality.

Fixes: #6531
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-lua-runtime/luasrc/dispatcher.lua

index 816c9f35e342deeaf285996237144d2bd26183d8..bbe7600c448c3a3026eaca656a741377aa72e9f7 100644 (file)
@@ -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",