OpenClash: Update to v0.42.03-beta

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
vernesong 2021-03-06 22:42:07 +08:00 committed by Tianling Shen
parent 02318e14f4
commit a094cc7906
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
26 changed files with 167 additions and 38 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.42.02
PKG_VERSION:=0.42.03
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -204,7 +204,7 @@ uci:commit("openclash")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config"))
end
btndl = tb:option(Button,"download",translate("Download Configurations"))
btndl = tb:option(Button,"download",translate("Download Config"))
btndl.template="openclash/other_button"
btndl.render=function(e,t,a)
e.inputstyle="remove"
@ -237,6 +237,44 @@ btndl.write = function (a,t)
HTTP.close()
end
btndlr = tb:option(Button,"download_run",translate("Download Running Config"))
btndlr.template="openclash/other_button"
btndlr.render=function(c,t,a)
if string.sub(SYS.exec("uci get openclash.config.config_path 2>/dev/null"), 23, -2) == e[t].name then
a.display=""
else
a.display="none"
end
c.inputstyle="remove"
Button.render(c,t,a)
end
btndlr.write = function (a,t)
local sPath, sFile, fd, block
sPath = "/etc/openclash/"..e[t].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then
return
end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block ==0) then
break
else
HTTP.write(block)
end
end
fd:close()
HTTP.close()
end
btnrm=tb:option(Button,"remove",translate("Remove"))
btnrm.render=function(e,t,a)
e.inputstyle="reset"

View File

@ -52,11 +52,11 @@ end
o = s:option(ListValue, "type", translate("Group Type"))
o.rmempty = true
o.description = translate("Choose The Operation Mode")
o:value("select", translate("Select "))
o:value("select", translate("Manual-Select"))
o:value("url-test", translate("URL-Test"))
o:value("fallback", translate("Fallback"))
o:value("load-balance", translate("Load-Balance"))
o:value("relay", translate("Relay Traffic"))
o:value("relay", translate("Relay-Traffic"))
o = s:option(ListValue, "strategy", translate("Strategy Type"))
o.rmempty = true

View File

@ -134,6 +134,17 @@ end
o:value("DIRECT")
o:value("REJECT")
o = s:option(ListValue, "Scholar", translate("Scholar"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
o:value(groupname)
end
end
o:value("DIRECT")
o:value("REJECT")
o = s:option(ListValue, "Microsoft", translate("Microsoft"))
o:depends("rule_name", "lhie1")
o.rmempty = true

View File

@ -40,7 +40,7 @@ nm1=tb1:option(DummyValue,"name",translate("File Name"))
mt1=tb1:option(DummyValue,"mtime",translate("Update Time"))
sz1=tb1:option(DummyValue,"size",translate("Size"))
btndl1 = tb1:option(Button,"download1",translate("Download Configurations"))
btndl1 = tb1:option(Button,"download1",translate("Download Config"))
btndl1.template="openclash/other_button"
btndl1.render=function(y,x,r)
y.inputstyle="remove"

View File

@ -40,7 +40,7 @@ nm2=tb2:option(DummyValue,"name",translate("File Name"))
mt2=tb2:option(DummyValue,"mtime",translate("Update Time"))
sz2=tb2:option(DummyValue,"size",translate("Size"))
btndl2 = tb2:option(Button,"download2",translate("Download Configurations"))
btndl2 = tb2:option(Button,"download2",translate("Download Config"))
btndl2.template="openclash/other_button"
btndl2.render=function(m,n,h)
m.inputstyle="remove"

View File

@ -10,7 +10,8 @@ local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor()
m = SimpleForm("openclash", translate("Other Rule Providers List"))
m.description=translate("规则项目: Profiles ( https://github.com/DivineEngine/Profiles )<br/>")
m.description=translate("规则项目: ConnersHua ( https://github.com/DivineEngine/Profiles ) \
<br/>: lhie1 ( https://github.com/lhie1/Rules )")
m.reset = false
m.submit = false

View File

@ -104,9 +104,12 @@ msgstr "保存配置"
msgid "Apply Configurations"
msgstr "应用配置"
msgid "Download Configurations"
msgid "Download Config"
msgstr "下载配置"
msgid "Download Running Config"
msgstr "下载运行配置"
msgid "Select Mode"
msgstr "*运行模式"
@ -484,6 +487,9 @@ msgstr "Youtube流量"
msgid "Apple"
msgstr "苹果服务流量"
msgid "Scholar"
msgstr "学术网站流量"
msgid "Microsoft"
msgstr "微软服务流量"
@ -786,7 +792,7 @@ msgstr "检测频率(秒)"
msgid "Tolerance(ms)"
msgstr "节点切换容忍值(毫秒)"
msgid "Select "
msgid "Manual-Select"
msgstr "Select【手动选择】"
msgid "URL-Test"
@ -798,7 +804,7 @@ msgstr "Fallback【故障切换】"
msgid "Load-Balance"
msgstr "Load-Balance【负载均衡】"
msgid "Relay Traffic"
msgid "Relay-Traffic"
msgstr "Relay【嵌套中转】"
msgid "Other Group"
@ -874,7 +880,7 @@ msgid "Exclude Keyword Match"
msgstr "排除节点"
msgid "(eg: hk or tw&bgp)"
msgstr "(格式示例:香港、台湾&bgp"
msgstr "(格式示例:香港 或 台湾&bgp 或 新加坡&bgp&奈飞"
msgid "Config File List"
msgstr "配置文件列表"

View File

@ -55,13 +55,13 @@ config dns_servers
option group 'nameserver'
option type 'udp'
option ip '119.28.28.28'
option enabled '1'
option enabled '0'
config dns_servers
option group 'nameserver'
option type 'udp'
option ip '223.5.5.5'
option enabled '1'
option enabled '0'
config dns_servers
option type 'https'
@ -76,7 +76,7 @@ config dns_servers
option type 'https'
config dns_servers
option enabled '1'
option enabled '0'
option group 'fallback'
option ip 'dns.google'
option port '853'
@ -89,7 +89,7 @@ config dns_servers
option ip '1.1.1.1/dns-query'
config dns_servers
option enabled '1'
option enabled '0'
option group 'fallback'
option ip '1.1.1.1'
option port '853'

View File

@ -86,3 +86,4 @@ stun.*.*.*
heartbeat.belkin.com
*.linksys.com
*.linksyssmartwifi.com
+.battlenet.com.cn

View File

@ -32,4 +32,15 @@
##- SRC-IP-CIDR,192.168.1.1/32,DIRECT
##- SRC-IP-CIDR,198.18.0.1/32,DIRECT
##DDNS
##-DOMAIN-SUFFIX,checkip.dyndns.org,DIRECT
##-DOMAIN-SUFFIX,checkipv6.dyndns.org,DIRECT
##-DOMAIN-SUFFIX,checkip.synology.com,DIRECT
##-DOMAIN-SUFFIX,ifconfig.co,DIRECT
##-DOMAIN-SUFFIX,api.myip.com,DIRECT
##-DOMAIN-SUFFIX,ip-api.com,DIRECT
##-DOMAIN-SUFFIX,ipapi.co,DIRECT
##-DOMAIN-SUFFIX,ip6.seeip.org,DIRECT
##-DOMAIN-SUFFIX,members.3322.org,DIRECT
##在线IP段转CIDR地址http://ip2cidr.com

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,9 @@
content="Clash web port"
/>
<title>Clash</title>
<script type="module" crossorigin src="./assets/index.236bee55.js"></script>
<script type="module" crossorigin src="./assets/index.0bf7b2ad.js"></script>
<link rel="modulepreload" href="./assets/vendor.b176d855.js">
<link rel="stylesheet" href="./assets/index.5dfcf857.css">
<link rel="stylesheet" href="./assets/index.0e294c2a.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1,10 +1,16 @@
#!/bin/bash
. /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/ruby.sh
status=$(unify_ps_status "openclash.sh")
[ "$status" -gt 3 ] && exit 0
set_lock() {
exec 889>"/tmp/lock/openclash_subs.lock" 2>/dev/null
flock -x 889 2>/dev/null
}
del_lock() {
flock -u 889 2>/dev/null
rm -rf "/tmp/lock/openclash_subs.lock"
}
START_LOG="/tmp/openclash_start.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
@ -18,6 +24,7 @@ enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
if_restart=0
only_download=0
set_lock
urlencode() {
local data
@ -391,3 +398,4 @@ else
[ "$(uci get openclash.config.auto_update 2>/dev/null)" -eq 1 ] && [ "$(uci get openclash.config.config_auto_update_mode 2>/dev/null)" -ne 1 ] && echo "0 $(uci get openclash.config.auto_update_time 2>/dev/null) * * $(uci get openclash.config.config_update_week_time 2>/dev/null) /usr/share/openclash/openclash.sh" >> $CRON_FILE
/etc/init.d/cron restart
fi
del_lock

View File

@ -30,10 +30,10 @@ if [ -n "$(pidof clash)" ] && [ -f "$CONFIG_FILE" ]; then
cmp -s "$HISTORY_TMP" "$HISTORY_PATH"
if [ "$?" -ne "0" ] && [ -s "$HISTORY_TMP" ]; then
mv "$HISTORY_TMP" "$HISTORY_PATH" 2>/dev/null
echo "${LOGTIME} History:【${CONFIG_NAME}】 Update Successful" >> $LOG_FILE
echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Update Successful" >> $LOG_FILE
fi
else
echo "${LOGTIME} History:【${CONFIG_NAME}】 Update Faild" >> $LOG_FILE
echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Update Faild" >> $LOG_FILE
fi
fi
rm -rf /tmp/openclash_history_* 2>/dev/null

View File

@ -64,7 +64,7 @@ if [ -s "$HISTORY_PATH" ] && [ ! -z "$(pidof clash)" ]; then
fi
done >/dev/null 2>&1
close_all_conection
echo "${LOGTIME} History:【${CONFIG_NAME}】 Restore Successful" >> $LOG_FILE
echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Restore Successful" >> $LOG_FILE
else
echo "${LOGTIME} History:【${CONFIG_NAME}】 Restore Faild" >> $LOG_FILE
echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Restore Faild" >> $LOG_FILE
fi

View File

@ -65,17 +65,20 @@
echo "Ruby依赖异常无法校验配置文件请确认ruby依赖工作正常后重试" > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3
echo "" >$START_LOG
exit 0
elif [ ! -f "/tmp/rules.yaml" ]; then
echo "错误:$rule_name 规则文件格式校验失败,请稍后再试..." > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3
echo "" >$START_LOG
exit 0
elif ! "$(ruby_read "/tmp/rules.yaml" ".key?('rules')")" ; then
echo "${LOGTIME} Error: Updated Others Rules 【$rule_name】 Has No Rules Field, Update Exit..." >> $LOG_FILE
echo "错误:$rule_name 规则文件规则部分校验失败,请稍后再试..." > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3
echo "" >$START_LOG
exit 0
#校验是否含有新策略组
elif ! "$(ruby -ryaml -E UTF-8 -e "
@ -89,6 +92,7 @@
echo "错误:$rule_name 规则文件含有未支持的新策略组更新停止请等待OpenClash版本更新适配..." > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3
echo "" >$START_LOG
exit 0
fi

View File

@ -45,6 +45,7 @@ rules:
- RULE-SET,Microsoft,Microsoft
- RULE-SET,PROXY,Proxy
- RULE-SET,Apple,Apple
- RULE-SET,Scholar,Scholar
- RULE-SET,Domestic,Domestic
- RULE-SET,Domestic IPs,Domestic
- RULE-SET,LAN,DIRECT
@ -100,6 +101,7 @@ script:
"Microsoft": "Microsoft",
"PROXY": "Proxy",
"Apple": "Apple",
"Scholar": "Scholar",
"Domestic": "Domestic",
"Domestic IPs": "Domestic",
"LAN": "DIRECT"
@ -407,6 +409,12 @@ rule-providers:
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Apple.yaml
path: "./Rules/Apple"
interval: 86400
Scholar:
type: http
behavior: classical
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Scholar.yaml
path: "./Rules/Scholar"
interval: 86400
Domestic IPs:
type: http
behavior: ipcidr

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,17 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh
status=$(unify_ps_status "yml_groups_set.sh")
[ "$status" -gt "3" ] && exit 0
set_lock() {
exec 887>"/tmp/lock/openclash_groups_set.lock" 2>/dev/null
flock -x 887 2>/dev/null
}
del_lock() {
flock -u 887 2>/dev/null
rm -rf "/tmp/lock/openclash_groups_set.lock"
}
set_lock
START_LOG="/tmp/openclash_start.log"
GROUP_FILE="/tmp/yaml_groups.yaml"
CFG_FILE="/etc/config/openclash"
@ -251,6 +258,7 @@ if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ] || [ ! -z "$if_g
uci commit openclash
sleep 5
echo "" >$START_LOG
del_lock
exit 0
else
if [ -z "$if_game_group" ]; then
@ -268,4 +276,5 @@ if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ] || [ ! -z "$if_g
fi
if [ -z "$if_game_group" ]; then
/usr/share/openclash/yml_proxys_set.sh
fi
fi
del_lock

View File

@ -790,16 +790,41 @@ cat >> "$SERVER_FILE" <<-EOF
- Proxy
- DIRECT
- Domestic
- name: Apple
type: select
proxies:
- DIRECT
- Proxy
- name: Microsoft
type: select
proxies:
- DIRECT
- Proxy
EOF
cat >> "$SERVER_FILE" <<-EOF
- name: Apple
type: select
proxies:
- DIRECT
- Proxy
EOF
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
if [ -f "/tmp/Proxy_Provider" ]; then
cat >> "$SERVER_FILE" <<-EOF
use:
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Scholar
type: select
proxies:
- Proxy
- DIRECT
EOF
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
if [ -f "/tmp/Proxy_Provider" ]; then
cat >> "$SERVER_FILE" <<-EOF
use:
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Netflix
type: select
proxies:
@ -959,6 +984,7 @@ ${uci_set}AsianTV="AsianTV"
${uci_set}Proxy="Proxy"
${uci_set}Youtube="Youtube"
${uci_set}Apple="Apple"
${uci_set}Scholar="Scholar"
${uci_set}Microsoft="Microsoft"
${uci_set}Netflix="Netflix"
${uci_set}Disney="Disney"
@ -979,6 +1005,8 @@ ${uci_set}Others="Others"
${UCI_DEL_LIST}="AsianTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="AsianTV" >/dev/null 2>&1
${UCI_DEL_LIST}="GlobalTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="GlobalTV" >/dev/null 2>&1
${UCI_DEL_LIST}="Netflix" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netflix" >/dev/null 2>&1
${UCI_DEL_LIST}="Apple" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Apple" >/dev/null 2>&1
${UCI_DEL_LIST}="Scholar" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Scholar" >/dev/null 2>&1
${UCI_DEL_LIST}="Disney" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Disney" >/dev/null 2>&1
${UCI_DEL_LIST}="Spotify" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Spotify" >/dev/null 2>&1
${UCI_DEL_LIST}="Steam" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Steam" >/dev/null 2>&1

View File

@ -136,6 +136,7 @@ yml_other_rules_get()
config_get "Proxy" "$section" "Proxy" ""
config_get "Youtube" "$section" "Youtube" ""
config_get "Apple" "$section" "Apple" ""
config_get "Scholar" "$section" "Scholar" ""
config_get "Netflix" "$section" "Netflix" ""
config_get "Disney" "$section" "Disney" ""
config_get "Spotify" "$section" "Spotify" ""
@ -180,6 +181,7 @@ if [ "$2" != "0" ]; then
|| [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Youtube" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Apple" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Scholar" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Netflix" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Disney" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Spotify" /tmp/Proxy_Group)" ]\
@ -228,6 +230,7 @@ if [ "$2" != "0" ]; then
.gsub(/,Proxy$/, ',$Proxy#d')
.gsub(/,YouTube$/, ',$Youtube#d')
.gsub(/,Apple$/, ',$Apple#d')
.gsub(/,Scholar$/, ',$Scholar#d')
.gsub(/,Netflix$/, ',$Netflix#d')
.gsub(/,Disney$/, ',$Disney#d')
.gsub(/,Spotify$/, ',$Spotify#d')
@ -246,6 +249,7 @@ if [ "$2" != "0" ]; then
.gsub!(/: \"Proxy\"/,': \"$Proxy#d\"')
.gsub!(/: \"YouTube\"/,': \"$Youtube#d\"')
.gsub!(/: \"Apple\"/,': \"$Apple#d\"')
.gsub!(/: \"Scholar\"/,': \"$Scholar#d\"')
.gsub!(/: \"Netflix\"/,': \"$Netflix#d\"')
.gsub!(/: \"Disney\"/,': \"$Disney#d\"')
.gsub!(/: \"Spotify\"/,': \"$Spotify#d\"')