I've been using Luci-argon-theme for a lot of time, but the latest changes in Luci are heavily affecting not only Argon but also other less-known themes, mostly used in China, where OpenWrt is a way to bypass the great wall.
I have seen that before, Luci was able to use sysauth.htm located at the old path /usr/lib/lua/luci/view/themes/THEME_NAME/sysauth.htm without any issue, a file using Lua code embedded in HTML
That seems to be deprecated, instead the new sysauth file seems to be sysauth.ut located at /usr/share/ucode/luci/template/themes/THEME_NAME/sysauth.ut, and the current file uses embedded js instead of lua code.
Was this change necessary? Luci is still based in lua, What was the reason to deprecate the use of lua in those places?
Any idea on how to use lua script in the sysauth.ut file, A way to restore previous capability, or any other creative solution other than translating the lua code into js?
to read from a config file is now difficult to implement. I could rewrite all in shell script and just do system('myscript.sh',0) to do all the job creating the page code, but I hope ucode could do something better.
Any idea on to implement the previous lua instruction in ucode?
I hope we are doing all this for the larger good. saving 120 KB is not reason enough to create all this mess.
Any resource on where to get more .ut files to learn about how to do things from now on?
I realize that, but I am afraid that at this point we don't have a proper server side ucode API. Not even the wiki considers ucode and the templates and instructions are all of them for Lua. I am having a hard time to test ut (ucode template) files using ucode -T. There are a reduced number of examples, so far only the themes.
I would like to have proper documentation of the new API >>before<< deprecating the previous one.
Affecting how, exactly? They should still work as before, provided the luci-lua-runtime package is installed. If not this is a bug that should be fixed, please open an issue in the LuCI Github repo in this case.
No, if the Lua runtime is installed LuCI will first try to locate an ucode template and if that fails, it should fallback to the Lua based .htm one. If this isn't working then there's a bug we should fix.
The current default package set in LuCI master does not depend on Lua anymore. Only apps which have not been converted require it still, for those there's the luci-lua-runtime package available.
As written above, you should still be able to use the sysauth.htm file at the previous location.
let ctx = require("uci").cursor();
let primary = ctx.get_first("argon", "global", "primary");
Thanks @jow I thought ucode was already replacing lua, even more after the snapshots were not rendering /usr/lib/lua/luci/view/themes/argon/sysauth.htm.
For some reason, latest Luci releases are executing /usr/share/ucode/luci/template/sysauth.ut instead of /usr/lib/lua/luci/view/themes/argon/sysauth.htm. However, it renders properly the headers and the footers in htm format, so it seems that only the sysauth detection is failing.
Following your instructions I have reported the issue #6105 in Github.