Difference between revisions of "Mesh/Firmware/Web Admin Development"

Jump to navigation Jump to search
no edit summary
Line 1: Line 1:


See [[Mesh/Firmware|Firmware Wants]] for a description of what we're hoping to be able to implement with our web admin page.
This used to be a page on our old Luci-based web admin UI, but that UI is being deprecated.


The code for the web admin is hosted here:
We are now writing [https://github.com/sudomesh/sudowrt-web-ui a new UI] that uses ubus via uhttpd-mod-ubus instead of Luci.


https://github.com/sudomesh/luci-app-peopleswifi
ubus is the system bus for OpenWRT, similar to D-Bus but very light-weight. Using ubus it is possible to configure all OpenWRT config files in the /etc/config directory, and even run scripts on the router. uhttpd-mod-ubus allows access to ubus over http with access restricted by access control lists. More info on this [http://wiki.openwrt.org/doc/techref/ubus#access_to_ubus_over_http here].


= Luci =
The new UI includes a simulator (written in node.js) that pretends to be a sudowrt router, which makes it easy for developers to test their client-side code without having to always have a sudowrt router with them.
 
Luci is the web admin framework that OpenWrt ships with and seems to be a popular choice among other projects. It is written in Lua, which is a sort of procedural language that's kind of a mix between javascript and ruby (??).
 
All of the Luci code is contained on the router in /usr/lib/lua/luci
 
Documentation related to the Luci project can be found at:
 
[http://luci.subsignal.org/trac/wiki/Documentation Luci Documentation]
 
Its a MVC framework, and files are separated into controller/ model/ and view/
 
There's a fairly similar package that we can probably take some cues from:
 
[https://github.com/openwrt-routing/packages/tree/master/luci-app-bmx6 bmx6 Luci Package]
 
We'll likely need every AP to serve a private WPA encrypted AP even if users have their own home router so that they can config the routers securely.
 
== Debugging ==
 
Luci is run as a cgi script. The script is at:
 
  /www/cgi-bin/luci
 
Luci has a caching system, which should be disabled when debugging, to ensure that requests are not being answered from the cache. To disable caching, change /www/cgi-bin/luci by commenting out the following lines:
 
-- require "luci.cacheloader"
-- luci.dispatcher.indexcache = "/tmp/luci-indexcache"
 
You can run /www/cgi-bin/luci from the command line like so:
 
REQUEST_URI="/cgi-bin/luci HTTP/1.1" QUERY_STRING="username=root&password=<password>" /www/cgi-bin/luci
 
The [http://en.wikipedia.org/wiki/Common_Gateway_Interface wikipedia article for CGI] has a list of other environment variables that can be set to pass data to a cgi script.

Navigation menu