diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-11-21 12:27:28 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-11-21 12:27:28 +0100 |
commit | fa17c1573f88c24a8e7d7d6dce67ad0d27486084 (patch) | |
tree | 7b5ac71ef037872a684b61d9eb8ed32aa4f57056 /modules/luci-base | |
parent | 08ae8d40a939654d2e4a1774853c5c5683b12268 (diff) |
luci-base, luci-lua-runtime: adjust Lua template environment
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>
Diffstat (limited to 'modules/luci-base')
-rw-r--r-- | modules/luci-base/ucode/dispatcher.uc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/luci-base/ucode/dispatcher.uc b/modules/luci-base/ucode/dispatcher.uc index c996c76af1..0644a756c2 100644 --- a/modules/luci-base/ucode/dispatcher.uc +++ b/modules/luci-base/ucode/dispatcher.uc @@ -774,7 +774,9 @@ function render_action(fn) { function run_action(request_path, lang, tree, resolved, action) { switch (action?.type) { case 'template': - runtime.render(action.path, {}); + render_action(() => { + runtime.call('luci.dispatcher', 'render_lua_template', action.path); + }); break; case 'view': |