summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-lua-runtime/luasrc/dispatcher.lua
AgeCommit message (Collapse)Author
2023-08-21luci-lua-runtime: dispatcher.lua: re-add post_on() dispatch actionJo-Philipp Wich
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>
2023-08-21luci-lua-runtime: dispatcher.lua: re-add test_post_security()Jo-Philipp Wich
While no LuCI code utilizes this function anymore, some existing legacy Lua controllers expect the function to exist, so restore it. Fixes: #6532 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-04-30luci-lua-runtime: fix legacy luci-mod-rpc authenticationJo-Philipp Wich
The legacy RPC module authentication fixup was improperly ported into the Lua dispatcher stub module, rendering legacy RPC authentication broken. Additionally, the split of the former `sysauth` cookie into `sysauth_http` and `sysauth_https` ones was also imposed upon the RPC module, without leaving the option to use just `sysauth` in place, so allow this cookie name again for the legacy RPC logins. Fixes: #6333 Fixes: e1932592c3 ("luci-base: use different cookie names for HTTP and HTTPS") Fixes: ded8ccf93e ("luci-base-ucode: add initial ucode based LuCI runtime") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-21luci-base, luci-lua-runtime: adjust Lua template environmentJo-Philipp Wich
To maintain full compatibility with the old Lua runtime, templates rendered from a menu `template()` action must implicitly inherit the `luci.dispatcher` namespace as scope while other indirectly included templates must not. Fixes: #6105 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-21luci-base, luci-lua-runtime: fix "dispatched" and "requested" propertiesJo-Philipp Wich
Ensure to properly emulate the "dispatched" and "requested" properties which refer to the executed and initially resolved menu node respectivey. Also stop exposing a `node` property in Lua context to maintain full compatibility with the old Lua runtime. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-15luci-lua-runtime: proxy all dispatcher context property accessesJo-Philipp Wich
The ucode side dispatcher environment might not be fully populated yet when the emulated Lua dispatcher is loaded, leading to `context.requested` and some other properties to be `nil`. Expose all properties through metatable `__index` lookups instead to ensure that the Lua side dispatcher always sees the latest values. Fixes: #6100 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-10luci-lua-runtime: dispatcher.lua: translate legacy node "target" propertyJo-Philipp Wich
Some legacy Lua controllers declare menu entries by first invoking `node()` and then setting the `.target` property on the resulting object. Make sure to properly translate such menu nodes into the internal menu JSON representation. Fixes: #6090 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-26luci-lua-runtime: render cbi header/footer templates via ucode runtimeJo-Philipp Wich
Trigger rendering of CBI header and footer templates via the ucode runtime `include()` in order to ensure that scope data is properly inherited from Lua templates (`cbi/header`) including ucode templates (`header`). This fixes automatic triggering of the config apply flow on legacy Lua CBI forms. Ref: https://github.com/openwrt/luci/pull/6056#issuecomment-1292396588 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-26luci-lua-runtime: fix loading header/footer templates for SimpleFormsJo-Philipp Wich
Fixes: #6054 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-26luci-lua-runtime: ensure proper forwarding of route arguments to cbi actionJo-Philipp Wich
Ensure that the optional cbi() `config` argument is set to an empty table if unspecified to ensure that the static call argument array is exactly two elements long, otherwise call arguments are shifted and the invoked method might not receive the expected parameter. This fixes, among others, the dispatching of `arcombine()` targets. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25treewide: separate Lua runtime resourcesJo-Philipp Wich
Move classes required for Lua runtime support into a new `luci-lua-runtime` package. Also replace the `luci.http` and `luci.util` classes in `luci-lib-base` with stubbed versions interacting with the ucode based runtime environment. Finally merge `luci-base-ucode` into the remainders of `luci-base`. Signed-off-by: Jo-Philipp Wich <jo@mein.io>