To implement the development of the Router configuration page on the router
Is the router, after the label, the management path is generally 192.168.1.1 or 192.168.0.1
To implement a set of such small projects
The project content is very small, the individual is interested, therefore took the task
Router comes with Nginx LUA support
Any web development, as long as there is a clear REQUEST,RESPONSE,MVC structure, it is easy to get started.
Front-end Reference js/jquery.idtabs.min.js
Back-end Sample code
#!/usr/bin/env lualocal JSON = require "Los.json" local util = Require "los.util"--Configuration file path wifiplacedatapath= "/etc/ Testconfig.data "--Set Local function set_placeinfo (data) Local str=" "Util.exec (' rm-rf ': Wifiplacedatapath) For k,v in pairs (data) does if k~= "Act" then Util.exec ("echo"). K.. "|" .. V.. ">>". Wifiplacedatapath) End End Ngx.print (Json.encode ({status=0})) end--read function getplaceinfo () local bw = IO.O Pen (wifiplacedatapath) Local wifidata={} if bw then local Bwraw = Bw:read ("*a") Local tabs= split ( Bwraw, "\ n") for I=1, #tabs does if Tabs[i]~=nil and tabs[i]~= ' then local subtabs=split (tabs[i ],"|") WIFIDATA[SUBTABS[1]]=SUBTABS[2] End END end return wifidataendlocal function Get_placeinfo () Local Wifidata=getplaceinfo () Ngx.print (Json.encode (wifidata)) end--route local function parser () Local args = Ngx.req.get _uri_args () if ToString (args. act) = = "Get" Thenget_placeinfo () ElseIf tostring (args.act) = = "Set" Thenset_placeinfo (args) endendparser () Local function split (str, delimiter) if Str==nil or str== "or delimiter==nil thenreturn nilend local result = {} for Match In (str.. Delimiter): Gmatch ("(.-)". Delimiter) do Table.insert (result, match) end return Resultend
OPENWRT Web Development Lua language