Commit graph

4 commits

Author SHA1 Message Date
Jo-Philipp Wich
fa17c1573f 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>
2022-11-21 12:27:28 +01:00
Jo-Philipp Wich
fd7427c4e5 luci-lua-runtime: also search luci.dispatcher scope when looking up values
Some legacy templates access dispatcher functions such as `build_url()`
without explicit scope, which worked in the old runtime since the template
view namespace was instantiated from the dispatcher.

Ensure that this continues to function in the emulated runtime.

Fixes: #6082
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-09 20:37:54 +01:00
Karl Palsson
37468c99a3 lua-runtime: template: fix "tpl" refactoring
This fixes crashes on "tpl" being undefined.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2022-11-08 15:23:10 +00:00
Jo-Philipp Wich
673f38246a treewide: separate Lua runtime resources
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>
2022-10-25 01:03:37 +02:00
Renamed from modules/luci-base-ucode/luasrc/ucodebridge/luci/template.lua (Browse further)