From 8366075488d478e8f8df33141f97f7059b7b1ea7 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Tue, 23 Oct 2018 17:34:06 +0800 Subject: [PATCH] add new ipk luci-app-webadmin --- package/lean/luci-app-webadmin/Makefile | 18 +++++++ .../luasrc/controller/webadmin.lua | 17 +++++++ .../luasrc/model/cbi/webadmin.lua | 50 +++++++++++++++++++ .../luci-app-webadmin/po/zh-cn/webadmin.po | 41 +++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 package/lean/luci-app-webadmin/Makefile create mode 100644 package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua create mode 100644 package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua create mode 100644 package/lean/luci-app-webadmin/po/zh-cn/webadmin.po diff --git a/package/lean/luci-app-webadmin/Makefile b/package/lean/luci-app-webadmin/Makefile new file mode 100644 index 0000000000..48d42b2a71 --- /dev/null +++ b/package/lean/luci-app-webadmin/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI page for Web Admin +LUCI_DEPENDS:=+uhttpd +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua b/package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua new file mode 100644 index 0000000000..5d33f4a5ee --- /dev/null +++ b/package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua @@ -0,0 +1,17 @@ +-- Copyright 2015 Daniel Dickinson +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.webadmin", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/uhttpd") then + return + end + + local page + + page = entry({"admin", "system", "webadmin"}, cbi("webadmin"), _("Web Admin"), 1) + page.leaf = true + +end + diff --git a/package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua b/package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua new file mode 100644 index 0000000000..d0444e8c78 --- /dev/null +++ b/package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua @@ -0,0 +1,50 @@ +-- Copyright 2015 Daniel Dickinson +-- Licensed to the public under the Apache License 2.0. + +local fs = require("nixio.fs") + +local m = Map("uhttpd", translate("Web Admin Settings"), + translate("Web Admin Settings Page")) + +local ucs = m:section(TypedSection, "uhttpd") +ucs.addremove = false +ucs.anonymous = false + +lhttp = ucs:option(DynamicList, "listen_http", translate("HTTP listeners (address:port)"), translate("Bind to specific interface:port (by specifying interface address")) +lhttp.datatype = "list(ipaddrport(1))" + +function lhttp.validate(self, value, section) + local have_https_listener = false + local have_http_listener = false + if lhttp and lhttp:formvalue(section) and (#(lhttp:formvalue(section)) > 0) then + for k, v in pairs(lhttp:formvalue(section)) do + if v and (v ~= "") then + have_http_listener = true + break + end + end + end + if lhttps and lhttps:formvalue(section) and (#(lhttps:formvalue(section)) > 0) then + for k, v in pairs(lhttps:formvalue(section)) do + if v and (v ~= "") then + have_https_listener = true + break + end + end + end + if not (have_http_listener or have_https_listener) then + return nil, "must listen on at list one address:port" + end + return DynamicList.validate(self, value, section) +end + +o = ucs:option(Flag, "redirect_https", translate("Redirect all HTTP to HTTPS")) +o.default = o.enabled +o.rmempty = false +o.description = translate("Redirect all HTTP to HTTPS when SSl cert was installed") + +o = ucs:option(Flag, "rfc1918_filter", translate("Ignore private IPs on public interface"), translate("Prevent access from private (RFC1918) IPs on an interface if it has an public IP address")) +o.default = o.enabled +o.rmempty = false + +return m diff --git a/package/lean/luci-app-webadmin/po/zh-cn/webadmin.po b/package/lean/luci-app-webadmin/po/zh-cn/webadmin.po new file mode 100644 index 0000000000..7478d4e4b9 --- /dev/null +++ b/package/lean/luci-app-webadmin/po/zh-cn/webadmin.po @@ -0,0 +1,41 @@ +msgid "" +msgstr "" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "Web Admin" +msgstr "路由器Web管理页面" + +msgid "Web Admin Settings" +msgstr "路由器Web管理页面设置" + +msgid "Web Admin Settings Page" +msgstr "设置更改路由器Web管理页面端口,绑定地址,是否允许从互联网访问等" + +msgid "HTTP listeners (address:port)"" +msgstr "HTTP 监听 (IP地址:端口)"" + +msgid "Bind to specific interface:port (by specifying interface address" +msgstr "绑定到指定的IP地址:端口" + +msgid "Redirect all HTTP to HTTPS" +msgstr "重定向HTTP到HTTPS" + +msgid "Redirect all HTTP to HTTPS when SSl cert was installed" +msgstr "当安装了SSL证书后,重定向HTTP到HTTPS管理页面" + +msgid "Auto activate" +msgstr "自动激活局域网客户端" + +msgid "configfile" +msgstr "配置文件" + +msgid "Ignore private IPs on public interface" +msgstr "只允许内网访问" + +msgid "Prevent access from private (RFC1918) IPs on an interface if it has an public IP address" +msgstr "拒绝从互联网访问Web管理页面" +