I've got an idea for a my NanoPi R1 – One of the online communities I'm involved in has a need for a networking appliance that members can use for helping to find other members for online multiplayer games. I'd like to make a firmware for the NanoPi so that members can get one and then download my firmware image. Since most members won't want to deal with the intricacies of setting it up, I want to make a "setup wizard" that will show when the web gui is first accessed – all the commonly needed functionality to get the device set up and running on the network. I've got my build environment working pretty well now (on Mac OS no less!), so the next step is developing my "Setup Wizard" for LuCI.
I certainly don't want to be walked through how to do all of this, but figured I'd describe what I'm doing on the off chance anyone can provide some resources or point me in the right direction for developing such functionality, using the most accepted practices.
I'd like to make this as a module that has "pages", like you'd imagine a setup wizard would use. Only one main menu item in the LuCI menu that links to the "master" or "template" wizard page with next and back buttons that will load in the "child" pages, possibly as an array of includes? Can't find any good examples of how to do this though.
I would like to have the child pages include:
A welcome page that describes what will need to be done to get the device set up.
I can't find any good examples of how to just format simple text on a page. I know it sounds silly, but ever since this change from Lua to JS, just putting a string of text as a page title seems to involve like 40 lines of javascript and probably 500,000 clock cycles on the client CPU... all to offload 100 clock cycles of Lua on the router?
A "Connect to your network" page (device will operate as Wifi client or Ethernet). I've been able to "include" the wireless.js module and have it work just fine, but that's with no changes at all and I fully realize that as soon as I change something I'm going to break it because these modules seem woefully complex. For example, I'd like to have a radio button that selects between using ethernet or wifi, and then conditionally load either Wifi setup or Ethernet setup page in the wizard as the next step. I'm not sure how to link to/load/append a page without it showing in the menu (since the only way to have a "path" for a page that I know of is to have it in the menu json, which adds it to the menu). I found a few places where "show different things based on a drop-down" functionality is implemented in the OpenWrt web gui so will be studying that, but still feel like I'll struggle getting this into a "wizard" interface given how complex the javascript seems to be in LuCI.
The reason I ask here, is because I'm having difficulty finding good tutorials and learning material for LuCI. For example, even the official developer guide shows writing a module in Lua, which as I understand, is old and deprecated and we're supposed to do everything with billions of lines of javascript now right?
Can I still write it in Lua? Should I? Why does so much of the documentation seem unaware of such a drastic fundamental change to how LuCI modules are written?
Thanks!