S
S
Stanislav Somov2014-10-01 18:36:14
Network administration
Stanislav Somov, 2014-10-01 18:36:14

What is the logic behind the luci interface?

In the OpenWrt firmware in the www folder:
index.html - a file with a redirect to the
cgi-bin
script luci a certain script with loading something and running
luci-static - css resources and pictures for the interface
File luci

#!/usr/bin/lua
require "luci.cacheloader"
require "luci.sgi.cgi"
luci.dispatcher.indexcache = "/tmp/luci-indexcache"
luci.sgi.cgi.run()

It is not clear that he calls the luci.sgi.cgi file by find no.
/usr/lib/lua/luci/ here you can see the standard mvc on lua
While writing, I realized that luci.sgi.cgi is not a file, but apparently a call to /usr/lib/lua/luci/sgi/cgi.lua
Back to the primary task I didn’t want to fence the garden from php or python, but use the built-in lua.
You need a page with a couple of fields and a button.
By pressing which you need to send a post request.
uhttpd is given 2
main servers with port 80 and directory /www luci itself test interface with port 8080 and directory /
www1 with my index.html

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Somov, 2014-10-02
@DarkDemon


The file in the www1/cgi-bin/ directory has been slightly cleared up a lua script, or a link to lua files

#!/usr/bin/lua  --указываем интерпретатор
require("ns.start")   --вызываем lua скрипт по пути /usr/lib/lua/ns/start.lua

start.lua - the file can be a simple lua web page
local function main()
print ("Content-type: Text/html\n")
print("")
print("<!DOCTYPE html>")
print("Hello World!!!")
end
main()

T
Telecom1, 2020-09-10
@Telecom1

Perhaps, for those who are looking for, such a useful application for creating a web panel with buttons is suitable.
(web command line interface)
luci-app-commands
This article has a usage example:
phantomexos.blogspot.com/2014/03/openwrt.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question