mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 19:35:13 +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,21 @@
|
||||
module("luci.controller.miaplus",package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/miaplus") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "miaplus"}, cbi("base"), _("Internet Access Schedule Control Plus"), 30).dependent = true
|
||||
entry({"admin", "services", "miaplus", "status"}, call("act_status")).leaf = true
|
||||
|
||||
entry({"admin", "services", "miaplus", "base"}, cbi("base"), _("Base Setting"), 40).leaf = true
|
||||
entry({"admin", "services", "miaplus", "advanced"}, cbi("advanced"), _("Advance Setting"), 50).leaf = true
|
||||
entry({"admin", "services", "miaplus", "template"}, cbi("template"), nil).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("iptables -L INPUT |grep MIAPLUS >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
local ds = require "luci.dispatcher"
|
||||
|
||||
a = Map("miaplus")
|
||||
|
||||
t = a:section(TypedSection, "templates")
|
||||
t.template = "cbi/tblsection"
|
||||
t.anonymous = true
|
||||
t.addremove = true
|
||||
t.sortable = true
|
||||
t.extedit = ds.build_url("admin/services/miaplus/template/%s")
|
||||
|
||||
e = t:option(Flag, "enable", translate("Enabled"))
|
||||
e.rmempty = false
|
||||
e.default = "1"
|
||||
|
||||
e = t:option(Value, "title", translate("Template"))
|
||||
e.width = "40%"
|
||||
e.optional = false
|
||||
e.default = "default"
|
||||
|
||||
return a
|
||||
@@ -0,0 +1,43 @@
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
a = Map("miaplus")
|
||||
a.title = translate("Internet Access Schedule Control Plus")
|
||||
a.description = translate("Access Schedule Control Description")
|
||||
|
||||
a:section(SimpleSection).template = "miaplus/miaplus_status"
|
||||
|
||||
t = a:section(TypedSection, "basic")
|
||||
t.anonymous = true
|
||||
|
||||
e = t:option(Flag, "enable", translate("Enabled"))
|
||||
e.rmempty = false
|
||||
|
||||
e = t:option(Flag, "strict", translate("Strict Mode"))
|
||||
e.description = translate("Strict Mode will degrade CPU performance, but it can achieve better results")
|
||||
e.rmempty = false
|
||||
|
||||
e = t:option(Flag, "ipv6enable", translate("IPV6 Enabled"))
|
||||
e.rmempty = false
|
||||
|
||||
t = a:section(TypedSection, "macbind", translate("Client Rules"))
|
||||
t.template = "cbi/tblsection"
|
||||
t.anonymous = true
|
||||
t.addremove = true
|
||||
t.sortable = true
|
||||
|
||||
e = t:option(Flag, "enable", translate("Enabled"))
|
||||
e.rmempty = false
|
||||
e.default = "1"
|
||||
|
||||
e = t:option(Value, "macaddr", translate("MAC address (Computer Name)"))
|
||||
e.rmempty = true
|
||||
luci.sys.net.mac_hints(function(t,a)
|
||||
e:value(t,"%s (%s)"%{t,a})
|
||||
end)
|
||||
|
||||
e = t:option(ListValue, "template", translate("Template"))
|
||||
uci:foreach("miaplus", "templates",
|
||||
function(s)
|
||||
e:value(s['.name'],s['title'])
|
||||
end)
|
||||
return a
|
||||
@@ -0,0 +1,51 @@
|
||||
a = Map("miaplus")
|
||||
|
||||
local section = arg[1]
|
||||
|
||||
t = a:section(TypedSection, section, translate("Rules"))
|
||||
t.template = "cbi/tblsection"
|
||||
t.anonymous = true
|
||||
t.addremove = true
|
||||
t.sortable = true
|
||||
|
||||
e = t:option(Flag, "enable", translate("Enabled"))
|
||||
e.rmempty = false
|
||||
e.default = "1"
|
||||
|
||||
e = t:option(Value, "timeon", translate("Start time"))
|
||||
e.optional = false
|
||||
e.default = "00:00"
|
||||
|
||||
e = t:option(Value, "timeoff", translate("End time"))
|
||||
e.optional=false
|
||||
e.default = "23:59"
|
||||
|
||||
e = t:option(Flag, "z1", translate("Mon"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z2", translate("Tue"))
|
||||
e.rmempty = true
|
||||
e.default=1
|
||||
|
||||
e = t:option(Flag, "z3", translate("Wed"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z4", translate("Thu"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z5", translate("Fri"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z6", translate("Sat"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
e = t:option(Flag, "z7", translate("Sun"))
|
||||
e.rmempty = true
|
||||
e.default = 1
|
||||
|
||||
return a
|
||||
@@ -0,0 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[miaplus]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('miaplus_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green><%:Internet Access Schedule Control Plus%> <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red><%:Internet Access Schedule Control Plus%> <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="miaplus_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
Reference in new issue
Block a user