mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 13:27:36 +08:00
update 2022-08-20 23:41:10
This commit is contained in:
parent
7d704c6da5
commit
3216039a8e
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.45.47
|
||||
PKG_VERSION:=0.45.51
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
|
@ -730,6 +730,38 @@ function custom_rules_2.write(self, section, value)
|
||||
end
|
||||
|
||||
--Stream Enhance
|
||||
se_dns_ip = s:taboption("stream_enhance", DynamicList, "lan_block_google_dns_ips", font_red..bold_on..translate("LAN Block Google DNS IP List")..bold_off..font_off)
|
||||
se_dns_ip:depends("proxy_mode", "global")
|
||||
se_dns_ip:depends("proxy_mode", "direct")
|
||||
se_dns_ip:depends("proxy_mode", "script")
|
||||
se_dns_ip:depends({router_self_proxy = "1", proxy_mode = "rule"})
|
||||
se_dns_ip.datatype = "ipaddr"
|
||||
se_dns_ip.rmempty = true
|
||||
|
||||
se_dns_mac = s:taboption("stream_enhance", DynamicList, "lan_block_google_dns_macs", font_red..bold_on..translate("LAN Block Google DNS Mac List")..bold_off..font_off)
|
||||
se_dns_mac.datatype = "list(macaddr)"
|
||||
se_dns_mac.rmempty = true
|
||||
se_dns_mac:depends("proxy_mode", "global")
|
||||
se_dns_mac:depends("proxy_mode", "direct")
|
||||
se_dns_mac:depends("proxy_mode", "script")
|
||||
se_dns_mac:depends({router_self_proxy = "1", proxy_mode = "rule"})
|
||||
|
||||
luci.ip.neighbors({ family = 4 }, function(n)
|
||||
if n.mac and n.dest then
|
||||
se_dns_ip:value(n.dest:string())
|
||||
se_dns_mac:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
|
||||
end
|
||||
end)
|
||||
|
||||
if string.len(SYS.exec("/usr/share/openclash/openclash_get_network.lua 'gateway6'")) ~= 0 then
|
||||
luci.ip.neighbors({ family = 6 }, function(n)
|
||||
if n.mac and n.dest then
|
||||
se_dns_ip:value(n.dest:string())
|
||||
se_dns_mac:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
o = s:taboption("stream_enhance", Flag, "stream_domains_prefetch", font_red..bold_on..translate("Prefetch Netflix, Disney Plus Domains")..bold_off..font_off)
|
||||
o.description = translate("Prevent Some Devices From Directly Using IP Access To Cause Unlocking Failure, Recommend Use meta Sniffer Function")
|
||||
o.default = 0
|
||||
@ -761,6 +793,12 @@ o.default = "30"
|
||||
o.datatype = "uinteger"
|
||||
o:depends("stream_auto_select", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", ListValue, "stream_auto_select_logic", font_red..bold_on..translate("Auto Select Logic")..bold_off..font_off)
|
||||
o.default = "urltest"
|
||||
o:value("urltest", translate("Urltest"))
|
||||
o:value("random", translate("Random"))
|
||||
o:depends("stream_auto_select", "1")
|
||||
|
||||
o = s:taboption("stream_enhance", Flag, "stream_auto_select_expand_group", font_red..bold_on..translate("Expand Group")..bold_off..font_off)
|
||||
o.description = translate("Automatically Expand The Group When Selected")
|
||||
o.default = 0
|
||||
|
@ -26,7 +26,6 @@
|
||||
<style>
|
||||
.ip-title {
|
||||
font-weight: bold;
|
||||
color: #444;
|
||||
font-size:15px;
|
||||
display: inline-block;
|
||||
width: 25%;
|
||||
@ -37,7 +36,6 @@
|
||||
|
||||
.ip-state_title {
|
||||
font-weight: bold;
|
||||
color: #444;
|
||||
font-size:15px;
|
||||
display: inline-block;
|
||||
width: 42%;
|
||||
@ -48,7 +46,6 @@
|
||||
}
|
||||
|
||||
.ip-result {
|
||||
color: #444;
|
||||
font-size:16px;
|
||||
margin:0px 0px 0px 5%;
|
||||
white-space: nowrap; /*强制span不换行*/
|
||||
@ -61,7 +58,6 @@
|
||||
}
|
||||
|
||||
.ip-geo {
|
||||
color: #444;
|
||||
font-size:15px;
|
||||
line-height:20px;
|
||||
white-space: nowrap; /*强制span不换行*/
|
||||
@ -75,7 +71,6 @@
|
||||
}
|
||||
|
||||
.ip-checking {
|
||||
color: #444;
|
||||
font-size:15px;
|
||||
line-height:20px;
|
||||
display: inline-block;
|
||||
|
@ -183,18 +183,22 @@
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_info")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.corever != "0" && status.corever != "" ) {
|
||||
core_version.value = status.corever;
|
||||
}
|
||||
else {
|
||||
core_version.value = "0";
|
||||
}
|
||||
if ( status.release_branch != "" ) {
|
||||
release_branch.value = status.release_branch;
|
||||
}
|
||||
else {
|
||||
release_branch.value = "master";
|
||||
}
|
||||
if ( status.corever != "0" && status.corever != "" ) {
|
||||
core_version.value = status.corever;
|
||||
}
|
||||
else {
|
||||
core_version.value = "0";
|
||||
}
|
||||
if ( status.release_branch != "" ) {
|
||||
release_branch.value = status.release_branch;
|
||||
}
|
||||
else {
|
||||
release_branch.value = "master";
|
||||
}
|
||||
}
|
||||
else {
|
||||
core_version.value = "0";
|
||||
release_branch.value = "master";
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -3107,4 +3107,19 @@ msgid "Domains or IPs in The List Will Not be Affected by The China IP Route Opt
|
||||
msgstr "列表中的域名或 IP 将不会受到绕过中国大陆 IP 选项的影响,此功能依赖于 Dnsmasq"
|
||||
|
||||
msgid "Warning: You May Need to Turn off The Rebinding Protection Option of Dnsmasq When Hosts Has Set a Reserved Address"
|
||||
msgstr "警告:Hosts 设置了保留地址时可能需要关闭 dnsmasq 的重绑定保护选项才能生效"
|
||||
msgstr "警告:Hosts 设置了保留地址时可能需要关闭 dnsmasq 的重绑定保护选项才能生效"
|
||||
|
||||
msgid "LAN Block Google DNS IP List"
|
||||
msgstr "实验性:屏蔽 Google DNS 的局域网设备 IP"
|
||||
|
||||
msgid "LAN Block Google DNS Mac List"
|
||||
msgstr "实验性:屏蔽 Google DNS 的局域网设备 Mac"
|
||||
|
||||
msgid "Auto Select Logic"
|
||||
msgstr "自动选择逻辑"
|
||||
|
||||
msgid "Urltest"
|
||||
msgstr "低延迟优先"
|
||||
|
||||
msgid "Random"
|
||||
msgstr "随机选择"
|
@ -448,6 +448,15 @@ do_run_file()
|
||||
#Some MIPS devices file system cound not use db
|
||||
source "/etc/openwrt_release"
|
||||
[ "$small_flash_memory" == "1" ] || [ -n "$(echo $core_version |grep mips)" ] || [ -n "$(echo $DISTRIB_ARCH |grep mips)" ] || [ -n "$(opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' |grep mips)" ] && mkdir -p /tmp/etc/openclash && CACHE_PATH="/tmp/etc/openclash/cache.db"
|
||||
|
||||
[ -f "/etc/openclash/geosite.dat" ] && {
|
||||
mv "/etc/openclash/geosite.dat" "/etc/openclash/GeoSite.dat" 2>/dev/null
|
||||
}
|
||||
|
||||
[ -f "/etc/openclash/geoip.dat" ] && {
|
||||
mv "/etc/openclash/geoip.dat" "/etc/openclash/GeoIP.dat" 2>/dev/null
|
||||
}
|
||||
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
dev_core_path="/etc/openclash/core/clash"
|
||||
tun_core_path="/etc/openclash/core/clash_tun"
|
||||
@ -1072,6 +1081,19 @@ if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --
|
||||
iptables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
fi
|
||||
|
||||
#lan_google_dns_ac
|
||||
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_ips)" ]; then
|
||||
ipset create lan_block_google_dns_ips hash:net
|
||||
ipset create lan_block_google_dns_ipv6s hash:net family inet6
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "lan_block_google_dns_ips" ac_add "lan_block_google_dns_ips" "lan_block_google_dns_ipv6s"
|
||||
fi
|
||||
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_macs)" ]; then
|
||||
ipset create lan_block_google_dns_macs hash:mac
|
||||
config_load "openclash"
|
||||
config_list_foreach "config" "lan_block_google_dns_macs" ac_add "lan_block_google_dns_macs"
|
||||
fi
|
||||
|
||||
#lan_ac
|
||||
if [ "$operation_mode" = "redir-host" ] && [ "$en_mode" = "redir-host" ]; then
|
||||
if [ "$lan_ac_mode" = "0" ]; then
|
||||
@ -1160,12 +1182,10 @@ fi
|
||||
if [ "$bypass_gateway_compatible" -eq 1 ]; then
|
||||
iptables -t nat -N openclash_post
|
||||
iptables -t nat -F openclash_post
|
||||
if [ "$bypass_gateway_compatible" -eq 1 ]; then
|
||||
iptables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT
|
||||
iptables -t nat -A openclash_post -m comment --comment "OpenClash Bypass Gateway Compatible" -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE
|
||||
fi
|
||||
iptables -t nat -I POSTROUTING -j openclash_post
|
||||
iptables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT
|
||||
iptables -t nat -A openclash_post -m comment --comment "OpenClash Bypass Gateway Compatible" -m set --match-set localnetwork dst -j RETURN
|
||||
iptables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE
|
||||
iptables -t nat -A POSTROUTING -j openclash_post
|
||||
fi
|
||||
|
||||
#intranet allowed
|
||||
@ -1313,12 +1333,11 @@ if [ -n "$en_mode_tun" ]; then
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -m set ! --match-set common_ports dst -j RETURN >/dev/null 2>&1
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p tcp -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -j MARK --set-mark "$PROXY_FWMARK"
|
||||
else
|
||||
iptables -t mangle -A openclash_output -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
elif [ -z "$_koolshare" ]; then
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -j MARK --set-mark "$PROXY_FWMARK"
|
||||
iptables -t mangle -A openclash_output -m owner ! --uid-owner 65534 -p udp -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
|
||||
fi
|
||||
iptables -t mangle -A OUTPUT -j openclash_output
|
||||
elif [ -z "$_koolshare" ] && [ "$en_mode" = "redir-host" ] && [ "$en_mode_tun" -eq 1 ]; then
|
||||
@ -1374,6 +1393,20 @@ if [ -n "$en_mode_tun" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
#google_dns_block
|
||||
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_ips)" ] || [ -n "$(uci -q get openclash.config.lan_block_google_dns_macs)" ]; then
|
||||
ipset create openclash_google_dns_ips hash:net
|
||||
ipset add openclash_google_dns_ips 8.8.8.8
|
||||
ipset add openclash_google_dns_ips 8.8.4.4
|
||||
|
||||
if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 2 ]; then
|
||||
iptables -t nat -I PREROUTING -m comment --comment "OpenClash Google DNS Block" -m set --match-set lan_block_google_dns_ips src -m set --match-set openclash_google_dns_ips dst -j ACCEPT >/dev/null 2>&1
|
||||
iptables -t nat -I PREROUTING -m comment --comment "OpenClash Google DNS Block" -m set --match-set lan_block_google_dns_macs src -m set --match-set openclash_google_dns_ips dst -j ACCEPT >/dev/null 2>&1
|
||||
fi
|
||||
iptables -t filter -I FORWARD -m set --match-set lan_block_google_dns_ips src -m set --match-set openclash_google_dns_ips dst -j REJECT >/dev/null 2>&1
|
||||
iptables -t filter -I FORWARD -m set --match-set lan_block_google_dns_macs src -m set --match-set openclash_google_dns_ips dst -j REJECT >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
#ipv6
|
||||
if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then
|
||||
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(ip6tables -t nat -nL PREROUTING --line-number |grep 'DNS Hijack')"]; then
|
||||
@ -1486,7 +1519,21 @@ if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Ch
|
||||
ip6tables -t nat -A openclash_post -m mark --mark "$PROXY_FWMARK" -m comment --comment "OpenClash Bypass Gateway Compatible" -j ACCEPT
|
||||
ip6tables -t nat -A openclash_post -m comment --comment "OpenClash Bypass Gateway Compatible" -m set --match-set localnetwork6 dst -j RETURN
|
||||
ip6tables -t nat -A openclash_post -m addrtype ! --src-type LOCAL -m owner ! --uid-owner 65534 -m comment --comment "OpenClash Bypass Gateway Compatible" -j MASQUERADE
|
||||
ip6tables -t nat -I POSTROUTING -j openclash_post
|
||||
ip6tables -t nat -A POSTROUTING -j openclash_post
|
||||
fi
|
||||
|
||||
#google_dns_block
|
||||
if [ -n "$(uci -q get openclash.config.lan_block_google_dns_ips)" ] || [ -n "$(uci -q get openclash.config.lan_block_google_dns_macs)" ]; then
|
||||
ipset create openclash_google_dns_ipv6s hash:net family inet6
|
||||
ipset add openclash_google_dns_ipv6s 2001:4860:4860::8888
|
||||
ipset add openclash_google_dns_ipv6s 2001:4860:4860::8844
|
||||
ipset add openclash_google_dns_ipv6s 2001:4860:4860::6464
|
||||
ipset add openclash_google_dns_ipv6s 2001:4860:4860::64
|
||||
|
||||
ip6tables -t nat -I PREROUTING -m comment --comment "OpenClash Google DNS Block" -m set --match-set lan_block_google_dns_ipv6s src -m set --match-set openclash_google_dns_ipv6s dst -j ACCEPT
|
||||
ip6tables -t nat -I PREROUTING -m comment --comment "OpenClash Google DNS Block" -m set --match-set lan_block_google_dns_macs src -m set --match-set openclash_google_dns_ipv6s dst -j ACCEPT
|
||||
ip6tables -t filter -I FORWARD -m set --match-set lan_block_google_dns_ipv6s src -m set --match-set openclash_google_dns_ipv6s dst -j REJECT >/dev/null 2>&1
|
||||
ip6tables -t filter -I FORWARD -m set --match-set lan_block_google_dns_macs src -m set --match-set openclash_google_dns_ipv6s dst -j REJECT >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
#intranet allowed
|
||||
@ -1561,7 +1608,9 @@ revert_firewall()
|
||||
ipset destroy lan_ac_white_ipv6s >/dev/null 2>&1
|
||||
ipset destroy lan_ac_black_ipv6s >/dev/null 2>&1
|
||||
ipset destroy wan_ac_black_ipv6s >/dev/null 2>&1
|
||||
|
||||
ipset destroy openclash_google_dns_ipv6s >/dev/null 2>&1
|
||||
ipset destroy lan_block_google_dns_ipv6s >/dev/null 2>&1
|
||||
|
||||
ipset destroy localnetwork >/dev/null 2>&1
|
||||
ipset destroy china_ip_route >/dev/null 2>&1
|
||||
ipset destroy china_ip_route_pass >/dev/null 2>&1
|
||||
@ -1571,6 +1620,9 @@ revert_firewall()
|
||||
ipset destroy lan_ac_black_macs >/dev/null 2>&1
|
||||
ipset destroy wan_ac_black_ips >/dev/null 2>&1
|
||||
ipset destroy common_ports >/dev/null 2>&1
|
||||
ipset destroy lan_block_google_dns_ips >/dev/null 2>&1
|
||||
ipset destroy lan_block_google_dns_macs >/dev/null 2>&1
|
||||
ipset destroy openclash_google_dns_ips >/dev/null 2>&1
|
||||
}
|
||||
|
||||
get_config()
|
||||
|
@ -128,3 +128,4 @@ ff.dorado.sdo.com
|
||||
shark007.net
|
||||
#Mijia
|
||||
Mijia Cloud
|
||||
+.dns.google
|
@ -33,7 +33,7 @@ urlencode() {
|
||||
if [ "$#" -eq 1 ]; then
|
||||
data=$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "key=$1" "")
|
||||
if [ ! -z "$data" ]; then
|
||||
echo "$(echo ${data##/?key=} |sed 's/\//%2f/g' |sed 's/:/%3a/g' |sed 's/?/%3f/g' |sed 's/(/%28/g' |sed 's/)/%29/g' |sed 's/\^/%5e/g' |sed 's/=/%3d/g' |sed 's/|/%7c/g' |sed 's/+/%20/g')"
|
||||
echo -n "$(echo ${data##/?key=} |sed 's/\//%2f/g' |sed 's/:/%3a/g' |sed 's/?/%3f/g' |sed 's/(/%28/g' |sed 's/)/%29/g' |sed 's/\^/%5e/g' |sed 's/=/%3d/g' |sed 's/|/%7c/g' |sed 's/+/%20/g')"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -69,11 +69,14 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 "$github_address_mod"https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" != "0" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
fi
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 https://raw.githubusercontent.com/vernesong/OpenClash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" != "0" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/premium/clash-"$CPU_MODEL"-"$CORE_LV".gz -o /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" == "0" ]; then
|
||||
gzip -t /tmp/clash_tun.gz >/dev/null 2>&1
|
||||
fi
|
||||
;;
|
||||
"Meta")
|
||||
LOG_OUT "【Meta】Core Downloading, Please Try to Download and Upload Manually If Fails"
|
||||
@ -93,6 +96,9 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
if [ "$?" != "0" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/meta/clash-"$CPU_MODEL".tar.gz -o /tmp/clash_meta.tar.gz >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" == "0" ]; then
|
||||
gzip -t /tmp/clash_meta.tar.gz >/dev/null 2>&1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
LOG_OUT "【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails"
|
||||
@ -112,6 +118,9 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
if [ "$?" != "0" ]; then
|
||||
curl -sL -m 30 --speed-time 15 --speed-limit 1 --retry 2 https://ftp.jaist.ac.jp/pub/sourceforge.jp/storage/g/o/op/openclash/"$RELEASE_BRANCH"/core-lateset/dev/clash-"$CPU_MODEL".tar.gz -o /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" == "0" ]; then
|
||||
gzip -t /tmp/clash.tar.gz >/dev/null 2>&1
|
||||
fi
|
||||
esac
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
@ -164,17 +173,17 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
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
|
||||
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
|
||||
uci -q set openclash.config.config_reload=0
|
||||
uci -q commit openclash
|
||||
if [ -z "$2" ] && [ "$1" != "one_key_update" ] && [ "$(unify_ps_prevent)" -eq 0 ]; then
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
fi
|
||||
|
@ -30,18 +30,28 @@
|
||||
fi
|
||||
|
||||
curl -sL --connect-timeout 5 -m 30 --speed-time 15 --speed-limit 1 --retry 2 "$DOWNLOAD_PATH" -o "$DASH_FILE_DIR" >/dev/null 2>&1
|
||||
|
||||
|
||||
if [ "$?" -eq "0" ] && [ -s "$DASH_FILE_DIR" ] && [ -z "$(grep "404: Not Found" "$DASH_FILE_DIR")" ] && [ -z "$(grep "Package size exceeded the configured limit" "$DASH_FILE_DIR")" ]; then
|
||||
cp -rf "$UNPACK_FILE_DIR". "$BACKUP_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$UNPACK_FILE_DIR" >/dev/null 2>&1
|
||||
unzip -q "$DASH_FILE_DIR" -d "$DASH_FILE_TMP" >/dev/null 2>&1
|
||||
if [ "$?" -eq "0" ] && [ -d "$DASH_FILE_TMP$FILE_PATH_INCLUDE" ]; then
|
||||
cp -rf "$DASH_FILE_TMP$FILE_PATH_INCLUDE"/. "$UNPACK_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
|
||||
return 1
|
||||
unzip -qt "$DASH_FILE_DIR" >/dev/null 2>&1
|
||||
if [ "$?" -eq "0" ]; then
|
||||
cp -rf "$UNPACK_FILE_DIR". "$BACKUP_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$UNPACK_FILE_DIR" >/dev/null 2>&1
|
||||
unzip -q "$DASH_FILE_DIR" -d "$DASH_FILE_TMP" >/dev/null 2>&1
|
||||
if [ "$?" -eq "0" ] && [ -d "$DASH_FILE_TMP$FILE_PATH_INCLUDE" ]; then
|
||||
cp -rf "$DASH_FILE_TMP$FILE_PATH_INCLUDE"/. "$UNPACK_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
|
||||
return 1
|
||||
else
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
|
||||
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$DASH_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$BACKUP_FILE_DIR" >/dev/null 2>&1
|
||||
rm -rf "$DASH_FILE_TMP" >/dev/null 2>&1
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
|
||||
cp -rf "$BACKUP_FILE_DIR". "$UNPACK_FILE_DIR" >/dev/null 2>&1
|
||||
|
@ -7,7 +7,7 @@ urlencode() {
|
||||
if [ "$#" -eq 1 ]; then
|
||||
data=$(curl -s -o /dev/null -w %{url_effective} --get --data-urlencode "key=$1" "")
|
||||
if [ ! -z "$data" ]; then
|
||||
echo "$(echo ${data##/?key=} |sed 's/\//%2f/g' |sed 's/:/%3a/g' |sed 's/?/%3f/g' |sed 's/(/%28/g' |sed 's/)/%29/g' |sed 's/\^/%5e/g' |sed 's/=/%3d/g' |sed 's/|/%7c/g' |sed 's/+/%20/g')"
|
||||
echo -n "$(echo ${data##/?key=} |sed 's/\//%2f/g' |sed 's/:/%3a/g' |sed 's/?/%3f/g' |sed 's/(/%28/g' |sed 's/)/%29/g' |sed 's/\^/%5e/g' |sed 's/=/%3d/g' |sed 's/|/%7c/g' |sed 's/+/%20/g')"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
cmp -s /tmp/GeoIP.dat "$geoip_path"
|
||||
if [ "$?" -ne "0" ]; then
|
||||
LOG_OUT "GeoIP Dat Has Been Updated, Starting To Replace The Old Version..."
|
||||
rm -rf "/etc/openclash/geoip.dat"
|
||||
mv /tmp/GeoIP.dat "$geoip_path" >/dev/null 2>&1
|
||||
LOG_OUT "GeoIP Dat Update Successful!"
|
||||
sleep 3
|
||||
|
@ -50,6 +50,7 @@
|
||||
cmp -s /tmp/GeoSite.dat "$geosite_path"
|
||||
if [ "$?" -ne "0" ]; then
|
||||
LOG_OUT "GeoSite Database Has Been Updated, Starting To Replace The Old Version..."
|
||||
rm -rf "/etc/openclash/geosite.dat"
|
||||
mv /tmp/GeoSite.dat "$geosite_path" >/dev/null 2>&1
|
||||
LOG_OUT "GeoSite Database Update Successful!"
|
||||
sleep 3
|
||||
|
@ -17,6 +17,7 @@ local now_name, group_name, group_type, group_show, status, ip, port, passwd, gr
|
||||
local groups = {}
|
||||
local proxies = {}
|
||||
local self_status = luci.sys.exec(string.format('ps -w |grep -v grep |grep -c "openclash_streaming_unlock.lua %s"', type))
|
||||
local select_logic = uci:get("openclash", "config", "stream_auto_select_logic") or "urltest"
|
||||
|
||||
if not type then
|
||||
print(os.date("%Y-%m-%d %H:%M:%S").." ".."Error: Streaming Unlock Has No Parameter of Type, Exiting...")
|
||||
@ -204,11 +205,16 @@ function unlock_auto_select()
|
||||
if value.type == "Selector" then
|
||||
--save group current selected
|
||||
proxy_default = value.now
|
||||
--random test
|
||||
if not all_test then
|
||||
value.all = table_rand(value.all)
|
||||
--filter nodes
|
||||
value.all = nodes_filter(value.all, info)
|
||||
if select_logic == "random" then
|
||||
--sort by random
|
||||
value.all = table_rand(value.all)
|
||||
else
|
||||
--sort by urltest
|
||||
value.all = table_sort_by_urltest(value.all)
|
||||
end
|
||||
end
|
||||
if #(value.all) == 0 then
|
||||
print(os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18.."【"..value.name.."】"..no_nodes_filter)
|
||||
@ -225,11 +231,16 @@ function unlock_auto_select()
|
||||
if group_name == value.all[i] then
|
||||
luci.sys.exec(string.format("curl -sL -m 3 --retry 2 -w %%{http_code} -o /dev/null -H 'Authorization: Bearer %s' -H 'Content-Type:application/json' -X PUT -d '{\"name\":\"%s\"}' http://%s:%s/proxies/%s", passwd, group_name, ip, port, urlencode(value.name)))
|
||||
end
|
||||
--random test
|
||||
if not all_test then
|
||||
proxies = table_rand(proxies)
|
||||
--filter nodes
|
||||
proxies = nodes_filter(proxies, info)
|
||||
if select_logic == "random" then
|
||||
--sort by random
|
||||
proxies = table_rand(proxies)
|
||||
else
|
||||
--sort by urltest
|
||||
proxies = table_sort_by_urltest(proxies)
|
||||
end
|
||||
end
|
||||
if #(proxies) == 0 then
|
||||
print(os.date("%Y-%m-%d %H:%M:%S").." "..type.." "..gorup_i18.."【"..group_show.."】"..no_nodes_filter)
|
||||
@ -488,7 +499,7 @@ end
|
||||
|
||||
function urlencode(data)
|
||||
local data = luci.sys.exec(string.format('curl -s -o /dev/null -w %%{url_effective} --get --data-urlencode "key=%s" ""', data))
|
||||
return luci.sys.exec(string.format("echo %s |sed 's/+/%%20/g'", string.match(data, "/%?key=(.+)")))
|
||||
return luci.sys.exec(string.format("echo -n %s |sed 's/+/%%20/g'", string.match(data, "/%?key=(.+)")))
|
||||
end
|
||||
|
||||
function datamatch(data, regex)
|
||||
@ -512,6 +523,66 @@ function table_rand(t)
|
||||
return tab
|
||||
end
|
||||
|
||||
function table_sort_by_urltest(t)
|
||||
local info, get_delay, group_delay
|
||||
local count = 1
|
||||
local tab = {}
|
||||
local result = {}
|
||||
|
||||
if t == nil then
|
||||
return
|
||||
end
|
||||
|
||||
info = luci.sys.exec(string.format('curl -sL -m 3 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://%s:%s/providers/proxies', passwd, ip, port))
|
||||
if info then
|
||||
info = json.parse(info)
|
||||
if not info or not info.providers then return t end
|
||||
end
|
||||
|
||||
for n = 1, #(t) do
|
||||
get_delay = false
|
||||
for _, value in pairs(info.providers) do
|
||||
if value.proxies and value.name ~= "default" then
|
||||
for _, v in pairs(value.proxies) do
|
||||
if v.name == t[n] then
|
||||
if v.history and #(v.history) ~= 0 and v.history[#(v.history)].delay ~= 0 then
|
||||
table.insert(tab, {v.name, v.history[#(v.history)].delay})
|
||||
get_delay = true
|
||||
end
|
||||
end
|
||||
if get_delay then break end
|
||||
end
|
||||
end
|
||||
if get_delay then break end
|
||||
end
|
||||
if not get_delay then
|
||||
if table_include(groups, t[n]) or t[n] == "DIRECT" then
|
||||
group_delay = luci.sys.exec(string.format('curl -sL -m 5 --retry 2 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET "http://%s:%s/proxies/%s/delay?timeout=5000&url=http%%3A%%2F%%2F%s"', passwd, ip, port, urlencode(t[n]), "www.gstatic.com%2Fgenerate_204"))
|
||||
if group_delay then
|
||||
group_delay = json.parse(group_delay)
|
||||
end
|
||||
if group_delay.delay and group_delay.delay ~= 0 then
|
||||
table.insert(tab, {t[n], group_delay.delay})
|
||||
else
|
||||
table.insert(tab, {t[n], 123456})
|
||||
end
|
||||
else
|
||||
table.insert(tab, {t[n], 123456})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(tab, function(a, b)
|
||||
return a[2] < b[2]
|
||||
end)
|
||||
|
||||
for _, value in pairs(tab) do
|
||||
table.insert(result, value[1])
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function table_include(table, value)
|
||||
if table == nil then
|
||||
return false
|
||||
@ -876,7 +947,7 @@ function netflix_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.netflix.com/title/"..filmId
|
||||
local headers = "User-Agent: "..UA
|
||||
local info = luci.sys.exec(string.format('curl -sLI --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H "Content-Type: application/json" -H "%s" -XGET %s', headers, url))
|
||||
local info = luci.sys.exec(string.format('curl -sLI --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H "Content-Type: application/json" -H "%s" -XGET %s', headers, url))
|
||||
local result = {}
|
||||
local region, old_region
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_netflix") or ""
|
||||
@ -919,7 +990,7 @@ function disney_unlock_test()
|
||||
local region, old_region, assertion, data, preassertion, disneycookie, tokencontent
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_disney") or ""
|
||||
|
||||
preassertion = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -H 'content-type: application/json; charset=UTF-8' -d '{\"deviceFamily\":\"browser\",\"applicationRuntime\":\"chrome\",\"deviceProfile\":\"windows\",\"attributes\":{}}' -XPOST %s", auth, UA, url))
|
||||
preassertion = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -H 'content-type: application/json; charset=UTF-8' -d '{\"deviceFamily\":\"browser\",\"applicationRuntime\":\"chrome\",\"deviceProfile\":\"windows\",\"attributes\":{}}' -XPOST %s", auth, UA, url))
|
||||
|
||||
if preassertion and json.parse(preassertion) then
|
||||
assertion = json.parse(preassertion).assertion
|
||||
@ -928,7 +999,7 @@ function disney_unlock_test()
|
||||
if not assertion then return end
|
||||
|
||||
disneycookie = "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&latitude=0&longitude=0&platform=browser&subject_token="..assertion.."&subject_token_type=urn%3Abamtech%3Aparams%3Aoauth%3Atoken-type%3Adevice"
|
||||
tokencontent = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -d '%s' -XPOST %s", auth, UA, disneycookie, url2))
|
||||
tokencontent = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -d '%s' -XPOST %s", auth, UA, disneycookie, url2))
|
||||
|
||||
if tokencontent and json.parse(tokencontent) then
|
||||
if json.parse(tokencontent).error_description then
|
||||
@ -937,7 +1008,7 @@ function disney_unlock_test()
|
||||
end
|
||||
end
|
||||
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -d '%s' -XPOST %s", headers, UA, body, url3))
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 %s -H 'User-Agent: %s' -d '%s' -XPOST %s", headers, UA, body, url3))
|
||||
|
||||
if data and json.parse(data) then
|
||||
status = 1
|
||||
@ -983,7 +1054,7 @@ end
|
||||
function hbo_now_unlock_test()
|
||||
status = 0
|
||||
local url = "https://play.hbonow.com/"
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data then
|
||||
data = json.parse(data)
|
||||
end
|
||||
@ -1001,7 +1072,7 @@ end
|
||||
function hbo_max_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.hbomax.com/"
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local result = {}
|
||||
local region = ""
|
||||
local old_region = ""
|
||||
@ -1039,13 +1110,13 @@ end
|
||||
function hbo_go_asia_unlock_test()
|
||||
status = 0
|
||||
local url = "https://api2.hbogoasia.com/v1/geog?lang=undefined&version=0&bundleId=www.hbogoasia.com"
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_hbo_go_asia") or ""
|
||||
local region = ""
|
||||
local old_region = ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
status = 1
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data then
|
||||
data = json.parse(data)
|
||||
end
|
||||
@ -1076,14 +1147,14 @@ end
|
||||
function ytb_unlock_test()
|
||||
status = 0
|
||||
local url = "https://m.youtube.com/premium"
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local region = ""
|
||||
local old_region = ""
|
||||
local data, he_data
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_ytb") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
status = 1
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -b 'YSC=BiCUU3-5Gdk; CONSENT=YES+cb.20220301-11-p0.en+FX+700; GPS=1; VISITOR_INFO1_LIVE=4VwPMkB7W5A; PREF=tz=Asia.Shanghai; _gcl_au=1.1.1809531354.1646633279' %s", UA, url))
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -b 'YSC=BiCUU3-5Gdk; CONSENT=YES+cb.20220301-11-p0.en+FX+700; GPS=1; VISITOR_INFO1_LIVE=4VwPMkB7W5A; PREF=tz=Asia.Shanghai; _gcl_au=1.1.1809531354.1646633279' %s", UA, url))
|
||||
if string.find(data,"www%.google%.cn") or string.find(data, "is not available in your country") then
|
||||
return
|
||||
end
|
||||
@ -1091,7 +1162,7 @@ function ytb_unlock_test()
|
||||
if region then
|
||||
status = 2
|
||||
else
|
||||
he_data = luci.sys.exec(string.format("curl -sIL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
he_data = luci.sys.exec(string.format("curl -sIL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
region = string.sub(string.match(he_data, "gl=%a+"), 4, -1)
|
||||
if region then
|
||||
status = 2
|
||||
@ -1117,13 +1188,13 @@ end
|
||||
function tvb_anywhere_unlock_test()
|
||||
status = 0
|
||||
local url = "https://uapisfm.tvbanywhere.com.sg/geoip/check/platform/android"
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local region = ""
|
||||
local old_region = ""
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_tvb_anywhere") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
status = 1
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data then
|
||||
data = json.parse(data)
|
||||
end
|
||||
@ -1151,13 +1222,13 @@ end
|
||||
function prime_video_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.primevideo.com"
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local region
|
||||
local old_region
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_prime_video") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
status = 1
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
if data then
|
||||
region = string.sub(string.match(data, "\"currentTerritory\":\"%a+\""), 21, -2)
|
||||
if region then
|
||||
@ -1184,13 +1255,13 @@ function dazn_unlock_test()
|
||||
status = 0
|
||||
local url = "https://www.dazn.com"
|
||||
local url2 = "https://startup.core.indazn.com/misl/v5/Startup"
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local region
|
||||
local old_region
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_dazn") or ""
|
||||
if tonumber(httpcode) == 200 then
|
||||
status = 1
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -X POST -d '{\"LandingPageKey\":\"generic\",\"Languages\":\"zh-CN,zh,en\",\"Platform\":\"web\",\"PlatformAttributes\":{},\"Manufacturer\":\"\",\"PromoCode\":\"\",\"Version\":\"2\"}' %s", UA, url2))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' -X POST -d '{\"LandingPageKey\":\"generic\",\"Languages\":\"zh-CN,zh,en\",\"Platform\":\"web\",\"PlatformAttributes\":{},\"Manufacturer\":\"\",\"PromoCode\":\"\",\"Version\":\"2\"}' %s", UA, url2))
|
||||
if data then
|
||||
data = json.parse(data)
|
||||
end
|
||||
@ -1221,13 +1292,13 @@ function paramount_plus_unlock_test()
|
||||
local region
|
||||
local old_region
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_paramount_plus") or ""
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{json} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
data = json.parse(data)
|
||||
if data and tonumber(data.http_code) == 200 then
|
||||
status = 1
|
||||
if not string.find(data.url_effective, "intl") then
|
||||
status = 2
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s", UA, url))
|
||||
region = string.upper(string.sub(string.match(data, "\"siteEdition\":\"%a+|%a+\""), 19, -1)) or string.upper(string.sub(string.match(data, "property: '%a+'"), 12, -2))
|
||||
if region then
|
||||
if fs.isfile(string.format("/tmp/openclash_%s_region", type)) then
|
||||
@ -1253,12 +1324,12 @@ function discovery_plus_unlock_test()
|
||||
local url1 = "https://us1-prod-direct.discoveryplus.com/users/me"
|
||||
local region
|
||||
local regex = uci:get("openclash", "config", "stream_auto_select_region_key_discovery_plus") or ""
|
||||
local token = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
local token = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
if token and json.parse(token) and json.parse(token).data and json.parse(token).data.attributes then
|
||||
status = 1
|
||||
token = json.parse(token).data.attributes.token
|
||||
local cookie = string.format("-b \"_gcl_au=1.1.858579665.1632206782; _rdt_uuid=1632206782474.6a9ad4f2-8ef7-4a49-9d60-e071bce45e88; _scid=d154b864-8b7e-4f46-90e0-8b56cff67d05; _pin_unauth=dWlkPU1qWTRNR1ZoTlRBdE1tSXdNaTAwTW1Nd0xUbGxORFV0WWpZMU0yVXdPV1l6WldFeQ; _sctr=1|1632153600000; aam_fw=aam%%3D9354365%%3Baam%%3D9040990; aam_uuid=24382050115125439381416006538140778858; st=%s; gi_ls=0; _uetvid=a25161a01aa711ec92d47775379d5e4d; AMCV_BC501253513148ED0A490D45%%40AdobeOrg=-1124106680%%7CMCIDTS%%7C18894%%7CMCMID%%7C24223296309793747161435877577673078228%%7CMCAAMLH-1633011393%%7C9%%7CMCAAMB-1633011393%%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%%7CMCOPTOUT-1632413793s%%7CNONE%%7CvVersion%%7C5.2.0; ass=19ef15da-95d6-4b1d-8fa2-e9e099c9cc38.1632408400.1632406594\"", token)
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s %s", UA, cookie, url1))
|
||||
local data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' %s %s", UA, cookie, url1))
|
||||
if data and json.parse(data) and json.parse(data).data and json.parse(data).data.attributes and json.parse(data).data.attributes.currentLocationSovereignTerritory then
|
||||
region = string.upper(json.parse(data).data.attributes.currentLocationTerritory) or string.upper(json.parse(data).data.attributes.currentLocationSovereignTerritory)
|
||||
if region then
|
||||
@ -1295,9 +1366,9 @@ function bilibili_unlock_test()
|
||||
url = string.format("https://api.bilibili.com/pgc/player/web/playurl?avid=82846771&qn=0&type=&otype=json&ep_id=307247&fourk=1&fnver=0&fnval=16&session=%s&module=bangumi", randsession)
|
||||
region = "CN"
|
||||
end
|
||||
httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
httpcode = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
if httpcode and tonumber(httpcode) == 200 then
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 15 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
data = luci.sys.exec(string.format("curl -sL --connect-timeout 5 -m 10 --speed-time 5 --speed-limit 1 --retry 2 -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, url))
|
||||
if data then
|
||||
data = json.parse(data)
|
||||
status = 1
|
||||
|
@ -107,9 +107,9 @@ fi
|
||||
|
||||
## 端口转发重启
|
||||
last_line=$(iptables -t nat -nL PREROUTING --line-number |awk '{print $1}' 2>/dev/null |awk 'END {print}' |sed -n '$p')
|
||||
op_line=$(iptables -t nat -nL PREROUTING --line-number |grep "openclash" 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1)
|
||||
op_line=$(iptables -t nat -nL PREROUTING --line-number |grep "openclash " 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1)
|
||||
if [ "$last_line" != "$op_line" ] && [ -n "$op_line" ]; then
|
||||
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/openclash/=' 2>/dev/null |sort -rn)
|
||||
pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/openclash /=' 2>/dev/null |sort -rn)
|
||||
for pre_line in $pre_lines; do
|
||||
iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1
|
||||
done >/dev/null 2>&1
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -8,9 +8,9 @@
|
||||
<meta name="description" content="Clash web port" />
|
||||
<!--meta name="external-controller" content="http://secret@example.com:9090"-->
|
||||
<title>Clash</title>
|
||||
<script type="module" crossorigin src="./assets/index.ccf895d1.js"></script>
|
||||
<link rel="modulepreload" href="./assets/vendor.46bd3f27.js">
|
||||
<link rel="stylesheet" href="./assets/index.e71ce3d7.css">
|
||||
<script type="module" crossorigin src="./assets/index.7cc327e0.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="./assets/vendor.8d36e21e.js">
|
||||
<link rel="stylesheet" href="./assets/index.ebec649d.css">
|
||||
<link rel="manifest" href="./manifest.webmanifest"><script>if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
@ -1 +1 @@
|
||||
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>n(e,r),d={module:{uri:r},exports:o,require:l};s[r]=Promise.all(i.map((e=>d[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-4ee7f24a"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.ccf895d1.js",revision:null},{url:"assets/index.e71ce3d7.css",revision:null},{url:"assets/vendor.46bd3f27.js",revision:null},{url:"index.html",revision:"c1e679f859800a2d888e2de265652e62"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));
|
||||
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>n(e,r),d={module:{uri:r},exports:o,require:l};s[r]=Promise.all(i.map((e=>d[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-74eda642"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.7cc327e0.js",revision:null},{url:"assets/index.ebec649d.css",revision:null},{url:"assets/vendor.8d36e21e.js",revision:null},{url:"index.html",revision:"244b72655b8f5e568d0cec0bb1ba8b28"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));
|
||||
|
File diff suppressed because one or more lines are too long
@ -201,7 +201,11 @@ yml_dns_get()
|
||||
fi
|
||||
|
||||
if [ -n "$port" ] && [ -n "$ip" ]; then
|
||||
dns_address="$ip:$port"
|
||||
if [ ${ip%%/*} != ${ip#*/} ]; then
|
||||
dns_address="${ip%%/*}:$port/${ip#*/}"
|
||||
else
|
||||
dns_address="$ip:$port"
|
||||
fi
|
||||
elif [ -z "$port" ] && [ -n "$ip" ]; then
|
||||
dns_address="$ip"
|
||||
else
|
||||
@ -636,6 +640,12 @@ Thread.new{
|
||||
Value['dns'].merge!({'fake-ip-filter'=>['+.nflxvideo.net', '+.media.dssott.com']});
|
||||
end;
|
||||
end;
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'].insert(-1,'+.dns.google');
|
||||
Value['dns']['fake-ip-filter']=Value['dns']['fake-ip-filter'].uniq;
|
||||
else
|
||||
Value['dns'].merge!({'fake-ip-filter'=>['+.dns.google']});
|
||||
end;
|
||||
elsif ${19} == 1 then
|
||||
if Value['dns'].has_key?('fake-ip-filter') and not Value['dns']['fake-ip-filter'].to_a.empty? then
|
||||
Value['dns']['fake-ip-filter'].insert(-1,'+.*');
|
||||
|
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.47-beta"><title>Current Version: v0.45.47-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.47-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.47-beta</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.51-beta"><title>Current Version: v0.45.51-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.51-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.51-beta</text></g></svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@ -25,7 +25,7 @@
|
||||
|
||||
.cm-s-idea span.cm-builtin { color: #30a; }
|
||||
.cm-s-idea span.cm-bracket { color: #cc7; }
|
||||
.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}
|
||||
.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif;}
|
||||
|
||||
|
||||
.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
|
||||
|
Loading…
Reference in New Issue
Block a user