mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 16:44:23 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,17 @@
|
||||
-- Copyright 2018 lean <coolsnowwolf@gmail.com>
|
||||
-- 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
|
||||
page.acl_depends = { "luci-app-webadmin" }
|
||||
end
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
-- Copyright 2015 Daniel Dickinson <openwrt@daniel.thecshore.com>
|
||||
-- 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 = true
|
||||
|
||||
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
|
||||
Reference in new issue
Block a user