1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge branch 'test' into qsdk

This commit is contained in:
suyuan168 2022-05-29 12:12:21 +08:00
commit 0301f89097
32 changed files with 1436 additions and 4921 deletions

9
contributors/flesser.md Normal file
View file

@ -0,0 +1,9 @@
2022-05-20
I hereby agree to the terms of the "OpenMPTCProuter Individual Contributor License Agreement", with MD5 checksum bc827a07eb93611d793ddb7c75083c00.
I furthermore declare that I am authorized and able to make this agreement and sign this declaration.
Signed,
Florian Karuhtz https://github.com/flesser

19
luci-app-iperf/root/etc/config/iperf Executable file → Normal file
View file

@ -94,3 +94,22 @@ config server 'he'
option tcp '1' option tcp '1'
option udp '1' option udp '1'
option location 'America' option location 'America'
config server 'biznetnetworks'
option host 'iperf.biznetnetworks.com'
option ipv4 '1'
option ipv6 '1'
option ports '5201,5202,5203'
option tcp '1'
option udp '1'
option location 'Asia'
config server 'milkywan'
option host 'speedtest.milkywan.fr'
option ipv4 '1'
option ipv6 '1'
option speed '10000'
option ports '9200,9201,9202,9203,9204,9205,9206,9207,9208,9209,9210,9211,9212,9213,9214,9215'
option tcp '1'
option udp '1'
option location 'Europe'

View file

@ -26,7 +26,11 @@ end
function interface_from_device(dev) function interface_from_device(dev)
for _, iface in ipairs(net:get_networks()) do for _, iface in ipairs(net:get_networks()) do
local ifacen = iface:name() local ifacen = iface:name()
local ifacename = ucic:get("network",ifacen,"ifname") local ifacename = ""
ifacename = ucic:get("network",ifacen,"device")
if ifacename == "" then
ifacename = ucic:get("network",ifacen,"ifname")
end
if ifacename == dev then if ifacename == dev then
return ifacen return ifacen
end end
@ -34,6 +38,17 @@ function interface_from_device(dev)
return "" return ""
end end
function uci_device_from_interface(intf)
intfname = ucic:get("network",intf,"device")
deviceuci = ""
ucic:foreach("network", "device", function(s)
if intfname == ucic:get("network",s[".name"],"name") then
deviceuci = s[".name"]
end
end)
return deviceuci
end
function wizard_add() function wizard_add()
local gostatus = true local gostatus = true
@ -113,7 +128,10 @@ function wizard_add()
end) end)
local defif = "eth0" local defif = "eth0"
if add_interface_ifname == "" then if add_interface_ifname == "" then
local defif1 = ucic:get("network","wan1_dev","ifname") or "" local defif1 = ucic:get("network","wan1_dev","device") or ""
if defif1 == "" then
defif1 = ucic:get("network","wan1_dev","ifname") or ""
end
if defif1 ~= "" then if defif1 ~= "" then
defif = defif1 defif = defif1
end end
@ -126,17 +144,29 @@ function wizard_add()
if ointf ~= "" then if ointf ~= "" then
if ucic:get("network",ointf,"type") == "" then if ucic:get("network",ointf,"type") == "" then
ucic:set("network",ointf,"type","macvlan") ucic:set("network",ointf,"type","macvlan")
ucic:set("network",ointf,"device",ointf)
ucic:set("network",ointf .. "_dev","device")
ucic:set("network",ointf .. "_dev","type","macvlan")
ucic:set("network",ointf .. "_dev","mode","vepa")
ucic:set("network",ointf .. "_dev","ifname",defif)
ucic:set("network",ointf .. "_dev","name",ointf)
end end
wanif = "wan" .. i wanif = "wan" .. i
end end
ucic:set("network","wan" .. i,"interface") ucic:set("network","wan" .. i,"interface")
ucic:set("network","wan" .. i,"ifname",defif) ucic:set("network","wan" .. i,"device",defif)
ucic:set("network","wan" .. i,"proto","static") ucic:set("network","wan" .. i,"proto","static")
ucic:set("openmptcprouter","wan" .. i,"interface") ucic:set("openmptcprouter","wan" .. i,"interface")
if ointf ~= "" then if ointf ~= "" then
ucic:set("network","wan" .. i,"type","macvlan") ucic:set("network","wan" .. i,"type","macvlan")
ucic:set("network","wan" .. i,"device","wan" .. i)
ucic:set("network","wan" .. i,"masterintf",defif) ucic:set("network","wan" .. i,"masterintf",defif)
ucic:set("network","wan" .. i .. "_dev","device")
ucic:set("network","wan" .. i .. "_dev","type","macvlan")
ucic:set("network","wan" .. i .. "_dev","mode","vepa")
ucic:set("network","wan" .. i .. "_dev","ifname",defif)
ucic:set("network","wan" .. i .. "_dev","name","wan" .. i)
end end
ucic:set("network","wan" .. i,"ip4table","wan") ucic:set("network","wan" .. i,"ip4table","wan")
if multipath_master then if multipath_master then
@ -171,7 +201,7 @@ function wizard_add()
ucic:set("sqm","wan" .. i,"script","simple.qos") ucic:set("sqm","wan" .. i,"script","simple.qos")
ucic:set("sqm","wan" .. i,"qdisc_advanced","0") ucic:set("sqm","wan" .. i,"qdisc_advanced","0")
ucic:set("sqm","wan" .. i,"linklayer","none") ucic:set("sqm","wan" .. i,"linklayer","none")
ucic:set("sqm","wan" .. i,"enabled","0") ucic:set("sqm","wan" .. i,"enabled","1")
ucic:set("sqm","wan" .. i,"debug_logging","0") ucic:set("sqm","wan" .. i,"debug_logging","0")
ucic:set("sqm","wan" .. i,"verbosity","5") ucic:set("sqm","wan" .. i,"verbosity","5")
ucic:set("sqm","wan" .. i,"download","0") ucic:set("sqm","wan" .. i,"download","0")
@ -197,7 +227,10 @@ function wizard_add()
local delete_intf = luci.http.formvaluetable("delete") or "" local delete_intf = luci.http.formvaluetable("delete") or ""
if delete_intf ~= "" then if delete_intf ~= "" then
for intf, _ in pairs(delete_intf) do for intf, _ in pairs(delete_intf) do
local defif = ucic:get("network",intf,"ifname") local defif = ucic:get("network",intf,"ifname") or ""
if defif == "" then
defif = ucic:get("network",intf,"ifname")
end
ucic:delete("network",intf) ucic:delete("network",intf)
if ucic:get("network",intf .. "_dev") ~= "" then if ucic:get("network",intf .. "_dev") ~= "" then
ucic:delete("network",intf .. "_dev") ucic:delete("network",intf .. "_dev")
@ -251,6 +284,7 @@ function wizard_add()
local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0" local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0"
local multipath = luci.http.formvalue("cbid.network.%s.multipath" % intf) or "on" local multipath = luci.http.formvalue("cbid.network.%s.multipath" % intf) or "on"
local lan = luci.http.formvalue("cbid.network.%s.lan" % intf) or "0" local lan = luci.http.formvalue("cbid.network.%s.lan" % intf) or "0"
local ttl = luci.http.formvalue("cbid.network.%s.ttl" % intf) or ""
if typeintf ~= "" then if typeintf ~= "" then
if typeintf == "normal" then if typeintf == "normal" then
typeintf = "" typeintf = ""
@ -262,15 +296,48 @@ function wizard_add()
end end
if typeintf == "macvlan" and masterintf ~= "" then if typeintf == "macvlan" and masterintf ~= "" then
ucic:set("network",intf,"type","macvlan") ucic:set("network",intf,"type","macvlan")
ucic:set("network",intf .. "_dev","device")
ucic:set("network",intf .. "_dev","type","macvlan")
ucic:set("network",intf .. "_dev","ifname",masterinf)
ucic:set("network",intf .. "_dev","mode","vepa")
ucic:set("network",intf .. "_dev","name",intf)
ucic:set("network",intf,"masterintf",masterintf) ucic:set("network",intf,"masterintf",masterintf)
elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" or proto == "dhcpv6") then elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" or proto == "dhcpv6") then
ucic:set("network",intf,"ifname",ifname) ucic:set("network",intf,"device",ifname)
if uci_device_from_interface(intf) == "" then
ucic:set("network",intf .. "_dev","device")
ucic:set("network",intf .. "_dev","name",ifname)
end
elseif typeintf == "" and device ~= "" and proto == "ncm" then elseif typeintf == "" and device ~= "" and proto == "ncm" then
ucic:set("network",intf,"device",device_ncm) ucic:set("network",intf,"device",device_ncm)
if uci_device_from_interface(intf) == "" then
ucic:set("network",intf .. "_dev","device")
ucic:set("network",intf .. "_dev","name",device_ncm)
end
elseif typeintf == "" and device ~= "" and proto == "qmi" then elseif typeintf == "" and device ~= "" and proto == "qmi" then
ucic:set("network",intf,"device",device_qmi) ucic:set("network",intf,"device",device_qmi)
if uci_device_from_interface(intf) == "" then
ucic:set("network",intf .. "_dev","device")
ucic:set("network",intf .. "_dev","name",device_qmi)
end
elseif typeintf == "" and device ~= "" and proto == "modemmanager" then elseif typeintf == "" and device ~= "" and proto == "modemmanager" then
ucic:set("network",intf,"device",device_manager) ucic:set("network",intf,"device",device_manager)
if uci_device_from_interface(intf) == "" then
ucic:set("network",intf .. "_dev","device")
ucic:set("network",intf .. "_dev","name",device_manager)
end
elseif typeintf == "" and ifname ~= "" and proto == "static" then
ucic:set("network",intf,"device",ifname)
if uci_device_from_interface(intf) == "" then
ucic:set("network",intf .. "_dev","device")
ucic:set("network",intf .. "_dev","name",ifname)
end
end
if typeintf ~= "macvlan" and ucic:get("network",intf .. "_dev","type") == "macvlan" then
ucic:delete("network",intf .. "_dev","type")
ucic:delete("network",intf .. "_dev","mode")
ucic:delete("network",intf .. "_dev","ifname")
ucic:delete("network",intf .. "_dev","macaddr")
end end
if proto == "pppoe" then if proto == "pppoe" then
ucic:set("network",intf,"pppd_options","persist maxfail 0") ucic:set("network",intf,"pppd_options","persist maxfail 0")
@ -278,6 +345,13 @@ function wizard_add()
if proto ~= "other" then if proto ~= "other" then
ucic:set("network",intf,"proto",proto) ucic:set("network",intf,"proto",proto)
end end
uci_device = uci_device_from_interface(intf)
if uci_device == "" then
uci_device = intf .. "_dev"
end
ucic:set("network",uci_device,"ttl",ttl)
ucic:set("network",intf,"apn",apn) ucic:set("network",intf,"apn",apn)
ucic:set("network",intf,"pincode",pincode) ucic:set("network",intf,"pincode",pincode)
ucic:set("network",intf,"delay",delay) ucic:set("network",intf,"delay",delay)
@ -342,7 +416,10 @@ function wizard_add()
if not ucic:get("sqm",intf) ~= "" then if not ucic:get("sqm",intf) ~= "" then
local defif = get_device(intf) local defif = get_device(intf)
if defif == "" then if defif == "" then
defif = ucic:get("network",intf,"ifname") or "" defif = ucic:get("network",intf,"device") or ""
if defif == "" then
defif = ucic:get("network",intf,"ifname") or ""
end
end end
ucic:set("sqm",intf,"queue") ucic:set("sqm",intf,"queue")
ucic:set("sqm",intf,"interface",defif) ucic:set("sqm",intf,"interface",defif)
@ -442,7 +519,7 @@ function wizard_add()
ucic:set("network","omrvpn","proto","bonding") ucic:set("network","omrvpn","proto","bonding")
end end
if vpn_intf ~= "" then if vpn_intf ~= "" then
ucic:set("network","omrvpn","ifname",vpn_intf) ucic:set("network","omrvpn","device",vpn_intf)
ucic:set("sqm","omrvpn","interface",vpn_intf) ucic:set("sqm","omrvpn","interface",vpn_intf)
ucic:save("network") ucic:save("network")
ucic:commit("network") ucic:commit("network")
@ -809,7 +886,7 @@ function wizard_add()
local dsvpn_key = luci.http.formvalue("dsvpn_key") local dsvpn_key = luci.http.formvalue("dsvpn_key")
if dsvpn_key ~= "" then if dsvpn_key ~= "" then
ucic:set("dsvpn","vpn","port","65011") ucic:set("dsvpn","vpn","port","65401")
ucic:set("dsvpn","vpn","key",dsvpn_key) ucic:set("dsvpn","vpn","key",dsvpn_key)
ucic:set("dsvpn","vpn","localip","10.255.251.2") ucic:set("dsvpn","vpn","localip","10.255.251.2")
ucic:set("dsvpn","vpn","remoteip","10.255.251.1") ucic:set("dsvpn","vpn","remoteip","10.255.251.1")
@ -894,7 +971,7 @@ function wizard_add()
-- Restart all -- Restart all
menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter" menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter"
if gostatus == true then if gostatus == true then
luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null") --luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null") luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
luci.sys.call("ip addr flush dev tun0 >/dev/null 2>/dev/null") luci.sys.call("ip addr flush dev tun0 >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null") luci.sys.call("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null")
@ -916,6 +993,7 @@ function wizard_add()
luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null") luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/vnstat restart >/dev/null 2>/dev/null") luci.sys.call("/etc/init.d/vnstat restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/v2ray restart >/dev/null 2>/dev/null") luci.sys.call("/etc/init.d/v2ray restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/sysntpd restart >/dev/null 2>/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin/system/" .. menuentry:lower() .. "/status")) luci.http.redirect(luci.dispatcher.build_url("admin/system/" .. menuentry:lower() .. "/status"))
else else
luci.http.redirect(luci.dispatcher.build_url("admin/system/" .. menuentry:lower() .. "/wizard")) luci.http.redirect(luci.dispatcher.build_url("admin/system/" .. menuentry:lower() .. "/wizard"))
@ -1112,6 +1190,19 @@ function settings_add()
local sfe_bridge = luci.http.formvalue("sfe_bridge") or "0" local sfe_bridge = luci.http.formvalue("sfe_bridge") or "0"
ucic:set("openmptcprouter","settings","sfe_bridge",sfe_bridge) ucic:set("openmptcprouter","settings","sfe_bridge",sfe_bridge)
-- Enable/disable SIP ALG
local sipalg = luci.http.formvalue("sipalg") or "0"
ucic:set("openmptcprouter","settings","sipalg",sipalg)
ucic:foreach("firewall", "zone", function (section)
ucic:set("firewall",section[".name"],"auto_helper",sipalg)
end)
if sipalg == "1" then
luci.sys.call("modprobe -q nf_conntrack_sip >/dev/null 2>/dev/null")
luci.sys.call("modprobe -q nf_nat_sip >/dev/null 2>/dev/null")
else
luci.sys.call("rmmod nf_nat_sip >/dev/null 2>/dev/null")
luci.sys.call("rmmod nf_conntrack_sip >/dev/null 2>/dev/null")
end
ucic:save("openmptcprouter") ucic:save("openmptcprouter")
ucic:commit("openmptcprouter") ucic:commit("openmptcprouter")

View file

@ -7,11 +7,19 @@
local sys = require "luci.sys" local sys = require "luci.sys"
local ut = require "luci.util" local ut = require "luci.util"
local ifaces = sys.net:devices() local ifaces = sys.net:devices()
local ifttyu = nixio.fs.glob("/dev/ttyUSB*")
local ifttyc = nixio.fs.glob("/dev/cdc-wdm*")
local sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'")
local qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'")
menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter" menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter"
function device_notvirtual(dev) function device_notvirtual(dev)
for _, iface in ipairs(net:get_networks()) do if dev:match("^eth.*") or dev:match("^wwan.*") or dev:match("^tun.*") or dev:match("/") then
return true
end
networks = net:get_networks()
for _, iface in ipairs(networks) do
local ifacen = iface:name() local ifacen = iface:name()
local ifacename = uci:get("network",ifacen,"ifname") local ifacename = uci:get("network",ifacen,"device")
local ifacetype = uci:get("network",ifacen,"type") or "" local ifacetype = uci:get("network",ifacen,"type") or ""
local ifaceproto = uci:get("network",ifacen,"proto") or "" local ifaceproto = uci:get("network",ifacen,"proto") or ""
--if ifacename == dev and (ifacetype == "macvlan" or ifacetype == "bridge" or ifaceproto == "6in4") then --if ifacename == dev and (ifacetype == "macvlan" or ifacetype == "bridge" or ifaceproto == "6in4") then
@ -428,7 +436,7 @@
<% <%
for _, iface in ipairs(net:get_networks()) do for _, iface in ipairs(net:get_networks()) do
local ifname = iface:name() local ifname = iface:name()
local firewall_lan = luci.util.trim(luci.sys.exec("uci -q get firewall.zone_lan.network | grep " .. ifname)) local firewall_lan = luci.util.trim(luci.sys.exec("uci -q get firewall.zone_lan.network | tr ' ' '\n' | grep \'^" .. ifname .. "$\'"))
if firewall_lan ~= "" then if firewall_lan ~= "" then
%> %>
<h3><%=ifname%></h3> <h3><%=ifname%></h3>
@ -473,7 +481,7 @@
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*") or ifacea:match("^bond.*")) and device_notvirtual(ifacea) then if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*") or ifacea:match("^bond.*")) and device_notvirtual(ifacea) then
if uci:get("network",ifname,"proto") ~= "macvlan" then if uci:get("network",ifname,"proto") ~= "macvlan" then
%> %>
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option> <option value="<%=ifacea%>"<% if uci:get("network",ifname,"device") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
<% <%
else else
%> %>
@ -483,9 +491,9 @@
end end
end end
if uci:get("network",ifname,"proto") ~= "macvlan" then if uci:get("network",ifname,"proto") ~= "macvlan" then
if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then if iffind == 0 and uci:get("network",ifname,"device") ~= nil then
%> %>
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option> <option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
<% <%
end end
else else
@ -531,7 +539,7 @@
<% <%
for _, iface in ipairs(net:get_networks()) do for _, iface in ipairs(net:get_networks()) do
local ifname = iface:name() local ifname = iface:name()
local firewall_wan = luci.util.trim(luci.sys.exec("uci -q get firewall.zone_wan.network | grep " .. ifname)) local firewall_wan = luci.util.trim(luci.sys.exec("uci -q get firewall.zone_wan.network | tr ' ' '\n' | grep \'^" .. ifname .. "$\'"))
if firewall_wan ~= "" then if firewall_wan ~= "" then
-- local multipath = uci:get("network",ifname,"multipath") -- local multipath = uci:get("network",ifname,"multipath")
@ -616,7 +624,7 @@
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1"> <select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1">
<% <%
iffind=0 iffind=0
uciifname=uci:get("network",ifname,"ifname") uciifname=uci:get("network",ifname,"device")
if uciifname ~= nil then if uciifname ~= nil then
if uciifname:match("/") then if uciifname:match("/") then
realifname=uciifname realifname=uciifname
@ -682,7 +690,7 @@
<div class="cbi-value" id="cbi-network-<%=ifname%>-ipv6address" data-index="8"> <div class="cbi-value" id="cbi-network-<%=ifname%>-ipv6address" data-index="8">
<label class="cbi-value-title"><%:IPv6 address%></label> <label class="cbi-value-title"><%:IPv6 address%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" id="cbid.network.<%=ifname%>.ip6addr" name="cbid.network.<%=ifname%>.ip6addr" class="cbi-input-text" value="<%=value%>" data-type="ip6addr"> <input type="text" id="cbid.network.<%=ifname%>.ip6addr" name="cbid.network.<%=ifname%>.ip6addr" class="cbi-input-text" value="<%=value%>" data-type="ip6addr" data-optional="true">
<br /> <br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%:Set an IP in the same network as the modem%> <%:Set an IP in the same network as the modem%>
@ -696,7 +704,7 @@
<div class="cbi-value" id="cbi-network-<%=ifname%>-ip6gw" data-index="9"> <div class="cbi-value" id="cbi-network-<%=ifname%>-ip6gw" data-index="9">
<label class="cbi-value-title"><%:IPv6 gateway%></label> <label class="cbi-value-title"><%:IPv6 gateway%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" id="cbid.network.<%=ifname%>.ip6gw" name="cbid.network.<%=ifname%>.ip6gw" class="cbi-input-text" value="<%=uci:get("network",ifname,"ip6gw")%>" data-type="ip6addr"> <input type="text" id="cbid.network.<%=ifname%>.ip6gw" name="cbid.network.<%=ifname%>.ip6gw" class="cbi-input-text" value="<%=uci:get("network",ifname,"ip6gw")%>" data-type="ip6addr" data-optional="true">
<br /> <br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%:Set here IP of the modem%> <%:Set here IP of the modem%>
@ -743,14 +751,12 @@
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device.ncm" name="cbid.network.<%=ifname%>.device.ncm" size="1"> <select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device.ncm" name="cbid.network.<%=ifname%>.device.ncm" size="1">
<% <%
iffind=0 iffind=0
iftty = nixio.fs.glob("/dev/ttyUSB*") for tty in ifttyu do
for tty in iftty do
%> %>
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option> <option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
<% <%
end end
iftty = nixio.fs.glob("/dev/cdc-wdm*") for tty in ifttyc do
for tty in iftty do
%> %>
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option> <option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
<% <%
@ -770,8 +776,7 @@
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device.qmi" name="cbid.network.<%=ifname%>.device.qmi" size="1"> <select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device.qmi" name="cbid.network.<%=ifname%>.device.qmi" size="1">
<% <%
iffind=0 iffind=0
iftty = nixio.fs.glob("/dev/cdc-wdm*") for tty in ifttyc do
for tty in iftty do
%> %>
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option> <option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
<% <%
@ -893,6 +898,16 @@
<% <%
end end
%> %>
<div class="cbi-value" data-index="14">
<label class="cbi-value-title"><%:Force TTL%></label>
<div class="cbi-value-field">
<input type="text" name="cbid.network.<%=ifname%>.ttl" class="cbi-input-text" value="<%=ttl%>" data-type="uinteger" data-optional="true">
<br />
<div class="cbi-value-description">
<%:You can force a TTL. Some LTE provider detect tethering by inpecting packet TTL value, setting it to 65 often solve the issue.%>
</div>
</div>
</div>
<% <%
local download = "0" local download = "0"
@ -909,7 +924,7 @@
-- end -- end
--end --end
%> %>
<div class="cbi-value" data-index="14"> <div class="cbi-value" data-index="15">
<label class="cbi-value-title"><%:MPTCP over VPN%></label> <label class="cbi-value-title"><%:MPTCP over VPN%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input class="cbi-input-checkbox" type="checkbox" name="multipathvpn.<%=ifname%>.enabled" value="1" <% if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then %>checked<% end %> /> <input class="cbi-input-checkbox" type="checkbox" name="multipathvpn.<%=ifname%>.enabled" value="1" <% if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then %>checked<% end %> />
@ -919,17 +934,40 @@
</div> </div>
</div> </div>
</div> </div>
<div class="cbi-value" data-index="15"> <%
if sqm == "1" then
%>
<div class="cbi-value" data-index="16">
<label class="cbi-value-title"><%:Enable SQM%></label> <label class="cbi-value-title"><%:Enable SQM%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == "1" then %>checked<% end %> /> <input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == "1" then %>checked<% end %> />
<br /> <br />
<div class="cbi-value-description"> <div class="cbi-value-description">
<%:SQM control bufferloat: the undesirable latency that arises when the router buffers too much data.%>
<%:You should disable SQM for LTE or any interfaces with variable speed.%> <%:You should disable SQM for LTE or any interfaces with variable speed.%>
</div> </div>
</div> </div>
</div> </div>
<%
end
%>
<%
if qos == "1" then
%>
<div class="cbi-value" data-index="16"> <div class="cbi-value" data-index="16">
<label class="cbi-value-title"><%:Enable QoS%></label>
<div class="cbi-value-field">
<input class="cbi-input-checkbox" type="checkbox" name="cbid.qos.<%=ifname%>.enabled" value="1" <% if uci:get("qos",ifname,"enabled") == "1" then %>checked<% end %> />
<br />
<div class="cbi-value-description">
<%:QoS permit to prioritize any upload traffic.%>
</div>
</div>
</div>
<%
end
%>
<div class="cbi-value" data-index="17">
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label> <label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger"> <input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
@ -945,7 +983,7 @@
--> -->
</div> </div>
</div> </div>
<div class="cbi-value" data-index="17"> <div class="cbi-value" data-index="18">
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label> <label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger"> <input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
@ -1000,4 +1038,4 @@
</div> </div>
</form> </form>
<script type="text/javascript">cbi_init();</script> <script type="text/javascript">cbi_init();</script>
<%+footer%> <%+footer%>

View file

@ -1474,6 +1474,9 @@ function interfaces_status()
whois = ut.trim(sys.exec("whois " .. publicIP .. " | grep -i 'netname' | awk '{print $2}'")) whois = ut.trim(sys.exec("whois " .. publicIP .. " | grep -i 'netname' | awk '{print $2}'"))
--whois = ut.trim(sys.exec("wget -4 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP .. "' | jsonfilter -q -e '@.as_description'")) --whois = ut.trim(sys.exec("wget -4 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP .. "' | jsonfilter -q -e '@.as_description'"))
end end
if publicIP == mArray.openmptcprouter["wan_addr"] then
mArray.openmptcprouter["direct_output"] = true
end
end end
if publicIP6 ~= "" then if publicIP6 ~= "" then
whois6 = uci:get("openmptcprouter",interface,"asn") or "" whois6 = uci:get("openmptcprouter",interface,"asn") or ""
@ -1481,6 +1484,9 @@ function interfaces_status()
whois6 = ut.trim(sys.exec("whois " .. publicIP6 .. " | grep -i 'netname' | awk '{print $2}'")) whois6 = ut.trim(sys.exec("whois " .. publicIP6 .. " | grep -i 'netname' | awk '{print $2}'"))
--whois6 = ut.trim(sys.exec("wget -6 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP6 .. "' | jsonfilter -q -e '@.as_description'")) --whois6 = ut.trim(sys.exec("wget -6 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP6 .. "' | jsonfilter -q -e '@.as_description'"))
end end
if publicIP6 == mArray.openmptcprouter["wan_addr6"] then
mArray.openmptcprouter["direct_output"] = true
end
end end
if ifname ~= "" and ifname ~= nil then if ifname ~= "" and ifname ~= nil then
if fs.access("/sys/class/net/" .. ifname) then if fs.access("/sys/class/net/" .. ifname) then

201
luci-theme-argon/LICENSE Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -7,9 +7,9 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
LUCI_TITLE:=Argon Theme LUCI_TITLE:=Argon Theme
LUCI_DEPENDS:= LUCI_DEPENDS:=+curl +jsonfilter
PKG_VERSION:=2.2.6 PKG_VERSION:=2.2.9.4
PKG_RELEASE:=20210215 PKG_RELEASE:=20220425
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk

View file

@ -6,30 +6,20 @@
<h3 align="center"> <h3 align="center">
Argon is a clean HTML5 theme for LuCI. Users may<br>setup their own favorite logins, including beautiful<br>pics and customized mp4 videos.<br><br> Argon is a clean HTML5 theme for LuCI. Users may<br>setup their own favorite logins, including beautiful<br>pics and customized mp4 videos.<br><br>
</h3> </h3>
<a href="/LICENSE">
<a href="/LICENSE"> <img src="https://img.shields.io/github/license/jerrykuku/luci-theme-argon?style=flat-square&a=1" alt="">
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="">
</a> </a>
<a href="https://github.com/jerrykuku/luci-theme-argon/pulls"> <a href="https://github.com/jerrykuku/luci-theme-argon/pulls">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt=""> <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="">
</a> </a><a href="https://github.com/jerrykuku/luci-theme-argon/issues/new">
<img src="https://img.shields.io/badge/Issues-welcome-brightgreen.svg?style=flat-square">
<a href="https://github.com/jerrykuku/luci-theme-argon/issues/new"> </a><a href="https://github.com/jerrykuku/luci-theme-argon/releases">
<img src="https://img.shields.io/badge/Issues-welcome-brightgreen.svg"> <img src="https://img.shields.io/github/release/jerrykuku/luci-theme-argon.svg?style=flat-square">
</a> </a><a href="hhttps://github.com/jerrykuku/luci-theme-argon/releases">
<img src="https://img.shields.io/github/downloads/jerrykuku/luci-theme-argon/total?style=flat-square">
<a href="https://github.com/jerrykuku/luci-theme-argon/releases"> </a><a href="https://t.me/jerryk6">
<img src="https://img.shields.io/badge/release-v2.2.5-blue.svg?"> <img src="https://img.shields.io/badge/Contact-telegram-blue?style=flat-square">
</a> </a>
<a href="https://github.com/jerrykuku/luci-theme-argon/releases">
<img src="https://img.shields.io/github/downloads/jerrykuku/luci-theme-argon/total">
</a>
<a href="https://t.me/jerryk6">
<img src="https://img.shields.io/badge/Contact-telegram-blue">
</a>
</div> </div>
<br> <br>
<div align="center"> <div align="center">
@ -46,8 +36,12 @@ FireFox does not enable the backdrop-filter by default, see here for the opening
v2.x.x Adapt to official mainline snapshot. v2.x.x Adapt to official mainline snapshot.
You can checkout branch 18.06 for OpenWRT 18.06 or lean 19.07. You can checkout branch 18.06 for OpenWRT 18.06 or lean 19.07.
## Update Log 2020.09.13 v2.2.5 ## Update Log 2021.10.16 v2.2.9
- 【v2.2.9】Fix the problem that the menu could not pop up in mobile mode
- 【v2.2.9】Unify the settings of css spacing
- 【v2.2.9】Refactored the code of the login page
- 【v2.2.8】Fix the problem that the Minify Css option is turned on when compiling, which causes the frosted glass effect to be invalid and the logo font is lost.
- 【v2.2.5】New config app for argon theme. You can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.[Chrome is recommended] [Download](https://github.com/jerrykuku/luci-app-argon-config/releases/download/v0.8-beta/luci-app-argon-config_0.8-beta_all.ipk) - 【v2.2.5】New config app for argon theme. You can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.[Chrome is recommended] [Download](https://github.com/jerrykuku/luci-app-argon-config/releases/download/v0.8-beta/luci-app-argon-config_0.8-beta_all.ipk)
- 【v2.2.5】Automatically set as the default theme when compiling. - 【v2.2.5】Automatically set as the default theme when compiling.
- 【v2.2.5】Modify the file structure to adapt to luci-app-argon-config. The old method of turning on dark mode is no longer applicable, please use it with luci-app-argon-config. - 【v2.2.5】Modify the file structure to adapt to luci-app-argon-config. The old method of turning on dark mode is no longer applicable, please use it with luci-app-argon-config.
@ -100,7 +94,7 @@ make -j1 V=s
### For Lean openwrt 18.06 LuCI ### For Lean openwrt 18.06 LuCI
``` ```
wget --no-check-certificate https://github.com/jerrykuku/luci-theme-argon/releases/download/v1.7.0/luci-theme-argon_1.7.0-20200909_all.ipk wget --no-check-certificate https://github.com/jerrykuku/luci-theme-argon/releases/download/v1.7.3/luci-theme-argon-18.06_1.7.3-20220421_all.ipk
opkg install luci-theme-argon*.ipk opkg install luci-theme-argon*.ipk
``` ```
@ -108,7 +102,8 @@ opkg install luci-theme-argon*.ipk
``` ```
opkg install luci-compat opkg install luci-compat
wget --no-check-certificate https://github.com/jerrykuku/luci-theme-argon/releases/download/v2.2.5/luci-theme-argon_2.2.5-20200914_all.ipk opkg install luci-lib-ipkg
wget --no-check-certificate https://github.com/jerrykuku/luci-theme-argon/releases/download/v2.2.9/luci-theme-argon_2.2.9-20211016-1_all.ipk
opkg install luci-theme-argon*.ipk opkg install luci-theme-argon*.ipk
``` ```
![](/Screenshots/screenshot_pc.jpg) ![](/Screenshots/screenshot_pc.jpg)

View file

@ -1,26 +1,30 @@
# luci-theme-argon ([English](/README.md)) <div align="center">
[1]: https://img.shields.io/badge/license-MIT-brightgreen.svg <img src="https://raw.githubusercontent.com/jerrykuku/staff/master/argon_title2.png" >
[2]: /LICENSE <h1 align="center">
[3]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg 全新的 Openwrt 主题
[4]: https://github.com/jerrykuku/luci-theme-argon/pulls </h1>
[5]: https://img.shields.io/badge/Issues-welcome-brightgreen.svg <h3 align="center">
[6]: https://github.com/jerrykuku/luci-theme-argon/issues/new Argon 是一个干净整洁的Openwrt主题用户可以自定义登录界面<br>包含图片或者视频,同时支持深色浅色的自动与手动切换
[7]: https://img.shields.io/badge/release-v2.2.5-blue.svg? </h3>
[8]: https://github.com/jerrykuku/luci-theme-argon/releases
[9]: https://img.shields.io/github/downloads/jerrykuku/luci-theme-argon/total <a href="/LICENSE">
[10]: https://img.shields.io/badge/Contact-telegram-blue <img src="https://img.shields.io/github/license/jerrykuku/luci-theme-argon?style=flat-square&a=1" alt="">
[11]: https://t.me/jerryk6 </a><a href="https://github.com/jerrykuku/luci-theme-argon/pulls">
[![license][1]][2] <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="">
[![PRs Welcome][3]][4] </a><a href="https://github.com/jerrykuku/luci-theme-argon/issues/new">
[![Issue Welcome][5]][6] <img src="https://img.shields.io/badge/Issues-welcome-brightgreen.svg?style=flat-square">
[![Release Version][7]][8] </a><a href="https://github.com/jerrykuku/luci-theme-argon/releases">
[![Release Count][9]][8] <img src="https://img.shields.io/github/release/jerrykuku/luci-theme-argon.svg?style=flat-square">
[![Contact Me][10]][11] </a><a href="hhttps://github.com/jerrykuku/luci-theme-argon/releases">
<img src="https://img.shields.io/github/downloads/jerrykuku/luci-theme-argon/total?style=flat-square">
</a><a href="https://t.me/jerryk6">
<img src="https://img.shields.io/badge/Contact-telegram-blue?style=flat-square">
</a>
</div>
![](/Screenshots/screenshot_pc.jpg) ![](/Screenshots/screenshot_pc.jpg)
![](/Screenshots/screenshot_phone.jpg) ![](/Screenshots/screenshot_phone.jpg)
全新的 Openwrt 主题基于luci-theme-material 和 开源免费的 Argon 模板进行移植。
## 注意 ## 注意
强烈建议使用Chrome 浏览器。主题中使用了一些新的css3特性目前只有Chrome有最佳的兼容性。 强烈建议使用Chrome 浏览器。主题中使用了一些新的css3特性目前只有Chrome有最佳的兼容性。
@ -31,8 +35,13 @@ v2.x.x 适配主线快照版本。
v1.x.x 适配18.06 和 Lean Openwrt [如果你是lean代码 请选择这个版本] v1.x.x 适配18.06 和 Lean Openwrt [如果你是lean代码 请选择这个版本]
## 更新日志 2020.09.13 v2.2.5 ## 更新日志 2021.10.16 v2.2.9
- 【v2.2.9】修复了在手机模式下无法弹出菜单的bug
- 【v2.2.9】统一css间距的设置
- 【v2.2.9】重构了登录页面的代码
- 【v2.2.9】为导航菜单添加滑动效果
- 【v2.2.8】修复编译时打开Minify Css选项导致磨砂玻璃效果无效logo字体丢失的问题
- 【v2.2.5】全新的设置app.你可以设置argon 主题的登录页面的模糊和透明度,并管理背景图片与视频。[建议使用 Chrome][点击下载](https://github.com/jerrykuku/luci-app-argon-config/releases/download/v0.8-beta/luci-app-argon-config_0.8-beta_all.ipk) - 【v2.2.5】全新的设置app.你可以设置argon 主题的登录页面的模糊和透明度,并管理背景图片与视频。[建议使用 Chrome][点击下载](https://github.com/jerrykuku/luci-app-argon-config/releases/download/v0.8-beta/luci-app-argon-config_0.8-beta_all.ipk)
- 【v2.2.5】当编译固件时,将自动设置为默认主题。 - 【v2.2.5】当编译固件时,将自动设置为默认主题。
- 【v2.2.5】修改文件结构以适应luci-app-argon-config旧的开启暗色模式方法将不再适用请搭配luci-app-argon-config使用。 - 【v2.2.5】修改文件结构以适应luci-app-argon-config旧的开启暗色模式方法将不再适用请搭配luci-app-argon-config使用。

View file

@ -1,2 +1,2 @@
Drop background here! Drop background here!
accept jpg png gif and mp4 accept jpg png gif mp4 webm

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#202124" d="m8,10.033663l-6.898535,-6.013274l-1.060688,0.972974l7.959223,6.986249l7.959223,-6.986249l-1.060688,-0.972974l-6.898535,6.013274z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#adaeaf" d="m8,10.033663l-6.898535,-6.013274l-1.060688,0.972974l7.959223,6.986249l7.959223,-6.986249l-1.060688,-0.972974l-6.898535,6.013274z"/></svg>

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 222 B

Before After
Before After

View file

@ -1,219 +0,0 @@
/**
* Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
*
* luci-theme-argon
* Copyright 2019 Jerrykuku <jerrykuku@qq.com>
*
* Have a bug? Please create an issue here on GitHub!
* https://github.com/jerrykuku/luci-theme-argon/issues
*
* luci-theme-material:
* Copyright 2015 Lutty Yang <lutty@wcan.in>
* https://github.com/LuttyYang/luci-theme-material/
*
* Agron Theme
* https://demos.creative-tim.com/argon-dashboard/index.html
*
* Login background
* https://unsplash.com/
* Font generate by Icomoon<icomoon.io>
*
* Licensed to the public under the Apache License 2.0
*/
document.addEventListener('luci-loaded', function(ev) {
(function ($) {
/**
* trim text, Remove spaces, wrap
* @param text
* @returns {string}
*/
function trimText(text) {
return text.replace(/[ \t\n\r]+/g, " ");
}
var lastNode = undefined;
var mainNodeName = undefined;
var nodeUrl = "";
(function(node){
var luciLocation;
if (node[0] == "admin"){
luciLocation = [node[1], node[2]];
}else{
luciLocation = node;
}
for(var i in luciLocation){
nodeUrl += luciLocation[i];
if (i != luciLocation.length - 1){
nodeUrl += "/";
}
}
})(luciLocation);
/**
* get the current node by Burl (primary)
* @returns {boolean} success?
*/
function getCurrentNodeByUrl() {
var ret = false;
if (!$('body').hasClass('logged-in')) {
luciLocation = ["Main", "Login"];
return true;
}
$(".main > .main-left > .nav > .slide > .menu").each(function () {
var ulNode = $(this);
ulNode.next().find("a").each(function () {
var that = $(this);
var href = that.attr("href");
if (href.indexOf(nodeUrl) != -1) {
ulNode.click();
ulNode.next(".slide-menu").stop(true, true);
lastNode = that.parent();
lastNode.addClass("active");
ret = true;
return true;
}
});
});
return ret;
}
/**
* menu click
*/
$(".main > .main-left > .nav > .slide > .menu").click(function () {
var ul = $(this).next(".slide-menu");
var menu = $(this);
$(".main > .main-left > .nav > .slide > .menu").each(function () {
var ulNode = $(this);
ulNode.removeClass("active");
ulNode.next(".slide-menu").stop(true).slideUp("fast")
});
if (!ul.is(":visible")) {
menu.addClass("active");
ul.addClass("active");
ul.stop(true).slideDown("fast");
} else {
ul.stop(true).slideUp("fast", function () {
menu.removeClass("active");
ul.removeClass("active");
});
}
return false;
});
/**
* hook menu click and add the hash
*/
$(".main > .main-left > .nav > .slide > .slide-menu > li > a").click(function () {
if (lastNode != undefined) lastNode.removeClass("active");
$(this).parent().addClass("active");
return true;
});
/**
* fix menu click
*/
$(".main > .main-left > .nav > .slide > .slide-menu > li").click(function () {
if (lastNode != undefined) lastNode.removeClass("active");
$(this).addClass("active");
window.location = $($(this).find("a")[0]).attr("href");
return false;
});
/**
* get current node and open it
*/
if (getCurrentNodeByUrl()) {
mainNodeName = "node-" + luciLocation[0] + "-" + luciLocation[1];
mainNodeName = mainNodeName.replace(/[ \t\n\r\/]+/g, "_").toLowerCase();
$("body").addClass(mainNodeName);
}
/**
* Sidebar expand
*/
var showSide = false;
$(".showSide").click(function () {
if (showSide) {
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").width(0);
$(".main-right").css("overflow-y", "visible");
showSide = false;
} else {
$(".darkMask").stop(true).fadeIn("fast");
$(".main-left").width("13rem")
$(".main-right").css("overflow-y", "hidden");
showSide = true;
}
});
$(".darkMask").click(function () {
if (showSide) {
showSide = false;
$(".darkMask").stop(true).fadeOut("fast");
$(".main-left").width(0);
$(".main-right").css("overflow-y", "visible");
}
});
$(window).resize(function () {
if ($(window).width() > 921) {
$(".main-left").css("width", "");
$(".darkMask").stop(true);
$(".darkMask").css("display", "none");
showSide = false;
}
});
/**
* fix legend position
*/
$("legend").each(function () {
var that = $(this);
that.after("<span class='panel-title'>" + that.text() + "</span>");
});
$(".cbi-section-table-titles, .cbi-section-table-descr, .cbi-section-descr").each(function () {
var that = $(this);
if (that.text().trim() == ""){
that.css("display", "none");
}
});
$(".main-right").focus();
$(".main-right").blur();
$("input").attr("size", "0");
$(".cbi-button-up").val("__");
$(".cbi-button-down").val("__");
$(".slide > a").removeAttr("href");
if (mainNodeName != undefined) {
console.log(mainNodeName);
switch (mainNodeName) {
case "node-status-system_log":
case "node-status-kernel_log":
$("#syslog").focus(function () {
$("#syslog").blur();
$(".main-right").focus();
$(".main-right").blur();
});
break;
case "node-status-firewall":
var button = $(".node-status-firewall > .main fieldset li > a");
button.addClass("cbi-button cbi-button-reset a-to-btn");
break;
case "node-system-reboot":
var button = $(".node-system-reboot > .main > .main-right p > a");
button.addClass("cbi-button cbi-input-reset a-to-btn");
break;
}
}
})(jQuery);
});

View file

@ -1,4 +1,4 @@
// out: ../css/cascade.css, compress: false , sourceMap: false // out: ../css/cascade.css, compress: true , sourceMap: false
/** /**
* Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template * Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
* *
@ -8,7 +8,7 @@
* Have a bug? Please create an issue here on GitHub! * Have a bug? Please create an issue here on GitHub!
* https://github.com/jerrykuku/luci-theme-argon/issues * https://github.com/jerrykuku/luci-theme-argon/issues
* *
* luci-theme-material: * luci-theme-material:
* Copyright 2015 Lutty Yang <lutty@wcan.in> * Copyright 2015 Lutty Yang <lutty@wcan.in>
* https://github.com/LuttyYang/luci-theme-material/ * https://github.com/LuttyYang/luci-theme-material/
* *
@ -25,9 +25,9 @@
/* /*
* Include base and custom css * Include base and custom css
*/ */
@import url("pure-min.less");
@import url("fonts.less");
@import url("fonts.css?v=3");
@import url("pure-min.css?v=1");
:root { :root {
--primary: #5e72e4; --primary: #5e72e4;
@ -102,9 +102,11 @@ html {
body { body {
font-size: 0.875rem; font-size: 0.875rem;
background-color: #f4f5f7; background-color: #f4f5f7;
background-color: var(--background-color); background-color: var(--background-color);
color: #32325d; color: #32325d;
color: var(--gray-dark); color: var(--gray-dark);
-webkit-tap-highlight-color: transparent;
} }
* { * {
@ -364,13 +366,14 @@ hr {
background-color: #000; background-color: #000;
background-color: var(--darker); background-color: var(--darker);
overflow: hidden; overflow: hidden;
video { video {
width: 100%; width: 100%;
height: auto; height: auto;
} }
} }
.volume-control{ .volume-control {
position: fixed; position: fixed;
right: 1rem; right: 1rem;
top: 1rem; top: 1rem;
@ -380,12 +383,13 @@ hr {
cursor: pointer; cursor: pointer;
background-size: contain; background-size: contain;
background-image: url(../img/volume_high.svg); background-image: url(../img/volume_high.svg);
&.mute{
&.mute {
background-image: url(../img/volume_off.svg); background-image: url(../img/volume_off.svg);
} }
} }
.main-bg{ .main-bg {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -427,6 +431,9 @@ hr {
max-width: 420px; max-width: 420px;
background-color: #fff; background-color: #fff;
background-color: var(--white); background-color: var(--white);
-webkit-backdrop-filter: blur(var(--blur-radius));
backdrop-filter: blur(var(--blur-radius));
background-color: rgba(244, 245, 247, var(--blur-opacity));
.brand { .brand {
display: flex; display: flex;
@ -509,7 +516,7 @@ hr {
box-sizing: border-box; box-sizing: border-box;
transition: all .3s cubic-bezier(.68, -.55, .265, 1.55); transition: all .3s cubic-bezier(.68, -.55, .265, 1.55);
color: #525461; color: #525461;
color:var(--default); color: var(--default);
border: 0; border: 0;
border-radius: 0; border-radius: 0;
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
@ -585,7 +592,8 @@ hr {
color: var(--default); color: var(--default);
position: absolute; position: absolute;
bottom: 0; bottom: 0;
.ftc{
.ftc {
position: absolute; position: absolute;
bottom: 30px; bottom: 30px;
width: 100%; width: 100%;
@ -598,15 +606,6 @@ hr {
} }
} }
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {
.login-page .login-container .login-form {
-webkit-backdrop-filter: blur(var(--blur-radius));
backdrop-filter: blur(var(--blur-radius));
background-color: rgba(244, 245, 247, var(--blur-opacity));
}
}
header, header,
.main { .main {
@ -659,7 +658,7 @@ small {
.sidenav-header { .sidenav-header {
padding: 1.5rem; padding: 1.5rem .5rem;
text-align: center; text-align: center;
.brand { .brand {
@ -671,7 +670,6 @@ small {
text-align: center; text-align: center;
cursor: default; cursor: default;
vertical-align: text-bottom; vertical-align: text-bottom;
white-space: nowrap;
} }
} }
@ -741,31 +739,40 @@ header {
.fill { .fill {
padding: 0.8rem 0; padding: 0.8rem 0;
border-bottom: 0px solid rgba(255, 255, 255, .08) !important; border-bottom: 0px solid rgba(255, 255, 255, .08) !important;
display: flex;
.container { .container {
height: 2rem; height: 2rem;
padding: 0 1.25rem; padding: 0 1.25rem;
display: flex;
align-items: center;
width: 100%;
.showSide { .flex1 {
display: none; flex: 1;
color: #fff;
font-size: 1.4rem;
&:hover { .showSide {
display: none;
color: #fff;
font-size: 1.4rem;
&:hover {
text-decoration: none;
}
}
.brand {
font-size: 1.5rem;
color: #fff;
font-family: "TypoGraphica";
text-decoration: none; text-decoration: none;
padding-left: 1rem;
cursor: default;
vertical-align: text-bottom;
display: none;
} }
} }
.brand {
font-size: 1.5rem;
color: #fff;
font-family: "TypoGraphica";
text-decoration: none;
padding-left: 1rem;
cursor: default;
vertical-align: text-bottom;
display: none;
}
.pull-right { .pull-right {
float: right; float: right;
@ -775,29 +782,33 @@ header {
} }
.status { .status {
position: absolute; span{
top: 25%;
right: 1.25rem;
float: right;
span[data-indicator] {
display: inline-block; display: inline-block;
font-size: 0.8rem; font-size: 0.8rem;
font-weight: bold; font-weight: bold;
padding: 0.3rem 0.8rem; padding: 0.3rem 0.8rem;
margin: 0 0.5rem;
white-space: nowrap; white-space: nowrap;
text-decoration: none; text-decoration: none;
text-transform: uppercase; text-transform: uppercase;
text-shadow: none; text-shadow: none;
border-radius: 3px; border-radius: 4px;
cursor: pointer; cursor: pointer;
transition: all 0.3s; transition: all 0.3s;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .16), 0 0 2px 0 rgba(0, 0, 0, .12);
margin: 0 0.25rem;
&:last-child{
margin-right: 0;
}
}
span[data-indicator="poll-status"] {
color: #32325d;
background-color: #fff;
} }
span[data-style="active"] { span[data-style="active"] {
color: #32325d !important;
background-color: #fff; background-color: var(--green);
} }
@ -849,8 +860,8 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
.alert, .alert,
.alert-message { .alert-message {
font-weight: bold; font-weight: bold;
margin-bottom: 1em; margin-bottom: 1.25rem;
padding: 1rem; padding: 1rem 1.25rem;
border: 0; border: 0;
border-radius: 0.375rem !important; border-radius: 0.375rem !important;
background-color: #fff; background-color: #fff;
@ -862,7 +873,9 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
} }
h4 { h4 {
padding: 0rem 1.5rem 0.75rem 0rem; padding: 0.25rem 0rem;
border-radius: 4px;
background-color: #ffd600;
} }
.btn { .btn {
@ -885,7 +898,7 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
.container .alert, .container .alert,
.container .alert-message { .container .alert-message {
margin-top: 1rem; margin-top: 0rem;
} }
@ -976,10 +989,9 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
ul { ul {
display: none; display: none;
overflow: hidden;
} }
&:hover { &:hover {
background: none; background: none;
} }
@ -988,6 +1000,12 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
margin: 0 0.5rem 0 2.5rem; margin: 0 0.5rem 0 2.5rem;
padding: 0rem 0.5rem; padding: 0rem 0.5rem;
&.active {
display: block;
}
li { li {
position: relative; position: relative;
border-radius: 0.375rem; border-radius: 0.375rem;
@ -997,7 +1015,6 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
list-style: none; list-style: none;
a { a {
white-space: nowrap;
text-decoration: none; text-decoration: none;
} }
@ -1274,11 +1291,12 @@ h2 {
margin: 0 0 1rem 0; margin: 0 0 1rem 0;
font-size: 1.25rem; font-size: 1.25rem;
letter-spacing: 0.1rem; letter-spacing: 0.1rem;
padding: 1rem 1.5rem; padding: 1rem 1.25rem;
color: #32325d; color: #32325d;
border-radius: .375rem; border-radius: .375rem;
background: #fff; background: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, .03); box-shadow: 0 4px 8px rgba(0, 0, 0, .03);
font-weight: bold;
} }
@ -1289,21 +1307,23 @@ h3 {
width: 100%; width: 100%;
margin: 0; margin: 0;
margin-bottom: 0; margin-bottom: 0;
padding: 0.8755rem 1.5rem; padding: 0.8755rem 1.25rem;
color: #32325d; color: #32325d;
color: var(--gray-dark); color: var(--gray-dark);
border-radius: .375rem; border-radius: .375rem;
background: #fff; background: #fff;
font-weight: bold;
} }
h4 { h4 {
margin: 0; margin: 0;
padding: 0.75rem 1.5rem; padding: 0.75rem 1.25rem;
font-size: 0.7rem; font-size: 0.7rem;
font-weight: 600; font-weight: 600;
color: #525f7f; color: #525f7f;
background-color: #e9ecef; background-color: #e9ecef;
background-color: var(--lighter); background-color: var(--lighter);
font-weight: bold;
em { em {
padding: 0 0.5rem; padding: 0 0.5rem;
@ -1332,7 +1352,7 @@ h5 {
font-style: normal; font-style: normal;
line-height: normal; line-height: normal;
min-width: inherit; min-width: inherit;
margin: 1.5rem 0; margin: 1.25rem 0;
padding: 0rem; padding: 0rem;
border: 0; border: 0;
@ -1351,11 +1371,17 @@ h5 {
margin-left: 0; margin-left: 0;
} }
.cbi-map-descr, .cbi-map-descr {
.cbi-section-descr {
font-size: small; font-size: small;
line-height: 1.42857143; line-height: 1.5;
padding: .5rem 1.5rem; padding: 0 1.25rem;
}
.cbi-section-descr:not(:empty) {
font-size: small;
line-height: 1.5;
padding: 1rem 1.25rem 0 1.25rem;
} }
.cbi-map-descr+fieldset { .cbi-map-descr+fieldset {
@ -1387,7 +1413,7 @@ fieldset>fieldset,
width: 100%; width: 100%;
margin: 0; margin: 0;
margin-bottom: 0; margin-bottom: 0;
padding: 0.8755rem 1.5rem; padding: 0.8755rem 1.25rem;
color: #32325d; color: #32325d;
color: var(--gray-dark); color: var(--gray-dark);
@ -1399,13 +1425,17 @@ fieldset>fieldset,
[data-tab-title]>h3:first-child, [data-tab-title]>h3:first-child,
[data-tab-title]>h4:first-child, [data-tab-title]>h4:first-child,
[data-tab-title]>p:first-child { [data-tab-title]>p:first-child {
padding: 1rem; padding: 1rem 1.25rem;
} }
.cbi-section p { .cbi-section p {
padding: 1rem; padding: 1rem;
} }
.cbi-tblsection {
overflow-x: scroll;
}
table { table {
border-spacing: 0; border-spacing: 0;
border-collapse: collapse; border-collapse: collapse;
@ -1457,7 +1487,7 @@ tr>th,
.cbi-section-table-row::before, .cbi-section-table-row::before,
#cbi-wireless>#wifi_assoclist_table>.tr:nth-child(2) { #cbi-wireless>#wifi_assoclist_table>.tr:nth-child(2) {
border-top: thin solid #ddd; border-top: thin solid #ddd;
padding: 1.1em 1.5rem; padding: 1.1em 1.25rem;
} }
#cbi-wireless .td, #cbi-wireless .td,
@ -1468,7 +1498,7 @@ tr>th,
.tr.cbi-section-table-titles>.th { .tr.cbi-section-table-titles>.th {
border-top: 0 !important; border-top: 0 !important;
background-color: #f6f9fc; background-color: #f6f9fc;
padding: 1.1em 1.5rem; padding: 1.1em 1.25rem;
line-height: 1.3rem; line-height: 1.3rem;
} }
@ -1493,6 +1523,11 @@ tr>th,
width: 100%; width: 100%;
} }
.cbi-section-table-row>.cbi-value-field .cbi-input-text,
.cbi-section-table-row>.cbi-value-field .cbi-input-password {
min-width: 80px;
}
.cbi-section-table-row>.cbi-value-field [data-dynlist]>input, .cbi-section-table-row>.cbi-value-field [data-dynlist]>input,
.cbi-section-table-row>.cbi-value-field input.cbi-input-password { .cbi-section-table-row>.cbi-value-field input.cbi-input-password {
width: calc(100% - 1.5rem); width: calc(100% - 1.5rem);
@ -1502,6 +1537,13 @@ tr>th,
text-align: center !important; text-align: center !important;
} }
.control-group {
display: inline-flex;
width: 100%;
flex-wrap: wrap;
gap: 2px;
}
div>table>tbody>tr:nth-of-type(2n), div>table>tbody>tr:nth-of-type(2n),
div>.table>.tr:nth-of-type(2n) { div>.table>.tr:nth-of-type(2n) {
background-color: #f9f9f9; background-color: #f9f9f9;
@ -1553,7 +1595,8 @@ td>table>tbody>tr>td,
font-size: 1.2rem; font-size: 1.2rem;
display: inline-block; display: inline-block;
min-width: 0; min-width: 0;
padding: .2rem .3rem; padding: .2rem 1rem;
font-size: 0;
color: transparent !important; color: transparent !important;
background: url(../icon/arrow.svg) no-repeat center; background: url(../icon/arrow.svg) no-repeat center;
background-size: 12px 20px; background-size: 12px 20px;
@ -1778,7 +1821,8 @@ td>table>tbody>tr>td,
display: inline-block; display: inline-block;
padding: 0.875rem 0rem; padding: 0.875rem 0rem;
border-bottom: 0.18751rem solid rgba(0, 0, 0, 0); border-bottom: 0.18751rem solid rgba(0, 0, 0, 0);
margin: 0 0.2rem; margin: 0;
transition: all 0.2s;
a { a {
text-decoration: none; text-decoration: none;
@ -1865,6 +1909,9 @@ td>table>tbody>tr>td,
padding: 0.5rem 1.5rem; padding: 0.5rem 1.5rem;
} }
.cbi-section-node {
padding: 1rem 0;
}
.cbi-section .cbi-section-remove:nth-of-type(2n), .cbi-section .cbi-section-remove:nth-of-type(2n),
.container>.cbi-section .cbi-section-node:nth-of-type(2n) { .container>.cbi-section .cbi-section-node:nth-of-type(2n) {
@ -2404,12 +2451,12 @@ body:not(.Interfaces) .cbi-rowstyle-2:first-child {
/* progressbar */ /* progressbar */
.cbi-progressbar { .cbi-progressbar {
position: relative; position: relative;
min-width: 170px; min-width: 11rem;
height: 20px; height: 1.5rem;
margin: 6px 0; margin: 0 0;
border: thin solid #999; border: thin solid #999;
background: #eee; background: #eee;
border-radius: 0.2rem; border-radius: 4px;
overflow: hidden; overflow: hidden;
} }
@ -2417,8 +2464,8 @@ body:not(.Interfaces) .cbi-rowstyle-2:first-child {
width: 0; width: 0;
height: 100%; height: 100%;
transition: width .25s ease-in; transition: width .25s ease-in;
background: #5e72e4; background: #5bc0de;
background: var(--primary); background: var(--bar-bg);
} }
.cbi-progressbar::after { .cbi-progressbar::after {
@ -2426,11 +2473,11 @@ body:not(.Interfaces) .cbi-rowstyle-2:first-child {
font-size: 1em; font-size: 1em;
font-weight: bold; font-weight: bold;
font-size-adjust: .38; font-size-adjust: .38;
line-height: normal; line-height: 1.5rem;
position: absolute; position: absolute;
top: 2px; top: 0;
right: 0; right: 0;
bottom: 2px; bottom: 0;
left: 0; left: 0;
overflow: hidden; overflow: hidden;
content: attr(title); content: attr(title);
@ -2596,6 +2643,7 @@ body.modal-overlay-active #modal_overlay {
.cbi-page-actions { .cbi-page-actions {
padding-top: 1rem; padding-top: 1rem;
text-align: right; text-align: right;
justify-content: flex-end;
} }
.cbi-page-actions>form[method="post"] { .cbi-page-actions>form[method="post"] {
@ -2612,10 +2660,12 @@ body.modal-overlay-active #modal_overlay {
.ifacebadge { .ifacebadge {
display: inline-flex; display: inline-flex;
gap: .2rem;
padding: .5rem .8rem; padding: .5rem .8rem;
border-bottom: thin solid #ccc; border-bottom: thin solid #ccc;
background: #eee; background: #eee;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .05);
border-radius: 4px;
} }
td>.ifacebadge, td>.ifacebadge,
@ -2628,7 +2678,6 @@ td>.ifacebadge,
.ifacebadge>img { .ifacebadge>img {
display: inline-block; display: inline-block;
align-self: flex-start; align-self: flex-start;
margin: 0 .2rem;
} }
.ifacebadge>img+img { .ifacebadge>img+img {
@ -2642,13 +2691,16 @@ td>.ifacebadge,
.network-status-table .ifacebox { .network-status-table .ifacebox {
flex-grow: 1; flex-grow: 1;
margin: .5em; border-radius: 4px;
overflow: hidden;
margin: 0 1.25rem 1rem 1.25rem;
} }
.network-status-table .ifacebox-body { .network-status-table .ifacebox-body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
gap: 0.5em;
} }
.network-status-table .ifacebox-body>span { .network-status-table .ifacebox-body>span {
@ -2659,15 +2711,21 @@ td>.ifacebadge,
.network-status-table .ifacebox-body>div { .network-status-table .ifacebox-body>div {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: .5rem;
} }
.network-status-table .ifacebox-body .ifacebadge { .network-status-table .ifacebox-body .ifacebadge {
align-items: center; align-items: center;
flex: 1 1 auto; flex: 1 1 auto;
min-width: 220px; min-width: 220px;
margin: .5em 0em 0 0em;
padding: .5em; padding: .5em;
background-color: #fff; background-color: #fff;
>span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
} }
/* textarea */ /* textarea */
@ -2787,7 +2845,9 @@ td>.ifacebadge,
.ifacebox { .ifacebox {
line-height: 1.25; line-height: 1.25;
display: inline-flex; display: inline-flex;
overflow: hidden;
flex-direction: column; flex-direction: column;
border-radius: 4px;
min-width: 100px; min-width: 100px;
border-bottom: thin solid #ccc; border-bottom: thin solid #ccc;
background-color: #f9f9f9; background-color: #f9f9f9;
@ -2811,7 +2871,7 @@ td>.ifacebadge,
} }
.ifacebox-body { .ifacebox-body {
padding: .5em 1rem; padding: 0.875rem 1rem;
line-height: 1.6em; line-height: 1.6em;
} }
@ -2822,6 +2882,7 @@ td>.ifacebadge,
.zonebadge { .zonebadge {
display: inline-block; display: inline-block;
padding: .2rem .5rem; padding: .2rem .5rem;
border-radius: 4px;
} }
.zonebadge .ifacebadge { .zonebadge .ifacebadge {
@ -2862,17 +2923,17 @@ td>.ifacebadge,
} }
.cbi-section-table-row>.cbi-value-field .cbi-dropdown { .cbi-section-table-row>.cbi-value-field .cbi-dropdown {
min-width: 7rem; min-width: 3rem;
} }
.cbi-section-create { .cbi-section-create {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
margin: 0.25rem 0 0.25rem 1rem; margin: 0.25rem 1.25rem;
} }
.cbi-section-create>* { .cbi-section-create>* {
margin: .5rem; margin: .5rem 0;
} }
.cbi-section-remove { .cbi-section-remove {
@ -2992,6 +3053,11 @@ label[data-index][data-depends] {
content: ""; content: "";
top: 0; top: 0;
background-color: rgba(0, 0, 0, .56); background-color: rgba(0, 0, 0, .56);
transition: all 0.2s;
&.active {
display: block;
}
} }
/* diagnostics */ /* diagnostics */
@ -3773,8 +3839,7 @@ pre.command-output {
} }
.cbi-progressbar::after { .cbi-progressbar::after {
font-size: .5rem; font-size: .6rem;
line-height: 1.5;
} }
@ -3783,10 +3848,22 @@ pre.command-output {
position: fixed; position: fixed;
z-index: 100; z-index: 100;
width: 0; width: 0;
&.active {
width: 13rem;
}
} }
.main-right { .main-right {
width: 100%; width: 100%;
&.active {
overflow-y: hidden;
}
}
.darkMask.active {
display: block;
} }
.showSide { .showSide {
@ -3810,7 +3887,7 @@ pre.command-output {
} }
header>.fill>.container>.brand { header>.fill>.container>.flex1>.brand {
display: inline-block; display: inline-block;
} }
@ -3915,6 +3992,10 @@ pre.command-output {
right: 0 !important; right: 0 !important;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.login-page .login-container footer {
display: none;
}
} }
@ -3979,4 +4060,4 @@ pre.command-output {
} }
} }

View file

@ -1,4 +1,4 @@
// compress: false , sourceMap: false // compress: true , sourceMap: false
/** /**
* Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template * Argon is a clean HTML5 theme for LuCI. It is based on luci-theme-material and Argon Template
* *
@ -37,6 +37,9 @@ body {
.login-form { .login-form {
background-color: #1e1e1e; background-color: #1e1e1e;
-webkit-backdrop-filter: blur(var(--blur-radius-dark));
backdrop-filter: blur(var(--blur-radius-dark));
background-color: rgba(0, 0, 0, var(--blur-opacity-dark));
.brand { .brand {
color: #adb5bd; color: #adb5bd;
@ -289,6 +292,12 @@ tr>th,
background-color: #252526; background-color: #252526;
} }
.cbi-rowstyle-2 .cbi-button-up,
.cbi-rowstyle-2 .cbi-button-down,
body:not(.Interfaces) .cbi-rowstyle-2:first-child {
background-color: rgb(102, 102, 102) !important;
}
.cbi-section>h3:first-child, .cbi-section>h3:first-child,
.panel-title, .panel-title,
h3 { h3 {
@ -808,14 +817,7 @@ input,
color: #ccc !important; color: #ccc !important;
} }
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {
.login-page .login-container .login-form {
-webkit-backdrop-filter: blur(var(--blur-radius-dark));
backdrop-filter: blur(var(--blur-radius-dark));
background-color: rgba(0, 0, 0, var(--blur-opacity-dark));
}
}
@media screen and (max-width: 480px) { @media screen and (max-width: 480px) {

View file

@ -1,3 +1,4 @@
// out: false
/*! /*!
Pure v2.0.3 Pure v2.0.3
Copyright 2013 Yahoo! Copyright 2013 Yahoo!

View file

@ -0,0 +1,158 @@
'use strict';
'require baseclass';
'require ui';
return baseclass.extend({
__init__: function () {
ui.menu.load().then(L.bind(this.render, this));
},
render: function (tree) {
var node = tree,
url = '',
children = ui.menu.getChildren(tree);
for (var i = 0; i < children.length; i++) {
var isActive = (L.env.requestpath.length ? children[i].name == L.env.requestpath[0] : i == 0);
if (isActive)
this.renderMainMenu(children[i], children[i].name);
}
if (L.env.dispatchpath.length >= 3) {
for (var i = 0; i < 3 && node; i++) {
node = node.children[L.env.dispatchpath[i]];
url = url + (url ? '/' : '') + L.env.dispatchpath[i];
}
if (node)
this.renderTabMenu(node, url);
}
document.querySelector('a.showSide')
.addEventListener('click', ui.createHandlerFn(this, 'handleSidebarToggle'));
document.querySelector('.darkMask')
.addEventListener('click', ui.createHandlerFn(this, 'handleSidebarToggle'));
},
handleMenuExpand: function (ev) {
var a = ev.target, slide = a.parentNode, slide_menu = a.nextElementSibling;
var collapse = false;
document.querySelectorAll('.main .main-left .nav > li >ul.active').forEach(function (ul) {
$(ul).stop(true).slideUp("fast", function () {
ul.classList.remove('active');
ul.previousElementSibling.classList.remove('active');
});
if (!collapse && ul === slide_menu) {
collapse = true;
}
});
if (!slide_menu)
return;
if (!collapse) {
$(slide).find(".slide-menu").slideDown("fast",function(){
slide_menu.classList.add('active');
a.classList.add('active');
});
a.blur();
}
ev.preventDefault();
ev.stopPropagation();
},
renderMainMenu: function (tree, url, level) {
var l = (level || 0) + 1,
ul = E('ul', { 'class': level ? 'slide-menu' : 'nav' }),
children = ui.menu.getChildren(tree);
if (children.length == 0 || l > 2)
return E([]);
for (var i = 0; i < children.length; i++) {
var isActive = ((L.env.dispatchpath[l] == children[i].name) && (L.env.dispatchpath[l - 1] == tree.name)),
submenu = this.renderMainMenu(children[i], url + '/' + children[i].name, l),
hasChildren = submenu.children.length,
slideClass = hasChildren ? 'slide' : null,
menuClass = hasChildren ? 'menu' : null;
if (isActive) {
ul.classList.add('active');
slideClass += " active";
menuClass += " active";
}
ul.appendChild(E('li', { 'class': slideClass }, [
E('a', {
'href': L.url(url, children[i].name),
'click': (l == 1) ? ui.createHandlerFn(this, 'handleMenuExpand') : null,
'class': menuClass,
'data-title': hasChildren ? children[i].title.replace(" ", "_") : children[i].title.replace(" ", "_"),
}, [_(children[i].title)]),
submenu
]));
}
if (l == 1) {
document.querySelector('#mainmenu').appendChild(ul);
document.querySelector('#mainmenu').style.display = '';
}
return ul;
},
renderTabMenu: function (tree, url, level) {
var container = document.querySelector('#tabmenu'),
l = (level || 0) + 1,
ul = E('ul', { 'class': 'tabs' }),
children = ui.menu.getChildren(tree),
activeNode = null;
if (children.length == 0)
return E([]);
for (var i = 0; i < children.length; i++) {
var isActive = (L.env.dispatchpath[l + 2] == children[i].name),
activeClass = isActive ? ' active' : '',
className = 'tabmenu-item-%s %s'.format(children[i].name, activeClass);
ul.appendChild(E('li', { 'class': className }, [
E('a', { 'href': L.url(url, children[i].name) }, [_(children[i].title)])
]));
if (isActive)
activeNode = children[i];
}
container.appendChild(ul);
container.style.display = '';
if (activeNode)
container.appendChild(this.renderTabMenu(activeNode, url + '/' + activeNode.name, l));
return ul;
},
handleSidebarToggle: function (ev) {
var showside = document.querySelector('a.showSide'),
sidebar = document.querySelector('#mainmenu'),
darkmask = document.querySelector('.darkMask'),
scrollbar = document.querySelector('.main-right');
if (showside.classList.contains('active')) {
showside.classList.remove('active');
sidebar.classList.remove('active');
scrollbar.classList.remove('active');
darkmask.classList.remove('active');
}
else {
showside.classList.add('active');
sidebar.classList.add('active');
scrollbar.classList.add('active');
darkmask.classList.add('active');
}
}
});

View file

@ -7,13 +7,13 @@
Have a bug? Please create an issue here on GitHub! Have a bug? Please create an issue here on GitHub!
https://github.com/jerrykuku/luci-theme-argon/issues https://github.com/jerrykuku/luci-theme-argon/issues
luci-theme-material: luci-theme-material:
Copyright 2015 Lutty Yang <lutty@wcan.in> Copyright 2015 Lutty Yang <lutty@wcan.in>
Agron Theme Agron Theme
https://demos.creative-tim.com/argon-dashboard/index.html https://demos.creative-tim.com/argon-dashboard/index.html
Licensed to the public under the Apache License 2.0 Licensed to the public under the Apache License 2.0
-%> -%>
<% local ver = require "luci.version" %> <% local ver = require "luci.version" %>
@ -41,6 +41,6 @@
} }
}) })
</script> </script>
<script src="<%=media%>/js/script.js"></script> <script type="text/javascript">L.require('menu-argon')</script>
</body> </body>
</html> </html>

View file

@ -18,12 +18,11 @@
<% local ver = require "luci.version" %> <% local ver = require "luci.version" %>
</div> </div>
<footer class="mobile-hide"> <footer>
<div> <div>
<a class="luci-link" href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> / <a class="luci-link" href="https://github.com/openwrt/luci">Powered by <%= ver.luciname %> (<%= ver.luciversion %>)</a> /
<a href="https://github.com/jerrykuku/luci-theme-argon">ArgonTheme <%# vPKG_VERSION %></a> / <a href="https://github.com/jerrykuku/luci-theme-argon">ArgonTheme <%# vPKG_VERSION %></a> /
<%= ver.distversion %> <%= ver.distversion %>
<ul class="breadcrumb pull-right" id="modemenu" style="display:none"></ul>
</div> </div>
</footer> </footer>
</div> </div>
@ -41,6 +40,5 @@
} }
}) })
</script> </script>
<script src="<%=media%>/js/script.js"></script>
</body> </body>
</html> </html>

View file

@ -21,6 +21,7 @@
local util = require "luci.util" local util = require "luci.util"
local http = require "luci.http" local http = require "luci.http"
local disp = require "luci.dispatcher" local disp = require "luci.dispatcher"
local ver = require "luci.version"
local boardinfo = util.ubus("system", "board") local boardinfo = util.ubus("system", "board")
@ -81,11 +82,11 @@
<link rel="icon" type="image/png" sizes="32x32" href="<%=media%>/icon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="<%=media%>/icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="<%=media%>/icon/favicon-96x96.png"> <link rel="icon" type="image/png" sizes="96x96" href="<%=media%>/icon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%=media%>/icon/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="<%=media%>/icon/favicon-16x16.png">
<link rel="manifest" href="<%=media%>/icon/manifest.json"> <link rel="manifest" href="<%=media%>/icon/manifest.json" crossorigin="use-credentials">
<meta name="msapplication-TileColor" content="<%=bar_color%>"> <meta name="msapplication-TileColor" content="<%=bar_color%>">
<meta name="msapplication-TileImage" content="<%=media%>/icon/ms-icon-144x144.png"> <meta name="msapplication-TileImage" content="<%=media%>/icon/ms-icon-144x144.png">
<meta name="theme-color" content="<%=bar_color%>"> <meta name="theme-color" content="<%=bar_color%>">
<link rel="stylesheet" href="<%=media%>/css/cascade.css?v=<%=math.random(1,100000)%>"> <link rel="stylesheet" href="<%=media%>/css/cascade.css<%# ?v=PKG_VERSION %>">
<style title="text/css"> <style title="text/css">
<% if mode == 'normal' then %> <% if mode == 'normal' then %>
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@ -115,110 +116,10 @@
</style> </style>
<% end -%> <% end -%>
<script src="<%=media%>/js/polyfill.min.js"></script> <script src="<%=media%>/js/polyfill.min.js"></script>
<script src="<%=url('admin/translations', luci.i18n.context.lang)%>?v=2.2.4"></script> <script src="<%=url('admin/translations', luci.i18n.context.lang)%>?v=<%=ver.luciversion%>"></script>
<script src="<%=resource%>/cbi.js?v=2.2.4"></script> <script src="<%=resource%>/cbi.js?v=<%=ver.luciversion%>"></script>
<script src="<%=resource%>/luci.js?v=2.2.4"></script> <script src="<%=resource%>/luci.js?v=<%=ver.luciversion%>"></script>
<script src="<%=media%>/js/jquery.min.js?v=2.2.4"></script> <script src="<%=media%>/js/jquery.min.js?v=3.5.1"></script>
<script type="text/javascript">//<![CDATA[
function EF() { return L.dom.create.apply(L.dom, arguments) }
(function() {
function get_children(node) {
var children = [];
for (var k in node.children) {
if (!node.children.hasOwnProperty(k))
continue;
if (!node.children[k].satisfied)
continue;
if (!node.children[k].hasOwnProperty('title'))
continue;
children.push(Object.assign(node.children[k], { name: k }));
}
return children.sort(function(a, b) {
return ((a.order || 1000) - (b.order || 1000));
});
}
function render_mainmenu(tree, url, level) {
var l = (level || 0) + 1,
ul = EF('ul', { 'class': level ? 'slide-menu' : 'nav' }),
children = get_children(tree);
if (children.length == 0 || l > 2)
return EF([]);
for (var i = 0; i < children.length; i++) {
var submenu = render_mainmenu(children[i], url + '/' + children[i].name, l),
hasChildren = submenu.children.length;
ul.appendChild(EF('li', { 'class': hasChildren ? 'slide' : null }, [
EF('a', {
'href': hasChildren ? '#' : L.url(url, children[i].name),
'class': hasChildren ? 'menu' : null,
'data-title': hasChildren ? children[i].title.replace(" ", "_") : children[i].title.replace(" ", "_"),
}, [ _(children[i].title) ]),
submenu
]));
}
if (l == 1) {
var container = document.querySelector('#mainmenu');
container.appendChild(ul);
container.style.display = '';
}
return ul;
}
function render_modemenu(tree) {
var ul = document.querySelector('#modemenu'),
children = get_children(tree);
for (var i = 0; i < children.length; i++) {
var isActive = (L.env.requestpath.length ? children[i].name == L.env.requestpath[0] : i == 0);
ul.appendChild(EF('li', {}, [
EF('a', {
'href': L.url(children[i].name),
'class': isActive ? 'active' : null
}, [ _(children[i].title) ])
]));
if (isActive)
render_mainmenu(children[i], children[i].name);
}
if (ul.children.length > 1)
ul.style.display = '';
}
function render_tabmenu(tree, url, level) {
var container = document.querySelector('#tabmenu'),
l = (level || 0) + 1,
ul = EF('ul', { 'class': 'tabs' }),
children = get_children(tree),
activeNode = null;
if (children.length == 0)
return EF([]);
for (var i = 0; i < children.length; i++) {
var isActive = (L.env.dispatchpath[l + 2] == children[i].name),
activeClass = isActive ? ' active' : '',
className = 'tabmenu-item-%s %s'.format(children[i].name, activeClass);
ul.appendChild(EF('li', { 'class': className }, [
EF('a', { 'href': L.url(url, children[i].name) }, [ _(children[i].title) ] )
]));
if (isActive)
activeNode = children[i];
}
container.appendChild(ul);
container.style.display = '';
if (activeNode)
container.appendChild(render_tabmenu(activeNode, url + '/' + activeNode.name, l));
return ul;
}
document.addEventListener('luci-loaded', function(ev) {
var tree = <%= luci.http.write_json(luci.dispatcher.menu_json() or {}) %>,
node = tree,
url = '';
render_modemenu(tree);
if (L.env.dispatchpath.length >= 3) {
for (var i = 0; i < 3 && node; i++) {
node = node.children[L.env.dispatchpath[i]];
url = url + (url ? '/' : '') + L.env.dispatchpath[i];
}
if (node)
render_tabmenu(node, url);
}
});
})();
//]]></script>
</head> </head>
<body <body
@ -246,14 +147,11 @@
<header class="bg-primary"> <header class="bg-primary">
<div class="fill"> <div class="fill">
<div class="container"> <div class="container">
<a class="showSide"></a> <div class="flex1">
<a class="brand" href="#"><%=brand_name%></a> <a class="showSide"></a>
<div class="status" id="indicators"> <a class="brand" href="#"><%=brand_name%></a>
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()"> </div>
<span class="label success" id="xhr_poll_status_on"><span class="mobile-hide"><%:Auto Refresh%></span> <%:on%></span> <div class="status" id="indicators"></div>
<span class="label" id="xhr_poll_status_off" style="display:none"><span class="mobile-hide"><%:Auto Refresh%></span> <%:off%></span>
</span>
</div>
</div> </div>
</div> </div>
</header> </header>

View file

@ -21,6 +21,7 @@
local util = require "luci.util" local util = require "luci.util"
local http = require "luci.http" local http = require "luci.http"
local disp = require "luci.dispatcher" local disp = require "luci.dispatcher"
local ver = require "luci.version"
local boardinfo = util.ubus("system", "board") local boardinfo = util.ubus("system", "board")
@ -78,11 +79,11 @@
<link rel="icon" type="image/png" sizes="32x32" href="<%=media%>/icon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="<%=media%>/icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="<%=media%>/icon/favicon-96x96.png"> <link rel="icon" type="image/png" sizes="96x96" href="<%=media%>/icon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="<%=media%>/icon/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="<%=media%>/icon/favicon-16x16.png">
<link rel="manifest" href="<%=media%>/icon/manifest.json"> <link rel="manifest" href="<%=media%>/icon/manifest.json" crossorigin="use-credentials">
<meta name="msapplication-TileColor" content="<%=bar_color%>"> <meta name="msapplication-TileColor" content="<%=bar_color%>">
<meta name="msapplication-TileImage" content="<%=media%>/icon/ms-icon-144x144.png"> <meta name="msapplication-TileImage" content="<%=media%>/icon/ms-icon-144x144.png">
<meta name="theme-color" content="<%=bar_color%>"> <meta name="theme-color" content="<%=bar_color%>">
<link rel="stylesheet" href="<%=media%>/css/cascade.css?v=<%=math.random(1,100000)%>"> <link rel="stylesheet" href="<%=media%>/css/cascade.css<%# ?v=PKG_VERSION %>">
<style title="text/css"> <style title="text/css">
<% if mode == 'normal' then %> <% if mode == 'normal' then %>
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@ -111,13 +112,8 @@
<%=css %> <%=css %>
</style> </style>
<% end -%> <% end -%>
<script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script> <script src="<%=media%>/js/jquery.min.js?v=3.5.1"></script>
<script src="<%=resource%>/cbi.js<%# ?v=PKG_VERSION %>"></script>
<script src="<%=resource%>/xhr.js<%# ?v=PKG_VERSION %>"></script>
<script src="<%=media%>/js/jquery.min.js<%# ?v=PKG_VERSION %>"></script>
</head> </head>
<body <body>
class="lang_<%=luci.i18n.context.lang%> <% if node then %><%= striptags( node.title ) %><% end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>"
data-page="<%= table.concat(disp.context.requestpath, "-") %>">

View file

@ -5,34 +5,10 @@
-%> -%>
<% <%
local ver = require "luci.version"
if not luci.dispatcher.context.template_header_sent then if not luci.dispatcher.context.template_header_sent then
include("themes/" .. theme .. "/header_login") include("themes/" .. theme .. "/header_login")
luci.dispatcher.context.template_header_sent = true luci.dispatcher.context.template_header_sent = true
end end
local applyconf = luci.config and luci.config.apply
%> %>
<script type="text/javascript" src="<%=resource%>/promis.min.js"></script>
<script type="text/javascript" src="<%=resource%>/luci.js"></script>
<script type="text/javascript">
L = new LuCI(<%= luci.http.write_json({
token = token,
media = media,
resource = resource,
scriptname = luci.http.getenv("SCRIPT_NAME"),
pathinfo = luci.http.getenv("PATH_INFO"),
documentroot = luci.http.getenv("DOCUMENT_ROOT"),
requestpath = luci.dispatcher.context.requestpath,
dispatchpath = luci.dispatcher.context.path,
pollinterval = luci.config.main.pollinterval or 5,
ubuspath = luci.config.main.ubuspath or '/ubus/',
sessionid = luci.dispatcher.context.authsession,
nodespec = luci.dispatcher.context.dispatched,
apply_rollback = math.max(applyconf and applyconf.rollback or 90, 90),
apply_holdoff = math.max(applyconf and applyconf.holdoff or 4, 1),
apply_timeout = math.max(applyconf and applyconf.timeout or 5, 1),
apply_display = math.max(applyconf and applyconf.display or 1.5, 1),
rollback_token = rollback_token
}) %>);
</script>

View file

@ -23,12 +23,16 @@
<%+themes/argon/out_header_login%> <%+themes/argon/out_header_login%>
<% <%
local util = require "luci.util" local util = require "luci.util"
local boardinfo = util.ubus("system", "board") local fs = require "nixio.fs"
local fs = require "nixio.fs" local nutil = require "nixio.util"
local nutil = require "nixio.util" local json = require "luci.jsonc"
local sys = require "luci.sys"
local uci = require 'luci.model.uci'.cursor()
function glob(...) -- Fetch Local Background Media
local function glob(...)
local iter, code, msg = fs.glob(...) local iter, code, msg = fs.glob(...)
if iter then if iter then
return nutil.consume(iter) return nutil.consume(iter)
@ -37,37 +41,69 @@
end end
end end
function getExtension(str)
return str:match(".+%.(%w+)$")
end
local bgcount = 0 local imageTypes = " jpg png gif "
local currentBg = {} local videoTypes = " mp4 webm "
local bgs,attr = {} local allTypes = imageTypes .. videoTypes
local theme_dir = media .. "/background/" local function fetchMedia(path,themeDir)
for i, f in ipairs(glob("/www" .. theme_dir .. "*")) do local backgroundTable = {}
attr = fs.stat(f) local backgroundCount = 0
if attr then for i, f in ipairs(glob(path)) do
local ext = getExtension(fs.basename(f)) attr = fs.stat(f)
if ext == "jpg" or ext == "png" or ext == "gif" or ext == "mp4" then if attr then
local bg = {} local ext = fs.basename(f):match(".+%.(%w+)$")
bg.type = ext if ext ~= nil then
bg.url = theme_dir .. fs.basename(f) ext = ext:lower()
table.insert(bgs,bg) end
bgcount = bgcount + 1 if ext ~= nil and string.match(allTypes, " "..ext.." ") ~= nil then
local bg = {}
bg.type = ext
bg.url = themeDir .. fs.basename(f)
table.insert(backgroundTable,bg)
backgroundCount = backgroundCount + 1
end
end end
end end
return backgroundTable,backgroundCount
end
local function selectBackground(themeDir)
local bgUrl = media .. "/img/bg1.jpg"
local backgroundType = "Image"
local mimeType = ""
if fs.access("/etc/config/argon") then
if uci:get_first('argon', 'global', 'bing_background') == "1" then
local bing = sys.exec("/usr/libexec/argon/bing_wallpaper")
if (bing and bing ~= '') then
return bing, "Image", ""
end
end
end
local backgroundTable, backgroundCount = fetchMedia("/www" .. themeDir .. "*",themeDir)
if ( backgroundCount > 0 ) then
local currentBg = backgroundTable[math.random(1,backgroundCount)]
bgUrl = currentBg.url
if (string.match(videoTypes, " "..currentBg.type.." ") ~= nil) then
backgroundType = "Video"
mimeType = "video/" .. currentBg.type
end
end
return bgUrl,backgroundType,mimeType
end end
if bgcount > 0 then local boardinfo = util.ubus("system", "board")
currentBg = bgs[math.random(1,bgcount)] local themeDir = media .. "/background/"
end local bgUrl,backgroundType,mimeType = selectBackground(themeDir)
%> %>
<!-- Login Page Start -->
<div class="login-page"> <div class="login-page">
<% if (bgcount > 0 and currentBg.type == "mp4") then %> <% if ( backgroundType == "Video" ) then %>
<!-- Video Player Start -->
<div class="video"> <div class="video">
<video autoplay loop muted id="video"> <video autoplay loop muted id="video">
<source src="<%=currentBg.url%>" type="video/mp4"> <source src="<%=bgUrl%>" type="<%=mimeType%>">
</video> </video>
</div> </div>
<div class="volume-control mute"></div> <div class="volume-control mute"></div>
@ -82,28 +118,21 @@
} }
}) })
</script> </script>
<% else <!-- Video Player End -->
local bg_url = media .. "/img/bg1.jpg" <% else %>
local bing = "123" <!-- Image Background Start -->
if (bgcount == 0 ) then <div class="main-bg" id="main-bg" style="background-image:url(<%=bgUrl%>)"></div>
local sys = require "luci.sys" <!-- Image Background End -->
local json = require "luci.jsonc"
local remote_bg_url="http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"
--bing = sys.httpget(remote_bg_url)
bing = sys.exec("wget --timeout=0.5 -qO- '%s'" %remote_bg_url)
if (bing and bing ~= '') then
bg_url = "https://www.bing.com" .. json.parse(bing).images[1].url
end
elseif (bgcount > 0 and currentBg["type"] ~= "mp4") then
bg_url = currentBg.url
end
%>
<div class="main-bg" id="main-bg" style="background-image:url(<%=bg_url%>)"></div>
<% end %> <% end %>
<!-- Login Container Start -->
<div class="login-container"> <div class="login-container">
<div class="login-form"> <div class="login-form">
<a class="brand" href="/"><img src="<%=media%>/img/argon.svg" class="icon"><span <!-- Logo Start -->
class="brand-text"><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %></span></a> <a class="brand" href="/"><img src="<%=media%>/img/argon.svg" class="icon">
<span class="brand-text"><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %></span>
</a>
<!-- Logo End -->
<!-- Login Form Start -->
<form class="form-login" method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>"> <form class="form-login" method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
<%- if fuser then %> <%- if fuser then %>
@ -124,7 +153,7 @@
<input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" /> <input type="submit" value="<%:Login%>" class="cbi-button cbi-button-apply" />
</div> </div>
</form> </form>
<!-- Login Form End -->
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
var input = document.getElementsByName('luci_password')[0]; var input = document.getElementsByName('luci_password')[0];
if (input) if (input)

View file

@ -0,0 +1,52 @@
#!/bin/sh
# author jjm2473
BING_BASE=http://www.bing.com
CACHE=/var/run/argon_bing.url
WRLOCK=/var/lock/argon_bing.lock
fetch_url_path() {
curl --fail --show-error --max-time 1 \
"$BING_BASE/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US" 2>/dev/null \
| jsonfilter -q -e '@.images[0].url'
}
try_update() {
local lock="$WRLOCK"
exec 200>$lock
if flock -n 200 >/dev/null 2>&1; then
local path=`fetch_url_path`
if [ -n "$path" ]; then
echo "${BING_BASE}${path}" | tee "$CACHE"
else
if [ -s "$CACHE" ]; then
cat "$CACHE"
else
touch "$CACHE"
fi
fi
flock -u 200 >/dev/null 2>&1
elif [ -s "$CACHE" ]; then
cat "$CACHE"
fi
}
get_url() {
if [ -f "$CACHE" ]; then
local idle_t=$((`date '+%s'` - `date -r "$CACHE" '+%s' 2>/dev/null || echo '0'`))
if [ -s "$CACHE" ]; then
if [ $idle_t -le 43200 ]; then
cat "$CACHE"
return
fi
else
if [ $idle_t -le 120 ]; then
return
fi
fi
fi
try_update
}
get_url

View file

@ -10,12 +10,15 @@ USE_PROCD=1
. /lib/functions/network.sh . /lib/functions/network.sh
global_multipath_settings() { global_multipath_settings() {
local multipath mptcp_path_manager mptcp_schdeduler mptcp_debug congestion mptcp_checksum mptcp_syn_retries mptcp_fullmesh_num_subflows mptcp_fullmesh_create_on_err mptcp_ndiffports_num_subflows mptcp_rr_cwnd_limited mptcp_rr_num_segments local multipath mptcp_path_manager mptcp_scheduler mptcp_subflows mptcp_debug mptcp_add_addr_accepted congestion mptcp_checksum mptcp_syn_retries mptcp_fullmesh_num_subflows mptcp_fullmesh_create_on_err mptcp_ndiffports_num_subflows mptcp_rr_cwnd_limited mptcp_rr_num_segments
local multipath_status=0 local multipath_status=0
config_load network config_load network
config_get multipath globals multipath config_get multipath globals multipath
config_get mptcp_path_manager globals mptcp_path_manager config_get mptcp_path_manager globals mptcp_path_manager
config_get mptcp_scheduler globals mptcp_scheduler config_get mptcp_scheduler globals mptcp_scheduler
config_get mptcp_subflows globals mptcp_subflows "3"
config_get mptcp_add_addr_accepted globals mptcp_add_addr_accepted "1"
config_get mptcp_add_addr_timeout globals mptcp_add_addr_timeout "120"
config_get mptcp_debug globals mptcp_debug config_get mptcp_debug globals mptcp_debug
config_get congestion globals congestion config_get congestion globals congestion
config_get mptcp_checksum globals mptcp_checksum config_get mptcp_checksum globals mptcp_checksum
@ -25,29 +28,38 @@ global_multipath_settings() {
config_get mptcp_ndiffports_num_subflows globals mptcp_ndiffports_num_subflows config_get mptcp_ndiffports_num_subflows globals mptcp_ndiffports_num_subflows
config_get mptcp_rr_cwnd_limited globals mptcp_rr_cwnd_limited config_get mptcp_rr_cwnd_limited globals mptcp_rr_cwnd_limited
config_get mptcp_rr_num_segments globals mptcp_rr_num_segments config_get mptcp_rr_num_segments globals mptcp_rr_num_segments
config_get mptcp_version globals mptcp_version "0"
[ "$multipath" = "enable" ] && multipath_status=1 [ "$multipath" = "enable" ] && multipath_status=1
# Global MPTCP configuration # Global MPTCP configuration
sysctl -qw net.mptcp.mptcp_enabled="$multipath_status" if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
[ -z "$mptcp_path_manager" ] || sysctl -qw net.mptcp.mptcp_path_manager="$mptcp_path_manager" sysctl -qew net.mptcp.mptcp_enabled="$multipath_status"
[ -z "$mptcp_scheduler" ] || sysctl -qw net.mptcp.mptcp_scheduler="$mptcp_scheduler" [ -z "$mptcp_path_manager" ] || sysctl -qew net.mptcp.mptcp_path_manager="$mptcp_path_manager"
[ -z "$congestion" ] || sysctl -qw net.ipv4.tcp_congestion_control="$congestion" [ -z "$mptcp_scheduler" ] || sysctl -qew net.mptcp.mptcp_scheduler="$mptcp_scheduler"
[ -z "$mptcp_checksum" ] || sysctl -qw net.mptcp.mptcp_checksum="$mptcp_checksum" [ -z "$mptcp_checksum" ] || sysctl -qew net.mptcp.mptcp_checksum="$mptcp_checksum"
[ -z "$mptcp_debug" ] || sysctl -qw net.mptcp.mptcp_debug="$mptcp_debug" [ -z "$mptcp_debug" ] || sysctl -qew net.mptcp.mptcp_debug="$mptcp_debug"
[ -z "$mptcp_syn_retries" ] || sysctl -qw net.mptcp.mptcp_syn_retries="$mptcp_syn_retries" [ -z "$mptcp_syn_retries" ] || sysctl -qew net.mptcp.mptcp_syn_retries="$mptcp_syn_retries"
[ -z "$mptcp_fullmesh_num_subflows" ] || sysctl -qw /sys/module/mptcp_fullmesh/parameters/num_subflows="$mptcp_fullmesh_num_subflows" [ -z "$mptcp_fullmesh_num_subflows" ] || sysctl -qew /sys/module/mptcp_fullmesh/parameters/num_subflows="$mptcp_fullmesh_num_subflows"
[ -z "$mptcp_fullmesh_create_on_err" ] || sysctl -qw /sys/module/mptcp_fullmesh/parameters/create_on_err="$mptcp_fullmesh_create_on_err" [ -z "$mptcp_fullmesh_create_on_err" ] || sysctl -qew /sys/module/mptcp_fullmesh/parameters/create_on_err="$mptcp_fullmesh_create_on_err"
[ -z "$mptcp_ndiffports_num_subflows" ] || sysctl -qw /sys/module/mptcp_ndiffports/parameters/num_subflows="$mptcp_ndiffports_num_subflows" [ -z "$mptcp_ndiffports_num_subflows" ] || sysctl -qew /sys/module/mptcp_ndiffports/parameters/num_subflows="$mptcp_ndiffports_num_subflows"
[ -z "$mptcp_rr_cwnd_limited" ] || sysctl -qw /sys/module/mptcp_rr/parameters/cwnd_limited="$mptcp_rr_cwnd_limited" [ -z "$mptcp_rr_cwnd_limited" ] || sysctl -qew /sys/module/mptcp_rr/parameters/cwnd_limited="$mptcp_rr_cwnd_limited"
[ -z "$mptcp_rr_num_segments" ] || sysctl -qw /sys/module/mptcp_rr/parameters/num_segments="$mptcp_rr_num_segments" [ -z "$mptcp_rr_num_segments" ] || sysctl -qew /sys/module/mptcp_rr/parameters/num_segments="$mptcp_rr_num_segments"
[ -z "$mptcp_version" ] || sysctl -qew net.mptcp.mptcp_version="$mptcp_version"
elif [ -f /proc/sys/net/mptcp/enabled ]; then
sysctl -qew net.mptcp.enabled="$multipath_status"
ip mptcp limits set add_addr_accepted $mptcp_add_addr_accepted subflows $mptcp_subflows 2>&1 >/dev/null
[ -z "$mptcp_add_addr_timeout" ] || sysctl -qew net.mptcp.add_addr_timeout="$mptcp_add_addr_timeout"
[ -z "$mptcp_checksum" ] || sysctl -qew net.mptcp.checksum_enabled="$mptcp_checksum"
fi
[ -z "$congestion" ] || sysctl -qew net.ipv4.tcp_congestion_control="$congestion"
} }
interface_macaddr_count() { interface_macaddr_count() {
local intf="$1" local intf="$1"
local dmacaddr="$2" local dmacaddr="$2"
config_get macaddr "$intf" macaddr config_get macaddr "$intf" macaddr
[ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1)) [ "$macaddr" = "$dmacaddr" ] && [ -z "$(echo $intf | grep '\.')" ] && nbmac=$((nbmac+1))
} }
interface_max_metric() { interface_max_metric() {
@ -85,9 +97,11 @@ interface_multipath_settings() {
local enabled local enabled
config_get enabled "$config" auto "1" config_get enabled "$config" auto "1"
config_get iface "$config" ifname network_get_device iface $config
config_get txqueuelen "$config" txqueuelen [ -z "$iface" ] && network_get_physdev iface $config
[ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]') [ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
[ -z "$iface" ] && config_get iface "$config" ifname
config_get txqueuelen "$config" txqueuelen
[ -n "$(echo $iface | grep '@')" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["device"]') [ -n "$(echo $iface | grep '@')" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["device"]')
if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then
count=$((count+1)) count=$((count+1))
@ -119,6 +133,7 @@ interface_multipath_settings() {
[ -z "$mptcpmintf" ] && mptcpmintf="$config" [ -z "$mptcpmintf" ] && mptcpmintf="$config"
uci -q set network.${config}.defaultroute=0 uci -q set network.${config}.defaultroute=0
uci -q set network.${config}.peerdns=0 uci -q set network.${config}.peerdns=0
echo '' > /etc/resolv.conf 2>&1 >/dev/null
} }
[ "$mode" = "master" ] && { [ "$mode" = "master" ] && {
# Force that only one interface is master # Force that only one interface is master
@ -152,6 +167,7 @@ interface_multipath_settings() {
[ "$config" = "omrvpn" ] && mode="off" [ "$config" = "omrvpn" ] && mode="off"
[ -n "$(ifconfig | grep $iface)" ] || return 0 [ -n "$(ifconfig | grep $iface)" ] || return 0
[ "$(echo $iface | grep _dev)" != "" ] && return 0 [ "$(echo $iface | grep _dev)" != "" ] && return 0
[ "$(echo $iface | grep '^if')" != "" ] && return 0
if [ "$mode" = "master" ]; then if [ "$mode" = "master" ]; then
multipath "$iface" "on" multipath "$iface" "on"
@ -176,7 +192,7 @@ interface_multipath_settings() {
config_get gateway $config gateway config_get gateway $config gateway
config_get netmask $config netmask config_get netmask $config netmask
[ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr $netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'` [ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr $netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'`
[ -n "$îpaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` [ -n "$ipaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
elif [ "$proto" != "gre" ]; then elif [ "$proto" != "gre" ]; then
network_get_ipaddr ipaddr $config network_get_ipaddr ipaddr $config
[ -z "$ipaddr" ] && ipaddr=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n") [ -z "$ipaddr" ] && ipaddr=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
@ -200,6 +216,7 @@ interface_multipath_settings() {
[ -n "$netmask" ] && [ "$(echo $netmask | grep '/')" != "" ] && netmask="" [ -n "$netmask" ] && [ "$(echo $netmask | grep '/')" != "" ] && netmask=""
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep peer | awk '{print $4}' | cut -d/ -f2 | tr -d "\n") [ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep peer | awk '{print $4}' | cut -d/ -f2 | tr -d "\n")
[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f2 | tr -d "\n") [ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep inet | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
[ -n "$ipaddr" ] && ipaddr=$(echo $ipaddr | cut -d/ -f1 | tr -d "\n")
[ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr $netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'` [ -n "$ipaddr" ] && [ -n "$netmask" ] && netmask=`ipcalc.sh $ipaddr $netmask | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'`
[ -n "$ipaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` [ -n "$ipaddr" ] && [ -n "$netmask" ] && network=`ipcalc.sh $ipaddr $netmask | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
fi fi
@ -244,19 +261,20 @@ interface_multipath_settings() {
else else
#echo "Add routes for $ipaddr table $id" #echo "Add routes for $ipaddr table $id"
[ -n "$ipaddr" ] && ip rule add from $ipaddr table $id pref 0 [ -n "$ipaddr" ] && ip rule add from $ipaddr table $id pref 0
ip rule add oif $iface table $id pref 0
ip route replace $network/$netmask dev $iface scope link metric $id 2>&1 >/dev/null ip route replace $network/$netmask dev $iface scope link metric $id 2>&1 >/dev/null
ip route replace $network/$netmask dev $iface scope link table $id 2>&1 >/dev/null ip route replace $network/$netmask dev $iface scope link table $id 2>&1 >/dev/null
ip route replace default via $gateway dev $iface table $id 2>&1 >/dev/null ip route replace default via $gateway dev $iface table $id 2>&1 >/dev/null
ip route replace default via $gateway dev $iface metric $id 2>&1 >/dev/null [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && ip route replace default via $gateway dev $iface metric $id 2>&1 >/dev/null
#ip route flush $id #ip route flush $id
fi fi
#config_get mode "$config" multipath "" #config_get mode "$config" multipath ""
#[ "$mode" = "" ] && mode="$(uci -q get openmptcprouter.${config}.multipath)" #[ "$mode" = "" ] && mode="$(uci -q get openmptcprouter.${config}.multipath)"
[ "$mode" = "master" ] && { #[ "$mode" = "master" ] && {
#echo "ip route replace default via $gateway dev $iface" # #echo "ip route replace default via $gateway dev $iface"
ip route replace default via $gateway dev $iface 2>&1 >/dev/null # ip route replace default via $gateway dev $iface 2>&1 >/dev/null
} #}
if [ "$txqueuelen" != "" ]; then if [ "$txqueuelen" != "" ]; then
ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1 ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1
else else
@ -276,20 +294,22 @@ interface_multipath_settings() {
ip6addr=`echo $ip6addr | cut -d/ -f1` ip6addr=`echo $ip6addr | cut -d/ -f1`
netmask6=`ipcalc $ipaddr6 | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'` netmask6=`ipcalc $ipaddr6 | sed -n '/PREFIX=/{;s/.*=//;s/ .*//;p;}'`
network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'` network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
if [ -z "$ip6addr" ] || [ -z "$network6" ]; then fi
ip6addr=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f1 | tr -d "\n") if [ -z "$ip6addr" ] || [ -z "$network6" ]; then
gateway6=$(ip -6 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n") [ -z "$ip6addr" ] && network_get_ipaddr6 ip6addr $config
[ -z "$gateway6" ] && gateway6=$(uci -q get "network.$config.ip6gw") [ -z "$ip6addr" ] && ip6addr=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
[ -z "$gateway6" ] && gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n") [ -z "$gateway6" ] && network_get_gateway6 gateway6 $config true
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then [ -z "$gateway6" ] && gateway6=$(ip -6 r list dev $iface | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.route[@.target="::"].nexthop' | tr -d "\n") [ -z "$gateway6" ] && gateway6=$(uci -q get "network.$config.ip6gw")
fi [ -z "$gateway6" ] && gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n")
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then
gateway6=$(ubus call network.interface.${config}_6 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n") gateway6=$(ubus call network.interface.$config status | jsonfilter -q -l 1 -e '@.route[@.target="::"].nexthop' | tr -d "\n")
fi
netmask6=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
fi fi
if [ -z "$gateway6" ] || [ "$( valid_subnet6 $gateway6 )" != "ok" ]; then
gateway6=$(ubus call network.interface.${config}_6 status 2>/dev/null | jsonfilter -q -l 1 -e '@.inactive.route[@.target="::"].nexthop' | tr -d "\n")
fi
netmask6=$(ip -6 addr show dev $iface | grep -v 'scope link' | grep inet6 | awk '{print $2}' | cut -d/ -f2 | tr -d "\n")
[ -n "$ip6addr" ] && network6=`ipcalc $ip6addr | sed -n '/NETWORK=/{;s/.*=//;s/ .*//;p;}'`
fi fi
if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
@ -302,7 +322,7 @@ interface_multipath_settings() {
[ -n "$(ip -6 rule list | grep 6$id)" ] && ip -6 rule del table 6$id > /dev/null 2>&1 [ -n "$(ip -6 rule list | grep 6$id)" ] && ip -6 rule del table 6$id > /dev/null 2>&1
ip -6 route flush 6$id > /dev/null 2>&1 ip -6 route flush 6$id > /dev/null 2>&1
fi fi
if [ -n "$ip6addr" ] && [ -n "$gateway6" ] && [ -n "$network6" ]; then if [ -n "$gateway6" ] && [ -n "$network6" ]; then
if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then if [ "$(uci -q get openmptcprouter.settings.uci_route)" = "1" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
delete network.${config}_rule6 delete network.${config}_rule6
@ -327,18 +347,19 @@ interface_multipath_settings() {
commit network commit network
EOF EOF
else else
ip -6 rule add from $ip6addr table 6$id pref 0 2>&1 >/dev/null [ -n "$ip6addr" ] && ip -6 rule add from $ip6addr table 6$id pref 0 2>&1 >/dev/null
ip rule add oif $iface table 6$id pref 0
ip -6 route replace $network6/$netmask6 dev $iface scope link metric 6$id 2>&1 >/dev/null ip -6 route replace $network6/$netmask6 dev $iface scope link metric 6$id 2>&1 >/dev/null
ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id 2>&1 >/dev/null ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id 2>&1 >/dev/null
ip -6 route replace default via $gateway6 dev $iface table 6$id 2>&1 >/dev/null ip -6 route replace default via $gateway6 dev $iface table 6$id 2>&1 >/dev/null
ip -6 route replace default via $gateway6 dev $iface metric 6$id 2>&1 >/dev/null [ "$(uci -q get openmptcprouter.settings.defaultgw)" != "0" ] && ip -6 route replace default via $gateway6 dev $iface metric 6$id 2>&1 >/dev/null
ip -6 route flush 6$id 2>&1 >/dev/null #ip -6 route flush 6$id 2>&1 >/dev/null
fi fi
#config_get mode "$config" multipath "off" #config_get mode "$config" multipath "off"
[ "$mode" = "master" ] && { #[ "$mode" = "master" ] && {
ip -6 route replace default via $gateway6 dev $iface 2>&1 >/dev/null # ip -6 route replace default via $gateway6 dev $iface 2>&1 >/dev/null
} #}
#[ "$mode" = "off" ] && { #[ "$mode" = "off" ] && {
# ifconfig $iface txqueuelen 50 > /dev/null 2>&1 # ifconfig $iface txqueuelen 50 > /dev/null 2>&1
#} || { #} || {
@ -349,7 +370,10 @@ interface_multipath_settings() {
} }
load_interfaces() { load_interfaces() {
config_get ifname "$1" ifname network_get_device ifname $1
[ -z "$ifname" ] && network_get_physdev ifname $1
[ -z "$ifname" ] && config_get ifname "$1" device
[ -z "$ifname" ] && config_get ifname "$1" ifname
config_get multipath "$1" multipath "" config_get multipath "$1" multipath ""
[ -z "$multipath" ] && multipath="$(uci -q get openmptcprouter.$1.multipath)" [ -z "$multipath" ] && multipath="$(uci -q get openmptcprouter.$1.multipath)"
[ "$multipath" != "off" ] && [ "$multipath" != "" ] && interfaces=" ${ifname} ${interfaces}" [ "$multipath" != "off" ] && [ "$multipath" != "" ] && interfaces=" ${ifname} ${interfaces}"
@ -473,6 +497,10 @@ start_service() {
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ -z "$(ubus call system board | jsonfilter -e '@.board_name' | grep '4-model-b')" ] && { [ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep raspberry)" ] && [ -z "$(ubus call system board | jsonfilter -e '@.board_name' | grep '4-model-b')" ] && {
ethtool --offload eth0 rx off tx off > /dev/null 2>&1 ethtool --offload eth0 rx off tx off > /dev/null 2>&1
} }
[ -n "$(ubus call system board | jsonfilter -e '@.board_name' | grep -i r2s)" ] && {
ethtool -K eth0 rx off tx off > /dev/null 2>&1
ethtool -K eth1 rx off tx off > /dev/null 2>&1
}
} }
reload_service() { reload_service() {

File diff suppressed because it is too large Load diff

View file

@ -10,13 +10,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=mptcpd PKG_NAME:=mptcpd
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git
PKG_SOURCE_VERSION:=0e7175adf721c95a3bd742be77cb85e0b47138cd PKG_SOURCE_VERSION:=df4ea048cd3821f749bf06e0d01bb7d79faac812
PKG_VERSION:=0.7-$(PKG_SOURCE_VERSION) PKG_VERSION:=0.9-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org> PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
PKG_FIXUP:=autoreconf
PKG_FORTIFY_SOURCE:=2 PKG_FORTIFY_SOURCE:=2
PKG_INSTALL:=1 PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
@ -36,7 +34,16 @@ define Package/$(PKG_NAME)/conffiles
/etc/mptcpd/mptcpd.conf /etc/mptcpd/mptcpd.conf
endef endef
TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral CONFIGURE_ARGS += \
--disable-doxygen-doc \
--disable-logging
TARGET_CFLAGS += -Wno-unused-result -Wno-format-nonliteral
define Build/Prepare
$(Build/Prepare/Default)
( cd $(PKG_BUILD_DIR); $(AM_TOOL_PATHS) ./bootstrap )
endef
define Build/Compile define Build/Compile
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)

View file

@ -1,167 +0,0 @@
--- a/src/configuration.c 2021-06-29 17:44:20.481179981 +0200
+++ b/src/configuration.c 2021-06-29 17:44:52.580655950 +0200
@@ -37,21 +37,12 @@
* Preprocessor concatenation that expands preprocessor tokens as
* needed by leveraging the usual indirection technique.
*/
-///@{
-/// Underlying string concatenation macro.
-#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__
-
-/// Concatenate strings using the preprocessor.
-#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__)
-///@}
// Compile-time default logging choice
#ifndef MPTCPD_LOGGER
// This should never occur!
# error Problem configuring default log message destination.
#endif
-/// Name of the default logging function determined at compile-time.
-#define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER)
/**
* @brief Get the function that sets the log message destination.
@@ -474,7 +465,6 @@
struct mptcpd_config *mptcpd_config_create(int argc, char *argv[])
{
- MPTCPD_SET_LOG_FUNCTION(); // For early logging.
struct mptcpd_config *const config =
l_new(struct mptcpd_config, 1);
--- a/src/mptcpize.c 2021-06-29 19:29:57.810281053 +0200
+++ b/src/mptcpize.c 2021-06-29 19:29:29.942701557 +0200
@@ -17,7 +17,6 @@
#include <argp.h>
#include <dlfcn.h>
#include <errno.h>
-#include <error.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -79,7 +78,7 @@
nr++;
envp = calloc(nr + 3, sizeof(char *));
if (!envp)
- error(1, errno, "can't allocate env list");
+ fprintf(stderr, "can't allocate env list");
// ... filtering out any 'LD_PRELOAD' ...
nr = 0;
@@ -103,7 +102,7 @@
// build the NULL terminated arg list
argv = calloc(argc + 1, sizeof(char *));
if (!argv)
- error(1, errno, "can't allocate argument list");
+ fprintf(stderr, "can't allocate argument list");
memcpy(argv, av, argc * sizeof(char*));
return execvpe(argv[0], argv, envp);
@@ -124,33 +123,33 @@
len = strlen(name) + 1 + strlen(SYSTEMCTL_SHOW);
cmd = malloc(len);
if (!cmd)
- error(1, 0, "can't allocate systemctl command string");
+ fprintf(stderr, "can't allocate systemctl command string");
sprintf(cmd, SYSTEMCTL_SHOW"%s", name);
systemctl = popen(cmd, "r");
if (!systemctl)
- error(1, errno, "can't execute %s", cmd);
+ fprintf(stderr, "can't execute %s", cmd);
free(cmd);
while ((read = getline(&line, &len, systemctl)) != -1) {
if (strncmp(line, SYSTEMD_UNIT_VAR, strlen(SYSTEMD_UNIT_VAR)) == 0) {
char *ret = strdup(&line[strlen(SYSTEMD_UNIT_VAR)]);
if (!ret)
- error(1, errno, "failed to duplicate string");
+ fprintf(stderr, "failed to duplicate string");
// trim trailing newline, if any
len = strlen(ret);
if (len > 0 && ret[len - 1] == '\n')
ret[--len] = 0;
if (len == 0)
- error(1, 0, "can't find unit file for service %s", name);
+ fprintf(stderr, "can't find unit file for service %s", name);
free(line);
pclose(systemctl);
return ret;
}
}
- error(1, 0, "can't find FragmentPath attribute for unit %s", name);
+ fprintf(stderr, "can't find FragmentPath attribute for unit %s", name);
// never reached: just silence gcc
return NULL;
@@ -175,12 +174,12 @@
unit = locate_unit(argv[0]);
src = fopen(unit, "r");
if (!src)
- error(1, errno, "can't open file %s", unit);
+ fprintf(stderr, "can't open file %s", unit);
strcpy(dst_path, "/tmp/unit_XXXXXX");
dst = mkstemp(dst_path);
if (dst < 0)
- error(1, errno, "can't create tmp file");
+ fprintf(stderr, "can't create tmp file");
// reset any prior error, to allow later check on errno
errno = 0;
@@ -194,27 +193,27 @@
if (!is_env) {
if (write(dst, line, read) < 0)
- error(1, errno, "can't write '%s' into %s", line, dst_path);
+ fprintf(stderr, "can't write '%s' into %s", line, dst_path);
}
if (append_env &&
(is_env || strncmp(line, SYSTEMD_SERVICE_TAG, strlen(SYSTEMD_SERVICE_TAG)) == 0)) {
if (dprintf(dst, "%s%s\n", SYSTEMD_ENV_VAR, MPTCPWRAP_ENV) < 0)
- error(1, errno, "can't write to env string into %s", dst_path);
+ fprintf(stderr, "can't write to env string into %s", dst_path);
append_env = 0;
}
}
if (errno != 0)
- error(1, errno, "can't read from %s", unit);
+ fprintf(stderr, "can't read from %s", unit);
free(line);
fclose(src);
close(dst);
if (rename(dst_path, unit) < 0)
- error(1, errno, "can't rename %s to %s", dst_path, unit);
+ fprintf(stderr, "can't rename %s to %s", dst_path, unit);
if (system("systemctl daemon-reload") != 0)
- error(1, errno, "can't reload unit, manual 'systemctl daemon-reload' is required");
+ fprintf(stderr, "can't reload unit, manual 'systemctl daemon-reload' is required");
printf("mptcp successfully %s on unit %s\n",
enable ? "enabled" : "disabled", unit);
@@ -239,7 +238,7 @@
argp_program_version = "mptcpize "VERSION;
argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, &idx, 0) < 0)
- error(1, errno, "can't parse arguments");
+ fprintf(stderr, "can't parse arguments");
argc -= idx;
argv += idx;
--- a/src/mptcpize.c 2021-07-05 20:06:07.035838944 +0200
+++ b/src/mptcpize.c 2021-07-05 20:06:26.875505617 +0200
@@ -7,8 +7,6 @@
* Copyright (c) 2021, Red Hat, Inc.
*/
-#define _GNU_SOURCE
-
#include <linux/limits.h>
#include <sys/types.h>

View file

@ -0,0 +1,16 @@
--- a/src/error.h
+++ b/src/error.h
@@ -0,0 +1,13 @@
+#ifndef _ERROR_H
+#define _ERROR_H 1
+
+#include <stdio.h>
+#include <stdlib.h>
+
+// mimic the behaviour of https://man7.org/linux/man-pages/man3/error.3.html
+void error(int status, int errnum, const char *format, ...)
+{
+ fprintf(stderr, "Error %d: %s", errnum, format);
+ if (status != 0) exit(status);
+}
+#endif

View file

@ -1,58 +1,56 @@
#!/bin/sh #!/bin/sh
if [ "$(uci -q get openmptcprouter.latest_versions)" ]; then if [ -z "$(uci -q get qos.omrvpn)" ]; then
if [ "$(uci -q get qos.wan1)" = "" ]; then uci -q batch <<-EOF >/dev/null
delete qos.wan
set qos.wan1=interface
set qos.wan1.classgroup="Default"
set qos.wan1.enabled="0"
set qos.wan1.upload="4000"
set qos.wan1.download="100000"
set qos.wan2=interface
set qos.wan2.classgroup="Default"
set qos.wan2.enabled="0"
set qos.wan2.upload="4000"
set qos.wan2.download="100000"
set qos.omrvpn=interface
set qos.omrvpn.classgroup="Default"
set qos.omrvpn.enabled="0"
set qos.omrvpn.interface="tun0"
set qos.omrvpn.upload="0"
set qos.omrvpn.download="0"
set qos.omrvpn.qdisc="cake"
set qos.omrvpn.script="layer_cake.qos"
delete qos.@classify[-1]
add qos classify
set qos.@classify[-1].target='Express'
set qos.@classify[-1].ports='5600'
set qos.@classify[-1].comments='SIP'
add qos classify
set qos.@classify[-1].target='Express'
set qos.@classify[-1].portrange='27000-27050'
set qos.@classify[-1].proto='udp'
set qos.@classify[-1].comments='Steam'
commit qos
EOF
if [ "$(uci -q get network.wan3)" != "" ]; then
uci -q batch <<-EOF >/dev/null uci -q batch <<-EOF >/dev/null
delete qos.wan set qos.wan3=interface
set qos.wan1=interface set qos.wan3.classgroup="Default"
set qos.wan1.classgroup="Default" set qos.wan3.enabled="0"
set qos.wan1.enabled="0" set qos.wan3.upload="4000"
set qos.wan1.upload="4000" set qos.wan3.download="100000"
set qos.wan1.download="100000" commit qos
set qos.wan2=interface EOF
set qos.wan2.classgroup="Default" fi
set qos.wan2.enabled="0" if [ "$(uci -q get network.wan4)" != "" ]; then
set qos.wan2.upload="4000" uci -q batch <<-EOF >/dev/null
set qos.wan2.download="100000" set qos.wan4=interface
set qos.omrvpn=interface set qos.wan4.classgroup="Default"
set qos.omrvpn.classgroup="Default" set qos.wan4.enabled="0"
set qos.omrvpn.enabled="1" set qos.wan4.upload="4000"
set qos.omrvpn.interface="tun0" set qos.wan4.download="100000"
set qos.omrvpn.upload="0"
set qos.omrvpn.download="0"
set qos.omrvpn.qdisc="cake"
set qos.omrvpn.script="layer_cake.qos"
delete qos.@classify[-1]
add qos classify
set qos.@classify[-1].target='Express'
set qos.@classify[-1].ports='5600'
set qos.@classify[-1].comments='SIP'
add qos classify
set qos.@classify[-1].target='Express'
set qos.@classify[-1].portrange='27000-27050'
set qos.@classify[-1].proto='udp'
set qos.@classify[-1].comments='Steam'
commit qos commit qos
EOF EOF
if [ "$(uci -q get network.wan3)" != "" ]; then
uci -q batch <<-EOF >/dev/null
set qos.wan3=interface
set qos.wan3.classgroup="Default"
set qos.wan3.enabled="0"
set qos.wan3.upload="4000"
set qos.wan3.download="100000"
commit qos
EOF
fi
if [ "$(uci -q get network.wan4)" != "" ]; then
uci -q batch <<-EOF >/dev/null
set qos.wan4=interface
set qos.wan4.classgroup="Default"
set qos.wan4.enabled="0"
set qos.wan4.upload="4000"
set qos.wan4.download="100000"
commit qos
EOF
fi
fi fi
fi fi
rm -f /tmp/luci-indexcache rm -f /tmp/luci-indexcache