mirror of
https://github.com/kenzok8/small-package
synced 2025-01-05 11:36:47 +08:00
update 2024-05-18 20:07:50
This commit is contained in:
parent
eb53acc08f
commit
faa2c557e1
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.46.003
|
||||
PKG_VERSION:=0.46.011
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
@ -145,9 +145,6 @@ define Package/$(PKG_NAME)/postrm
|
||||
uci -q commit firewall
|
||||
uci -q delete ucitrack.@openclash[-1]
|
||||
uci -q commit ucitrack
|
||||
uci -q delete network.utun
|
||||
uci -q commit network
|
||||
/etc/init.d/network restart >/dev/null 2>&1 &
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
endef
|
||||
|
@ -175,7 +175,13 @@ local function chnroutev6()
|
||||
end
|
||||
|
||||
local function daip()
|
||||
local daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
local daip, lan_int_name
|
||||
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
daip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
daip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not daip or daip == "" then
|
||||
daip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
@ -345,21 +351,19 @@ local function historychecktime()
|
||||
end
|
||||
|
||||
function core_download()
|
||||
if uci:get("openclash", "config", "github_address_mod") == "0" or not uci:get("openclash", "config", "github_address_mod") then
|
||||
uci:set("openclash", "config", "github_address_mod", "https://testingcf.jsdelivr.net/")
|
||||
uci:commit("openclash")
|
||||
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
|
||||
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
|
||||
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
|
||||
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
|
||||
uci:set("openclash", "config", "github_address_mod", "0")
|
||||
uci:commit("openclash")
|
||||
local cdn_url = luci.http.formvalue("url")
|
||||
if cdn_url then
|
||||
luci.sys.call(string.format("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh '%s' >/dev/null 2>&1", cdn_url))
|
||||
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Dev' '%s' >/dev/null 2>&1 &", cdn_url))
|
||||
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'TUN' '%s' >/dev/null 2>&1 &", cdn_url))
|
||||
luci.sys.call(string.format("bash /usr/share/openclash/openclash_core.sh 'Meta' '%s' >/dev/null 2>&1 &", cdn_url))
|
||||
else
|
||||
luci.sys.call("rm -rf /tmp/clash_last_version 2>/dev/null && bash /usr/share/openclash/clash_version.sh >/dev/null 2>&1")
|
||||
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Dev' >/dev/null 2>&1 &")
|
||||
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'TUN' >/dev/null 2>&1 &")
|
||||
luci.sys.call("bash /usr/share/openclash/openclash_core.sh 'Meta' >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function download_rule()
|
||||
@ -410,7 +414,12 @@ function action_remove_all_core()
|
||||
end
|
||||
|
||||
function action_one_key_update()
|
||||
return luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_update.sh 'one_key_update' >/dev/null 2>&1 &")
|
||||
local cdn_url = luci.http.formvalue("url")
|
||||
if cdn_url then
|
||||
return luci.sys.call(string.format("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_update.sh 'one_key_update' '%s' >/dev/null 2>&1 &", cdn_url))
|
||||
else
|
||||
return luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && bash /usr/share/openclash/openclash_update.sh 'one_key_update' >/dev/null 2>&1 &")
|
||||
end
|
||||
end
|
||||
|
||||
local function dler_login_info_save()
|
||||
|
@ -166,6 +166,8 @@ dler.reset = false
|
||||
dler.submit = false
|
||||
dler:section(SimpleSection).template = "openclash/dlercloud"
|
||||
|
||||
m:append(Template("openclash/select_git_cdn"))
|
||||
|
||||
if uci:get("openclash", "config", "dler_token") then
|
||||
return m, dler, form, s, ap, d
|
||||
else
|
||||
|
@ -17,8 +17,19 @@ bold_off = [[</strong>]]
|
||||
|
||||
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
|
||||
if not op_mode then op_mode = "redir-host" end
|
||||
local lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n' || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
|
||||
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
local lan_ip
|
||||
if lan_int_name == "0" then
|
||||
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
m = Map("openclash", translate("Overwrite Settings"))
|
||||
m.pageaction = false
|
||||
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"
|
||||
@ -69,7 +80,7 @@ o:value("http://captive.apple.com/generate_204")
|
||||
o.default = "0"
|
||||
|
||||
o = s:taboption("settings", Value, "github_address_mod", translate("Github Address Modify"))
|
||||
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghproxy.com/\")'>https://ghproxy.com/</a>"
|
||||
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Faild. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://mirror.ghproxy.com/\")'>https://mirror.ghproxy.com/</a>"
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("https://fastly.jsdelivr.net/")
|
||||
o:value("https://testingcf.jsdelivr.net/")
|
||||
|
@ -81,6 +81,10 @@ local hysteria_protocols = {
|
||||
"faketcp"
|
||||
}
|
||||
|
||||
local hysteria2_protocols = {
|
||||
"udp"
|
||||
}
|
||||
|
||||
local obfs = {
|
||||
"plain",
|
||||
"http_simple",
|
||||
@ -157,12 +161,19 @@ o.datatype = "port"
|
||||
o.rmempty = false
|
||||
o.default = "443"
|
||||
|
||||
o = s:option(Value, "ports", translate("Port Hopping"))
|
||||
o = s:option(Flag, "flag_port_hopping", translate("Enable Port Hopping"))
|
||||
o:depends("type", "hysteria")
|
||||
o:depends("type", "hysteria2")
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
|
||||
o = s:option(Value, "ports", translate("Port Range"))
|
||||
o.datatype = "portrange"
|
||||
o.rmempty = true
|
||||
o.default = "20000-40000"
|
||||
o.placeholder = translate("20000-40000")
|
||||
o:depends("type", "hysteria")
|
||||
o:depends({type = "hysteria", flag_port_hopping = true})
|
||||
o:depends({type = "hysteria2", flag_port_hopping = true})
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.password = true
|
||||
@ -278,18 +289,29 @@ o.default = "1420"
|
||||
o.placeholder = translate("1420")
|
||||
o:depends("type", "wireguard")
|
||||
|
||||
o = s:option(Flag, "flag_transport", translate("Enable Transport Protocol Settings"))
|
||||
o:depends("type", "hysteria")
|
||||
o:depends("type", "hysteria2")
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
|
||||
o = s:option(ListValue, "hysteria_protocol", translate("Protocol"))
|
||||
for _, v in ipairs(hysteria_protocols) do o:value(v) end
|
||||
o.rmempty = false
|
||||
o:depends("type", "hysteria")
|
||||
o.rmempty = true
|
||||
o:depends({type = "hysteria", flag_transport = true})
|
||||
|
||||
o = s:option(Value, "hysteria_up", translate("up"))
|
||||
o = s:option(ListValue, "hysteria2_protocol", translate("Protocol"))
|
||||
for _, v in ipairs(hysteria2_protocols) do o:value(v) end
|
||||
o.rmempty = true
|
||||
o:depends({type = "hysteria2", flag_transport = true})
|
||||
|
||||
o = s:option(Value, "hysteria_up", translate("Uplink Capacity(Default:Mbps)"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Required")
|
||||
o:depends("type", "hysteria")
|
||||
o:depends("type", "hysteria2")
|
||||
|
||||
o = s:option(Value, "hysteria_down", translate("down"))
|
||||
o = s:option(Value, "hysteria_down", translate("Downlink Capacity(Default:Mbps)"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Required")
|
||||
o:depends("type", "hysteria")
|
||||
@ -682,18 +704,30 @@ o:depends("type", "hysteria")
|
||||
o:depends("type", "hysteria2")
|
||||
|
||||
-- [[ recv_window_conn ]]--
|
||||
o = s:option(Flag, "flag_quicparam", translate("Hysterir QUIC parameters"))
|
||||
o:depends("type", "hysteria")
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
|
||||
o = s:option(Value, "recv_window_conn", translate("recv_window_conn"))
|
||||
o.rmempty = true
|
||||
o.placeholder = translate("QUIC stream receive window")
|
||||
o.datatype = "uinteger"
|
||||
o:depends("type", "hysteria")
|
||||
o:depends({type = "hysteria", flag_quicparam = true})
|
||||
|
||||
-- [[ recv_window ]]--
|
||||
o = s:option(Value, "recv_window", translate("recv_window"))
|
||||
o.rmempty = true
|
||||
o.placeholder = translate("QUIC connection receive window")
|
||||
o.datatype = "uinteger"
|
||||
o:depends("type", "hysteria")
|
||||
o:depends({type = "hysteria", flag_quicparam = true})
|
||||
|
||||
-- [[ hop_interval ]]--
|
||||
o = s:option(Value, "hop_interval", translate("Hop Interval (Unit:second)"))
|
||||
o.rmempty = true
|
||||
o.default = "10"
|
||||
o:depends({type = "hysteria", flag_transport = true, flag_port_hopping = true})
|
||||
o:depends({type = "hysteria2", flag_port_hopping = true})
|
||||
|
||||
-- [[ disable_mtu_discovery ]]--
|
||||
o = s:option(ListValue, "disable_mtu_discovery", translate("disable_mtu_discovery"))
|
||||
@ -701,13 +735,7 @@ o.rmempty = true
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o.default = "false"
|
||||
o:depends("type", "hysteria")
|
||||
|
||||
-- [[ hop_interval ]]--
|
||||
o = s:option(Value, "hop_interval", translate("Hop Interval"))
|
||||
o.rmempty = true
|
||||
o.default = "10"
|
||||
o:depends("type", "hysteria")
|
||||
o:depends({type = "hysteria", flag_quicparam = true})
|
||||
|
||||
o = s:option(ListValue, "packet-addr", translate("Packet-Addr")..translate("(Only Meta Core)"))
|
||||
o.rmempty = true
|
||||
|
@ -16,8 +16,19 @@ bold_off = [[</strong>]]
|
||||
|
||||
local op_mode = string.sub(luci.sys.exec('uci get openclash.config.operation_mode 2>/dev/null'),0,-2)
|
||||
if not op_mode then op_mode = "redir-host" end
|
||||
local lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n' || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
|
||||
local lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
local lan_ip
|
||||
if lan_int_name == "0" then
|
||||
lan_ip = SYS.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
lan_ip = SYS.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
if not lan_ip or lan_ip == "" then
|
||||
lan_ip = luci.sys.exec("ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1 | tr -d '\n'")
|
||||
end
|
||||
m = Map("openclash", translate("Plugin Settings"))
|
||||
m.pageaction = false
|
||||
m.description = translate("Note: To restore the default configuration, try accessing:").." <a href='javascript:void(0)' onclick='javascript:restore_config(this)'>http://"..lan_ip.."/cgi-bin/luci/admin/services/openclash/restore</a>"..
|
||||
@ -256,7 +267,7 @@ if op_mode == "redir-host" then
|
||||
o.default = 0
|
||||
else
|
||||
o = s:taboption("traffic_control", Flag, "china_ip_route", translate("China IP Route"))
|
||||
o.description = translate("Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq")
|
||||
o.description = translate("Bypass The China Network Flows, Improve Performance, If Inaccessibility on Bypass Gateway, Try to Enable Bypass Gateway Compatible Option, Depend on Dnsmasq")
|
||||
o.default = 0
|
||||
o:depends("enable_redirect_dns", "1")
|
||||
o:depends("enable_redirect_dns", "0")
|
||||
@ -272,6 +283,22 @@ o = s:taboption("traffic_control", Flag, "intranet_allowed", translate("Only int
|
||||
o.description = translate("When Enabled, The Control Panel And The Connection Broker Port Will Not Be Accessible From The Public Network")
|
||||
o.default = 1
|
||||
|
||||
o = s:taboption("traffic_control", DynamicList, "intranet_allowed_wan_name", translate("WAN Interface Name"))
|
||||
o.description = translate("Select WAN Interface Name For The Intranet Allowed")
|
||||
o:depends("intranet_allowed", "1")
|
||||
local interfaces = SYS.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
|
||||
for interface in string.gmatch(interfaces, "%S+") do
|
||||
o:value(interface)
|
||||
end
|
||||
|
||||
o = s:taboption("traffic_control", ListValue, "lan_interface_name", translate("LAN Interface Name"))
|
||||
o.description = translate("Select LAN Interface Name")
|
||||
o:value("0", translate("Disable"))
|
||||
o.default = "0"
|
||||
for interface in string.gmatch(interfaces, "%S+") do
|
||||
o:value(interface)
|
||||
end
|
||||
|
||||
o = s:taboption("traffic_control", Value, "local_network_pass", translate("Local IPv4 Network Bypassed List"))
|
||||
o.template = "cbi/tvalue"
|
||||
o.description = translate("The Traffic of The Destination For The Specified Address Will Not Pass The Core")
|
||||
@ -1297,6 +1324,7 @@ end
|
||||
|
||||
m:append(Template("openclash/config_editor"))
|
||||
m:append(Template("openclash/toolbar_show"))
|
||||
m:append(Template("openclash/select_git_cdn"))
|
||||
|
||||
return m
|
||||
|
||||
|
@ -6,15 +6,15 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-dns-prefetch-control" content="on">
|
||||
<link rel="dns-prefetch" href="//cdn.jsdelivr.net">
|
||||
<link rel="dns-prefetch" href="//whois.pconline.com.cn/ipJson.jsp">
|
||||
<link rel="dns-prefetch" href="//www.taobao.com/help/getip.php">
|
||||
<link rel="dns-prefetch" href="//whois.pconline.com.cn">
|
||||
<link rel="dns-prefetch" href="//forge.speedtest.cn">
|
||||
<link rel="dns-prefetch" href="//api-ipv4.ip.sb">
|
||||
<link rel="dns-prefetch" href="//api.ipify.org">
|
||||
<link rel="dns-prefetch" href="//api.ttt.sh">
|
||||
<link rel="dns-prefetch" href="//qqwry.api.skk.moe">
|
||||
<link rel="dns-prefetch" href="//d.skk.moe">
|
||||
<link rel="preconnect" href="https://www.taobao.com/help/getip.php">
|
||||
<link rel="preconnect" href="https://whois.pconline.com.cn/ipJson.jsp">
|
||||
<link rel="preconnect" href="https://forge.speedtest.cn">
|
||||
<link rel="preconnect" href="https://whois.pconline.com.cn">
|
||||
<link rel="preconnect" href="https://api-ipv4.ip.sb">
|
||||
<link rel="preconnect" href="https://api.ipify.org">
|
||||
<link rel="preconnect" href="https://api.ttt.sh">
|
||||
@ -63,22 +63,22 @@
|
||||
.ip-result {
|
||||
font-size:15px;
|
||||
margin:0px 0px 0px 5%;
|
||||
white-space: nowrap; /*强制span不换行*/
|
||||
display: inline-block; /*将span当做块级元素对待*/
|
||||
width: 32%; /*限制宽度*/
|
||||
overflow: hidden; /*超出宽度部分隐藏*/
|
||||
text-overflow: ellipsis; /*超出部分以点号代替*/
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
width: 32%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
vertical-align:bottom;
|
||||
}
|
||||
|
||||
.ip-geo {
|
||||
font-size:15px;
|
||||
line-height:20px;
|
||||
white-space: nowrap; /*强制span不换行*/
|
||||
display: inline-block; /*将span当做块级元素对待*/
|
||||
width: 35%; /*限制宽度*/
|
||||
overflow: hidden; /*超出宽度部分隐藏*/
|
||||
text-overflow: ellipsis; /*超出部分以点号代替*/
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
width: 35%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: right;
|
||||
vertical-align:bottom;
|
||||
}
|
||||
@ -142,18 +142,17 @@
|
||||
<p style="margin: 20px 0 20px 8%; padding: 0px !important; text-align: left; font-size: 25px; font-weight: bold;"><%:IP Address%>
|
||||
<span style="float: right;"><img src="/luci-static/resources/openclash/img/eye-light.svg" height="20px" title="<%:Hide IP%>" alt="<%:Hide IP%>" id="eye-icon" onclick="return privacy_my_ip(this)" /></span>
|
||||
</p>
|
||||
|
||||
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
|
||||
<span class="ip-title">IP.TB <%:Mainland%>:</span><span class="ip-result" id="ip-taobao"></span> <span class="ip-geo" id="ip-taobao-geo"></span>
|
||||
<span class="ip-title">SpeedTest:</span><span class="ip-result" id="ip-speedtest"></span> <span class="ip-geo" id="ip-speedtest-geo"></span>
|
||||
</p>
|
||||
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
|
||||
<span class="ip-title">IP.PC <%:Mainland%>:</span><span class="ip-result" id="ip-pcol"></span> <span class="ip-geo" id="ip-pcol-geo"></span>
|
||||
<span class="ip-title">PConline:</span><span class="ip-result" id="ip-pcol"></span> <span class="ip-geo" id="ip-pcol-geo"></span>
|
||||
</p>
|
||||
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
|
||||
<span class="ip-title">IP.SB <%:Abroad%>:</span><span class="ip-result" id="ip-ipsb"></span> <span class="ip-geo" id="ip-ipsb-geo"></span>
|
||||
<span class="ip-title">IP.SB:</span><span class="ip-result" id="ip-ipsb"></span> <span class="ip-geo" id="ip-ipsb-geo"></span>
|
||||
</p>
|
||||
<p style="margin: 10px -2% 0 8%; text-align: left; padding-left: 0px !important; padding-right: 0px !important;">
|
||||
<span class="ip-title">IPIFY <%:Abroad%>:</span><span class="ip-result" id="ip-ipify"></span> <span class="ip-geo" id="ip-ipify-geo"></span>
|
||||
<span class="ip-title">IPIFY:</span><span class="ip-result" id="ip-ipify"></span> <span class="ip-geo" id="ip-ipify-geo"></span>
|
||||
</p>
|
||||
</div>
|
||||
<div style="width: 52%">
|
||||
@ -190,13 +189,13 @@
|
||||
const $$ = document;
|
||||
var ip_pcol_ip;
|
||||
var ip_ipsb_ip;
|
||||
var ip_taobao_ip;
|
||||
var ip_speedtest_ip;
|
||||
var ip_ipify_ip;
|
||||
var refresh_http;
|
||||
var refresh_ip;
|
||||
$$.getElementById('ip-pcol').innerHTML = '<%:Querying...%>';
|
||||
$$.getElementById('ip-ipify').innerHTML = '<%:Querying...%>';
|
||||
$$.getElementById('ip-taobao').innerHTML = '<%:Querying...%>';
|
||||
$$.getElementById('ip-speedtest').innerHTML = '<%:Querying...%>';
|
||||
$$.getElementById('ip-ipsb').innerHTML = '<%:Querying...%>';
|
||||
let random = parseInt(Math.random() * 100000000);
|
||||
let IP = {
|
||||
@ -266,8 +265,8 @@
|
||||
if (localStorage.getItem('privacy_my_ip') != 'true') {
|
||||
$$.getElementById('ip-speedtest').innerHTML = resp.data.ip;
|
||||
};
|
||||
$$.getElementById('ip-speedtest-geo').innerHTML = resp.data.country + resp.data.province + resp.data.city + (resp.data.distinct == "null" ? resp.data.distinct : '') + ' ' + (resp.data.isp == "null" ? resp.data.isp : '');
|
||||
//IP.parseIPIpip(resp.data.ip, 'ip-speedtest-geo');
|
||||
//$$.getElementById('ip-speedtest-geo').innerHTML = resp.data.country + resp.data.province + resp.data.city + (resp.data.distinct == "null" ? '' : resp.data.distinct) + ' ' + (resp.data.isp == "null" ? '' : resp.data.isp);
|
||||
IP.parseIPIpip(resp.data.ip, 'ip-speedtest-geo');
|
||||
})
|
||||
},
|
||||
getIpifyIP: () => {
|
||||
@ -350,20 +349,19 @@
|
||||
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
|
||||
};
|
||||
|
||||
function ipCallback(data){
|
||||
if (localStorage.getItem('privacy_my_ip') != 'true') {
|
||||
$$.getElementById('ip-taobao').innerHTML = data.ip;
|
||||
};
|
||||
IP.parseIPIpip(data.ip, 'ip-taobao-geo');
|
||||
};
|
||||
//function ipCallback(data){
|
||||
// if (localStorage.getItem('privacy_my_ip') != 'true') {
|
||||
// $$.getElementById('ip-taobao').innerHTML = data.ip;
|
||||
// };
|
||||
// IP.parseIPIpip(data.ip, 'ip-taobao-geo');
|
||||
//};
|
||||
|
||||
function delete_ip_script()
|
||||
{
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
for (var i = scripts.length; i--; ) {
|
||||
if (document.getElementsByTagName("script")[i]['src'].indexOf('whois.pconline.com.cn') > -1
|
||||
|| document.getElementsByTagName("script")[i]['src'].indexOf('api-ipv4.ip.sb') > -1
|
||||
|| document.getElementsByTagName("script")[i]['src'].indexOf('www.taobao.com') > -1) {
|
||||
|| document.getElementsByTagName("script")[i]['src'].indexOf('api-ipv4.ip.sb') > -1) {
|
||||
scripts[i].parentNode.removeChild(scripts[i]);
|
||||
};
|
||||
};
|
||||
@ -384,14 +382,9 @@
|
||||
sbipScript.src='https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP';
|
||||
mypage.appendChild(sbipScript);
|
||||
|
||||
var tbipScript= document.createElement("script");
|
||||
tbipScript.defer = "defer";
|
||||
tbipScript.src='https://www.taobao.com/help/getip.php?callback=ipCallback';
|
||||
mypage.appendChild(tbipScript);
|
||||
|
||||
//HTTP.runcheck();
|
||||
IP.getSpeedIP();
|
||||
IP.getIpifyIP();
|
||||
//IP.getSpeedIP();
|
||||
};
|
||||
|
||||
function show_my_ip()
|
||||
@ -402,11 +395,11 @@
|
||||
$$.getElementById('eye-icon').alt='<%:Show IP%>';
|
||||
ip_pcol_ip = $$.getElementById('ip-pcol').innerHTML;
|
||||
ip_ipsb_ip = $$.getElementById('ip-ipsb').innerHTML;
|
||||
ip_taobao_ip = $$.getElementById('ip-taobao').innerHTML;
|
||||
ip_speedtest_ip = $$.getElementById('ip-speedtest').innerHTML;
|
||||
ip_ipify_ip = $$.getElementById('ip-ipify').innerHTML;
|
||||
$$.getElementById('ip-pcol').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-ipsb').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-taobao').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-speedtest').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-ipify').innerHTML = '***.***.***.***';
|
||||
}
|
||||
else {
|
||||
@ -426,13 +419,12 @@
|
||||
imgobj.alt='<%:Show IP%>';
|
||||
ip_pcol_ip = $$.getElementById('ip-pcol').innerHTML;
|
||||
ip_ipsb_ip = $$.getElementById('ip-ipsb').innerHTML;
|
||||
ip_taobao_ip = $$.getElementById('ip-taobao').innerHTML;
|
||||
ip_speedtest_ip = $$.getElementById('ip-speedtest').innerHTML;
|
||||
ip_ipify_ip = $$.getElementById('ip-ipify').innerHTML;
|
||||
$$.getElementById('ip-pcol').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-ipsb').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-taobao').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-speedtest').innerHTML = '***.***.***.***';
|
||||
$$.getElementById('ip-ipify').innerHTML = '***.***.***.***';
|
||||
|
||||
}
|
||||
else {
|
||||
imgobj.src='/luci-static/resources/openclash/img/eye-light.svg';
|
||||
@ -440,7 +432,7 @@
|
||||
imgobj.alt='<%:Hide IP%>';
|
||||
$$.getElementById('ip-pcol').innerHTML = ip_pcol_ip;
|
||||
$$.getElementById('ip-ipsb').innerHTML = ip_ipsb_ip;
|
||||
$$.getElementById('ip-taobao').innerHTML = ip_taobao_ip;
|
||||
$$.getElementById('ip-speedtest').innerHTML = ip_speedtest_ip;
|
||||
$$.getElementById('ip-ipify').innerHTML = ip_ipify_ip;
|
||||
localStorage.removeItem('privacy_my_ip');
|
||||
myip_Load();
|
||||
@ -460,12 +452,11 @@
|
||||
|
||||
HTTP.runcheck();
|
||||
IP.getIpifyIP();
|
||||
//IP.getSpeedIP();
|
||||
IP.getSpeedIP();
|
||||
show_my_ip();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
document.write('<script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP&z='+parseInt(Math.random() * 100000000)+'" type="text/javascript"><\/script>');
|
||||
</script>
|
||||
<script defer="defer" src="https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP"></script>
|
||||
<script defer="defer" src="https://www.taobao.com/help/getip.php?callback=ipCallback"></script>
|
||||
</html>
|
||||
|
195
luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm
Normal file
195
luci-app-openclash/luasrc/view/openclash/select_git_cdn.htm
Normal file
@ -0,0 +1,195 @@
|
||||
|
||||
<style type="text/css">
|
||||
.select-popup {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: white;
|
||||
border: 3px solid #9e9e9e;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
z-index: 1000;
|
||||
max-width: 1000%;
|
||||
min-width: 70%;
|
||||
width: 70%;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.select-popup.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.select-popup-header {
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.select-popup-body {
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.select-option {
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
border-bottom: 1px solid #d7d7d7;
|
||||
}
|
||||
|
||||
.select-option:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.custom-option-input {
|
||||
margin-top: 5px;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div id="selectPopup" class="select-popup hidden">
|
||||
<div class="select-popup-header"><%:Choose CDN For Downloading:%></div>
|
||||
<div class="select-popup-body">
|
||||
<div class="select-option" data-value="https://fastly.jsdelivr.net/">https://fastly.jsdelivr.net/</div>
|
||||
<div class="select-option" data-value="https://testingcf.jsdelivr.net/">https://testingcf.jsdelivr.net/</div>
|
||||
<div class="select-option" data-value="https://raw.fastgit.org/">https://raw.fastgit.org/</div>
|
||||
<div class="select-option" data-value="https://cdn.jsdelivr.net/">https://cdn.jsdelivr.net/</div>
|
||||
<div class="select-option" data-value="custom"><%:Custom Your CDN URL%></div>
|
||||
<input type="text" id="customOptionInput" class="custom-option-input" value="https://mirror.ghproxy.com/" placeholder="<%:Type CDN URL, Format Like%> https://mirror.ghproxy.com/" style="display: none;">
|
||||
<div class="select-option" id="addCustomOption" style="display: none;"><%:Add%></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function isValidURL(str) {
|
||||
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
|
||||
'(\\#[-a-z\\d_]*)?'+'\/$','i'); // fragment locator
|
||||
return !!pattern.test(str);
|
||||
};
|
||||
|
||||
function HTTP_delay(domain, ID) {
|
||||
let img = new Image;
|
||||
let img_start_time = (+new Date());
|
||||
let timeout = setTimeout(() => {
|
||||
img.onerror = img.onload = null;
|
||||
ID.innerHTML = ID.dataset.value + ' <font style=\'color:red\'><%:Access Timed Out%></font>'
|
||||
}, 3000);
|
||||
|
||||
img.onerror = () => {
|
||||
clearTimeout(timeout);
|
||||
ID.innerHTML = ID.dataset.value + ' <font style=\'color:red\'><%:Access Denied%></font>'
|
||||
};
|
||||
|
||||
img.onload = () => {
|
||||
clearTimeout(timeout);
|
||||
let img_load_time = (new Date())- img_start_time;
|
||||
if (img_load_time <= 500) {
|
||||
ID.innerHTML = ID.dataset.value + ' ' + '<font style=\'color:#32b643\'>'+img_load_time+' ms</font>'
|
||||
}
|
||||
else if (img_load_time > 500 && img_load_time <= 1000) {
|
||||
ID.innerHTML = ID.dataset.value + ' ' + '<font style=\'color:orange\'>'+img_load_time+' ms</font>'
|
||||
}
|
||||
else {
|
||||
ID.innerHTML = ID.dataset.value + ' ' + '<font style=\'color:#e85600\'>'+img_load_time+' ms</font>'
|
||||
}
|
||||
};
|
||||
|
||||
img.src = `${domain}favicon.ico?${+(new Date)}`;
|
||||
};
|
||||
|
||||
function select_git_cdn(btn, type) {
|
||||
var selectPopup = document.getElementById('selectPopup');
|
||||
selectPopup.classList.remove('hidden');
|
||||
|
||||
var customOptionInput = document.getElementById('customOptionInput');
|
||||
var addCustomOption = document.getElementById('addCustomOption');
|
||||
var selectOptions = document.getElementsByClassName('select-option');
|
||||
|
||||
// 隐藏自定义输入和按钮
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
|
||||
// 添加自定义选项的事件监听
|
||||
selectPopup.addEventListener('click', select_window, type);
|
||||
|
||||
//点击弹窗外部关闭弹窗
|
||||
document.addEventListener('click', select_window_close);
|
||||
|
||||
refresh_httpdelay = setInterval(() => {
|
||||
for(var i = 0; i < selectOptions.length; i++) {
|
||||
if (isValidURL(selectOptions[i].dataset.value)) {
|
||||
HTTP_delay(selectOptions[i].dataset.value, selectOptions[i]);
|
||||
};
|
||||
};
|
||||
}, Math.floor(Math.random()*(7-3+1)+3)*1000);
|
||||
};
|
||||
|
||||
function select_window_close(event) {
|
||||
if (!selectPopup.contains(event.target)) {
|
||||
selectPopup.classList.add('hidden');
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
};
|
||||
|
||||
function select_window(event, type) {
|
||||
var selectOptions = document.getElementsByClassName('select-option');
|
||||
var target = event.target;
|
||||
if (target.classList.contains('select-option') && target.dataset.value === 'custom') {
|
||||
// 显示自定义输入和按钮
|
||||
customOptionInput.style.display = 'block';
|
||||
addCustomOption.style.display = 'block';
|
||||
} else if (target === addCustomOption) {
|
||||
// 添加自定义选项到列表中
|
||||
var newValue = customOptionInput.value.trim();
|
||||
if (newValue !== '' && isValidURL(newValue)) {
|
||||
var newOption = document.createElement('div');
|
||||
newOption.classList.add('select-option');
|
||||
newOption.textContent = newValue;
|
||||
newOption.dataset.value = newValue;
|
||||
selectPopup.querySelector('.select-popup-body').insertBefore(newOption, selectPopup.querySelector('.select-popup-body').children[selectOptions.length - 2]);
|
||||
|
||||
// 隐藏自定义输入和按钮
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
}
|
||||
else {
|
||||
alert("<%:Please enter a valid URL!%>");
|
||||
}
|
||||
} else if (target != addCustomOption && target != customOptionInput && target.classList.contains('select-option')) {
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
if (type === 'core_download') {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', {url: target.dataset.value}, function(x, status) {
|
||||
});
|
||||
}
|
||||
else {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', {url: target.dataset.value}, function(x, status) {
|
||||
});
|
||||
}
|
||||
|
||||
selectPopup.classList.add('hidden');
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
else if (target != addCustomOption && target != customOptionInput) {
|
||||
// 点击其他选项或弹窗外部,隐藏自定义输入和按钮
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
}
|
||||
else {
|
||||
if (target != customOptionInput) {
|
||||
selectPopup.classList.add('hidden');
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
};
|
||||
};
|
||||
//]]>
|
||||
</script>
|
@ -997,11 +997,7 @@
|
||||
{
|
||||
var r = confirm("<%:You have not installed the core yet, do you want to download and install it now?%>")
|
||||
if (r == true) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
window.location.href='<%="'+window.location.protocol+'//'+window.location.hostname+'/cgi-bin/luci/admin/services/openclash/log"%>';
|
||||
}
|
||||
});
|
||||
return select_git_cdn("core_download");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,10 @@
|
||||
<option value="linux-armv6"><%:linux-armv6%></option>
|
||||
<option value="linux-armv7"><%:linux-armv7%></option>
|
||||
<option value="linux-arm64"><%:linux-arm64(armv8)%></option>
|
||||
<option value="linux-loong64-abi1"><%:linux-loong64-abi1%></option>
|
||||
<option value="linux-loong64-abi2"><%:linux-loong64-abi2%></option>
|
||||
<option value="linux-riscv64"><%:linux-riscv64%></option>
|
||||
<option value="linux-s390x"><%:linux-s390x%></option>
|
||||
<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>
|
||||
<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>
|
||||
<option value="linux-mips64"><%:linux-mips64%></option>
|
||||
@ -80,6 +84,11 @@
|
||||
<%:Collecting data...%>
|
||||
</p>
|
||||
</td>
|
||||
<td width="25%">
|
||||
<p align="center" id="one_key_update_cdn">
|
||||
<%:Collecting data...%>
|
||||
</p>
|
||||
</td>
|
||||
<td width="25%">
|
||||
<p align="center" id="one_key_update">
|
||||
<%:Collecting data...%>
|
||||
@ -149,20 +158,21 @@
|
||||
var core_meta_up = document.getElementById('core_meta_up');
|
||||
var op_up = document.getElementById('op_up');
|
||||
var update_tip = document.getElementById('update_tip');
|
||||
var ma_core_up = document.getElementById('ma_core_up');
|
||||
var ma_core_tun_up = document.getElementById('ma_core_tun_up');
|
||||
var ma_core_meta_up = document.getElementById('ma_core_meta_up');
|
||||
var ma_op_up = document.getElementById('ma_op_up');
|
||||
var restore = document.getElementById('restore');
|
||||
var backup = document.getElementById('backup');
|
||||
var backup_ex_core = document.getElementById('backup_ex_core');
|
||||
var ma_core_up = document.getElementById('ma_core_up');
|
||||
var ma_core_tun_up = document.getElementById('ma_core_tun_up');
|
||||
var ma_core_meta_up = document.getElementById('ma_core_meta_up');
|
||||
var ma_op_up = document.getElementById('ma_op_up');
|
||||
var restore = document.getElementById('restore');
|
||||
var backup = document.getElementById('backup');
|
||||
var backup_ex_core = document.getElementById('backup_ex_core');
|
||||
var backup_core_only = document.getElementById('backup_core_only');
|
||||
var backup_config_only = document.getElementById('backup_config_only');
|
||||
var backup_rule_only = document.getElementById('backup_rule_only');
|
||||
var backup_proxy_only = document.getElementById('backup_proxy_only');
|
||||
var one_key_update = document.getElementById('one_key_update');
|
||||
var remove_core = document.getElementById('remove_core');
|
||||
var release_branch = document.getElementById('RELEASE_BRANCH');
|
||||
var one_key_update = document.getElementById('one_key_update');
|
||||
var one_key_update_cdn = document.getElementById('one_key_update_cdn');
|
||||
var remove_core = document.getElementById('remove_core');
|
||||
var release_branch = document.getElementById('RELEASE_BRANCH');
|
||||
core_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Dev\')"/>';
|
||||
core_tun_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'TUN\')"/>';
|
||||
core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Meta\')"/>';
|
||||
@ -173,6 +183,7 @@
|
||||
ma_op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_op_update(this)"/>';
|
||||
restore.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Restore Default Config%>" onclick="return restore_config(this)"/>';
|
||||
one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update%>" onclick="return all_one_key_update(this)"/>';
|
||||
one_key_update_cdn.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update With CDN%>" onclick="return all_one_key_update_cdn(this)"/>';
|
||||
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
|
||||
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
|
||||
backup_ex_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup Exclude Cores%>" onclick="return backup_no_core(this)"/>';
|
||||
@ -539,4 +550,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
function all_one_key_update_cdn(btn)
|
||||
{
|
||||
var v = core_version.value;
|
||||
var r = release_branch.value;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
btn.value = '<%:One Click Check Update With CDN%>';
|
||||
btn.disabled = true;
|
||||
var r = confirm("<%:Check and Update all Cores and OpenClash?%>")
|
||||
if (r == true) {
|
||||
btn.disabled = false;
|
||||
return select_git_cdn("one_key_update");
|
||||
}
|
||||
else {
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//]]></script>
|
||||
|
@ -173,8 +173,8 @@ msgstr "实验性:绕过中国大陆 IPv6"
|
||||
msgid "Bypass The China Network Flows, Improve Performance"
|
||||
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能"
|
||||
|
||||
msgid "Bypass The China Network Flows, Improve Performance, Depend on Dnsmasq"
|
||||
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能,此功能依赖于 Dnsmasq"
|
||||
msgid "Bypass The China Network Flows, Improve Performance, If Inaccessibility on Bypass Gateway, Try to Enable Bypass Gateway Compatible Option, Depend on Dnsmasq"
|
||||
msgstr "启用后中国大陆流量将不再经过内核,提升系统性能,如旁路由遇到无法访问,请尝试启用旁路由兼容模式,此功能依赖于 Dnsmasq"
|
||||
|
||||
msgid "Log Level"
|
||||
msgstr "日志等级"
|
||||
@ -726,7 +726,7 @@ msgstr "协议"
|
||||
msgid "Protocol param(optional)"
|
||||
msgstr "传输协议参数(可选)"
|
||||
|
||||
msgid "Obfs"
|
||||
msgid "obfs"
|
||||
msgstr "混淆插件"
|
||||
|
||||
msgid "Obfs param(optional)"
|
||||
@ -765,6 +765,36 @@ msgstr "策略组配置(使用一键生成配置文件功能时无需设置)
|
||||
msgid "Proxies"
|
||||
msgstr "服务器节点配置"
|
||||
|
||||
msgid "Enable Port Hopping"
|
||||
msgstr "启用端口跃迁"
|
||||
|
||||
msgid "Port Range"
|
||||
msgstr "端口范围值"
|
||||
|
||||
msgid "Uplink Capacity(Default:Mbps)"
|
||||
msgstr "上行链路容量(默认:Mbps)"
|
||||
|
||||
msgid "Downlink Capacity(Default:Mbps)"
|
||||
msgstr "下行链路容量(默认:Mbps)"
|
||||
|
||||
msgid "Hop Interval (Unit:second)"
|
||||
msgstr "跳跃间隔(单位:秒)"
|
||||
|
||||
msgid "Obfs"
|
||||
msgstr "混淆插件"
|
||||
|
||||
msgid "Obfs param (optional)"
|
||||
msgstr "混淆参数(可选)"
|
||||
|
||||
msgid "obfs-password"
|
||||
msgstr "混淆密码"
|
||||
|
||||
msgid "Enable Transport Protocol Settings"
|
||||
msgstr "启用传输协议设置"
|
||||
|
||||
msgid "Hysterir QUIC parameters"
|
||||
msgstr "QUIC 参数"
|
||||
|
||||
msgid "Edit Rule Providers"
|
||||
msgstr "编辑规则集配置"
|
||||
|
||||
@ -1389,6 +1419,9 @@ msgstr "还原默认配置"
|
||||
msgid "One Click Check Update"
|
||||
msgstr "一键检查更新"
|
||||
|
||||
msgid "One Click Check Update With CDN"
|
||||
msgstr "使用CDN一键检查更新"
|
||||
|
||||
msgid "Failed to get the latest version. Please try again later!"
|
||||
msgstr "最新版本获取失败,请稍后再试!"
|
||||
|
||||
@ -1425,12 +1458,6 @@ msgstr "页面已切换为 Redir-Host 模式!"
|
||||
msgid "IP Address"
|
||||
msgstr "IP 地址"
|
||||
|
||||
msgid "Mainland"
|
||||
msgstr "国内"
|
||||
|
||||
msgid "Abroad"
|
||||
msgstr "国外"
|
||||
|
||||
msgid "Website Access Check"
|
||||
msgstr "网站访问检查"
|
||||
|
||||
@ -1641,11 +1668,11 @@ msgstr "版本内核更新失败,请检查网络或稍后再试!"
|
||||
msgid "Core Update Successful!"
|
||||
msgstr "版本内核更新成功!"
|
||||
|
||||
msgid "Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
|
||||
msgstr "版本内核更新失败,请确认设备闪存空间足够后再试!"
|
||||
msgid "Core Update Failed. Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
|
||||
msgstr "版本内核更新失败,请确认设备闪存空间足够或内核平台正确后再试!"
|
||||
|
||||
msgid "No Compiled Version Selected, Please Select In Global Settings And Try Again!"
|
||||
msgstr "未选择编译版本,请到全局设置中选择后再试!"
|
||||
msgid "No Compiled Version Selected, Please Select In Update Page And Try Again!"
|
||||
msgstr "未选择编译版本,请到升级页面选择后再试!"
|
||||
|
||||
msgid "Core Has Not Been Updated, Stop Continuing Operation!"
|
||||
msgstr "版本内核没有更新,停止继续操作!"
|
||||
@ -3496,4 +3523,31 @@ msgid "Skip Proxy Address"
|
||||
msgstr "绕过服务器地址"
|
||||
|
||||
msgid "Bypassing Server Addresses And Preventing Duplicate Proxies"
|
||||
msgstr "绕过服务器地址,防止重复代理"
|
||||
msgstr "绕过服务器地址,防止重复代理"
|
||||
|
||||
msgid "Warning: Unsupported format, Proxies Address Skip Function Ignore Proxy-providers File"
|
||||
msgstr "警告:不支持的格式,绕过代理服务器地址功能已忽略代理集文件"
|
||||
|
||||
msgid "Choose CDN For Downloading:"
|
||||
msgstr "请在下方选择一个 CDN 地址进行加速下载:"
|
||||
|
||||
msgid "Custom Your CDN URL"
|
||||
msgstr "自定义链接地址"
|
||||
|
||||
msgid "Type CDN URL, Format Like"
|
||||
msgstr "输入链接地址,格式请参考"
|
||||
|
||||
msgid "Please enter a valid URL!"
|
||||
msgstr "请参考示例输入正确的链接地址!"
|
||||
|
||||
msgid "WAN Interface Name"
|
||||
msgstr "WAN 接口名称"
|
||||
|
||||
msgid "Select WAN Interface Name For The Intranet Allowed"
|
||||
msgstr "为仅允许内网指定正确的 WAN 接口名称"
|
||||
|
||||
msgid "LAN Interface Name"
|
||||
msgstr "LAN 接口名称"
|
||||
|
||||
msgid "Select LAN Interface Name"
|
||||
msgstr "指定正确的 LAN 接口名称"
|
@ -123,88 +123,130 @@ config dns_servers
|
||||
option enabled '1'
|
||||
|
||||
config dns_servers
|
||||
option type 'https'
|
||||
option group 'fallback'
|
||||
option ip 'dns.cloudflare.com/dns-query'
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '9.9.9.9'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option ip 'dns.google'
|
||||
option port '853'
|
||||
option type 'tls'
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '149.112.112.112'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option type 'https'
|
||||
option ip '1.1.1.1/dns-query'
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '2620:fe::fe'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option ip '1.1.1.1'
|
||||
option port '853'
|
||||
option type 'tls'
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '2620:fe::9'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '8.8.8.8'
|
||||
option port '853'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '8.8.4.4'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '2001:4860:4860::8888'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '2001:4860:4860::8844'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '2001:da8::666'
|
||||
option type 'udp'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'dns.quad9.net'
|
||||
option type 'tls'
|
||||
|
||||
config dns_servers
|
||||
option type 'udp'
|
||||
option group 'fallback'
|
||||
option ip '2001:4860:4860::8888'
|
||||
option port '53'
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'dns.google'
|
||||
option type 'tls'
|
||||
|
||||
config dns_servers
|
||||
option type 'udp'
|
||||
option group 'fallback'
|
||||
option ip '2001:4860:4860::8844'
|
||||
option port '53'
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '1.1.1.1'
|
||||
option type 'tls'
|
||||
|
||||
config dns_servers
|
||||
option type 'udp'
|
||||
option group 'fallback'
|
||||
option ip '2001:da8::666'
|
||||
option port '53'
|
||||
option enabled '0'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option type 'https'
|
||||
option ip 'public.dns.iij.jp/dns-query'
|
||||
option enabled '0'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option type 'https'
|
||||
option ip 'jp.tiar.app/dns-query'
|
||||
option enabled '0'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option type 'https'
|
||||
option ip 'jp.tiarap.org/dns-query'
|
||||
option enabled '0'
|
||||
|
||||
config dns_servers
|
||||
option group 'fallback'
|
||||
option ip 'jp.tiar.app'
|
||||
option type 'tls'
|
||||
option enabled '0'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'dot.tiar.app'
|
||||
option type 'tls'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'dns.quad9.net/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'dns.google/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'dns.cloudflare.com/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip '1.1.1.1/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'public.dns.iij.jp/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'jp.tiar.app/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option ip 'jp.tiarap.org/dns-query'
|
||||
option type 'https'
|
||||
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
@ -245,5 +287,5 @@ config dns_servers
|
||||
config dns_servers
|
||||
option enabled '0'
|
||||
option group 'fallback'
|
||||
option type 'https'
|
||||
option ip 'doh.mullvad.net/dns-query'
|
||||
option type 'https'
|
||||
|
@ -744,6 +744,7 @@ config_test()
|
||||
{
|
||||
if [ -f "$CLASH" ]; then
|
||||
LOG_OUT "Test The Config File First..."
|
||||
chmod o+w "$CONFIG_FILE" 2>/dev/null
|
||||
test_info=$(nohup $CLASH -t -d $CLASH_CONFIG -f "$CONFIG_FILE")
|
||||
local IFS=$'\n'
|
||||
for i in $test_info; do
|
||||
@ -934,6 +935,32 @@ ac_add()
|
||||
[ -n "$3" ] && ipset add "$3" "$1" 2>/dev/null
|
||||
}
|
||||
|
||||
wan_name_add()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$wan_ints" ]; then
|
||||
wan_ints="$wan_ints $1"
|
||||
else
|
||||
wan_ints="$1"
|
||||
fi
|
||||
}
|
||||
|
||||
wan6_name_add()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$wan6_ints" ]; then
|
||||
wan6_ints="$wan6_ints $1"
|
||||
else
|
||||
wan6_ints="$1"
|
||||
fi
|
||||
}
|
||||
|
||||
upnp_exclude()
|
||||
{
|
||||
if [ -s "$upnp_lease_file" ]; then
|
||||
@ -1525,7 +1552,12 @@ if [ -n "$FW4" ]; then
|
||||
|
||||
#intranet allowed
|
||||
if [ "$intranet_allowed" -eq 1 ]; then
|
||||
wan_ints=$(nft list chain inet fw4 input |grep -e "jump input_wan" 2>/dev/null |awk '{for (i=1;i<=NF;i++){if ($i ~ /iifname/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
|
||||
if [ -n "$intranet_allowed_wan_name" ]; then
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "intranet_allowed_wan_name" wan_name_add
|
||||
else
|
||||
wan_ints=$(nft list chain inet fw4 input |grep -e "jump input_wan" 2>/dev/null |awk '{for (i=1;i<=NF;i++){if ($i ~ /iifname/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
|
||||
fi
|
||||
if [ -n "$wan_ints" ]; then
|
||||
nft 'add chain inet fw4 openclash_wan_input'
|
||||
nft 'flush chain inet fw4 openclash_wan_input'
|
||||
@ -1841,6 +1873,9 @@ if [ -n "$FW4" ]; then
|
||||
|
||||
#TUN FORWORD
|
||||
nft insert rule inet fw4 forward position 0 meta l4proto {tcp,udp} oifname utun counter accept comment \"OpenClash TUN Forward\"
|
||||
nft insert rule inet fw4 forward position 0 meta l4proto {tcp,udp} iifname utun counter accept comment \"OpenClash TUN Forward\"
|
||||
nft insert rule inet fw4 input position 0 meta l4proto {tcp,udp} iifname utun counter accept comment \"OpenClash TUN Input\"
|
||||
nft insert rule inet fw4 srcnat position 0 meta nfproto {ipv4} oifname utun counter return comment \"OpenClash TUN Postrouting\"
|
||||
|
||||
#quic
|
||||
if [ "$disable_udp_quic" -eq 1 ]; then
|
||||
@ -2129,9 +2164,21 @@ if [ -n "$FW4" ]; then
|
||||
set_tun_tap "v6"
|
||||
fi
|
||||
|
||||
#TUN FORWORD
|
||||
if [ "$ipv6_mode" -eq 2 ]; then
|
||||
nft insert rule inet fw4 forward position 0 meta nfproto {ipv6} oifname utun counter accept comment \"OpenClash TUN Forward\"
|
||||
nft insert rule inet fw4 forward position 0 meta nfproto {ipv6} iifname utun counter accept comment \"OpenClash TUN Forward\"
|
||||
nft insert rule inet fw4 input position 0 meta nfproto {ipv6} iifname utun counter accept comment \"OpenClash TUN Input\"
|
||||
nft insert rule inet fw4 srcnat position 0 meta nfproto {ipv6} oifname utun counter return comment \"OpenClash TUN Postrouting\"
|
||||
fi
|
||||
|
||||
#quic
|
||||
if [ "$disable_udp_quic" -eq 1 ]; then
|
||||
nft insert rule inet fw4 input position 0 udp dport 443 ip6 daddr != @china_ip6_route counter reject comment \"OpenClash QUIC REJECT\"
|
||||
if [ "$ipv6_mode" -eq 2 ]; then
|
||||
nft insert rule inet fw4 forward position 0 udp dport 443 ip6 daddr != @china_ip6_route counter reject comment \"OpenClash QUIC REJECT\"
|
||||
else
|
||||
nft insert rule inet fw4 input position 0 udp dport 443 ip6 daddr != @china_ip6_route counter reject comment \"OpenClash QUIC REJECT\"
|
||||
fi
|
||||
fi
|
||||
|
||||
#bypass gateway compatible
|
||||
@ -2158,7 +2205,12 @@ if [ -n "$FW4" ]; then
|
||||
|
||||
#intranet allowed
|
||||
if [ "$intranet_allowed" -eq 1 ]; then
|
||||
wan6_ints=$(nft list chain inet fw4 input |grep -e "jump input_wan" 2>/dev/null |awk '{for (i=1;i<=NF;i++){if ($i ~ /iifname/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
|
||||
if [ -n "$intranet_allowed_wan_name" ]; then
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "intranet_allowed_wan_name" wan6_name_add
|
||||
else
|
||||
wan6_ints=$(nft list chain inet fw4 input |grep -e "jump input_wan" 2>/dev/null |awk '{for (i=1;i<=NF;i++){if ($i ~ /iifname/ && $(i+1) != "{") {print $(i+1)} if ($i ~ /iifname/ && $(i+1) == "{"){for (j=i+1;j<=NF;j++){if ($j~ /}/) {out="";for (k=i+1;k<=j;k++){out=out" "$k};print out}}}}}' 2>/dev/null |sed 's/"//g'|sed 's/{//g'|sed 's/}//g'|sed 's/,//g')
|
||||
fi
|
||||
if [ -n "$wan6_ints" ]; then
|
||||
nft 'add chain inet fw4 openclash_wan6_input'
|
||||
nft 'flush chain inet fw4 openclash_wan6_input'
|
||||
@ -2278,7 +2330,12 @@ if [ -z "$FW4" ]; then
|
||||
|
||||
#intranet allowed
|
||||
if [ "$intranet_allowed" -eq 1 ]; then
|
||||
wan_ints=$(iptables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
|
||||
if [ -n "$intranet_allowed_wan_name" ]; then
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "intranet_allowed_wan_name" wan_name_add
|
||||
else
|
||||
wan_ints=$(iptables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
|
||||
fi
|
||||
if [ -n "$wan_ints" ]; then
|
||||
iptables -t filter -N openclash_wan_input
|
||||
iptables -t filter -F openclash_wan_input
|
||||
@ -2617,7 +2674,10 @@ if [ -z "$FW4" ]; then
|
||||
fi
|
||||
|
||||
#TUN FORWORD
|
||||
iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT
|
||||
iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT >/dev/null 2>&1
|
||||
iptables -I FORWARD -m comment --comment "OpenClash TUN Forward" -i utun -j ACCEPT >/dev/null 2>&1
|
||||
iptables -I INPUT -m comment --comment "OpenClash TUN Input" -i utun -j ACCEPT >/dev/null 2>&1
|
||||
iptables -t nat -I POSTROUTING -m comment --comment "OpenClash TUN Postrouting" -o utun -j RETURN >/dev/null 2>&1
|
||||
|
||||
#quic
|
||||
if [ "$disable_udp_quic" -eq 1 ]; then
|
||||
@ -2889,9 +2949,21 @@ if [ -z "$FW4" ]; then
|
||||
set_tun_tap "v6"
|
||||
fi
|
||||
|
||||
#TUN FORWORD
|
||||
if [ "$ipv6_mode" -eq 2 ]; then
|
||||
ip6tables -I FORWARD -m comment --comment "OpenClash TUN Forward" -o utun -j ACCEPT >/dev/null 2>&1
|
||||
ip6tables -I FORWARD -m comment --comment "OpenClash TUN Forward" -i utun -j ACCEPT >/dev/null 2>&1
|
||||
ip6tables -I INPUT -m comment --comment "OpenClash TUN Input" -i utun -j ACCEPT >/dev/null 2>&1
|
||||
ip6tables -t nat -I POSTROUTING -m comment --comment "OpenClash TUN Postrouting" -o utun -j RETURN >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
#quic
|
||||
if [ "$disable_udp_quic" -eq 1 ]; then
|
||||
ip6tables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip6_route dst -j REJECT >/dev/null 2>&1
|
||||
if [ "$ipv6_mode" -eq 2 ]; then
|
||||
ip6tables -I FORWARD -p udp --dport 443 -o utun -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip6_route dst -j REJECT >/dev/null 2>&1
|
||||
else
|
||||
ip6tables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip6_route dst -j REJECT >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
#bypass gateway compatible
|
||||
@ -2921,7 +2993,12 @@ if [ -z "$FW4" ]; then
|
||||
|
||||
#intranet allowed
|
||||
if [ "$intranet_allowed" -eq 1 ]; then
|
||||
wan6_ints=$(ip6tables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
|
||||
if [ -n "$intranet_allowed_wan_name" ]; then
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "intranet_allowed_wan_name" wan6_name_add
|
||||
else
|
||||
wan6_ints=$(ip6tables-save -t filter |grep -e "-j zone_wan_input" 2>/dev/null |awk '{for (i=1;i<=NF;i++) {if ($i ~ /-i/) {print $(i+1)}}}' 2>/dev/null)
|
||||
fi
|
||||
if [ -n "$wan6_ints" ]; then
|
||||
ip6tables -t filter -N openclash_wan_input
|
||||
ip6tables -t filter -F openclash_wan_input
|
||||
@ -3061,7 +3138,12 @@ get_config()
|
||||
fakeip_range=$(uci -q get openclash.config.fakeip_range)
|
||||
fi
|
||||
[ -z "$fakeip_range" ] && fakeip_range="198.18.0.1/16"
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
|
||||
if [ "$lan_interface_name" = "0" ]; then
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
else
|
||||
lan_ip=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
|
||||
fi
|
||||
wan_ip4s=$(/usr/share/openclash/openclash_get_network.lua "wanip" 2>/dev/null)
|
||||
wan_ip6s=$(ifconfig | grep 'inet6 addr' | awk '{print $3}' 2>/dev/null)
|
||||
disable_masq_cache=$(uci -q get openclash.config.disable_masq_cache)
|
||||
@ -3101,6 +3183,7 @@ get_config()
|
||||
enable_unified_delay=$(uci -q get openclash.config.enable_unified_delay || echo "0")
|
||||
keep_alive_interval=$(uci -q get openclash.config.keep_alive_interval || echo "0")
|
||||
proxy_dns_group=$(uci -q get openclash.config.proxy_dns_group || echo "Disable")
|
||||
intranet_allowed_wan_name=$(uci -q get openclash.config.intranet_allowed_wan_name || echo "0")
|
||||
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
|
||||
uci -q set openclash.config.restricted_mode=0 && uci -q commit openclash
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
#!/bin/bash
|
||||
. /lib/functions.sh
|
||||
|
||||
[ -e "/etc/config/ucitrack" ] && {
|
||||
uci -q delete ucitrack.@openclash[-1]
|
||||
uci -q add ucitrack openclash
|
||||
uci -q set ucitrack.@openclash[-1].init=openclash
|
||||
uci -q commit ucitrack
|
||||
}
|
||||
uci -q delete firewall.openclash
|
||||
uci -q set firewall.openclash=include
|
||||
uci -q set firewall.openclash.type=script
|
||||
@ -196,28 +198,5 @@ sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*10240;
|
||||
|
||||
/etc/init.d/uhttpd restart >/dev/null 2>&1
|
||||
|
||||
#set tun interface firewall rule
|
||||
add_utun_firewall_zone()
|
||||
{
|
||||
local section="$1"
|
||||
local name network
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "network" "$section" "network" ""
|
||||
if [ "$name" = "lan" ] && [ -z "$(echo $network |grep utun)" ]; then
|
||||
uci -q set firewall."$section".network="$network utun"
|
||||
uci -q commit firewall
|
||||
fi
|
||||
}
|
||||
|
||||
uci -q set network.utun=interface
|
||||
uci -q set network.utun.proto=none
|
||||
uci -q set network.utun.ifname=utun
|
||||
uci -q set network.utun.device=utun
|
||||
uci -q set network.utun.auto='0'
|
||||
uci -q commit network
|
||||
|
||||
config_load "firewall"
|
||||
config_foreach add_utun_firewall_zone "zone"
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
|
@ -15,6 +15,9 @@ CHTIME=$(date "+%Y-%m-%d-%H" -r "/tmp/clash_last_version" 2>/dev/null)
|
||||
LAST_OPVER="/tmp/clash_last_version"
|
||||
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
|
||||
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
|
||||
if [ -n "$1" ]; then
|
||||
github_address_mod="$1"
|
||||
fi
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
set_lock
|
||||
|
||||
|
@ -50,6 +50,7 @@ config_test()
|
||||
{
|
||||
if [ -f "$CLASH" ]; then
|
||||
LOG_OUT "Config File Download Successful, Test If There is Any Errors..."
|
||||
chmod o+w "$CFG_FILE" 2>/dev/null
|
||||
test_info=$(nohup $CLASH -t -d $CLASH_CONFIG -f "$CFG_FILE")
|
||||
local IFS=$'\n'
|
||||
for i in $test_info; do
|
||||
|
@ -4,18 +4,28 @@
|
||||
. /usr/share/openclash/log.sh
|
||||
|
||||
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
|
||||
if [ "$github_address_mod" = "0" ] && [ "$1" != "one_key_update" ] && [ "$2" != "one_key_update" ]; then
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$(echo $2 2>/dev/null |grep -E 'http|one_key_update')" ] && [ -z "$(echo $3 2>/dev/null |grep 'http')" ]; then
|
||||
LOG_OUT "Tip: If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
fi
|
||||
if [ -n "$3" ] && [ "$2" = "one_key_update" ]; then
|
||||
github_address_mod="$3"
|
||||
fi
|
||||
if [ -n "$2" ] && [ "$2" != "one_key_update" ]; then
|
||||
github_address_mod="$2"
|
||||
fi
|
||||
CORE_TYPE="$1"
|
||||
C_CORE_TYPE=$(uci -q get openclash.config.core_type)
|
||||
[ -z "$CORE_TYPE" ] || [ "$1" = "one_key_update" ] && CORE_TYPE="Dev"
|
||||
[ -z "$CORE_TYPE" ] && CORE_TYPE="Dev"
|
||||
small_flash_memory=$(uci -q get openclash.config.small_flash_memory)
|
||||
CPU_MODEL=$(uci -q get openclash.config.core_version)
|
||||
RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
|
||||
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
|
||||
if [ "$github_address_mod" != "0" ]; then
|
||||
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh "$github_address_mod" 2>/dev/null
|
||||
else
|
||||
[ ! -f "/tmp/clash_last_version" ] && /usr/share/openclash/clash_version.sh 2>/dev/null
|
||||
fi
|
||||
if [ ! -f "/tmp/clash_last_version" ]; then
|
||||
LOG_OUT "Error: 【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
|
||||
SLOG_CLEAN
|
||||
@ -115,13 +125,14 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Download Successful, Start Update..."
|
||||
case $CORE_TYPE in
|
||||
case $CORE_TYPE in
|
||||
"TUN")
|
||||
[ -s "/tmp/clash_tun.gz" ] && {
|
||||
gzip -d /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
rm -rf /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
rm -rf "$tun_core_path" >/dev/null 2>&1
|
||||
chmod 4755 /tmp/clash_tun >/dev/null 2>&1
|
||||
/tmp/clash_tun -v >/dev/null 2>&1
|
||||
}
|
||||
;;
|
||||
"Meta")
|
||||
@ -131,6 +142,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
mv /tmp/clash /tmp/clash_meta >/dev/null 2>&1
|
||||
rm -rf /tmp/clash_meta.tar.gz >/dev/null 2>&1
|
||||
chmod 4755 /tmp/clash_meta >/dev/null 2>&1
|
||||
/tmp/clash_meta -v >/dev/null 2>&1
|
||||
}
|
||||
;;
|
||||
*)
|
||||
@ -139,10 +151,11 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
tar zxvf /tmp/clash.tar.gz -C /tmp
|
||||
rm -rf /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
chmod 4755 /tmp/clash >/dev/null 2>&1
|
||||
/tmp/clash -v >/dev/null 2>&1
|
||||
}
|
||||
esac
|
||||
if [ "$?" != "0" ]; then
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space And Try Again!"
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Update Failed. Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
|
||||
case $CORE_TYPE in
|
||||
"TUN")
|
||||
rm -rf /tmp/clash_tun >/dev/null 2>&1
|
||||
@ -157,23 +170,23 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $CORE_TYPE in
|
||||
case $CORE_TYPE in
|
||||
"TUN")
|
||||
mv /tmp/clash_tun "$tun_core_path" >/dev/null 2>&1
|
||||
;;
|
||||
mv /tmp/clash_tun "$tun_core_path" >/dev/null 2>&1
|
||||
;;
|
||||
"Meta")
|
||||
mv /tmp/clash_meta "$meta_core_path" >/dev/null 2>&1
|
||||
;;
|
||||
mv /tmp/clash_meta "$meta_core_path" >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
mv /tmp/clash "$dev_core_path" >/dev/null 2>&1
|
||||
esac
|
||||
mv /tmp/clash "$dev_core_path" >/dev/null 2>&1
|
||||
esac
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
LOG_OUT "【"$CORE_TYPE"】Core Update Successful!"
|
||||
if [ "$if_restart" -eq 1 ]; then
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
if [ -z "$2" ] && [ "$1" != "one_key_update" ] && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
|
||||
if ([ -z "$2" ] || ([ -n "$2" ] && [ "$2" != "one_key_update" ])) && [ "$(find /tmp/lock/ |grep -v "openclash.lock" |grep -c "openclash")" -le 1 ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
fi
|
||||
else
|
||||
@ -188,7 +201,7 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_OUT "No Compiled Version Selected, Please Select In Global Settings And Try Again!"
|
||||
LOG_OUT "No Compiled Version Selected, Please Select In Update Page And Try Again!"
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
|
@ -45,7 +45,12 @@ router_self_proxy=$(uci -q get openclash.config.router_self_proxy)
|
||||
core_type=$(uci -q get openclash.config.core_type || echo "Dev")
|
||||
da_password=$(uci -q get openclash.config.dashboard_password)
|
||||
cn_port=$(uci -q get openclash.config.cn_port)
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
|
||||
if [ "$lan_interface_name" = "0" ]; then
|
||||
lan_ip=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
else
|
||||
lan_ip=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
|
||||
fi
|
||||
dnsmasq_default_resolvfile=$(uci -q get openclash.config.default_resolvfile)
|
||||
|
||||
if [ -z "$RAW_CONFIG_FILE" ] || [ ! -f "$RAW_CONFIG_FILE" ]; then
|
||||
|
@ -10,8 +10,13 @@ local addr = arg[1]
|
||||
local resolve = arg[2]
|
||||
|
||||
local function debug_dns()
|
||||
local info, ip, host
|
||||
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
local info, ip, host, lan_int_name
|
||||
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
ip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not ip or ip == "" then
|
||||
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
@ -22,61 +27,67 @@ local function debug_dns()
|
||||
local passwd = uci:get("openclash", "config", "dashboard_password") or ""
|
||||
|
||||
if datatype.hostname(addr) and ip and port then
|
||||
info = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/dns/query?name="%s"', passwd, ip, port, addr))
|
||||
if info then
|
||||
info = json.parse(info)
|
||||
info_v4 = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/dns/query?name="%s"', passwd, ip, port, addr))
|
||||
info_v6 = luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET \"http://"%s":"%s"/dns/query?name="%s"&type=AAAA\"', passwd, ip, port, addr))
|
||||
if info_v4 then
|
||||
info_v4 = json.parse(info_v4)
|
||||
end
|
||||
if info and not resolve then
|
||||
print("Status: "..(info.Status))
|
||||
print("TC: "..tostring(info.TC))
|
||||
print("RD: "..tostring(info.RD))
|
||||
print("RA: "..tostring(info.RA))
|
||||
print("AD: "..tostring(info.AD))
|
||||
print("CD: "..tostring(info.CD))
|
||||
print("")
|
||||
print("Question: ")
|
||||
for _, v in pairs(info.Question) do
|
||||
print(" Name: "..(v.Name))
|
||||
print(" Qtype: "..(v.Qtype))
|
||||
print(" Qclass: "..(v.Qclass))
|
||||
if info_v6 then
|
||||
info_v6 = json.parse(info_v6)
|
||||
end
|
||||
for _, info in pairs({info_v4, info_v6}) do
|
||||
if info and not resolve then
|
||||
print("Status: "..(info.Status))
|
||||
print("TC: "..tostring(info.TC))
|
||||
print("RD: "..tostring(info.RD))
|
||||
print("RA: "..tostring(info.RA))
|
||||
print("AD: "..tostring(info.AD))
|
||||
print("CD: "..tostring(info.CD))
|
||||
print("")
|
||||
end
|
||||
if info.Answer then
|
||||
print("Answer: ")
|
||||
for _, v in pairs(info.Answer) do
|
||||
print(" TTL: "..(v.TTL))
|
||||
print(" data: "..(v.data:gsub("\n?", "")))
|
||||
print(" name: "..(v.name))
|
||||
print(" type: "..(v.type))
|
||||
print("Question: ")
|
||||
for _, v in pairs(info.Question) do
|
||||
print(" Name: "..(v.Name))
|
||||
print(" Qtype: "..(v.Qtype))
|
||||
print(" Qclass: "..(v.Qclass))
|
||||
print("")
|
||||
end
|
||||
end
|
||||
if info.Additional then
|
||||
print("Additional: ")
|
||||
for _, v in pairs(info.Additional) do
|
||||
print(" TTL: "..(v.TTL))
|
||||
print(" data: "..(v.data:gsub("\n?", "")))
|
||||
print(" name: "..(v.name))
|
||||
print(" type: "..(v.type))
|
||||
print("")
|
||||
if info.Answer then
|
||||
print("Answer: ")
|
||||
for _, v in pairs(info.Answer) do
|
||||
print(" TTL: "..(v.TTL))
|
||||
print(" data: "..(v.data:gsub("\n?", "")))
|
||||
print(" name: "..(v.name))
|
||||
print(" type: "..(v.type))
|
||||
print("")
|
||||
end
|
||||
end
|
||||
if info.Additional then
|
||||
print("Additional: ")
|
||||
for _, v in pairs(info.Additional) do
|
||||
print(" TTL: "..(v.TTL))
|
||||
print(" data: "..(v.data:gsub("\n?", "")))
|
||||
print(" name: "..(v.name))
|
||||
print(" type: "..(v.type))
|
||||
print("")
|
||||
end
|
||||
end
|
||||
if info.Authority then
|
||||
print("Authority: ")
|
||||
for _, v in pairs(info.Authority) do
|
||||
print(" TTL: "..(v.TTL))
|
||||
print(" data: "..(v.data:gsub("\n?", "")))
|
||||
print(" name: "..(v.name))
|
||||
print(" type: "..(v.type))
|
||||
print("")
|
||||
end
|
||||
end
|
||||
end
|
||||
if info.Authority then
|
||||
print("Authority: ")
|
||||
for _, v in pairs(info.Authority) do
|
||||
print(" TTL: "..(v.TTL))
|
||||
print(" data: "..(v.data:gsub("\n?", "")))
|
||||
print(" name: "..(v.name))
|
||||
print(" type: "..(v.type))
|
||||
print("")
|
||||
end
|
||||
end
|
||||
end
|
||||
if info and resolve then
|
||||
if info.Answer then
|
||||
for _, v in pairs(info.Answer) do
|
||||
if v.type == 1 then
|
||||
print(v.data)
|
||||
if info and resolve then
|
||||
if info.Answer then
|
||||
for _, v in pairs(info.Answer) do
|
||||
if v.type == 1 or v.type == 28 then
|
||||
print(v.data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -85,4 +96,4 @@ local function debug_dns()
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
debug_dns()
|
||||
debug_dns()
|
||||
|
@ -20,8 +20,13 @@ return string.format("%.1f",e)..a[t]
|
||||
end
|
||||
|
||||
local function debug_getcon()
|
||||
local info, ip, host, diag_info
|
||||
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
local info, ip, host, diag_info, lan_int_name
|
||||
lan_int_name = uci:get("openclash", "config", "lan_interface_name") or "0"
|
||||
if lan_int_name == "0" then
|
||||
ip = luci.sys.exec("uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null |tr -d '\n'")
|
||||
else
|
||||
ip = luci.sys.exec(string.format("ip address show %s | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'", lan_int_name))
|
||||
end
|
||||
if not ip or ip == "" then
|
||||
ip = luci.sys.exec("ip address show $(uci -q -p /tmp/state get network.lan.ifname) | grep -w 'inet' 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | tr -d '\n'")
|
||||
end
|
||||
|
@ -14,7 +14,12 @@ del_lock() {
|
||||
|
||||
close_all_conection() {
|
||||
SECRET=$(uci -q get openclash.config.dashboard_password)
|
||||
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
lan_interface_name=$(uci -q get openclash.config.lan_interface_name || echo "0")
|
||||
if [ "$lan_interface_name" = "0" ]; then
|
||||
LAN_IP=$(uci -q get network.lan.ipaddr |awk -F '/' '{print $1}' 2>/dev/null || ip address show $(uci -q -p /tmp/state get network.lan.ifname || uci -q -p /tmp/state get network.lan.device) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}' || ip addr show 2>/dev/null | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Eo 'inet [0-9\.]+' | awk '{print $2}' | head -n 1)
|
||||
else
|
||||
LAN_IP=$(ip address show $(uci -q -p $lan_interface_name) | grep -w "inet" 2>/dev/null |grep -Eo 'inet [0-9\.]+' | awk '{print $2}')
|
||||
fi
|
||||
PORT=$(uci -q get openclash.config.cn_port)
|
||||
curl -m 2 -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X DELETE http://"$LAN_IP":"$PORT"/connections >/dev/null 2>&1
|
||||
}
|
||||
|
@ -11,7 +11,14 @@ del_lock() {
|
||||
rm -rf "/tmp/lock/openclash_update.lock"
|
||||
}
|
||||
|
||||
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh 2>/dev/null
|
||||
if [ -n "$1" ] && [ "$1" != "one_key_update" ]; then
|
||||
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh "$1" 2>/dev/null
|
||||
elif [ -n "$2" ]; then
|
||||
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh "$2" 2>/dev/null
|
||||
else
|
||||
[ ! -f "/tmp/openclash_last_version" ] && /usr/share/openclash/openclash_version.sh 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ ! -f "/tmp/openclash_last_version" ]; then
|
||||
LOG_OUT "Error: Failed to Get Version Information, Please Try Again Later..."
|
||||
SLOG_CLEAN
|
||||
@ -30,12 +37,20 @@ github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
|
||||
if [ "$1" = "one_key_update" ]; then
|
||||
uci -q set openclash.config.enable=1
|
||||
uci -q commit openclash
|
||||
if [ "$github_address_mod" = "0" ]; then
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
|
||||
LOG_OUT "Tip: If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
fi
|
||||
/usr/share/openclash/openclash_core.sh "$1" >/dev/null 2>&1 &
|
||||
/usr/share/openclash/openclash_core.sh "TUN" "$1" >/dev/null 2>&1 &
|
||||
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1 &
|
||||
if [ -n "$2" ]; then
|
||||
/usr/share/openclash/openclash_core.sh "Dev" "$1" "$2" >/dev/null 2>&1 &
|
||||
/usr/share/openclash/openclash_core.sh "TUN" "$1" "$2" >/dev/null 2>&1 &
|
||||
/usr/share/openclash/openclash_core.sh "Meta" "$1" "$2" >/dev/null 2>&1 &
|
||||
github_address_mod="$2"
|
||||
else
|
||||
/usr/share/openclash/openclash_core.sh "Dev" "$1" >/dev/null 2>&1 &
|
||||
/usr/share/openclash/openclash_core.sh "TUN" "$1" >/dev/null 2>&1 &
|
||||
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
wait
|
||||
else
|
||||
if [ "$github_address_mod" = "0" ]; then
|
||||
|
@ -7,6 +7,9 @@ RELEASE_BRANCH=$(uci -q get openclash.config.release_branch || echo "master")
|
||||
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F '-' '{print $1}' |awk -F 'Version: ' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
github_address_mod=$(uci -q get openclash.config.github_address_mod || echo 0)
|
||||
if [ -n "$1" ]; then
|
||||
github_address_mod="$1"
|
||||
fi
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
|
||||
if [ "$TIME" != "$CHTIME" ]; then
|
||||
|
@ -364,6 +364,10 @@ fi
|
||||
path = i['path']
|
||||
end;
|
||||
if File::exist?(path) then
|
||||
if YAML.load_file(path).class == String then
|
||||
puts '${LOGTIME} Warning: Unsupported format, Proxies Address Skip Function Ignore Proxy-providers File【' + path + '】';
|
||||
next
|
||||
end;
|
||||
if YAML.load_file(path).key?('proxies') and not YAML.load_file(path)['proxies'].nil? then
|
||||
YAML.load_file(path)['proxies'].each do
|
||||
|j|
|
||||
|
@ -312,8 +312,13 @@ yml_groups_set()
|
||||
sed -i "/use: ${name}/d" $GROUP_FILE 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ "$set_group" -eq 0 ] && [ "$set_proxy_provider" -eq 0 ]; then
|
||||
echo " proxies:" >>$GROUP_FILE
|
||||
echo " - DIRECT" >>$GROUP_FILE
|
||||
fi
|
||||
|
||||
[ -n "$test_url" ] && {
|
||||
echo " url: $test_url" >>$GROUP_FILE
|
||||
echo " url: $test_url" >>$GROUP_FILE
|
||||
}
|
||||
[ -n "$test_interval" ] && {
|
||||
echo " interval: \"$test_interval\"" >>$GROUP_FILE
|
||||
|
@ -1027,7 +1027,8 @@ do
|
||||
}.join
|
||||
end;
|
||||
|
||||
if '$server_type' == 'hysteria' or '$server_type' == 'hysteria2' then
|
||||
if '$server_type' == 'hysteria' then
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#hysteria_protocol
|
||||
if Value['proxies'][$count].key?('protocol') then
|
||||
@ -1035,7 +1036,21 @@ do
|
||||
system(hysteria_protocol)
|
||||
end
|
||||
}.join
|
||||
end;
|
||||
|
||||
if '$server_type' == 'hysteria2' then
|
||||
#hysteria2
|
||||
Thread.new{
|
||||
#hysteria2_protocol
|
||||
if Value['proxies'][$count].key?('protocol') then
|
||||
hysteria2_protocol = '${uci_set}hysteria2_protocol=\"' + Value['proxies'][$count]['protocol'].to_s + '\"'
|
||||
system(hysteria2_protocol)
|
||||
end
|
||||
}.join
|
||||
end;
|
||||
|
||||
if '$server_type' == 'hysteria' or '$server_type' == 'hysteria2' then
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hysteria_up
|
||||
if Value['proxies'][$count].key?('up') then
|
||||
@ -1044,6 +1059,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hysteria_down
|
||||
if Value['proxies'][$count].key?('down') then
|
||||
@ -1052,6 +1068,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#skip-cert-verify
|
||||
if Value['proxies'][$count].key?('skip-cert-verify') then
|
||||
@ -1060,6 +1077,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#sni
|
||||
if Value['proxies'][$count].key?('sni') then
|
||||
@ -1068,6 +1086,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#alpn
|
||||
if Value['proxies'][$count].key?('alpn') then
|
||||
@ -1085,6 +1104,7 @@ do
|
||||
end;
|
||||
}.join
|
||||
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#recv_window_conn
|
||||
if Value['proxies'][$count].key?('recv-window-conn') then
|
||||
@ -1093,6 +1113,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#recv_window
|
||||
if Value['proxies'][$count].key?('recv-window') then
|
||||
@ -1101,6 +1122,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hysteria_obfs
|
||||
if Value['proxies'][$count].key?('obfs') then
|
||||
@ -1109,6 +1131,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hysteria_obfs_password
|
||||
if Value['proxies'][$count].key?('obfs-password') then
|
||||
@ -1117,6 +1140,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#hysteria_auth
|
||||
if Value['proxies'][$count].key?('auth') then
|
||||
@ -1125,6 +1149,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#hysteria_auth_str
|
||||
if Value['proxies'][$count].key?('auth-str') then
|
||||
@ -1133,6 +1158,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hysteria_ca
|
||||
if Value['proxies'][$count].key?('ca') then
|
||||
@ -1141,6 +1167,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hysteria_ca_str
|
||||
if Value['proxies'][$count].key?('ca-str') then
|
||||
@ -1149,6 +1176,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#disable_mtu_discovery
|
||||
if Value['proxies'][$count].key?('disable-mtu-discovery') then
|
||||
@ -1157,6 +1185,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria
|
||||
Thread.new{
|
||||
#fast_open
|
||||
if Value['proxies'][$count].key?('fast-open') then
|
||||
@ -1165,6 +1194,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#fingerprint
|
||||
if Value['proxies'][$count].key?('fingerprint') then
|
||||
@ -1173,6 +1203,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#ports
|
||||
if Value['proxies'][$count].key?('ports') then
|
||||
@ -1181,6 +1212,7 @@ do
|
||||
end
|
||||
}.join
|
||||
|
||||
#hysteria hysteria2
|
||||
Thread.new{
|
||||
#hop-interval
|
||||
if Value['proxies'][$count].key?('hop-interval') then
|
||||
@ -1573,4 +1605,4 @@ SLOG_CLEAN
|
||||
rm -rf /tmp/match_servers.list 2>/dev/null
|
||||
rm -rf /tmp/match_provider.list 2>/dev/null
|
||||
rm -rf /tmp/yaml_other_group.yaml 2>/dev/null
|
||||
del_lock
|
||||
del_lock
|
||||
|
@ -246,6 +246,7 @@ yml_servers_set()
|
||||
config_get "vless_flow" "$section" "vless_flow" ""
|
||||
config_get "http_headers" "$section" "http_headers" ""
|
||||
config_get "hysteria_protocol" "$section" "hysteria_protocol" ""
|
||||
config_get "hysteria2_protocol" "$section" "hysteria2_protocol" ""
|
||||
config_get "hysteria_up" "$section" "hysteria_up" ""
|
||||
config_get "hysteria_down" "$section" "hysteria_down" ""
|
||||
config_get "hysteria_alpn" "$section" "hysteria_alpn" ""
|
||||
@ -977,6 +978,21 @@ EOF
|
||||
if [ -n "$fingerprint" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
fingerprint: "$fingerprint"
|
||||
EOF
|
||||
fi
|
||||
if [ -n "$ports" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
ports: $ports
|
||||
EOF
|
||||
fi
|
||||
if [ -n "$hysteria2_protocol" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
protocol: $hysteria2_protocol
|
||||
EOF
|
||||
fi
|
||||
if [ -n "$hop_interval" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
hop-interval: $hop_interval
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"config": "openclash",
|
||||
"init": "openclash"
|
||||
}
|
@ -250,6 +250,21 @@ function connect_status()
|
||||
local e = {}
|
||||
e.use_time = ""
|
||||
local url = luci.http.formvalue("url")
|
||||
local is_baidu = string.find(url, "baidu")
|
||||
local pw_switch = uci:get(appname, "@global[0]", "enabled")
|
||||
local chn_list = uci:get(appname, "@global[0]", "chn_list")
|
||||
local socks_port = uci:get(appname, "@global[0]", "tcp_node_socks_port")
|
||||
if pw_switch ~= 0 then
|
||||
if chn_list == "proxy" then
|
||||
if is_baidu ~= nil then
|
||||
url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url
|
||||
end
|
||||
else
|
||||
if is_baidu == nil then
|
||||
url = "--socks5 127.0.0.1:" .. socks_port .. " " .. url
|
||||
end
|
||||
end
|
||||
end
|
||||
local result = luci.sys.exec('curl --connect-timeout 3 -o /dev/null -I -sk -w "%{http_code}:%{time_appconnect}" ' .. url)
|
||||
local code = tonumber(luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $1}'") or "0")
|
||||
if code ~= 0 then
|
||||
|
@ -317,6 +317,7 @@ o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)")
|
||||
o:value("8.8.4.4", "8.8.4.4 (Google)")
|
||||
o:value("8.8.8.8", "8.8.8.8 (Google)")
|
||||
o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)")
|
||||
o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)")
|
||||
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
||||
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
||||
o:depends({dns_mode = "dns2socks"})
|
||||
@ -330,7 +331,8 @@ if has_singbox or has_xray then
|
||||
o:value("https://1.1.1.2/dns-query", "CloudFlare-Security")
|
||||
o:value("https://8.8.4.4/dns-query", "Google 8844")
|
||||
o:value("https://8.8.8.8/dns-query", "Google 8888")
|
||||
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended")
|
||||
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended 9.9.9.9")
|
||||
o:value("https://149.112.112.112/dns-query", "Quad9-Recommended 149.112.112.112")
|
||||
o:value("https://208.67.222.222/dns-query", "OpenDNS")
|
||||
o:value("https://dns.adguard.com/dns-query,176.103.130.130", "AdGuard")
|
||||
o:value("https://doh.libredns.gr/dns-query,116.202.176.26", "LibreDNS")
|
||||
|
@ -330,6 +330,7 @@ o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)")
|
||||
o:value("8.8.4.4", "8.8.4.4 (Google)")
|
||||
o:value("8.8.8.8", "8.8.8.8 (Google)")
|
||||
o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)")
|
||||
o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)")
|
||||
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
||||
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
||||
o:depends({dns_mode = "dns2socks"})
|
||||
@ -346,7 +347,8 @@ o:value("https://1.1.1.1/dns-query", "CloudFlare")
|
||||
o:value("https://1.1.1.2/dns-query", "CloudFlare-Security")
|
||||
o:value("https://8.8.4.4/dns-query", "Google 8844")
|
||||
o:value("https://8.8.8.8/dns-query", "Google 8888")
|
||||
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended")
|
||||
o:value("https://9.9.9.9/dns-query", "Quad9-Recommended 9.9.9.9")
|
||||
o:value("https://149.112.112.112/dns-query", "Quad9-Recommended 149.112.112.112")
|
||||
o:value("https://208.67.222.222/dns-query", "OpenDNS")
|
||||
o:value("https://dns.adguard.com/dns-query,176.103.130.130", "AdGuard")
|
||||
o:value("https://doh.libredns.gr/dns-query,116.202.176.26", "LibreDNS")
|
||||
|
20
luci-app-runmynas/Makefile
Normal file
20
luci-app-runmynas/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=1.1.1-20231208
|
||||
PKG_RELEASE:=
|
||||
|
||||
LUCI_TITLE:=LuCI support for runmynas
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+docker +dockerd +luci-lib-iform +luci-lib-taskd
|
||||
LUCI_EXTRA_DEPENDS:=luci-lib-iform (>=1.1)
|
||||
|
||||
define Package/luci-app-runmynas/conffiles
|
||||
/etc/config/runmynas
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
174
luci-app-runmynas/luasrc/controller/runmynas.lua
Executable file
174
luci-app-runmynas/luasrc/controller/runmynas.lua
Executable file
@ -0,0 +1,174 @@
|
||||
local util = require "luci.util"
|
||||
local http = require "luci.http"
|
||||
local docker = require "luci.model.docker"
|
||||
local iform = require "luci.iform"
|
||||
local runmynas_model = require "luci.model.runmynas_disk"
|
||||
|
||||
module("luci.controller.runmynas", package.seeall)
|
||||
|
||||
function index()
|
||||
|
||||
entry({"admin", "services", "runmynas"}, call("redirect_index"), _("RunMyNAS"), 30).dependent = true
|
||||
entry({"admin", "services", "runmynas", "pages"}, call("runmynas_index")).leaf = true
|
||||
entry({"admin", "services", "runmynas", "form"}, call("runmynas_form"))
|
||||
entry({"admin", "services", "runmynas", "submit"}, call("runmynas_submit"))
|
||||
|
||||
end
|
||||
|
||||
local appname = "runmynas"
|
||||
local page_index = {"admin", "services", "runmynas", "pages"}
|
||||
|
||||
function redirect_index()
|
||||
http.redirect(luci.dispatcher.build_url(unpack(page_index)))
|
||||
end
|
||||
|
||||
function runmynas_index()
|
||||
luci.template.render("runmynas/main", {prefix=luci.dispatcher.build_url(unpack(page_index))})
|
||||
end
|
||||
|
||||
function runmynas_form()
|
||||
local error = ""
|
||||
local scope = ""
|
||||
local success = 0
|
||||
|
||||
local blocks = runmynas_model.blocks()
|
||||
local home = runmynas_model.home()
|
||||
local paths, default_path = runmynas_model.find_paths(blocks, home, "Configs")
|
||||
local data = get_data(default_path)
|
||||
local result = {
|
||||
data = data,
|
||||
schema = get_schema(data, paths)
|
||||
}
|
||||
local response = {
|
||||
error = error,
|
||||
scope = scope,
|
||||
success = success,
|
||||
result = result,
|
||||
}
|
||||
http.prepare_content("application/json")
|
||||
http.write_json(response)
|
||||
end
|
||||
|
||||
function get_schema(data, paths)
|
||||
local actions
|
||||
actions = {
|
||||
{
|
||||
name = "build",
|
||||
text = "运行",
|
||||
type = "apply",
|
||||
},
|
||||
}
|
||||
local schema = {
|
||||
actions = actions,
|
||||
containers = get_containers(data, paths),
|
||||
description = "自定义你的 iStoreNAS,本插件只能运行在 X86 平台,可以去定制其他平台的固件。源码地址:<a href=\"https://github.com/linkease/iStoreNAS\" target=\"_blank\">https://github.com/linkease/iStoreNAS</a>",
|
||||
title = "RunMyNAS"
|
||||
}
|
||||
return schema
|
||||
end
|
||||
|
||||
function get_containers(data, paths)
|
||||
local containers = {
|
||||
main_container(data, paths)
|
||||
}
|
||||
return containers
|
||||
end
|
||||
|
||||
function main_container(data, paths)
|
||||
local names = {}
|
||||
for k, v in pairs(paths) do
|
||||
names[k] = v
|
||||
end
|
||||
local main_c2 = {
|
||||
properties = {
|
||||
{
|
||||
name = "download",
|
||||
required = true,
|
||||
title = "源码下载",
|
||||
type = "string",
|
||||
enum = {"github", "koolcenter"},
|
||||
enumNames = {"Github", "Koolcenter"}
|
||||
},
|
||||
{
|
||||
name = "target",
|
||||
required = true,
|
||||
title = "平台",
|
||||
type = "string",
|
||||
enum = {"x86_64", "rk35xx", "rk33xx"},
|
||||
enumNames = {"x86_64", "rk35xx", "rk33xx"}
|
||||
},
|
||||
{
|
||||
name = "path",
|
||||
required = true,
|
||||
title = "运行路径",
|
||||
type = "string",
|
||||
enum = paths,
|
||||
enumNames = names
|
||||
},
|
||||
},
|
||||
description = "请选择合适的平台运行:",
|
||||
title = "运行操作"
|
||||
}
|
||||
return main_c2
|
||||
end
|
||||
|
||||
function get_data(default_path)
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local target = uci:get_first(appname, appname, "target", "x86_64")
|
||||
local download = uci:get_first(appname, appname, "download", "github")
|
||||
local path = uci:get_first(appname, appname, "path", default_path)
|
||||
local data = {
|
||||
target = target,
|
||||
download = download,
|
||||
path = path,
|
||||
}
|
||||
return data
|
||||
end
|
||||
|
||||
function runmynas_submit()
|
||||
local error = ""
|
||||
local scope = ""
|
||||
local success = 0
|
||||
local result
|
||||
|
||||
local jsonc = require "luci.jsonc"
|
||||
local json_parse = jsonc.parse
|
||||
local content = http.content()
|
||||
local req = json_parse(content)
|
||||
result = runmynas(req)
|
||||
http.prepare_content("application/json")
|
||||
local resp = {
|
||||
error = error,
|
||||
scope = scope,
|
||||
success = success,
|
||||
result = result,
|
||||
}
|
||||
http.write_json(resp)
|
||||
end
|
||||
|
||||
function runmynas(req)
|
||||
local download = req["download"]
|
||||
local target = req["target"]
|
||||
local path = req["path"]
|
||||
|
||||
-- save config
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
uci:tset(appname, "@"..appname.."[0]", {
|
||||
target = target or "x86_64",
|
||||
download = download or "github",
|
||||
path = path,
|
||||
})
|
||||
uci:save(appname)
|
||||
uci:commit(appname)
|
||||
|
||||
local exec_cmd = string.format("/usr/libexec/istorec/runmynas.sh %s", req["$apply"])
|
||||
exec_cmd = "/etc/init.d/tasks task_add runmynas " .. luci.util.shellquote(exec_cmd)
|
||||
os.execute(exec_cmd .. " >/dev/null 2>&1")
|
||||
|
||||
local result = {
|
||||
async = true,
|
||||
async_state = appname
|
||||
}
|
||||
return result
|
||||
end
|
||||
|
55
luci-app-runmynas/luasrc/model/runmynas_disk.lua
Normal file
55
luci-app-runmynas/luasrc/model/runmynas_disk.lua
Normal file
@ -0,0 +1,55 @@
|
||||
local util = require "luci.util"
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local runmynas_disk = {}
|
||||
|
||||
runmynas_disk.blocks = function()
|
||||
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
|
||||
local vals = {}
|
||||
if f then
|
||||
local ret = f:read("*all")
|
||||
f:close()
|
||||
local obj = jsonc.parse(ret)
|
||||
for _, val in pairs(obj["blockdevices"]) do
|
||||
local fsize = val["fssize"]
|
||||
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
|
||||
-- fsize > 1G
|
||||
vals[#vals+1] = val["mountpoint"]
|
||||
end
|
||||
end
|
||||
end
|
||||
return vals
|
||||
end
|
||||
|
||||
runmynas_disk.home = function()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local home_dirs = {}
|
||||
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root")
|
||||
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/Configs")
|
||||
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public")
|
||||
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"].."/Downloads")
|
||||
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/Caches")
|
||||
return home_dirs
|
||||
end
|
||||
|
||||
runmynas_disk.find_paths = function(blocks, home_dirs, path_name)
|
||||
local default_path = ''
|
||||
local configs = {}
|
||||
|
||||
default_path = home_dirs[path_name] .. "/RunMyNAS"
|
||||
if #blocks == 0 then
|
||||
table.insert(configs, default_path)
|
||||
else
|
||||
for _, val in pairs(blocks) do
|
||||
table.insert(configs, val .. "/" .. path_name .. "/RunMyNAS")
|
||||
end
|
||||
local without_conf_dir = "/root/" .. path_name .. "/RunMyNAS"
|
||||
if default_path == without_conf_dir then
|
||||
default_path = configs[1]
|
||||
end
|
||||
end
|
||||
|
||||
return configs, default_path
|
||||
end
|
||||
|
||||
return runmynas_disk
|
28
luci-app-runmynas/luasrc/view/runmynas/main.htm
Normal file
28
luci-app-runmynas/luasrc/view/runmynas/main.htm
Normal file
@ -0,0 +1,28 @@
|
||||
<%+header%>
|
||||
|
||||
<%+tasks/embed%>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
})();
|
||||
</script>
|
||||
<div id="app">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.IstoreosFormConfig = {
|
||||
getApi:"/cgi-bin/luci/admin/services/runmynas/form/",
|
||||
logApi:"/cgi-bin/luci/admin/services/runmynas/log",
|
||||
submitApi:"/cgi-bin/luci/admin/services/runmynas/submit",
|
||||
getHook:function(resp){
|
||||
return resp;
|
||||
},
|
||||
submitHook:function(params){
|
||||
return params;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="module" crossorigin src="/luci-static/iform/1.1/index.js?v=<%=math.random(1,100000)%>"></script>
|
||||
<link rel="stylesheet" href="/luci-static/iform/1.1/style.css?v=<%=math.random(1,100000)%>">
|
||||
|
||||
<%+footer%>
|
62
luci-app-runmynas/po/zh-cn/runmynas.po
Normal file
62
luci-app-runmynas/po/zh-cn/runmynas.po
Normal file
@ -0,0 +1,62 @@
|
||||
msgid "runmynas"
|
||||
msgstr "runmynas"
|
||||
|
||||
msgid "The runmynas service is running."
|
||||
msgstr "runmynas已启动"
|
||||
|
||||
msgid "The runmynas service is not running."
|
||||
msgstr "runmynas服务未启动"
|
||||
|
||||
msgid "The runmynas service is not installed."
|
||||
msgstr "runmynas服务未安装"
|
||||
|
||||
msgid "open runmynas"
|
||||
msgstr "打开runmynas"
|
||||
|
||||
msgid "stop runmynas"
|
||||
msgstr "停止runmynas"
|
||||
|
||||
msgid "run runmynas"
|
||||
msgstr "启动runmynas"
|
||||
|
||||
msgid "uninstall runmynas"
|
||||
msgstr "删除runmynas"
|
||||
|
||||
msgid "install runmynas"
|
||||
msgstr "安装runmynas"
|
||||
|
||||
msgid "Collecting data..."
|
||||
msgstr "收集数据..."
|
||||
|
||||
msgid "storage path"
|
||||
msgstr "存储路径(建议插入U盘或硬盘,然后输入路径。例如:/mnt/sda1/runmynas)"
|
||||
|
||||
msgid "Storage path could not be empty!"
|
||||
msgstr "存储路径不能为空!"
|
||||
|
||||
msgid "Version"
|
||||
msgstr "系统版本"
|
||||
|
||||
msgid "Port (optional)"
|
||||
msgstr "端口"
|
||||
|
||||
msgid "Password (optional)"
|
||||
msgstr "密码"
|
||||
|
||||
msgid "standard version"
|
||||
msgstr "标准版本"
|
||||
|
||||
msgid "full version"
|
||||
msgstr "全量版本"
|
||||
|
||||
msgid "UserName"
|
||||
msgstr "用户名"
|
||||
|
||||
msgid "Password"
|
||||
msgstr "密码"
|
||||
|
||||
msgid "LanAddress"
|
||||
msgstr "内网地址"
|
||||
|
||||
msgid "WanAddress"
|
||||
msgstr "外网地址"
|
1
luci-app-runmynas/po/zh_Hans
Symbolic link
1
luci-app-runmynas/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
2
luci-app-runmynas/root/etc/config/runmynas
Normal file
2
luci-app-runmynas/root/etc/config/runmynas
Normal file
@ -0,0 +1,2 @@
|
||||
config runmynas
|
||||
option 'target' ''
|
84
luci-app-runmynas/root/usr/libexec/istorec/runmynas.sh
Executable file
84
luci-app-runmynas/root/usr/libexec/istorec/runmynas.sh
Executable file
@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
# Author Xiaobao(xiaobao@linkease.com)
|
||||
|
||||
ACTION=${1}
|
||||
shift 1
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
Download_Files(){
|
||||
local URL=$1
|
||||
local FileName=$2
|
||||
if command_exists curl; then
|
||||
curl -sSLk ${URL} -o ${FileName}
|
||||
elif command_exists wget; then
|
||||
wget -c --no-check-certificate ${URL} -O ${FileName}
|
||||
fi
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Download OK"
|
||||
else
|
||||
echo "Download failed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
local download=`uci get runmynas.@runmynas[0].download 2>/dev/null`
|
||||
local target=`uci get runmynas.@runmynas[0].target 2>/dev/null`
|
||||
local path=`uci get runmynas.@runmynas[0].path 2>/dev/null`
|
||||
[ ! -z $download ] || download="github"
|
||||
[ ! -z $target ] || target="x86_64"
|
||||
|
||||
if echo `uname -m` | grep -Eqi 'x86_64'; then
|
||||
echo "Support x86_64"
|
||||
else
|
||||
echo "Not x86_64, only support x86_64, exit"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$path" ]; then
|
||||
echo "path is empty"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
mkdir -p $path
|
||||
if [ ! -f "${path}/runmynas.sh" ]; then
|
||||
if [ "$download" = "github" ]; then
|
||||
DLURL=`curl -s https://api.github.com/repos/linkease/iStoreNAS/releases/latest | grep tarball_url | cut -d '"' -f 4`
|
||||
else
|
||||
DLURL="https://fw0.koolcenter.com/iStoreNAS/runmynas/runmynas.tar.gz"
|
||||
fi
|
||||
echo "download $DLURL"
|
||||
rm -f /tmp/rumynas-source.tar.gz
|
||||
Download_Files ${DLURL} /tmp/rumynas-source.tar.gz
|
||||
tar -C ${path} --strip-components=1 -zxf /tmp/rumynas-source.tar.gz
|
||||
if [ ! -f "${path}/runmynas.sh" ]; then
|
||||
echo "runmynas.sh not found, failed!"
|
||||
exit 2
|
||||
fi
|
||||
rm -f /tmp/rumynas-source.tar.gz
|
||||
fi
|
||||
|
||||
cd ${path}
|
||||
echo "./runmynas.sh $target"
|
||||
./runmynas.sh $target
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 sub-command"
|
||||
echo "where sub-command is one of:"
|
||||
echo " build Build your NAS"
|
||||
}
|
||||
|
||||
case ${ACTION} in
|
||||
"build")
|
||||
do_build
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-runmynas": {
|
||||
"description": "Grant UCI access for luci-app-runmynas",
|
||||
"read": {
|
||||
"uci": [ "runmynas" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "runmynas" ]
|
||||
}
|
||||
}
|
||||
}
|
@ -52,14 +52,6 @@ CONFIGURE_ARGS += \
|
||||
TARGET_CFLAGS += -flto
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
|
||||
|
||||
ifeq ($(CONFIG_GCC_VERSION_12),y)
|
||||
TARGET_CFLAGS += -Wno-error=use-after-free
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_GCC_VERSION_13),y)
|
||||
TARGET_CFLAGS += -Wno-error=use-after-free
|
||||
endif
|
||||
|
||||
$(foreach component,$(SHADOWSOCKSR_COMPONENTS), \
|
||||
$(eval $(call BuildPackage,shadowsocksr-libev-ssr-$(component))) \
|
||||
)
|
||||
)
|
@ -14,6 +14,8 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
delete mode 100644 m4/pcre.m4
|
||||
create mode 100644 m4/pcre2.m4
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f9c51ab..0513db0 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -20,10 +20,10 @@ AC_DISABLE_STATIC
|
||||
@ -31,6 +33,9 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
fi
|
||||
|
||||
dnl Checks for using shared libraries from system
|
||||
diff --git a/m4/pcre.m4 b/m4/pcre.m4
|
||||
deleted file mode 100644
|
||||
index 4d965bc..0000000
|
||||
--- a/m4/pcre.m4
|
||||
+++ /dev/null
|
||||
@@ -1,152 +0,0 @@
|
||||
@ -186,6 +191,9 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
-AC_SUBST(pcreh)
|
||||
-AC_SUBST(pcre_pcreh)
|
||||
-])
|
||||
diff --git a/m4/pcre2.m4 b/m4/pcre2.m4
|
||||
new file mode 100644
|
||||
index 0000000..fcec4b7
|
||||
--- /dev/null
|
||||
+++ b/m4/pcre2.m4
|
||||
@@ -0,0 +1,181 @@
|
||||
@ -370,6 +378,8 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
+AC_SUBST(pcre2h)
|
||||
+AC_SUBST(pcre2_pcre2h)
|
||||
+])
|
||||
diff --git a/src/rule.c b/src/rule.c
|
||||
index 8aae04e..41ba5e7 100644
|
||||
--- a/src/rule.c
|
||||
+++ b/src/rule.c
|
||||
@@ -82,14 +82,28 @@ int
|
||||
@ -407,7 +417,7 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -109,8 +123,15 @@ lookup_rule(const struct cork_dllist *ru
|
||||
@@ -109,8 +123,15 @@ lookup_rule(const struct cork_dllist *rules, const char *name, size_t name_len)
|
||||
|
||||
cork_dllist_foreach_void(rules, curr, next) {
|
||||
rule_t *rule = cork_container_of(curr, rule_t, entries);
|
||||
@ -441,6 +451,8 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
+ }
|
||||
ss_free(rule);
|
||||
}
|
||||
diff --git a/src/rule.h b/src/rule.h
|
||||
index 015bc42..84a89af 100644
|
||||
--- a/src/rule.h
|
||||
+++ b/src/rule.h
|
||||
@@ -33,17 +33,27 @@
|
||||
@ -476,4 +488,7 @@ Signed-off-by: sbwml <984419930@qq.com>
|
||||
+ pcre2_match_data *pattern_re_match_data;
|
||||
|
||||
struct cork_dllist_item entries;
|
||||
} rule_t;
|
||||
} rule_t;
|
||||
--
|
||||
2.42.0
|
||||
|
||||
|
@ -105,7 +105,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
|
||||
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
|
||||
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
|
||||
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/mbedtls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/pcre2.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/pcre.m4 \
|
||||
$(top_srcdir)/m4/polarssl.m4 \
|
||||
$(top_srcdir)/m4/stack-protector.m4 $(top_srcdir)/m4/zlib.m4 \
|
||||
$(top_srcdir)/libev/libev.m4 $(top_srcdir)/configure.ac
|
||||
|
@ -82,28 +82,14 @@ int
|
||||
init_rule(rule_t *rule)
|
||||
{
|
||||
if (rule->pattern_re == NULL) {
|
||||
int errornumber;
|
||||
PCRE2_SIZE erroroffset;
|
||||
rule->pattern_re = pcre2_compile(
|
||||
(PCRE2_SPTR)rule->pattern, /* the pattern */
|
||||
PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminated */
|
||||
0, /* default options */
|
||||
&errornumber, /* for error number */
|
||||
&erroroffset, /* for error offset */
|
||||
NULL); /* use default compile context */
|
||||
const char *reerr;
|
||||
int reerroffset;
|
||||
|
||||
rule->pattern_re =
|
||||
pcre_compile(rule->pattern, 0, &reerr, &reerroffset, NULL);
|
||||
if (rule->pattern_re == NULL) {
|
||||
PCRE2_UCHAR errbuffer[512];
|
||||
pcre2_get_error_message(errornumber, errbuffer, sizeof(errbuffer));
|
||||
LOGE("PCRE2 regex compilation failed at offset %d: %s\n", (int)erroroffset,
|
||||
errbuffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rule->pattern_re_match_data = pcre2_match_data_create_from_pattern(rule->pattern_re, NULL);
|
||||
|
||||
if (rule->pattern_re_match_data == NULL) {
|
||||
ERROR("PCRE2: the memory for the block could not be obtained");
|
||||
LOGE("Regex compilation of \"%s\" failed: %s, offset %d",
|
||||
rule->pattern, reerr, reerroffset);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -123,15 +109,8 @@ lookup_rule(const struct cork_dllist *rules, const char *name, size_t name_len)
|
||||
|
||||
cork_dllist_foreach_void(rules, curr, next) {
|
||||
rule_t *rule = cork_container_of(curr, rule_t, entries);
|
||||
if (pcre2_match(
|
||||
rule->pattern_re, /* the compiled pattern */
|
||||
(PCRE2_SPTR)name, /* the subject string */
|
||||
name_len, /* the length of the subject */
|
||||
0, /* start at offset 0 in the subject */
|
||||
0, /* default options */
|
||||
rule->pattern_re_match_data, /* block for storing the result */
|
||||
NULL /* use default match context */
|
||||
) >= 0)
|
||||
if (pcre_exec(rule->pattern_re, NULL,
|
||||
name, name_len, 0, 0, NULL, 0) >= 0)
|
||||
return rule;
|
||||
}
|
||||
|
||||
@ -152,13 +131,7 @@ free_rule(rule_t *rule)
|
||||
return;
|
||||
|
||||
ss_free(rule->pattern);
|
||||
if (rule->pattern_re != NULL) {
|
||||
pcre2_code_free(rule->pattern_re); /* data and the compiled pattern. */
|
||||
rule->pattern_re = NULL;
|
||||
}
|
||||
if (rule->pattern_re_match_data != NULL) {
|
||||
pcre2_match_data_free(rule->pattern_re_match_data); /* Release memory used for the match */
|
||||
rule->pattern_re_match_data = NULL;
|
||||
}
|
||||
if (rule->pattern_re != NULL)
|
||||
pcre_free(rule->pattern_re);
|
||||
ss_free(rule);
|
||||
}
|
||||
|
@ -33,27 +33,17 @@
|
||||
|
||||
#include <libcork/ds.h>
|
||||
|
||||
/*
|
||||
* The PCRE2_CODE_UNIT_WIDTH macro must be defined before including pcre2.h.
|
||||
* For a program that uses only one code unit width, setting it to 8, 16, or 32
|
||||
* makes it possible to use generic function names such as pcre2_compile(). Note
|
||||
* that just changing 8 to 16 (for example) is not sufficient to convert this
|
||||
* program to process 16-bit characters. Even in a fully 16-bit environment, where
|
||||
* string-handling functions such as strcmp() and printf() work with 16-bit
|
||||
* characters, the code for handling the table of named substrings will still need
|
||||
* to be modified.
|
||||
*/
|
||||
/* we only need to support ASCII chartable, thus set it to 8 */
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
|
||||
#include <pcre2.h>
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#elif HAVE_PCRE_PCRE_H
|
||||
#include <pcre/pcre.h>
|
||||
#endif
|
||||
|
||||
typedef struct rule {
|
||||
char *pattern;
|
||||
|
||||
/* Runtime fields */
|
||||
pcre2_code *pattern_re;
|
||||
pcre2_match_data *pattern_re_match_data;
|
||||
pcre *pattern_re;
|
||||
|
||||
struct cork_dllist_item entries;
|
||||
} rule_t;
|
||||
|
Loading…
Reference in New Issue
Block a user