一、我来说LuCI: LuCI官方----1. 概述

LuCI是2008年专为OpenWrt创建的项目,旨在提供一个免费、干净、可扩展且易于维护的嵌入式设备Web用户界面。它使用Lua编程语言,并通过MVC框架将界面分为模型、视图和UI部分,确保更高的性能、更小的安装尺寸和更快的运行速度。LuCI现已发展成为一系列库、应用和用户界面,服务于Lua程序员,同时也是OpenWrt Kamikaze的一部分。


中文总结:

1. LuCI 是2008年3月专为OpenWrt创建的项目;
2. LuCI保证了更高性能,更小size, 更好的可维护性--这是最重要的;
3. LuCI的MVC框架,包括libs, apps, UI;
4. LuCI采用Lua脚本编程;
5. 源码: https://github.com/openwrt/lucihttp://luci.subsignal.org/trac/browser/luci
6. 文档: http://luci.subsignal.org/trac/wiki/Documentation
7. API参考:      http://luci.subsignal.org/api/, LuCI库, nixio库:文件访问


From: http://luci.subsignal.org/,  英文原版:

About

LuCI was founded in March 2008 as "FFLuCI" as part of the efforts to create a port of the Freifunk-Firmware from OpenWrt? Whiterussian to Kamikaze.

The initial reason for this project was the absence of a free, clean, extensible and easily maintainable web user interface for embedded devices. While most similar configuration interfaces make heavy use of the Shell-scripting language LuCI uses the Lua programming language and splits up the interface into logical parts like models and views, uses object-oriented libraries and templating. That ensures a higher performance, smaller installation size, faster runtimes and what is even more important: better maintainability.

Meanwhile LuCI evolved from a MVC-Webframework to a collection of several libraries, applications and user interfaces with general purpose for Lua programmers while the focus still remains on the web user interface which also became an official part of OpenWrt? Kamikaze.

LuCI is an open and independent project. Everyone is welcome to contribute.

News

The LuCI source has been moved to  https://github.com/openwrt/luci under the umbrella of the OpenWrt? organization.

Resources

Submitting Tickets

This ticket tracker is discontinued. You can raise issues on  https://github.com/openwrt/luci/issues . Please do only open LuCI related tickets there.


Download

Stable Releases

The current stable branch is  luci-0.12. You can checkout the release via Git using:

git clone https://github.com/openwrt/luci.git
git checkout luci-0.12

Development Master

You can checkout the current working branch with:

git clone https://github.com/openwrt/luci.git

or use the  Github Source Browser


请解释下我提供的lua代码:debug.print("备份extern分区") --backup file = AES_ENC(MD5(product_name)+AES_ENC(COMPRESS(user_config_xml_file))) local product_info_md5 = md5_product_info() local product_info_md5_file = io.open("/tmp/product_info_md5_file", "w") local agile_support = uci_r:get_profile("agile_config", "support") or "no" for num in string.gmatch(product_info_md5, "%x%x") do local number = "0x"..num product_info_md5_file:write(string.char(number)) end product_info_md5_file:close() -- 备份extern分区, 如有特殊情况的分区,再特殊处理 local extern_partitions = uci_r:get_profile("backup_restore", "extern_partition") or nil if extern_partitions ~= nil then extern_partitions = util.split(extern_partitions, " ") os.execute("mkdir /tmp/backup >/dev/null 2>&1") for i, v in ipairs(extern_partitions) do if v ~= nil then debug("-----------------------backup :" .. v) local externname = "/tmp/backup/ori-backup-" .. v .. ".bin" luci.sys.exec("nvrammanager -r " .. externname .. " -p " .. v .. " >/dev/null 2>&1") local filesize = fs.stat(externname).size if (v == 'router-config' or v == 'ap-config' or v == 'repeater-config' or v == 'multissid-config' or v == 'client-config') and filesize > 0 then hide_info(externname, username) end end end luci.sys.exec("nvrammanager -r /tmp/backup/ori-backup-user-config.bin -p user-config >/dev/null 2>&1") -- don't need to hide account info as it will be ignored in store procedue... if agile_support == "no" then hide_info("/tmp/backup/ori-backup-user-config.bin", username) else hide_common_info("/tmp/backup/ori-backup-user-config.bin") end hide_rsa2048_info("/tmp/backup/ori-backup-user-config.bin") --打包 os.execute("tar -cf /tmp/ori-backup-userconf.bin -C /tmp/backup . >/dev/null 2>&1") luci.sys.exec("rm -rf /tmp/backup >/dev/null 2>&1") else luci.sys.exec("nvrammanager -r /tmp/ori-backup-userconf.bin -p user-config >/dev/null 2>&1") cry.dec_file_entry("/tmp/ori-backup-userconf.bin", "/tmp/tmp-backup-userconf.xml") luci.sys.exec("mkdir -p /tmp/backupcfg") configtool.xmlToFile("/tmp/tmp-backup-userconf.xml", "/tmp/backupcfg") -- hide cloud info config local hide_files = {"accountmgnt", "cloud_config"} if username == "superadmin" then hide_files = {"cloud_config"} end for _, f in ipairs(hide_files) do luci.sys.exec("rm -f /tmp/backupcfg/config/" .. f) end -- recreate xml config files luci.sys.exec("rm -f /tmp/ori-backup-userconf.bin;rm -f /tmp/tmp-backup-userconf.xml") configtool.convertFileToXml("/tmp/backupcfg/config", "/tmp/tmp-backup-userconf.xml") cry.enc_file_entry("/tmp/tmp-backup-userconf.xml", "/tmp/ori-backup-userconf.bin") luci.sys.exec("rm -rf /tmp/backupcfg;rm -f /tmp/tmp-backup-userconf.xml") end luci.sys.exec("cat /tmp/product_info_md5_file /tmp/ori-backup-userconf.bin > /tmp/mid-backup-userconf.bin") cry.enc_file_entry("/tmp/mid-backup-userconf.bin", "/tmp/save-backup-userconf.bin") local feedback = {http_form} if feedback[1] == true then local reader = require("io").popen("cat /tmp/save-backup-userconf.bin") luci.sys.exec("rm -f /tmp/save-backup-userconf.bin; rm -f /tmp/product_info_md5_file; rm -f /tmp/mid-backup-userconf.bin; rm -f /tmp/ori-backup-userconf.bin") uci_r:set("accountmgnt", "login", "logining", logining) uci_r:commit("accountmgnt") return reader else local reader = sys.ltn12_popen("cat /tmp/save-backup-userconf.bin") if agile_support == "no" then luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.bin"' % {configtool.getsysinfo("product_name"), os.date("%Y-%m-%d")}) else --support agile_config local agileconfig_filename = agile_config_filename(true) local productname = util.execl("getfirm HOSTNAME_NO_BLANK") if productname then debug.printf("[ag]agileconfig_filename: " .. productname[1] .. agileconfig_filename) else debug.printf("[ag]getfirm HOSTNAME_NO_BLANK failed!") uci_r:set("accountmgnt", "login", "logining", logining) uci_r:commit("accountmgnt") return false end local TPLink = uci_r:get_profile("tplink","TPLINK_TPLink") or "yes" if TPLink == "no" then luci.http.header('Content-Disposition', 'attachment; filename="%s%sn_agc3031.bin"' % { productname[1], agileconfig_filename}) else luci.http.header('Content-Disposition', 'attachment; filename="%s%sn.bin"' % { productname[1], agileconfig_filename}) end end luci.http.prepare_content("application/octet-stream") luci.ltn12.pump.all(reader, luci.http.write) luci.sys.exec("rm -f /tmp/save-backup-userconf.bin; rm -f /tmp/product_info_md5_file; rm -f /tmp/mid-backup-userconf.bin; rm -f /tmp/ori-backup-userconf.bin") end
09-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值