OpenClash: bump to v0.37.3-beta
This commit is contained in:
parent
9ad793f494
commit
0bd3bb5365
@ -34,6 +34,7 @@ define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/config >/dev/null 2>&1
|
||||
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/proxy_provider >/dev/null 2>&1
|
||||
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/backup >/dev/null 2>&1
|
||||
mkdir -p $(PKG_BUILD_DIR)/files/etc/openclash/core >/dev/null 2>&1
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
@ -47,12 +48,14 @@ define Package/$(PKG_NAME)/preinst
|
||||
if [ -f "/etc/config/openclash" ]; then
|
||||
cp "/etc/config/openclash" "/tmp/openclash.bak" >/dev/null 2>&1
|
||||
cp "/etc/config/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/config/openclash_custom_rules_2.list" "/tmp/openclash_custom_rules_2.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/config/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/config/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/history" "/tmp/openclash_history.bak" >/dev/null 2>&1
|
||||
fi
|
||||
if [ -f "/etc/openclash/custom/openclash_custom_rules.list" ]; then
|
||||
cp "/etc/openclash/custom/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_rules_2.list" "/tmp/openclash_custom_rules_2.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
|
||||
fi
|
||||
@ -74,9 +77,18 @@ mkdir -p /etc/openclash/config >/dev/null 2>&1
|
||||
mkdir -p /etc/openclash/proxy_provider >/dev/null 2>&1
|
||||
mkdir -p /etc/openclash/backup >/dev/null 2>&1
|
||||
mkdir -p /etc/openclash/core >/dev/null 2>&1
|
||||
mkdir -p /usr/share/openclash/backup >/dev/null 2>&1
|
||||
|
||||
cp "/etc/config/openclash" "/usr/share/openclash/backup/openclash" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_rules.list" "/usr/share/openclash/backup/openclash_custom_rules.list" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_rules_2.list" "/usr/share/openclash/backup/openclash_custom_rules_2.list" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_hosts.list" "/usr/share/openclash/backup/openclash_custom_hosts.list" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_fake_black.conf" "/usr/share/openclash/backup/openclash_custom_fake_black.conf" >/dev/null 2>&1
|
||||
|
||||
if [ -f "/tmp/openclash.bak" ]; then
|
||||
mv "/tmp/openclash.bak" "/etc/config/openclash" >/dev/null 2>&1
|
||||
mv "/tmp/openclash_custom_rules.list.bak" "/etc/openclash/custom/openclash_custom_rules.list" >/dev/null 2>&1
|
||||
mv "/tmp/openclash_custom_rules_2.list.bak" "/etc/openclash/custom/openclash_custom_rules_2.list" >/dev/null 2>&1
|
||||
mv "/tmp/openclash_custom_hosts.list.bak" "/etc/openclash/custom/openclash_custom_hosts.list" >/dev/null 2>&1
|
||||
mv "/tmp/openclash_custom_fake_black.conf.bak" "/etc/openclash/custom/openclash_custom_fake_black.conf" >/dev/null 2>&1
|
||||
mv "/tmp/openclash_history.bak" "/etc/openclash/history" >/dev/null 2>&1
|
||||
@ -135,6 +147,7 @@ define Package/$(PKG_NAME)/prerm
|
||||
cp "/etc/config/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/config/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_rules_2.list" "/tmp/openclash_custom_rules_2.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" >/dev/null 2>&1
|
||||
cp "/etc/openclash/custom/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" >/dev/null 2>&1
|
||||
endef
|
||||
|
||||
@ -110,14 +110,6 @@ yml_check()
|
||||
sed -i "s/- \{2,\}/- /g" "$3" 2>/dev/null
|
||||
|
||||
#检查关键字避免后续操作出错
|
||||
#proxies
|
||||
[ -z "$(grep "^Proxy:" "$3")" ] && {
|
||||
sed -i "/^ \{1,\}Proxy:/c\Proxy:" "$3" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$3")" ] && {
|
||||
sed -i "s/^proxies:/Proxy:/" "$3" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxy-providers
|
||||
[ -z "$(grep "^proxy-provider:" "$3")" ] && {
|
||||
sed -i "/^ \{1,\}proxy-provider:/c\proxy-provider:" "$3" 2>/dev/null
|
||||
@ -135,6 +127,21 @@ yml_check()
|
||||
sed -i "/^ \{0,\}proxy-groups:/c\Proxy Group:" "$3" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxies
|
||||
[ -z "$(grep "^Proxy:" "$3")" ] && {
|
||||
sed -i "/^ \{1,\}Proxy:/c\Proxy:" "$3" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$3")" ] && {
|
||||
sed -i "/^proxies:/c\Proxy:" "$3" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$3")" ] && {
|
||||
group_len=$(sed -n '/^Proxy Group:/=' "$3" 2>/dev/null)
|
||||
proxies_len=$(sed -n '/proxies:/=' "$3" 2>/dev/null |sed -n 1p)
|
||||
if [ "$proxies_len" -lt "$group_len" ]; then
|
||||
sed -i "${proxies_len}c\Proxy:" "$3" 2>/dev/null
|
||||
fi 2>/dev/null
|
||||
}
|
||||
|
||||
#rules
|
||||
[ -z "$(grep "^Rule:" "$3")" ] && {
|
||||
sed -i "/^ \{1,\}Rule:/c\Rule:" "$3" 2>/dev/null
|
||||
@ -158,9 +165,8 @@ yml_check()
|
||||
|
||||
#位置检查
|
||||
proxy_len=$(sed -n '/^Proxy:/=' "$3" 2>/dev/null)
|
||||
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$3" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^proxy-provider:/=' "$3" 2>/dev/null)
|
||||
dns_len=$(sed -n '/^ \{0,\}dns:/=' "$3" 2>/dev/null)
|
||||
dns_len=$(sed -n '/^dns:/=' "$3" 2>/dev/null)
|
||||
rule_len=$(sed -n '/^Rule:/=' "$3" 2>/dev/null)
|
||||
|
||||
if [ "$dns_len" -ge "$proxy_len" ] || [ "$dns_len" -ge "$rule_len" ] || [ "$dns_len" -ge "$group_len" ]; then
|
||||
|
||||
@ -75,6 +75,7 @@ Kurtzpel,Kurtzpel.rules
|
||||
失落的方舟俄服,Lostark-RU.rules
|
||||
冒险岛,Maplestory-us.rules
|
||||
怪兽世界猎人steam版,Monster-Hunter-World.rules
|
||||
万智牌:竞技场-国际服,MTG-Arena.rules
|
||||
奇迹传奇MU2,MU2.rules
|
||||
NBA-2K19,NBA-2K19.rules
|
||||
NBA2K20,NBA2K20.rules
|
||||
|
||||
@ -21,6 +21,7 @@ function index()
|
||||
entry({"admin", "services", "openclash", "coregameupdate"},call("action_core_game_update"))
|
||||
entry({"admin", "services", "openclash", "ping"}, call("act_ping"))
|
||||
entry({"admin", "services", "openclash", "download_game_rule"}, call("action_download_rule"))
|
||||
entry({"admin", "services", "openclash", "restore"}, call("action_restore_config"))
|
||||
entry({"admin", "services", "openclash", "settings"},cbi("openclash/settings"),_("Global Settings"), 30).leaf = true
|
||||
entry({"admin", "services", "openclash", "servers"},cbi("openclash/servers"),_("Severs and Groups"), 40).leaf = true
|
||||
entry({"admin", "services", "openclash", "game-settings"},cbi("openclash/game-settings"),_("Game Rules and Groups"), 50).leaf = true
|
||||
@ -194,6 +195,15 @@ function download_rule()
|
||||
return state
|
||||
end
|
||||
|
||||
function action_restore_config()
|
||||
luci.sys.call("/etc/init.d/openclash stop >/dev/null 2>&1")
|
||||
luci.sys.call("cp '/usr/share/openclash/backup/openclash' '/etc/config/openclash' >/dev/null 2>&1 &")
|
||||
luci.sys.call("cp '/usr/share/openclash/backup/openclash_custom_rules.list' '/etc/openclash/custom/openclash_custom_rules.list' >/dev/null 2>&1 &")
|
||||
luci.sys.call("cp '/usr/share/openclash/backup/openclash_custom_rules_2.list' '/etc/openclash/custom/openclash_custom_rules_2.list' >/dev/null 2>&1 &")
|
||||
luci.sys.call("cp '/usr/share/openclash/backup/openclash_custom_fake_black.conf' '/etc/openclash/custom/openclash_custom_fake_black.conf' >/dev/null 2>&1 &")
|
||||
luci.sys.call("cp '/usr/share/openclash/backup/openclash_custom_hosts.list' '/etc/openclash/custom/openclash_custom_hosts.list' >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
function action_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
@ -206,6 +216,7 @@ function action_status()
|
||||
mode = mode();
|
||||
})
|
||||
end
|
||||
|
||||
function action_state()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
@ -302,4 +313,4 @@ function action_download_rule()
|
||||
luci.http.write_json({
|
||||
game_rule_download_status = download_rule();
|
||||
})
|
||||
end
|
||||
end
|
||||
@ -202,13 +202,9 @@
|
||||
throw error;
|
||||
}),
|
||||
parseIPIpip: (ip, elID) => {
|
||||
IP.get(`https://api.skk.moe/network/parseIp/ipip/v3/${ip}`, 'json')
|
||||
IP.get(`https://qqwry.api.skk.moe/${ip}`, 'json')
|
||||
.then(resp => {
|
||||
let x = '';
|
||||
for (let i of resp.data) {
|
||||
x += (i !== '') ? `${i} ` : '';
|
||||
}
|
||||
$$.getElementById(elID).innerHTML = x;
|
||||
$$.getElementById(elID).innerHTML = resp.data.geo;
|
||||
//$$.getElementById(elID).innerHTML = `${resp.data.country} ${resp.data.regionName} ${resp.data.city} ${resp.data.isp}`;
|
||||
})
|
||||
},
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
|
||||
<table>
|
||||
<tr><td width="100%" colspan="4">
|
||||
<p align="center" id="update_tip">
|
||||
@ -43,6 +42,11 @@
|
||||
<tr><td width="25%"> 更新客户端 </td><td width="25%" align="left" id="op_up"><%:Collecting data...%></td><td width="25%"> 下载最新版本客户端 </td><td width="25%" align="left" id="ma_op_up"><%:Collecting data...%></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<fieldset class="cbi-section">
|
||||
<table>
|
||||
<tr><td width="100%" colspan="4" align="center" id="restore"><%:Collecting data...%></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var core_version = document.getElementById('CORE_VERSION');
|
||||
@ -66,6 +70,7 @@
|
||||
var ma_core_tun_up = document.getElementById('ma_core_tun_up');
|
||||
var ma_core_game_up = document.getElementById('ma_core_game_up');
|
||||
var ma_op_up = document.getElementById('ma_op_up');
|
||||
var restore = document.getElementById('restore');
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
var cpu_models = status.coremodel;
|
||||
@ -262,6 +267,7 @@
|
||||
ma_core_tun_up.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:下载到本地%>" onclick="return ma_core_tun_update(this)"/>';
|
||||
ma_core_game_up.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:下载到本地%>" onclick="return ma_core_game_update(this)"/>';
|
||||
ma_op_up.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:下载到本地%>" onclick="return ma_op_update(this)"/>';
|
||||
restore.innerHTML = '<input type="button" class="cbi-button cbi-button-reset" value="<%:还原默认配置%>" onclick="return restore_config(this)"/>';
|
||||
|
||||
function core_update(btn)
|
||||
{
|
||||
@ -386,6 +392,26 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function restore_config(btn)
|
||||
{
|
||||
btn.value = '<%:还原默认配置%>';
|
||||
btn.disabled = true;
|
||||
var r = confirm("确定要还原默认配置吗?")
|
||||
if (r == true) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "restore")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
alert('还原默认配置成功!')
|
||||
}
|
||||
else {
|
||||
alert('还原默认配置失败!')
|
||||
}
|
||||
});
|
||||
} else {
|
||||
}
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
XHR.poll(7, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.startlog == "\n" || status.startlog == "" ) {
|
||||
|
||||
@ -100,14 +100,6 @@ config_su_check()
|
||||
|
||||
config_encode()
|
||||
{
|
||||
#proxies
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^ \{1,\}Proxy:/c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "s/^proxies:/Proxy:/" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxy-providers
|
||||
[ -z "$(grep "^proxy-provider:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^ \{1,\}proxy-provider:/c\proxy-provider:" "$CFG_FILE" 2>/dev/null
|
||||
@ -125,6 +117,21 @@ config_encode()
|
||||
sed -i "/^ \{0,\}proxy-groups:/c\Proxy Group:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxies
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^ \{1,\}Proxy:/c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^proxies:/c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
group_len=$(sed -n '/^Proxy Group:/=' "$CFG_FILE" 2>/dev/null)
|
||||
proxies_len=$(sed -n '/proxies:/=' "$CFG_FILE" 2>/dev/null |sed -n 1p)
|
||||
if [ "$proxies_len" -lt "$group_len" ]; then
|
||||
sed -i "${proxies_len}c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
fi 2>/dev/null
|
||||
}
|
||||
|
||||
#rules
|
||||
[ -z "$(grep "^Rule:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^ \{1,\}Rule:/c\Rule:" "$CFG_FILE" 2>/dev/null
|
||||
|
||||
@ -13,14 +13,6 @@ fi
|
||||
|
||||
if [ -f "$CFG_FILE" ]; then
|
||||
#检查关键字避免后续操作出错
|
||||
#proxies
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "s/^ \{1,\}Proxy:/c\Proxy:/" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "s/^proxies:/Proxy:/" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxy-providers
|
||||
[ -z "$(grep "^proxy-provider:" "$CFG_FILE")" ] && {
|
||||
sed -i "s/^ \{1,\}proxy-provider:/proxy-provider:/" "$CFG_FILE" 2>/dev/null
|
||||
@ -28,6 +20,7 @@ if [ -f "$CFG_FILE" ]; then
|
||||
[ -z "$(grep "^proxy-provider:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^ \{0,\}proxy-providers:/c\proxy-provider:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxy-groups
|
||||
[ -z "$(grep "^Proxy Group:" "$CFG_FILE")" ] && {
|
||||
sed -i "s/^ \{0,\}\'Proxy Group\':/Proxy Group:/" "$CFG_FILE" 2>/dev/null
|
||||
@ -38,6 +31,21 @@ if [ -f "$CFG_FILE" ]; then
|
||||
sed -i "s/^ \{0,\}proxy-groups:/Proxy Group:/" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
|
||||
#proxies
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^ \{1,\}Proxy:/c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
sed -i "/^proxies:/c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
}
|
||||
[ -z "$(grep "^Proxy:" "$CFG_FILE")" ] && {
|
||||
group_len=$(sed -n '/^Proxy Group:/=' "$CFG_FILE" 2>/dev/null)
|
||||
proxies_len=$(sed -n '/proxies:/=' "$CFG_FILE" 2>/dev/null |sed -n 1p)
|
||||
if [ "$proxies_len" -lt "$group_len" ]; then
|
||||
sed -i "${proxies_len}c\Proxy:" "$CFG_FILE" 2>/dev/null
|
||||
fi 2>/dev/null
|
||||
}
|
||||
|
||||
#rules
|
||||
[ -z "$(grep "^Rule:" "$CFG_FILE")" ] && {
|
||||
sed -i "s/^ \{1,\}Rule:/Rule:/" "$CFG_FILE" 2>/dev/null
|
||||
@ -52,8 +60,7 @@ if [ -f "$CFG_FILE" ]; then
|
||||
}
|
||||
|
||||
#判断各个区位置
|
||||
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$CONFIG_FILE" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-provider:/=' "$CONFIG_FILE" 2>/dev/null)
|
||||
provider_len=$(sed -n '/proxy-provider:/=' "$CONFIG_FILE" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
awk '/Proxy Group:/,/proxy-provider:/{print}' "$CFG_FILE" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep name: |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null >/tmp/Proxy_Group 2>&1
|
||||
else
|
||||
|
||||
@ -13,6 +13,9 @@ CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
|
||||
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)
|
||||
UCI_DEL_LIST="uci del_list openclash.config.new_servers_group"
|
||||
UCI_ADD_LIST="uci add_list openclash.config.new_servers_group"
|
||||
UCI_SET="uci set openclash.config."
|
||||
|
||||
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
|
||||
CONFIG_FILE="$UPDATE_CONFIG_FILE"
|
||||
@ -445,15 +448,35 @@ EOF
|
||||
|
||||
}
|
||||
|
||||
new_servers_group_set()
|
||||
{
|
||||
local section="$1"
|
||||
config_get_bool "enabled" "$section" "enabled" "1"
|
||||
config_get "name" "$section" "name" ""
|
||||
|
||||
if [ "$enabled" = "0" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$name" ] || [ "$(echo $name.yaml)" != "$CONFIG_NAME" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
new_servers_group_set=1
|
||||
|
||||
}
|
||||
|
||||
|
||||
#创建配置文件
|
||||
if_game_proxy="$1"
|
||||
if_game_proxy_type="$2"
|
||||
#判断是否启用保留配置
|
||||
config_load "openclash"
|
||||
config_foreach new_servers_group_set "config_subscribe"
|
||||
#proxy-provider
|
||||
echo "开始写入配置文件【$CONFIG_NAME】的代理集信息..." >$START_LOG
|
||||
echo "proxy-provider:" >$PROXY_PROVIDER_FILE
|
||||
rm -rf /tmp/Proxy_Provider
|
||||
config_load "openclash"
|
||||
config_foreach yml_proxy_provider_set "proxy-provider"
|
||||
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Provider 2>/dev/null #添加参数
|
||||
if [ "$(grep "-" /tmp/Proxy_Provider 2>/dev/null |wc -l)" -eq 0 ]; then
|
||||
@ -561,21 +584,20 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
uci set openclash.config.rule_source="ConnersHua"
|
||||
uci set openclash.config.GlobalTV="GlobalTV"
|
||||
uci set openclash.config.AsianTV="AsianTV"
|
||||
uci set openclash.config.Proxy="Proxy"
|
||||
uci set openclash.config.Apple="Apple"
|
||||
uci set openclash.config.AdBlock="AdBlock"
|
||||
uci set openclash.config.Domestic="Domestic"
|
||||
uci set openclash.config.Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && {
|
||||
uci set openclash.config.servers_update="1"
|
||||
uci del openclash.config.new_servers_group >/dev/null 2>&1
|
||||
uci add_list openclash.config.new_servers_group="Auto - UrlTest"
|
||||
uci add_list openclash.config.new_servers_group="Proxy"
|
||||
uci add_list openclash.config.new_servers_group="AsianTV"
|
||||
uci add_list openclash.config.new_servers_group="GlobalTV"
|
||||
${UCI_SET}rule_source="ConnersHua"
|
||||
${UCI_SET}GlobalTV="GlobalTV"
|
||||
${UCI_SET}AsianTV="AsianTV"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
${UCI_SET}Apple="Apple"
|
||||
${UCI_SET}AdBlock="AdBlock"
|
||||
${UCI_SET}Domestic="Domestic"
|
||||
${UCI_SET}Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && [ "$new_servers_group_set" -eq 1 ] && {
|
||||
${UCI_SET}servers_update="1"
|
||||
${UCI_DEL_LIST}="Auto - UrlTest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Auto - UrlTest" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Proxy" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Proxy" >/dev/null 2>&1
|
||||
${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
|
||||
}
|
||||
elif [ "$rule_sources" = "lhie1" ] && [ "$servers_if_update" != "1" ] && [ -z "$if_game_proxy" ]; then
|
||||
echo "使用lhie1规则创建中..." >$START_LOG
|
||||
@ -765,36 +787,35 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
EOF
|
||||
fi
|
||||
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
|
||||
uci set openclash.config.rule_source="lhie1"
|
||||
uci set openclash.config.GlobalTV="GlobalTV"
|
||||
uci set openclash.config.AsianTV="AsianTV"
|
||||
uci set openclash.config.Proxy="Proxy"
|
||||
uci set openclash.config.Apple="Apple"
|
||||
uci set openclash.config.Microsoft="Microsoft"
|
||||
uci set openclash.config.Netflix="Netflix"
|
||||
uci set openclash.config.Spotify="Spotify"
|
||||
uci set openclash.config.Steam="Steam"
|
||||
uci set openclash.config.AdBlock="AdBlock"
|
||||
uci set openclash.config.Netease_Music="Netease Music"
|
||||
uci set openclash.config.Speedtest="Speedtest"
|
||||
uci set openclash.config.Telegram="Telegram"
|
||||
uci set openclash.config.PayPal="PayPal"
|
||||
uci set openclash.config.Domestic="Domestic"
|
||||
uci set openclash.config.Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && {
|
||||
uci set openclash.config.servers_update="1"
|
||||
uci del openclash.config.new_servers_group >/dev/null 2>&1
|
||||
uci add_list openclash.config.new_servers_group="Auto - UrlTest"
|
||||
uci add_list openclash.config.new_servers_group="Proxy"
|
||||
uci add_list openclash.config.new_servers_group="AsianTV"
|
||||
uci add_list openclash.config.new_servers_group="GlobalTV"
|
||||
uci add_list openclash.config.new_servers_group="Netflix"
|
||||
uci add_list openclash.config.new_servers_group="Spotify"
|
||||
uci add_list openclash.config.new_servers_group="Steam"
|
||||
uci add_list openclash.config.new_servers_group="Telegram"
|
||||
uci add_list openclash.config.new_servers_group="PayPal"
|
||||
uci add_list openclash.config.new_servers_group="Speedtest"
|
||||
uci add_list openclash.config.new_servers_group="Netease Music"
|
||||
${UCI_SET}rule_source="lhie1"
|
||||
${UCI_SET}GlobalTV="GlobalTV"
|
||||
${UCI_SET}AsianTV="AsianTV"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
${UCI_SET}Apple="Apple"
|
||||
${UCI_SET}Microsoft="Microsoft"
|
||||
${UCI_SET}Netflix="Netflix"
|
||||
${UCI_SET}Spotify="Spotify"
|
||||
${UCI_SET}Steam="Steam"
|
||||
${UCI_SET}AdBlock="AdBlock"
|
||||
${UCI_SET}Netease_Music="Netease Music"
|
||||
${UCI_SET}Speedtest="Speedtest"
|
||||
${UCI_SET}Telegram="Telegram"
|
||||
${UCI_SET}PayPal="PayPal"
|
||||
${UCI_SET}Domestic="Domestic"
|
||||
${UCI_SET}Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && [ "$new_servers_group_set" -eq 1 ] && {
|
||||
${UCI_SET}servers_update="1"
|
||||
${UCI_DEL_LIST}="Auto - UrlTest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Auto - UrlTest" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Proxy" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Proxy" >/dev/null 2>&1
|
||||
${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}="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
|
||||
${UCI_DEL_LIST}="Telegram" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Telegram" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="PayPal" >/dev/null 2>&1 && ${UCI_ADD_LIST}="PayPal" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Speedtest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Speedtest" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Netease Music" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netease Music" >/dev/null 2>&1
|
||||
}
|
||||
elif [ "$rule_sources" = "ConnersHua_return" ] && [ "$servers_if_update" != "1" ] && [ -z "$if_game_proxy" ]; then
|
||||
echo "使用ConnersHua回国规则创建中..." >$START_LOG
|
||||
@ -838,14 +859,13 @@ cat >> "$SERVER_FILE" <<-EOF
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
uci set openclash.config.rule_source="ConnersHua_return"
|
||||
uci set openclash.config.Proxy="Proxy"
|
||||
uci set openclash.config.Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && {
|
||||
uci set openclash.config.servers_update="1"
|
||||
uci del openclash.config.new_servers_group >/dev/null 2>&1
|
||||
uci add_list openclash.config.new_servers_group="Auto - UrlTest"
|
||||
uci add_list openclash.config.new_servers_group="Proxy"
|
||||
${UCI_SET}rule_source="ConnersHua_return"
|
||||
${UCI_SET}Proxy="Proxy"
|
||||
${UCI_SET}Others="Others"
|
||||
[ "$config_auto_update" -eq 1 ] && [ "$new_servers_group_set" -eq 1 ] && {
|
||||
${UCI_SET}servers_update="1"
|
||||
${UCI_DEL_LIST}="Auto - UrlTest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Auto - UrlTest" >/dev/null 2>&1
|
||||
${UCI_DEL_LIST}="Proxy" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Proxy" >/dev/null 2>&1
|
||||
}
|
||||
fi
|
||||
|
||||
@ -894,8 +914,8 @@ if [ -z "$if_game_proxy" ]; then
|
||||
fi
|
||||
rm -rf /tmp/Proxy_Server 2>/dev/null
|
||||
rm -rf /tmp/Proxy_Provider 2>/dev/null
|
||||
uci set openclash.config.enable=1 2>/dev/null
|
||||
${UCI_SET}enable=1 2>/dev/null
|
||||
[ "$(uci get openclash.config.servers_if_update)" == "0" ] && [ -z "$if_game_proxy" ] && /etc/init.d/openclash restart >/dev/null 2>&1
|
||||
uci set openclash.config.servers_if_update=0
|
||||
${UCI_SET}servers_if_update=0
|
||||
uci commit openclash
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user