mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 19:12:33 +08:00
OpenClash: bump to v0.37.1-beta
This commit is contained in:
parent
ac0ace3923
commit
1477e7265d
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.36.12
|
||||
PKG_VERSION:=0.37.1
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
|
@ -186,18 +186,63 @@ Proxy: # 节点设置,此部分与proxy-provider两者不能同时删除
|
||||
|
||||
Proxy Group: # 此参数必须保留,不能删除
|
||||
|
||||
# relay chains the proxies. proxies shall not contain a proxy-group. No UDP support.
|
||||
# Traffic: clash <-> http <-> vmess <-> ss1 <-> ss2 <-> Internet
|
||||
- name: "relay"
|
||||
type: relay
|
||||
proxies:
|
||||
- http
|
||||
- vmess
|
||||
- ss1
|
||||
- ss2
|
||||
|
||||
# url-test select which proxy will be used by benchmarking speed to a URL.
|
||||
- { name: "auto", type: url-test, proxies: ["ss1", "ss2", "vmess1"], url: "http://www.gstatic.com/generate_204", interval: 300 }
|
||||
- name: "auto"
|
||||
type: url-test
|
||||
proxies:
|
||||
- ss1
|
||||
- ss2
|
||||
- vmess1
|
||||
url: 'http://www.gstatic.com/generate_204'
|
||||
interval: 300
|
||||
|
||||
# fallback select an available policy by priority. The availability is tested by accessing an URL, just like an auto url-test group.
|
||||
- { name: "fallback-auto", type: fallback, proxies: ["ss1", "ss2", "vmess1"], url: "http://www.gstatic.com/generate_204", interval: 300 }
|
||||
- name: "fallback-auto"
|
||||
type: fallback
|
||||
proxies:
|
||||
- ss1
|
||||
- ss2
|
||||
- vmess1
|
||||
url: 'http://www.gstatic.com/generate_204'
|
||||
interval: 300
|
||||
|
||||
# load-balance: The request of the same eTLD will be dial on the same proxy.
|
||||
- { name: "load-balance", type: load-balance, proxies: ["ss1", "ss2", "vmess1"], url: "http://www.gstatic.com/generate_204", interval: 300 }
|
||||
- name: "load-balance"
|
||||
type: load-balance
|
||||
proxies:
|
||||
- ss1
|
||||
- ss2
|
||||
- vmess1
|
||||
url: 'http://www.gstatic.com/generate_204'
|
||||
interval: 300
|
||||
|
||||
# select is used for selecting proxy or proxy group
|
||||
# you can use RESTful API to switch proxy, is recommended for use in GUI.
|
||||
- { name: "Proxy", type: select, proxies: ["ss1", "ss2", "vmess1", "auto"] }
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- ss1
|
||||
- ss2
|
||||
- vmess1
|
||||
- auto
|
||||
|
||||
- name: UseProvider
|
||||
type: select
|
||||
use:
|
||||
- provider1
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
|
||||
Rule: # 此参数必须保留,不能删除
|
||||
# 如果您将一直使用第三方规则,下方可以留空。
|
||||
|
File diff suppressed because one or more lines are too long
@ -56,6 +56,7 @@ o:value("select", translate("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 = s:option(Value, "name", translate("Group Name"))
|
||||
o.rmempty = false
|
||||
|
@ -101,7 +101,9 @@ o.description = font_red..bold_on..translate("No Need Set when Config Create, Th
|
||||
o.rmempty = true
|
||||
m.uci:foreach("openclash", "groups",
|
||||
function(s)
|
||||
o:value(s.name)
|
||||
if s.name ~= "" and s.name ~= nil and s.type ~= "relay" then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
|
||||
local t = {
|
||||
|
@ -250,7 +250,9 @@ o.description = font_red..bold_on..translate("No Need Set when Config Create, Th
|
||||
o.rmempty = true
|
||||
m.uci:foreach("openclash", "groups",
|
||||
function(s)
|
||||
o:value(s.name)
|
||||
if s.name ~= "" and s.name ~= nil then
|
||||
o:value(s.name)
|
||||
end
|
||||
end)
|
||||
|
||||
local t = {
|
||||
|
@ -64,7 +64,7 @@
|
||||
var arr_core = corelv.split(",");
|
||||
var corelvis = arr_core[0];
|
||||
var new_ch = arr_core[1];
|
||||
if ( corelvis != "" && new_ch == "2" && status.corecv != "" && status.corecv != "0" && corelvis != "\n" ) {
|
||||
if ( new_ch == "2" ) {
|
||||
core_lv.innerHTML = "<b><font color=green>"+corelvis+"<%:<New>%></font></b>";
|
||||
}
|
||||
else if (corelvis != "" && corelvis != "\n" ) {
|
||||
@ -78,10 +78,10 @@
|
||||
var oplvis = arr_op[0];
|
||||
var new_op = arr_op[1];
|
||||
op_cv.innerHTML = status.opcv ? "<b><font color=green>"+status.opcv+"</font></b>" : "<b><font color=red><%:Unknown%></font></b>";
|
||||
if ( status.oplv != "" && status.oplv != "\n" && new_op == "2" && status.opcv != "" ) {
|
||||
if ( new_op == "2" ) {
|
||||
op_lv.innerHTML = "<b><font color=green>"+oplvis+"<%:<New>%></font></b>";
|
||||
}
|
||||
else if (status.oplv != "" && status.oplv != "\n") {
|
||||
else if (oplvis != "" && oplvis != "\n") {
|
||||
op_lv.innerHTML = "<b><font color=green>"+oplvis+"</font></b>";
|
||||
}
|
||||
else {
|
||||
@ -123,7 +123,7 @@
|
||||
var arr_core = corelv.split(",");
|
||||
var corelvis = arr_core[0];
|
||||
var new_ch = arr_core[1];
|
||||
if ( corelvis != "" && new_ch == "2" && status.corecv != "" && status.corecv != "0" && corelvis != "\n" ) {
|
||||
if ( new_ch == "2" ) {
|
||||
core_lv.innerHTML = "<b><font color=green>"+corelvis+"<%:<New>%></font></b>";
|
||||
}
|
||||
else if (corelvis != "" && corelvis != "\n" ) {
|
||||
@ -137,10 +137,10 @@
|
||||
var oplvis = arr_op[0];
|
||||
var new_op = arr_op[1];
|
||||
op_cv.innerHTML = status.opcv ? "<b><font color=green>"+status.opcv+"</font></b>" : "<b><font color=red><%:Unknown%></font></b>";
|
||||
if ( status.oplv != "" && status.oplv != "\n" && new_op == "2" && status.opcv != "" ) {
|
||||
if ( new_op == "2" ) {
|
||||
op_lv.innerHTML = "<b><font color=green>"+oplvis+"<%:<New>%></font></b>";
|
||||
}
|
||||
else if (status.oplv != "" && status.oplv != "\n") {
|
||||
else if (oplvis != "" && oplvis != "\n") {
|
||||
op_lv.innerHTML = "<b><font color=green>"+oplvis+"</font></b>";
|
||||
}
|
||||
else {
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/sh
|
||||
CKTIME=$(date "+%Y-%m-%d-%H")
|
||||
LAST_OPVER="/tmp/clash_last_version"
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
CLASH_VERF=$(/etc/openclash/clash -v 2>/dev/null)
|
||||
CLASH_VER=$(echo "$CLASH_VERF" 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F 'v' '{print $2}' 2>/dev/null |awk -F '.' '{print $1"."$2$3}' 2>/dev/null)
|
||||
CLASH_VER=$(/etc/openclash/clash -v 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F 'v' '{print $2}' 2>/dev/null |awk -F '.' '{print $1"."$2$3}' 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
|
||||
@ -18,13 +17,14 @@ if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{prin
|
||||
else
|
||||
curl -sL --connect-timeout 10 --retry 2 "$VERSION_URL" -o $LAST_OPVER >/dev/null 2>&1
|
||||
fi
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
if [ "$?" -eq "0" ] && [ -s "$LAST_OPVER" ]; then
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F 'v' '{print $2}' 2>/dev/null |awk -F '.' '{print $1"."$2$3}' 2>/dev/null)
|
||||
echo "CheckTime:$CKTIME" >>$LAST_OPVER
|
||||
else
|
||||
rm -rf $LAST_OPVER
|
||||
fi
|
||||
fi
|
||||
if [ "$LAST_VER" -gt "$CLASH_VER" ]; then
|
||||
|
||||
if [ "$(expr "$LAST_VER" \> "$CLASH_VER")" -eq 1 ]; then
|
||||
return 2
|
||||
fi 2>/dev/null
|
@ -8,15 +8,15 @@ LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
LAST_OPVER="/tmp/openclash_last_version"
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g")
|
||||
OP_CV=$(sed -n 1p /etc/openclash/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F '.' '{print $2$3}')
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F '.' '{print $2$3}')
|
||||
OP_CV=$(sed -n 1p /etc/openclash/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $1"."$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 $1"."$2$3}' 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
if [ -s "/tmp/openclash.auth" ]; then
|
||||
PROXY_AUTH=$(cat /tmp/openclash.auth |awk -F '- ' '{print $2}' |sed -n '1p' 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ "$OP_CV" -lt "$OP_LV" ] && [ -f "$LAST_OPVER" ]; then
|
||||
if [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ] && [ -f "$LAST_OPVER" ]; then
|
||||
echo "开始下载 OpenClash-$LAST_VER ..." >$START_LOG
|
||||
if pidof clash >/dev/null; then
|
||||
curl -sL --connect-timeout 10 --retry 5 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://github.com/vernesong/OpenClash/releases/download/v"$LAST_VER"/luci-app-openclash_"$LAST_VER"_all.ipk -o /tmp/openclash.ipk >/dev/null 2>&1
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
CKTIME=$(date "+%Y-%m-%d-%H")
|
||||
LAST_OPVER="/tmp/openclash_last_version"
|
||||
OP_CV=$(sed -n 1p /etc/openclash/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F '.' '{print $2$3}')
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F '.' '{print $2$3}')
|
||||
OP_CV=$(sed -n 1p /etc/openclash/openclash_version 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $1"."$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 $1"."$2$3}' 2>/dev/null)
|
||||
HTTP_PORT=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
PROXY_ADDR=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
|
||||
|
||||
@ -18,20 +18,20 @@ if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{prin
|
||||
curl -sL --connect-timeout 10 --retry 2 "$VERSION_URL" -o $LAST_OPVER >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$?" -eq "0" ] && [ -s "$LAST_OPVER" ]; then
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F '.' '{print $2$3}')
|
||||
if [ "$OP_CV" -ge "$OP_LV" ]; then
|
||||
OP_LV=$(sed -n 1p $LAST_OPVER 2>/dev/null |awk -F '-' '{print $1}' |awk -F 'v' '{print $2}' |awk -F '.' '{print $1"."$2$3}' 2>/dev/null)
|
||||
if [ "$(expr "$OP_CV" \>= "$OP_LV")" -eq 1 ]; then
|
||||
sed -i "/^https:/i\CheckTime:${CKTIME}" "$LAST_OPVER" 2>/dev/null
|
||||
sed -i '/^https:/,$d' $LAST_OPVER
|
||||
elif [ "$OP_CV" -lt "$OP_LV" ]; then
|
||||
elif [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ]; then
|
||||
sed -i "/^https:/i\CheckTime:${CKTIME}" "$LAST_OPVER" 2>/dev/null
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
rm -rf "$LAST_OPVER"
|
||||
fi
|
||||
elif [ "$OP_CV" -ge "$OP_LV" ]; then
|
||||
elif [ "$(expr "$OP_CV" \>= "$OP_LV")" -eq 1 ]; then
|
||||
sed -i '/^CheckTime:/,$d' $LAST_OPVER
|
||||
echo "CheckTime:$CKTIME" >> $LAST_OPVER
|
||||
elif [ "$OP_CV" -lt "$OP_LV" ]; then
|
||||
elif [ "$(expr "$OP_LV" \> "$OP_CV")" -eq 1 ]; then
|
||||
return 2
|
||||
fi
|
||||
|
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
@ -29,13 +29,13 @@
|
||||
<div id="app"></div>
|
||||
|
||||
|
||||
<script src="runtime.3f467867c30e4422dade.js" type="text/javascript"></script>
|
||||
<script src="runtime.c72e8723983b31413a8e.js" type="text/javascript"></script>
|
||||
|
||||
<script src="core-js~app.6649a23b1d13a5f65fc1.js" type="text/javascript"></script>
|
||||
<script src="core-js~app.e768d5b23b7e7ef5d68d.js" type="text/javascript"></script>
|
||||
|
||||
<script src="react~app.71e146262a2c1f21d27e.js" type="text/javascript"></script>
|
||||
|
||||
<script src="app.623087d3dd2fb338b3d6.js" type="text/javascript"></script>
|
||||
<script src="app.97da0bf63bfa93de767f.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
._37wt2_a2Gx{display:flex;align-items:center}._37wt2_a2Gx .L80zPM0Rx0{display:inline-flex;transform:rotate(0deg);transition:transform .3s}._37wt2_a2Gx .L80zPM0Rx0._36RO7_wtuv{transform:rotate(180deg)}._37wt2_a2Gx .L80zPM0Rx0:focus{outline:var(--color-focus-blue) solid 1px}._1s98xvUoBx{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}
|
||||
._37wt2_a2Gx{display:flex;align-items:center}._37wt2_a2Gx .L80zPM0Rx0{display:inline-flex;transform:rotate(0deg);transition:transform .3s}._37wt2_a2Gx .L80zPM0Rx0._36RO7_wtuv{transform:rotate(180deg)}._37wt2_a2Gx .L80zPM0Rx0:focus{outline:var(--color-focus-blue) solid 1px}._2XKN3NArpV{margin-left:5px}._1s98xvUoBx{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:inline-flex;justify-content:center;align-items:center;background-color:var(--bg-near-transparent);border-radius:30px}
|
||||
._2V-RqIAl7n{border-radius:20px;color:#eee;font-size:.6em}@media screen and (min-width:30em){._2V-RqIAl7n{font-size:1em}}
|
||||
.NpfXwxWAxo{position:relative;padding:5px;border-radius:8px;overflow:hidden;max-width:280px;background-color:var(--color-bg-proxy)}@media screen and (min-width:30em){.NpfXwxWAxo{min-width:200px;border-radius:10px;padding:10px}}.NpfXwxWAxo._2zD7drviYH{background-color:var(--color-focus-blue);color:#ddd}.NpfXwxWAxo._2bylJNYYdN{opacity:.5}._1rVl-Kdmss{font-family:var(--font-mono);font-size:.6em}@media screen and (min-width:30em){._1rVl-Kdmss{font-size:1em}}.aS2noEcBcP{display:flex;align-items:center;justify-content:space-between}._3kdi5nima5{width:100%;overflow:hidden;text-overflow:ellipsis;margin-bottom:5px;font-size:.85em}@media screen and (min-width:30em){._3kdi5nima5{font-size:1.1em}}._3NpxWygDxO{width:12px;height:12px;border-radius:8px}._3NpxWygDxO ._2zD7drviYH{outline:1px solid pink}
|
||||
._3PCSxT0l14{margin-bottom:12px}._1yYRIyvlRd{display:flex;flex-wrap:wrap;margin-top:8px}._1OcDlvlM5R{margin-right:5px;margin-bottom:5px;transition:transform .2s ease-in-out}@media screen and (min-width:30em){._1OcDlvlM5R{margin-right:10px;margin-bottom:10px}}._1OcDlvlM5R._3oAxPKtZFv{cursor:pointer}._1OcDlvlM5R._3oAxPKtZFv:hover{transform:translateY(-2px)}
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
!function(e){function t(t){for(var n,o,i=t[0],l=t[1],s=t[2],f=t[3]||[],d=0,h=[];d<i.length;d++)o=i[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&h.push(a[o][0]),a[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t),u.push.apply(u,f);h.length;)h.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var s=r[o];0!==a[s]&&(n=!1)}n&&(c.splice(t--,1),e=l(l.s=r[0]))}return 0===c.length&&(u.forEach((function(e){if(void 0===a[e]){a[e]=null;var t=document.createElement("link");l.nc&&t.setAttribute("nonce",l.nc),t.rel="prefetch",t.as="script",t.href=i(e),document.head.appendChild(t)}})),u.length=0),e}var n={},o={5:0},a={5:0},c=[],u=[];function i(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs",7:"vendors~proxies"}[e]||e)+"."+{2:"49fb4634cda581289b5a",4:"9d27c78e021c1d86e02d",6:"7079553c634b376d7c1c",7:"0ab0478edefe25bc30a4",8:"61fe79e386de4226efcc"}[e]+".js"}function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{2:1,4:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n=({2:"proxies",4:"rules",6:"vendors~chartjs",7:"vendors~proxies"}[e]||e)+"."+{2:"1041caa2a300c5b850ba",4:"664f8b737878361937cb",6:"31d6cfe0d16ae931b73c",7:"31d6cfe0d16ae931b73c",8:"31d6cfe0d16ae931b73c"}[e]+".css",a=l.p+n,c=document.getElementsByTagName("link"),u=0;u<c.length;u++){var i=(f=c[u]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(i===n||i===a))return t()}var s=document.getElementsByTagName("style");for(u=0;u<s.length;u++){var f;if((i=(f=s[u]).getAttribute("data-href"))===n||i===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],d.parentNode.removeChild(d),r(c)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,u=document.createElement("script");u.charset="utf-8",u.timeout=120,l.nc&&u.setAttribute("nonce",l.nc),u.src=i(e);var s=new Error;c=function(t){u.onerror=u.onload=null,clearTimeout(f);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,r[1](s)}a[e]=void 0}};var f=setTimeout((function(){c({type:"timeout",target:u})}),12e4);u.onerror=u.onload=c,document.head.appendChild(u)}return Promise.all(t)},l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="",l.oe=function(e){throw console.error(e),e};var s=window.webpackJsonp=window.webpackJsonp||[],f=s.push.bind(s);s.push=t,s=s.slice();for(var d=0;d<s.length;d++)t(s[d]);var p=f;r()}([]);
|
||||
!function(e){function t(t){for(var n,o,i=t[0],l=t[1],s=t[2],f=t[3]||[],d=0,h=[];d<i.length;d++)o=i[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&h.push(a[o][0]),a[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t),u.push.apply(u,f);h.length;)h.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var s=r[o];0!==a[s]&&(n=!1)}n&&(c.splice(t--,1),e=l(l.s=r[0]))}return 0===c.length&&(u.forEach((function(e){if(void 0===a[e]){a[e]=null;var t=document.createElement("link");l.nc&&t.setAttribute("nonce",l.nc),t.rel="prefetch",t.as="script",t.href=i(e),document.head.appendChild(t)}})),u.length=0),e}var n={},o={5:0},a={5:0},c=[],u=[];function i(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs",7:"vendors~proxies"}[e]||e)+"."+{2:"bdb3659841c50b543b0e",4:"efdab873e544c5738c5c",6:"7079553c634b376d7c1c",7:"0ab0478edefe25bc30a4",8:"cfac5eece126ce875152"}[e]+".js"}function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{2:1,4:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n=({2:"proxies",4:"rules",6:"vendors~chartjs",7:"vendors~proxies"}[e]||e)+"."+{2:"cea47222a686cf441cb9",4:"664f8b737878361937cb",6:"31d6cfe0d16ae931b73c",7:"31d6cfe0d16ae931b73c",8:"31d6cfe0d16ae931b73c"}[e]+".css",a=l.p+n,c=document.getElementsByTagName("link"),u=0;u<c.length;u++){var i=(f=c[u]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(i===n||i===a))return t()}var s=document.getElementsByTagName("style");for(u=0;u<s.length;u++){var f;if((i=(f=s[u]).getAttribute("data-href"))===n||i===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],d.parentNode.removeChild(d),r(c)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,u=document.createElement("script");u.charset="utf-8",u.timeout=120,l.nc&&u.setAttribute("nonce",l.nc),u.src=i(e);var s=new Error;c=function(t){u.onerror=u.onload=null,clearTimeout(f);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,r[1](s)}a[e]=void 0}};var f=setTimeout((function(){c({type:"timeout",target:u})}),12e4);u.onerror=u.onload=c,document.head.appendChild(u)}return Promise.all(t)},l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="",l.oe=function(e){throw console.error(e),e};var s=window.webpackJsonp=window.webpackJsonp||[],f=s.push.bind(s);s.push=t,s=s.slice();for(var d=0;d<s.length;d++)t(s[d]);var p=f;r()}([]);
|
@ -53,15 +53,15 @@ if [ "$provider_len" -ge "$group_len" ]; then
|
||||
awk '/Proxy Group:/,/proxy-provider:/{print}' "$CONFIG_FILE" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_group.yaml 2>&1
|
||||
else
|
||||
awk '/Proxy Group:/,/Rule:/{print}' "$CONFIG_FILE" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_group.yaml 2>&1
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
|
||||
if [ "$servers_update" -ne "1" ] || [ "$servers_if_update" != "1" ] || [ -z "$(grep "config groups" "$CFG_FILE")" ]; then
|
||||
if [ "$servers_update" -ne "1" ] || [ "$servers_if_update" != "1" ] || [ -z "$(grep "config groups" "$CFG_FILE" 2>/dev/null)" ]; then
|
||||
echo "正在删除旧配置..." >$START_LOG
|
||||
#删除策略组
|
||||
group_num=$(grep "config groups" "$CFG_FILE" |wc -l)
|
||||
for ((i=$group_num;i>=0;i--))
|
||||
do
|
||||
if [ "$(uci get openclash.@groups["$i"].config)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@groups["$i"].config)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@groups["$i"].config 2>/dev/null)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@groups["$i"].config 2>/dev/null)" = "all" ]; then
|
||||
uci delete openclash.@groups["$i"] 2>/dev/null
|
||||
uci commit openclash
|
||||
fi
|
||||
@ -70,18 +70,18 @@ echo "正在删除旧配置..." >$START_LOG
|
||||
server_num=$(grep "config servers" "$CFG_FILE" |wc -l)
|
||||
for ((i=$server_num;i>=0;i--))
|
||||
do
|
||||
if [ "$(uci get openclash.@servers["$i"].config)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@servers["$i"].config)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@servers["$i"].enabled)" = "1" ]; then
|
||||
if [ "$(uci get openclash.@servers["$i"].config 2>/dev/null)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@servers["$i"].config 2>/dev/null)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@servers["$i"].enabled 2>/dev/null)" = "1" ]; then
|
||||
uci delete openclash.@servers["$i"] 2>/dev/null
|
||||
uci commit openclash
|
||||
fi
|
||||
fi
|
||||
done
|
||||
#删除启用代理集
|
||||
provider_num=$(grep "config proxy-provider" "$CFG_FILE" |wc -l)
|
||||
provider_num=$(grep "config proxy-provider" "$CFG_FILE" 2>/dev/null |wc -l)
|
||||
for ((i=$provider_num;i>=0;i--))
|
||||
do
|
||||
if [ "$(uci get openclash.@proxy-provider["$i"].config)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@proxy-provider["$i"].config)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@proxy-provider["$i"].config 2>/dev/null)" = "$CONFIG_NAME" ] || [ "$(uci get openclash.@proxy-provider["$i"].config 2>/dev/null)" = "all" ]; then
|
||||
if [ "$(uci get openclash.@proxy-provider["$i"].enabled)" = "1" ]; then
|
||||
uci delete openclash.@proxy-provider["$i"] 2>/dev/null
|
||||
uci commit openclash
|
||||
@ -97,12 +97,12 @@ count=1
|
||||
file_count=1
|
||||
match_group_file="/tmp/Proxy_Group"
|
||||
group_file="/tmp/yaml_group.yaml"
|
||||
line=$(sed -n '/name:/=' $group_file)
|
||||
num=$(grep -c "name:" $group_file)
|
||||
line=$(sed -n '/name:/=' $group_file 2>/dev/null)
|
||||
num=$(grep -c "name:" $group_file 2>/dev/null)
|
||||
|
||||
cfg_get()
|
||||
{
|
||||
echo "$(grep "$1" "$2" 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/\}.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)"
|
||||
echo "$(grep "$1" "$2" 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/\}.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed "s/^\'//g" 2>/dev/null |sed "s/\'$//g" 2>/dev/null)"
|
||||
}
|
||||
|
||||
for n in $line
|
||||
@ -138,11 +138,8 @@ do
|
||||
uci_name_tmp=$(uci add $name groups)
|
||||
uci_set="uci -q set $name.$uci_name_tmp."
|
||||
uci_add="uci -q add_list $name.$uci_name_tmp."
|
||||
if [ "$servers_update" -eq "1" ]; then
|
||||
${uci_set}config="all"
|
||||
else
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
fi
|
||||
|
||||
${uci_set}config="$CONFIG_NAME"
|
||||
${uci_set}name="$group_name"
|
||||
${uci_set}old_name="$group_name"
|
||||
${uci_set}old_name_cfg="$group_name"
|
||||
@ -151,14 +148,15 @@ do
|
||||
${uci_set}test_interval="$group_test_interval"
|
||||
|
||||
#other_group
|
||||
cat $single_group |while read line
|
||||
if [ "$group_type" = "select" ]; then
|
||||
cat $single_group |while read -r line
|
||||
do
|
||||
if [ -z "$(echo "$line" |grep "^ \{0,\}-")" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
group_name1=$(echo "$line" |grep -v "name:" 2>/dev/null |grep "^ \{0,\}-" 2>/dev/null |awk -F '^ \{0,\}-' '{print $2}' 2>/dev/null |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null)
|
||||
group_name2=$(echo "$line" |awk -F 'proxies: \\[' '{print $2}' 2>/dev/null |sed 's/].*//' 2>/dev/null |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}, \{0,\}/#,#/g' 2>/dev/null)
|
||||
group_name1=$(echo "$line" |grep -v "name:" 2>/dev/null |grep "^ \{0,\}-" 2>/dev/null |awk -F '^ \{0,\}-' '{print $2}' 2>/dev/null |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed "s/^\'//g" 2>/dev/null |sed "s/\'$//g" 2>/dev/null)
|
||||
group_name2=$(echo "$line" |awk -F 'proxies: \\[' '{print $2}' 2>/dev/null |sed 's/].*//' 2>/dev/null |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed "s/^\'//g" 2>/dev/null |sed "s/\'$//g" 2>/dev/null |sed 's/ \{0,\}, \{0,\}/#,#/g' 2>/dev/null)
|
||||
proxies_len=$(sed -n '/proxies:/=' $single_group 2>/dev/null)
|
||||
use_len=$(sed -n '/use:/=' $single_group 2>/dev/null)
|
||||
name1_len=$(sed -n "/${group_name1}/=" $single_group 2>/dev/null)
|
||||
@ -177,7 +175,7 @@ do
|
||||
if [ "$name1_len" -ge "$proxies_len" ] && [ ! -z "$(grep -F "$group_name1" $match_group_file)" ] && [ "$group_name1" != "$group_name" ]; then
|
||||
${uci_add}other_group="$group_name1"
|
||||
fi
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
elif [ -z "$group_name1" ] && [ ! -z "$group_name2" ]; then
|
||||
group_num=$(expr $(echo "$group_name2" |grep -c "#,#") + 1)
|
||||
if [ "$group_num" -le 1 ]; then
|
||||
@ -198,7 +196,7 @@ do
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
file_count=$(expr "$file_count" + 1)
|
||||
|
||||
done
|
||||
|
@ -24,9 +24,12 @@ cfg_groups_set()
|
||||
fi
|
||||
|
||||
#名字变化时处理配置文件
|
||||
if [ "$name" != "$old_name_cfg" ]; then
|
||||
sed -i "s/\'${old_name_cfg}\'/\'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/old_name \'${name}\'/old_name \'${old_name}\'/g" $CFG_FILE 2>/dev/null
|
||||
if [ "$name" != "$old_name_cfg" ] && [ ! -z "$old_name_cfg" ]; then
|
||||
sed -i "s/old_name_cfg \'${old_name_cfg}\'/old_name_cfg \'${name}\'/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/groups \'${old_name_cfg}/groups \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/other_group \'${old_name_cfg}/other_group \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/new_servers_group \'${old_name_cfg}/new_servers_group \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
sed -i "s/relay_groups \'${old_name_cfg}/relay_groups \'${name}/g" $CFG_FILE 2>/dev/null
|
||||
config_load "openclash"
|
||||
fi
|
||||
|
||||
|
@ -29,33 +29,6 @@ if [ -z "$CONFIG_NAME" ]; then
|
||||
CONFIG_NAME="config.yaml"
|
||||
fi
|
||||
|
||||
#加入节点
|
||||
yml_servers_add()
|
||||
{
|
||||
|
||||
local section="$1"
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
config_get "name" "$section" "name" ""
|
||||
|
||||
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
else
|
||||
if [ -z "$3" ]; then
|
||||
config_list_foreach "$section" "groups" set_groups "$name" "$2"
|
||||
fi
|
||||
|
||||
if [ ! -z "$if_game_group" ] && [ -z "$(grep -F $name /tmp/yaml_proxy.yaml)" ]; then
|
||||
/usr/share/openclash/yml_proxys_set.sh "$name" "proxy"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
set_groups()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
@ -69,6 +42,53 @@ set_groups()
|
||||
|
||||
}
|
||||
|
||||
set_relay_groups()
|
||||
{
|
||||
if [ -z "$1" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -z "$(echo "$1" |grep "#relay#")" ]; then
|
||||
server_relay_num=$(echo "$1" |awk -F '#relay#' '{print $2}')
|
||||
server_group_name=$(echo "$1" |awk -F '#relay#' '{print $1}')
|
||||
fi
|
||||
|
||||
if [ ! -z "$server_relay_num" ] && [ "$server_group_name" = "$3" ]; then
|
||||
set_group=1
|
||||
echo "$server_relay_num # - \"${2}\"" >>/tmp/relay_server
|
||||
fi
|
||||
}
|
||||
|
||||
#加入节点
|
||||
yml_servers_add()
|
||||
{
|
||||
|
||||
local section="$1"
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "config" "$section" "config" ""
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "relay_groups" "$section" "relay_groups" ""
|
||||
|
||||
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
else
|
||||
if [ -z "$4" ] && [ "$3" = "relay" ] && [ ! -z "$relay_groups" ]; then
|
||||
config_list_foreach "$section" "relay_groups" set_relay_groups "$name" "$2"
|
||||
elif [ -z "$4" ]; then
|
||||
config_list_foreach "$section" "groups" set_groups "$name" "$2"
|
||||
fi
|
||||
|
||||
if [ ! -z "$if_game_group" ] && [ -z "$(grep -F $name /tmp/yaml_proxy.yaml)" ]; then
|
||||
/usr/share/openclash/yml_proxys_set.sh "$name" "proxy"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#加入其它策略组
|
||||
set_other_groups()
|
||||
{
|
||||
@ -117,6 +137,7 @@ set_provider_groups()
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#创建策略组
|
||||
yml_groups_set()
|
||||
{
|
||||
@ -131,8 +152,6 @@ yml_groups_set()
|
||||
|
||||
if [ ! -z "$if_game_group" ] && [ "$if_game_group" != "$name" ]; then
|
||||
return
|
||||
elif [ "$servers_update" -eq "1" ] && [ "$config" != "all" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
|
||||
@ -147,13 +166,13 @@ yml_groups_set()
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$test_url" ] || [ -z "$test_interval" ] && [ "$type" != "select" ]; then
|
||||
if [ -z "$test_url" ] || [ -z "$test_interval" ] && [ "$type" != "select" ] && [ "$type" != "relay" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
#游戏策略组存在时判断节点是否存在
|
||||
if [ ! -z "$if_game_group" ] && [ ! -z "$(grep "^ \{0,\}- name: $if_game_group" "$CONFIG_GROUP_FILE")" ]; then
|
||||
config_foreach yml_servers_add "servers" "$name" "check" #加入服务器节点
|
||||
config_foreach yml_servers_add "servers" "$name" "$type" "check" #加入服务器节点
|
||||
config_foreach set_proxy_provider "proxy-provider" "$group_name" "check" #加入代理集
|
||||
return
|
||||
fi
|
||||
@ -169,19 +188,31 @@ yml_groups_set()
|
||||
if [ "$name" != "$old_name" ] && [ ! -z "$old_name" ]; then
|
||||
sed -i "s/,${old_name}/,${name}#d/g" "$CONFIG_FILE" 2>/dev/null
|
||||
sed -i "s/:${old_name}$/:${name}#d/g" "$CONFIG_FILE" 2>/dev/null #修改第三方规则分组对应标签
|
||||
sed -i "s/\'${old_name}\'/\'${name}\'/g" "$CFG_FILE" 2>/dev/null
|
||||
sed -i "s/old_name \'${old_name}/old_name \'${name}/g" "$CFG_FILE" 2>/dev/null
|
||||
config_load "openclash"
|
||||
fi
|
||||
|
||||
set_group=0
|
||||
set_proxy_provider=0
|
||||
|
||||
config_list_foreach "$section" "other_group" set_other_groups #加入其他策略组
|
||||
config_foreach yml_servers_add "servers" "$name" #加入服务器节点
|
||||
|
||||
if [ "$type" = "select" ]; then
|
||||
config_list_foreach "$section" "other_group" set_other_groups #加入其他策略组
|
||||
fi
|
||||
|
||||
config_foreach yml_servers_add "servers" "$name" "$type" #加入服务器节点
|
||||
|
||||
if [ "$type" = "relay" ] && [ -s "/tmp/relay_server" ]; then
|
||||
cat /tmp/relay_server |sort -k 1 |awk -F '#' '{print $2}' > /tmp/relay_server.list 2>/dev/null
|
||||
sed -i "/^ \{0,\}proxies: ${group_name}/r/tmp/relay_server.list" "$GROUP_FILE" 2>/dev/null
|
||||
rm -rf /tmp/relay_server 2>/dev/null
|
||||
fi
|
||||
|
||||
echo " use: $group_name" >>$GROUP_FILE
|
||||
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
|
||||
|
||||
if [ "$type" != "relay" ]; then
|
||||
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
|
||||
fi
|
||||
|
||||
if [ "$set_group" -eq 1 ]; then
|
||||
sed -i "/^ \{0,\}proxies: ${group_name}/c\ proxies:" $GROUP_FILE
|
||||
else
|
||||
@ -224,6 +255,7 @@ if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ] || [ ! -z "$if_g
|
||||
config_load "openclash"
|
||||
config_foreach yml_groups_set "groups"
|
||||
sed -i "s/#d//g" "$CONFIG_FILE" 2>/dev/null
|
||||
rm -rf /tmp/relay_server.list 2>/dev/null
|
||||
echo "配置文件【$CONFIG_NAME】的策略组写入完成!" >$START_LOG
|
||||
fi
|
||||
fi
|
||||
|
@ -4,6 +4,7 @@ status=$(ps|grep -c /usr/share/openclash/yml_proxys_get.sh)
|
||||
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
SERVER_RELAY="/tmp/relay_server"
|
||||
CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
UPDATE_CONFIG_FILE=$(uci get openclash.config.config_update_path 2>/dev/null)
|
||||
UPDATE_CONFIG_NAME=$(echo "$UPDATE_CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
|
||||
@ -80,29 +81,22 @@ provider_count=1
|
||||
|
||||
cfg_get()
|
||||
{
|
||||
echo "$(grep "$1" "$2" 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/\}.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)"
|
||||
echo "$(grep "$1" "$2" 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/\}.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed "s/^\'//g" 2>/dev/null |sed "s/\'$//g" 2>/dev/null)"
|
||||
}
|
||||
|
||||
cfg_get_alpn()
|
||||
{
|
||||
echo "$(grep "^ \{0,\}$1" "$2" 2>/dev/null |grep -v "^ \{0,\}- name:" |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/\}.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)"
|
||||
echo "$(grep "^ \{0,\}$1" "$2" 2>/dev/null |grep -v "^ \{0,\}- name:" |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/\}.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed "s/^\'//g" 2>/dev/null |sed "s/\'$//g" 2>/dev/null)"
|
||||
}
|
||||
|
||||
echo "开始更新【$CONFIG_NAME】的代理集配置..." >$START_LOG
|
||||
|
||||
[ "$servers_update" -eq "1" ] && {
|
||||
echo "" >"$match_provider"
|
||||
provider_nums=0
|
||||
config_load "openclash"
|
||||
config_foreach yml_provider_name_get "proxy-provider"
|
||||
}
|
||||
|
||||
yml_provider_name_get()
|
||||
{
|
||||
local section="$1"
|
||||
config_get "name" "$section" "name" ""
|
||||
[ ! -z "$name" ] && {
|
||||
echo "$provider_nums"."$name" >>"$match_provider"
|
||||
echo "$provider_nums.$name" >>"$match_provider"
|
||||
}
|
||||
provider_nums=$(( $provider_nums + 1 ))
|
||||
}
|
||||
@ -116,6 +110,13 @@ cfg_new_provider_groups_get()
|
||||
${uci_add}groups="${1}"
|
||||
}
|
||||
|
||||
[ "$servers_update" -eq "1" ] && {
|
||||
echo "" >"$match_provider"
|
||||
provider_nums=0
|
||||
config_load "openclash"
|
||||
config_foreach yml_provider_name_get "proxy-provider"
|
||||
}
|
||||
|
||||
for n in $provider_line
|
||||
do
|
||||
[ "$provider_count" -eq 1 ] && {
|
||||
@ -225,20 +226,20 @@ do
|
||||
proxies_line=$(sed -n '/^ \{0,\}proxies:/=' $single_group)
|
||||
if [ "$use_line" -le "$proxies_line" ]; then
|
||||
if [ ! -z "$(sed -n "${use_line},${proxies_line}p" "$single_group" |grep -F "$provider_name")" ]; then
|
||||
group_name=$(grep "name:" $single_group 2>/dev/null |awk -F 'name:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)
|
||||
group_name=$(cfg_get "name:" "$single_group")
|
||||
${uci_add}groups="$group_name"
|
||||
fi
|
||||
elif [ "$use_line" -ge "$proxies_line" ]; then
|
||||
if [ ! -z "$(sed -n "${use_line},\$p" "$single_group" |grep -F "$provider_name")" ]; then
|
||||
group_name=$(grep "name:" $single_group 2>/dev/null |awk -F 'name:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)
|
||||
group_name=$(cfg_get "name:" "$single_group")
|
||||
${uci_add}groups="$group_name"
|
||||
fi
|
||||
elif [ ! -z "$use_line" ] && [ -z "$proxies_line" ]; then
|
||||
if [ ! -z "$(grep -F "$provider_name" $single_group)" ]; then
|
||||
group_name=$(grep "name:" $single_group 2>/dev/null |awk -F 'name:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)
|
||||
group_name=$(cfg_get "name:" "$single_group")
|
||||
${uci_add}groups="$group_name"
|
||||
fi
|
||||
fi
|
||||
fi 2>/dev/null
|
||||
done
|
||||
fi
|
||||
fi
|
||||
@ -266,7 +267,7 @@ yml_servers_name_get()
|
||||
local section="$1"
|
||||
config_get "name" "$section" "name" ""
|
||||
[ ! -z "$name" ] && {
|
||||
echo "$server_num"."$name" >>"$match_servers"
|
||||
echo "$server_num.$name" >>"$match_servers"
|
||||
}
|
||||
server_num=$(( $server_num + 1 ))
|
||||
}
|
||||
@ -624,8 +625,22 @@ do
|
||||
for ((i=1;i<=$group_num;i++))
|
||||
do
|
||||
single_group="/tmp/group_$i.yaml"
|
||||
if [ ! -z "$(grep -F "$server_name" "$single_group")" ]; then
|
||||
group_name=$(grep "name:" $single_group 2>/dev/null |awk -F 'name:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)
|
||||
group_type="$(cfg_get "type:" "$single_group")"
|
||||
if [ ! -z "$(grep -F "$server_name" "$single_group")" ] && [ "$group_type" = "relay" ]; then
|
||||
group_name=$(cfg_get "name:" "$single_group")
|
||||
grep "^ \{0,\}-" "$single_group" 2>/dev/null |grep -v "^ \{0,\}- name:" 2>/dev/null > $SERVER_RELAY
|
||||
s=1
|
||||
cat $SERVER_RELAY |while read -r line
|
||||
do
|
||||
if [ ! -z "$(echo "$line" |grep -F "$server_name" 2>/dev/null)" ]; then
|
||||
${uci_add}groups="$group_name"
|
||||
${uci_add}relay_groups="$group_name#relay#$s"
|
||||
else
|
||||
s=$(expr "$s" + 1)
|
||||
fi
|
||||
done
|
||||
elif [ ! -z "$(grep -F "$server_name" "$single_group")" ]; then
|
||||
group_name=$(cfg_get "name:" "$single_group")
|
||||
${uci_add}groups="$group_name"
|
||||
fi
|
||||
done
|
||||
@ -643,7 +658,7 @@ if [ "$servers_if_update" = "1" ]; then
|
||||
if [ -z "$line" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "$(uci get openclash.@servers["$line"].manual)" = "0" ] && [ "$(uci get openclash.@servers["$line"].config)" = "$CONFIG_NAME" ]; then
|
||||
if [ "$(uci get openclash.@servers["$line"].manual 2>/dev/null)" = "0" ] && [ "$(uci get openclash.@servers["$line"].config 2>/dev/null)" = "$CONFIG_NAME" ]; then
|
||||
uci delete openclash.@servers["$line"] 2>/dev/null
|
||||
fi
|
||||
done
|
||||
@ -665,3 +680,4 @@ rm -rf /tmp/provider.yaml 2>/dev/null
|
||||
rm -rf /tmp/provider_gen.yaml 2>/dev/null
|
||||
rm -rf /tmp/provider_che.yaml 2>/dev/null
|
||||
rm -rf /tmp/match_provider.list 2>/dev/null
|
||||
rm -rf /tmp/relay_server 2>/dev/null
|
||||
|
@ -183,63 +183,24 @@ yml_servers_set()
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$udp" ] && [ "$obfs" = "none" ] && [ "$type" = "ss" ]; then
|
||||
udp=", udp: $udp"
|
||||
fi
|
||||
|
||||
if [ ! -z "$udp" ] && [ "$type" != "trojan" ] && [ "$type" != "ss" ]; then
|
||||
udp=", udp: $udp"
|
||||
fi
|
||||
|
||||
if [ "$obfs_snell" = "none" ]; then
|
||||
obfs_snell=""
|
||||
fi
|
||||
|
||||
if [ "$obfs_vmess" != "none" ]; then
|
||||
obfs_vmess=", network: ws"
|
||||
else
|
||||
obfs_vmess=""
|
||||
fi
|
||||
|
||||
if [ ! -z "$host" ]; then
|
||||
host="host: $host"
|
||||
obfs_vmess="network: ws"
|
||||
fi
|
||||
|
||||
if [ ! -z "$custom" ] && [ "$type" = "vmess" ]; then
|
||||
custom=", ws-headers: { Host: $custom }"
|
||||
fi
|
||||
|
||||
if [ ! -z "$tls" ] && [ "$type" != "ss" ]; then
|
||||
tls=", tls: $tls"
|
||||
elif [ ! -z "$tls" ]; then
|
||||
tls="tls: $tls"
|
||||
custom="Host: $custom"
|
||||
fi
|
||||
|
||||
if [ ! -z "$path" ]; then
|
||||
if [ "$type" != "vmess" ]; then
|
||||
path="path: '$path'"
|
||||
else
|
||||
path=", ws-path: $path"
|
||||
path="ws-path: $path"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$skip_cert_verify" ] && [ "$type" != "ss" ] && [ "$type" != "trojan" ]; then
|
||||
skip_cert_verify=", skip-cert-verify: $skip_cert_verify"
|
||||
elif [ ! -z "$skip_cert_verify" ]; then
|
||||
skip_cert_verify="skip-cert-verify: $skip_cert_verify"
|
||||
fi
|
||||
|
||||
if [ ! -z "$auth_name" ]; then
|
||||
auth_name=", username: $auth_name"
|
||||
fi
|
||||
|
||||
if [ ! -z "$auth_pass" ]; then
|
||||
auth_pass=", password: $auth_pass"
|
||||
fi
|
||||
|
||||
if [ "$type" = "ss" ] && [ "$obfs" = "none" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port, cipher: $cipher, password: \"$password\"$udp }" >>$SERVER_FILE
|
||||
elif [ "$type" = "ss" ] && [ "$obfs" != "none" ]; then
|
||||
#ss
|
||||
if [ "$type" = "ss" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
@ -248,59 +209,159 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
cipher: $cipher
|
||||
password: "$password"
|
||||
EOF
|
||||
if [ ! -z "$udp" ]; then
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$obfss" ] && [ ! -z "$host" ]; then
|
||||
fi
|
||||
if [ ! -z "$obfss" ] && [ ! -z "$host" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$obfss
|
||||
plugin-opts:
|
||||
mode: $obfs
|
||||
$host
|
||||
host: $host
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
if [ "$obfss" = "plugin: v2ray-plugin" ]; then
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$tls
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$path" ]; then
|
||||
fi
|
||||
if [ ! -z "$path" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$path
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$mux" ]; then
|
||||
fi
|
||||
if [ ! -z "$mux" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
mux: $mux
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$custom" ]; then
|
||||
fi
|
||||
if [ ! -z "$custom" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
headers:
|
||||
custom: $custom
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#vmess
|
||||
if [ "$type" = "vmess" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port, uuid: $uuid, alterId: $alterId, cipher: $securitys$udp$skip_cert_verify$obfs_vmess$path$custom$tls }" >>$SERVER_FILE
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
uuid: $uuid
|
||||
alterId: $alterId
|
||||
cipher: $securitys
|
||||
EOF
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ "$obfs_vmess" != "none" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$obfs_vmess
|
||||
EOF
|
||||
if [ ! -z "$path" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$path
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$custom" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
ws-headers:
|
||||
$custom
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#socks5
|
||||
if [ "$type" = "socks5" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port$auth_name$auth_pass$udp$skip_cert_verify$tls }" >>$SERVER_FILE
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
EOF
|
||||
if [ ! -z "$auth_name" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
username: $auth_name
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$auth_pass" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
password: $auth_pass
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#http
|
||||
if [ "$type" = "http" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port$auth_name$auth_pass$skip_cert_verify$tls }" >>$SERVER_FILE
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
EOF
|
||||
if [ ! -z "$auth_name" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
username: $auth_name
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$auth_pass" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
password: $auth_pass
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$tls" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
tls: $tls
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#trojan
|
||||
if [ "$type" = "trojan" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
@ -327,11 +388,12 @@ EOF
|
||||
fi
|
||||
if [ ! -z "$skip_cert_verify" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$skip_cert_verify
|
||||
skip-cert-verify: $skip_cert_verify
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#snell
|
||||
if [ "$type" = "snell" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
@ -344,7 +406,7 @@ EOF
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
obfs-opts:
|
||||
mode: $obfs_snell
|
||||
$host
|
||||
host: $host
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
@ -651,6 +651,9 @@ msgstr "Fallback【故障切换】"
|
||||
msgid "Load-Balance"
|
||||
msgstr "Load-Balance【负载均衡】"
|
||||
|
||||
msgid "Relay Traffic"
|
||||
msgstr "Relay【嵌套中转】"
|
||||
|
||||
msgid "Other Group"
|
||||
msgstr "包含其他策略组(请勿重复添加)"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user