luci-app-openclash: sync with upstream source

This commit is contained in:
CN_SZTL 2020-01-19 11:41:04 +08:00
parent 28d0f34519
commit 525be2e7d8
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
72 changed files with 12114 additions and 973 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.35.6
PKG_VERSION:=0.36.1
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -30,6 +30,9 @@ define Build/Prepare
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
chmod 0755 ${CURDIR}/files/etc/init.d/openclash
chmod -R 0755 ${CURDIR}/files/usr/share/openclash/
mkdir -p ${CURDIR}/files/etc/openclash/config >/dev/null 2>&1
mkdir -p ${CURDIR}/files/etc/openclash/proxy_provider >/dev/null 2>&1
mkdir -p ${CURDIR}/files/etc/openclash/backup >/dev/null 2>&1
endef
define Build/Configure
@ -46,6 +49,11 @@ if [ -f "/etc/config/openclash" ]; then
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
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_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
endef
define Package/$(PKG_NAME)/postinst
@ -60,17 +68,31 @@ uci set firewall.openclash.type=script >/dev/null 2>&1
uci set firewall.openclash.path=/var/etc/openclash.include >/dev/null 2>&1
uci set firewall.openclash.reload=1 >/dev/null 2>&1
uci commit firewall >/dev/null 2>&1
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
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/config/openclash_custom_rules.list" >/dev/null 2>&1
mv "/tmp/openclash_custom_hosts.list.bak" "/etc/config/openclash_custom_hosts.list" >/dev/null 2>&1
mv "/tmp/openclash_custom_fake_black.conf.bak" "/etc/config/openclash_custom_fake_black.conf" >/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_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
fi
if [ -f "/tmp/config.yaml" ]; then
mv "/tmp/config.yaml" "/etc/openclash/config.yaml" >/dev/null 2>&1
mv "/tmp/config.yaml" "/etc/openclash/config/config.yaml" >/dev/null 2>&1
elif [ -f "/tmp/config.yml" ]; then
mv "/tmp/config.yml" "/etc/openclash/config.yaml" >/dev/null 2>&1
mv "/tmp/config.yml" "/etc/openclash/config/config.yaml" >/dev/null 2>&1
elif [ -d "/tmp/openclash_config/" ]; then
rm -rf "/etc/openclash/config" >/dev/null 2>&1
mv "/tmp/openclash_config" "/etc/openclash/config" >/dev/null 2>&1
fi
if [ -d "/tmp/openclash_proxy_provider/" ]; then
rm -rf "/etc/openclash/proxy_provider" >/dev/null 2>&1
mv "/tmp/openclash_proxy_provider" "/etc/openclash/proxy_provider" >/dev/null 2>&1
fi
mkdir -p /lib/upgrade/keep.d >/dev/null 2>&1
cat > "/lib/upgrade/keep.d/luci-app-openclash" <<-EOF
/etc/openclash/custom/
EOF
uci set openclash.config.enable=0 >/dev/null 2>&1
uci commit openclash >/dev/null 2>&1
chmod 0755 /etc/init.d/openclash >/dev/null 2>&1
@ -83,22 +105,28 @@ define Package/$(PKG_NAME)/prerm
if [ ! -f "/tmp/openclash_update.sh" ]; then
rm -rf /etc/openclash/clash >/dev/null 2>&1
fi
mv "/etc/openclash/config.yaml" "/tmp/config.yaml" >/dev/null 2>&1
mv "/etc/openclash/config" "/tmp/openclash_config" >/dev/null 2>&1
mv "/etc/openclash/proxy_provider" "/tmp/openclash_proxy_provider" >/dev/null 2>&1
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_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_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
define Package/$(PKG_NAME)/postrm
#!/bin/sh
if [ -f "/etc/openclash/config.yaml" ]; then
mv "/etc/openclash/config.yaml" "/tmp/config.yaml"
fi
if [ -f "/etc/openclash/clash" ]; then
rm -rf /etc/openclash/config.* >/dev/null 2>&1
rm -rf /etc/openclash/config >/dev/null 2>&1
rm -rf /etc/openclash/backup >/dev/null 2>&1
rm -rf /etc/openclash/proxy_provider >/dev/null 2>&1
else
rm -rf /etc/openclash >/dev/null 2>&1
fi
rm -rf /lib/upgrade/keep.d/luci-app-openclash >/dev/null 2>&1
rm -rf /tmp/openclash.log >/dev/null 2>&1
rm -rf /tmp/openclash_start.log >/dev/null 2>&1
rm -rf /tmp/Proxy_Group >/dev/null 2>&1

View File

@ -8,16 +8,19 @@ STOP=15
CLASH="/etc/openclash/clash"
CLASH_CONFIG="/etc/openclash"
CRON_FILE="/etc/crontabs/root"
CONFIG_FILE="/etc/openclash/config.yaml"
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
LOG_FILE="/tmp/openclash.log"
START_LOG="/tmp/openclash_start.log"
BACKUP_FILE="/etc/openclash/config.bak"
BACKUP_FILE="/etc/openclash/backup/$(uci get openclash.config.config_path |awk -F '/' '{print $5}' 2>/dev/null)"
START_BACKUP="/tmp/config.sbak"
CHANGE_FILE="/tmp/yaml_change.yaml"
RULE_FILE="/tmp/yaml_rules.yaml"
DNS_FILE="/tmp/yaml_dns.yaml"
PROXY_FILE="/tmp/yaml_proxy.yaml"
HOSTS_FILE="/etc/config/openclash_custom_hosts.list"
PROXY_PROVIDER_FILE="/tmp/yaml_proxy_provider.yaml"
HOSTS_FILE="/etc/openclash/custom/openclash_custom_hosts.list"
PROXY_FWMARK="0x162"
PROXY_ROUTE_TABLE="0x162"
add_cron()
{
@ -103,18 +106,7 @@ yml_check()
#替换tab
sed -i 's/\t/ /g' "$3" 2>/dev/null
#自定义DNS还原
if [ "$(grep -c '##Custom DNS##' "$3")" -gt 0 ] && [ "$2" = 0 ] && [ -f "$4" ]; then
awk '/^ {0,}nameserver:/,/Proxy:/{print}' "$4" | sed '/^Proxy:/d' >/tmp/bakdns.config 2>/dev/null
sed -i '/OpenClash-General-Settings/i\Custom DNS End' "$3" 2>/dev/null
sed -i '/^ \{0,\}nameserver:/,/^Custom DNS End$/d' "$3" 2>/dev/null
sed -i '/##Custom DNS##/r/tmp/bakdns.config' "$3" 2>/dev/null
rm -rf /tmp/bakdns.config 2>/dev/null
fi
yml_dns_check
#检查关键字避免后续操作出错
[ ! -z "$(grep "^ \{0,\}'Proxy':" "$3")" ] || [ ! -z "$(grep '^ \{0,\}"Proxy":' "$3")" ] && {
@ -122,6 +114,11 @@ yml_check()
sed -i '/^ \{0,\}\"Proxy\":/c\Proxy:' "$3"
}
[ ! -z "$(grep "^ \{0,\}'proxy-provider':" "$3")" ] || [ ! -z "$(grep '^ \{0,\}"proxy-provider":' "$3")" ] && {
sed -i "/^ \{0,\}\'proxy-provider\'/c\proxy-provider:" "$3"
sed -i '/^ \{0,\}\"proxy-provider\":/c\proxy-provider:' "$3"
}
[ ! -z "$(grep "^ \{0,\}'Proxy Group':" "$3")" ] || [ ! -z "$(grep '^ \{0,\}"Proxy Group":' "$3")" ] && {
sed -i "/^ \{0,\}\'Proxy Group\'/c\Proxy Group:" "$3"
sed -i '/^ \{0,\}\"Proxy Group\":/c\Proxy Group:' "$3"
@ -140,7 +137,11 @@ yml_check()
[ ! -z "$(grep "^ \{1,\}Proxy:" "$3")" ] && {
sed -i "/^ \{1,\}Proxy:/c\Proxy:" "$3"
}
[ ! -z "$(grep "^ \{1,\}proxy-provider:" "$3")" ] && {
sed -i "/^ \{1,\}proxy-provider:/c\proxy-provider:" "$3"
}
[ ! -z "$(grep "^ \{1,\}Proxy Group:" "$3")" ] && {
sed -i "/^ \{1,\}Proxy Group:/c\Proxy Group:" "$3"
}
@ -153,6 +154,54 @@ yml_check()
sed -i "/^ \{1,\}dns:/c\dns:" "$3"
}
#处理provider位置
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)
if [ ! -z "$provider_len" ]; then
if [ "$provider_len" -ge "$proxy_len" ] && [ "$provider_len" -le "$group_len" ]; then
awk '/^proxy-provider:/,/^Proxy Group:/{print}' "$3" | sed '/^Proxy Group:/d' >/tmp/backprovider.yaml 2>/dev/null
sed -i '/^Proxy Group:/i\proxy-provider-tag' "$3" 2>/dev/null
sed -i '/^proxy-provider:/,/proxy-provider-tag/d' "$3" 2>/dev/null
sed -i '/^Rule:/i\proxy-provider:' "$3" 2>/dev/null
sed -i '/^proxy-provider:/d' /tmp/backprovider.yaml 2>/dev/null
sed -i '/proxy-provider:/r/tmp/backprovider.yaml' "$3" 2>/dev/null
rm -rf /tmp/backprovider.yaml 2>/dev/null
elif [ "$provider_len" -ge "$group_len" ]; then
awk '/^proxy-provider:/,/^Rule:/{print}' "$3" | sed '/^Rule:/d' >/tmp/backprovider.yaml 2>/dev/null
sed -i '/^Rule:/i\proxy-provider-tag' "$3" 2>/dev/null
sed -i '/^proxy-provider:/,/proxy-provider-tag/d' "$3" 2>/dev/null
if [ ! -z "$proxy_len" ]; then
sed -i '/^Proxy:/i\proxy-provider:' "$3" 2>/dev/null
else
sed -i '/^Proxy Group:/i\proxy-provider:' "$3" 2>/dev/null
fi
sed -i '/^proxy-provider:/d' /tmp/backprovider.yaml 2>/dev/null
sed -i '/proxy-provider:/r/tmp/backprovider.yaml' "$3" 2>/dev/null
rm -rf /tmp/backprovider.yaml 2>/dev/null
fi
fi
if [ ! -z "$provider_len" ]; then
proxy_provider_mode=1
fi
#自定义DNS还原
if [ "$(grep -c '##Custom DNS##' "$3")" -gt 0 ] && [ "$2" = 0 ] && [ -f "$4" ]; then
if [ "$proxy_provider_mode" -eq 1 ]; then
awk '/^ {0,}nameserver:/,/proxy-provider:/{print}' "$4" | sed '/^proxy-provider:/d' >/tmp/backdns.config 2>/dev/null
else
awk '/^ {0,}nameserver:/,/Proxy:/{print}' "$4" | sed '/^Proxy:/d' >/tmp/backdns.config 2>/dev/null
fi
sed -i '/OpenClash-General-Settings/i\Custom DNS End' "$3" 2>/dev/null
sed -i '/^ \{0,\}nameserver:/,/^Custom DNS End$/d' "$3" 2>/dev/null
sed -i '/##Custom DNS##/r/tmp/bakdns.config' "$3" 2>/dev/null
rm -rf /tmp/backdns.config 2>/dev/null
fi
yml_dns_check
if [ ! -z "$(grep "^ \{1,\}port:" "$3")" ] || [ ! -z "$(grep "^ \{1,\}mode:" "$3")" ] || [ ! -z "$(grep "^ \{1,\}log-level:" "$3")" ]; then
cp "$3" /tmp/config.check 2>/dev/null
sed -i '/^dns:/,$d' /tmp/config.check 2>/dev/null
@ -163,22 +212,34 @@ yml_check()
#添加标识
sed -i '/OpenClash-General/d' "$3" 2>/dev/null
sed -i '/^Proxy:/i\#===================== OpenClash-General-Settings =====================#' "$3" 2>/dev/null
if [ "$proxy_provider_mode" -eq 1 ]; then
sed -i '/^proxy-provider:/i\#===================== OpenClash-General-Settings =====================#' "$3" 2>/dev/null
else
sed -i '/^Proxy:/i\#===================== OpenClash-General-Settings =====================#' "$3" 2>/dev/null
fi
}
#检查DNS设置
yml_dns_check()
{
[ -z "$(grep '^dns:' $CONFIG_FILE)" ] && {
sed -i '/^Proxy:/i\dns:' "$CONFIG_FILE" 2>/dev/null
}
if [ -z "$(grep '^dns:' $CONFIG_FILE)" ]; then
if [ "$proxy_provider_mode" -eq 1 ]; then
sed -i '/^proxy-provider:/i\dns:' "$CONFIG_FILE" 2>/dev/null
else
sed -i '/^Proxy:/i\dns:' "$CONFIG_FILE" 2>/dev/null
fi
fi
[ -z "$(grep '^ \{0,\}nameserver:' $CONFIG_FILE)" ] && {
sed -i '/^Proxy:/i\ nameserver:' "$CONFIG_FILE" 2>/dev/null
if [ -z "$(grep '^ \{0,\}nameserver:' $CONFIG_FILE)" ]; then
if [ "$proxy_provider_mode" -eq 1 ]; then
sed -i '/^proxy-provider:/i\ nameserver:' "$CONFIG_FILE" 2>/dev/null
else
sed -i '/^Proxy:/i\ nameserver:' "$CONFIG_FILE" 2>/dev/null
fi
sed -i "/^ \{0,\}nameserver:/a\ - tls://8.8.8.8:853" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - 114.114.114.114" "$CONFIG_FILE" 2>/dev/null
}
fi
dns_port=$(grep "^ \{0,\}listen:" $CONFIG_FILE |awk -F ':' '{print $3}' |awk -F '#' '{print $1}' |tr -cd "[0-9]" 2>/dev/null)
if [ -z "$dns_port" ] || [ "$dns_port" -eq 53 ]; then
@ -195,17 +256,65 @@ yml_dns_check()
}
#检查代理集文件防止启动失败
yml_proxy_provider_check()
{
while ( [ ! -z "$(pidof clash)" ] && [ "$proxy_provider_path_exist" != 1 ] )
do
if [ "$proxy_provider_mode" = 1 ]; then
proxy_provider_path_line=$(sed -n '/^ \{0,\}path:/=' "$1" 2>/dev/null)
proxy_provider_path_exist=1
for n in $proxy_provider_path_line
do
provider_path=$(sed -n "${n}p" $1 |awk -F 'path:' '{print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null)
if [ "$(echo ${provider_path:0:1})" = "." ]; then
provider_path_check="/etc/openclash/$(echo ${provider_path:2})"
if [ -f "$provider_path_check" ]; then
if [ -z "$(grep "'proxies:':" "$provider_path_check")" ] && [ -z "$(grep '"proxies:":' "$provider_path_check")" ] && [ -z "$(grep 'proxies:' "$provider_path_check")" ]; then
proxy_provider_path_exist=0
fi
else
proxy_provider_path_exist=0
fi
else
provider_path_check="$provider_path"
if [ -f "$provider_path_check" ]; then
if [ -z "$(grep "'proxies:':" "$provider_path_check")" ] && [ -z "$(grep '"proxies:":' "$provider_path_check")" ] && [ -z "$(grep 'proxies:' "$provider_path_check")" ]; then
proxy_provider_path_exist=0
fi
else
proxy_provider_path_exist=0
fi
fi
done
else
proxy_provider_path_exist=1
fi
done
}
#切割配置文件以分开处理
yml_cut()
{
cp "$4" "$1"
sed -i '/^Rule:/,$d' "$1"
sed -n '/^ \{0,\}nameserver:/,$p' "$1" >"$3"
sed -n '/^ \{0,\}Proxy:/,$p' "$3" >"$5"
sed -i '/^ \{0,\}nameserver:/,$d' "$1"
sed -i '/^ \{0,\}Proxy:/,$d' "$3"
sed -n '/^Rule:/,$p' "$4" >"$2"
sed -i '/^Rule:/,$d' "$1" 2>/dev/null
sed -n '/^ \{0,\}nameserver:/,$p' "$1" >"$3" 2>/dev/null
if [ "$proxy_provider_mode" -eq 1 ]; then
sed -n '/^ \{0,\}Proxy:/,$p' "$3" >"$5" 2>/dev/null
sed -n '/^ \{0,\}proxy-provider:/,$p' "$3" >"$6" 2>/dev/null
sed -i '/^ \{0,\}Proxy:/,$d' "$6" 2>/dev/null
else
sed -n '/^ \{0,\}Proxy:/,$p' "$3" >"$5" 2>/dev/null
fi
sed -i '/^ \{0,\}nameserver:/,$d' "$1" 2>/dev/null
if [ "$proxy_provider_mode" -eq 1 ]; then
sed -i '/^ \{0,\}proxy-provider:/,$d' "$3" 2>/dev/null
else
sed -i '/^ \{0,\}Proxy:/,$d' "$3" 2>/dev/null
fi
sed -n '/^Rule:/,$p' "$4" >"$2" 2>/dev/null
}
#获取自定义DNS设置
@ -311,13 +420,15 @@ yml_dns_custom()
if [ -z "$(grep "^ - " $2)" ]; then
sed -i '/^ \{0,\}ipcidr:/,/OpenClash-General-Settings/ {s/^ \{0,\}- / - /}' "$2" 2>/dev/null #修改参数空格
fi
else #删除fallback-filter
#删除fallback-filter
else
if [ ! -z "$(grep '^ \{0,\}fallback-filter:' $2)" ]; then
sed -i '/fallback-filter:/,$d' "$2" 2>/dev/null
echo "#===================== OpenClash-General-Settings =====================#" >>"$2"
fi
if [ ! -z "$(grep "^ \{0,1\}- " $2)" ]; then
sed -i "s/^ \{0,\}- / - /" "$2" 2>/dev/null #添加参数空格
#添加参数空格
sed -i "s/^ \{0,\}- / - /" "$2" 2>/dev/null
fi
fi
@ -362,11 +473,27 @@ start()
status=$(ps|grep -c /etc/init.d/openclash)
[ "$status" -gt "3" ] && exit 0
if [ ! -f "$CONFIG_FILE" ] && [ "$(ls -l /etc/openclash/config.yml 2>/dev/null |awk '{print int($5/1024)}')" -gt 0 ]; then
mv "/etc/openclash/config.yml" "$CONFIG_FILE"
fi
if [ ! -f "$CONFIG_FILE" ] && [ -f "$BACKUP_FILE" ]; then
if [ -z "$CONFIG_FILE" ]; then
CONFIG_NAME=$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')
if [ ! -z "$CONFIG_NAME" ]; then
uci set openclash.config.config_path="/etc/openclash/config/$CONFIG_NAME"
uci commit openclash
CONFIG_FILE="/etc/openclash/config/$CONFIG_NAME"
elif [ -f "/etc/openclash/config.yaml" ]; then
mv "/etc/openclash/config.yaml" "/etc/openclash/config/config.yaml"
uci set openclash.config.config_path="/etc/openclash/config/config.yaml"
uci commit openclash
CONFIG_FILE="/etc/openclash/config/config.yaml"
elif [ -f "/etc/openclash/config.yml" ]; then
mv "/etc/openclash/config.yml" "/etc/openclash/config/config.yaml"
uci set openclash.config.config_path="/etc/openclash/config/config.yaml"
uci commit openclash
CONFIG_FILE="/etc/openclash/config/config.yaml"
fi
else
if [ ! -f "$CONFIG_FILE" ] && [ -f "$BACKUP_FILE" ]; then
cp $BACKUP_FILE $CONFIG_FILE
fi
fi
enable=$(uci get openclash.config.enable 2>/dev/null)
@ -381,6 +508,18 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
echo "OpenClash 开始启动..." >$START_LOG
echo "第一步: 获取配置..." >$START_LOG
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
if [ "$en_mode" = "fake-ip-tun" ]; then
en_mode_tun="1"
en_mode="fake-ip"
fi
if [ "$en_mode" = "redir-host-vpn" ]; then
en_mode_tun="2"
en_mode="redir-host"
fi
if [ "$en_mode" = "fake-ip-vpn" ]; then
en_mode_tun="2"
en_mode="fake-ip"
fi
enable_custom_dns=$(uci get openclash.config.enable_custom_dns 2>/dev/null)
rule_source=$(uci get openclash.config.rule_source 2>/dev/null)
enable_custom_clash_rules=$(uci get openclash.config.enable_custom_clash_rules 2>/dev/null)
@ -392,6 +531,7 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
socks_port=$(uci get openclash.config.socks_port 2>/dev/null)
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
lan_ip=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
lan_ip6=$(uci get network.lan.ip6addr 2>/dev/null)
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
log_level=$(uci get openclash.config.log_level 2>/dev/null)
@ -399,126 +539,175 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
intranet_allowed=$(uci get openclash.config.intranet_allowed 2>/dev/null)
echo "第二步: 配置文件检查..." >$START_LOG
yml_check "$en_mode" "$enable_custom_dns" "$CONFIG_FILE" "$BACKUP_FILE" "$START_BACKUP"
grep "^ \{0,\}Proxy:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Proxy Group:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Rule:" $CONFIG_FILE >/dev/null 2>&1
if [ "$?" -ne "0" ]; then
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
echo "错误: 配置文件完整性检查不通过,已自动还原配置文件,请根据日志信息对照模板格式检查修改配置文件!" >$START_LOG
mv $START_BACKUP $CONFIG_FILE
stop
sleep 5
echo "" >$START_LOG
else
echo "第三步: 修改配置文件..." >$START_LOG
config_load "openclash"
config_foreach yml_auth_get "authentication"
yml_auth_custom "$CONFIG_FILE"
yml_cut "$CHANGE_FILE" "$RULE_FILE" "$DNS_FILE" "$CONFIG_FILE" "$PROXY_FILE"
yml_dns_custom "$enable_custom_dns" "$DNS_FILE"
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" &
sh /usr/share/openclash/yml_rules_change.sh "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$RULE_FILE" &
wait
cat "$CHANGE_FILE" "$DNS_FILE" "$PROXY_FILE" "$RULE_FILE" >$CONFIG_FILE 2>/dev/null
rm -rf /tmp/yaml_* 2>/dev/null
echo "第四步: DNS设置检查..." >$START_LOG
if [ ! -z "$(sed -n '/^ \{0,\}nameserver:/{n;p}' $CONFIG_FILE |grep '^ \{0,\}fallback:')" ] || [ ! -z "$(sed -n '/^ \{0,\}nameserver:/{n;p}' $CONFIG_FILE |grep 'OpenClash-General')" ]; then
echo "错误: 配置文件DNS选项下的Nameserver必须设置服务器已自动还原配置文件请重新设置" >$START_LOG
echo "${LOGTIME} Nameserver Must Be Set, Please Change Your Configrations In Config.yaml" >>$LOG_FILE
grep "^ \{0,\}Proxy Group:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Rule:" $CONFIG_FILE >/dev/null 2>&1
if [ "$?" -eq "0" ]; then
grep "^ \{0,\}Proxy:" $CONFIG_FILE >/dev/null 2>&1 || grep "^ \{0,\}proxy-provider:" $CONFIG_FILE >/dev/null 2>&1
if [ "$?" -ne "0" ]; then
nohup $CLASH -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
echo "错误: 配置文件完整性检查不通过,已自动还原配置文件,请根据日志信息对照模板格式检查修改配置文件!" >$START_LOG
mv $START_BACKUP $CONFIG_FILE
sleep 10
stop
sleep 5
echo "" >$START_LOG
else
echo "第五步: 启动 Clash 主程序..." >$START_LOG
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
echo "第三步: 修改配置文件..." >$START_LOG
config_load "openclash"
config_foreach yml_auth_get "authentication"
yml_auth_custom "$CONFIG_FILE"
yml_cut "$CHANGE_FILE" "$RULE_FILE" "$DNS_FILE" "$CONFIG_FILE" "$PROXY_FILE" "$PROXY_PROVIDER_FILE"
yml_dns_custom "$enable_custom_dns" "$DNS_FILE"
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" "$en_mode_tun" &
sh /usr/share/openclash/yml_rules_change.sh "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$RULE_FILE" &
wait
cat "$CHANGE_FILE" "$DNS_FILE" "$PROXY_PROVIDER_FILE" "$PROXY_FILE" "$RULE_FILE" >$CONFIG_FILE 2>/dev/null
echo "第四步: DNS设置检查..." >$START_LOG
if [ ! -z "$(sed -n '/^ \{0,\}nameserver:/{n;p}' $CONFIG_FILE |grep '^ \{0,\}fallback:')" ] || [ ! -z "$(sed -n '/^ \{0,\}nameserver:/{n;p}' $CONFIG_FILE |grep 'OpenClash-General')" ]; then
echo "错误: 配置文件DNS选项下的Nameserver必须设置服务器已自动还原配置文件请重新设置" >$START_LOG
echo "${LOGTIME} Nameserver Must Be Set, Please Change Your Configrations In Config.yaml" >>$LOG_FILE
mv $START_BACKUP $CONFIG_FILE
sleep 10
echo "" >$START_LOG
else
echo "第五步: 启动 Clash 主程序..." >$START_LOG
nohup $CLASH -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
#检测proxy_provider配置文件状态
yml_proxy_provider_check "$PROXY_PROVIDER_FILE"
rm -rf /tmp/yaml_* 2>/dev/null
echo "第六步: 设置控制面板..." >$START_LOG
ln -s /usr/share/openclash/yacd /www/openclash 2>/dev/null
echo "第六步: 设置控制面板..." >$START_LOG
ln -s /usr/share/openclash/yacd /www/openclash 2>/dev/null
echo "第七步: 设置 OpenClash 防火墙规则..." >$START_LOG
if [ -z "$(uci get firewall.openclash 2>/dev/null)" ] || [ -z "$(uci get ucitrack.@openclash[-1].init 2>/dev/null)" ]; then
uci delete ucitrack.@openclash[-1] >/dev/null 2>&1
uci add ucitrack openclash >/dev/null 2>&1
uci set ucitrack.@openclash[-1].init=openclash >/dev/null 2>&1
uci commit ucitrack >/dev/null 2>&1
uci delete firewall.openclash >/dev/null 2>&1
uci set firewall.openclash=include >/dev/null 2>&1
uci set firewall.openclash.type=script >/dev/null 2>&1
uci set firewall.openclash.path=/var/etc/openclash.include >/dev/null 2>&1
uci set firewall.openclash.reload=1 >/dev/null 2>&1
uci commit firewall >/dev/null 2>&1
fi
echo "第七步: 设置 OpenClash 防火墙规则..." >$START_LOG
if [ -z "$(uci get firewall.openclash 2>/dev/null)" ] || [ -z "$(uci get ucitrack.@openclash[-1].init 2>/dev/null)" ]; then
uci delete ucitrack.@openclash[-1] >/dev/null 2>&1
uci add ucitrack openclash >/dev/null 2>&1
uci set ucitrack.@openclash[-1].init=openclash >/dev/null 2>&1
uci commit ucitrack >/dev/null 2>&1
uci delete firewall.openclash >/dev/null 2>&1
uci set firewall.openclash=include >/dev/null 2>&1
uci set firewall.openclash.type=script >/dev/null 2>&1
uci set firewall.openclash.path=/var/etc/openclash.include >/dev/null 2>&1
uci set firewall.openclash.reload=1 >/dev/null 2>&1
fi
if [ ! -z "$en_mode_tun" ] && [ "$(uci get firewall.@defaults[0].forward)" != "ACCEPT" ]; then
uci set firewall.@defaults[0].forward=ACCEPT >/dev/null 2>&1
uci commit firewall >/dev/null 2>&1
/etc/init.d/firewall reload >/dev/null 2>&1
fi
mkdir -p /var/etc
cat > "/var/etc/openclash.include" <<-EOF
/etc/init.d/openclash restart
EOF
if [ "$en_mode_tun" != "2" ]; then
iptables -t nat -N openclash
iptables -t nat -N openclash
iptables -t nat -A openclash -d 0.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 10.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 127.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 169.254.0.0/16 -j RETURN
iptables -t nat -A openclash -d 172.16.0.0/12 -j RETURN
iptables -t nat -A openclash -d 192.168.0.0/16 -j RETURN
iptables -t nat -A openclash -d 224.0.0.0/4 -j RETURN
iptables -t nat -A openclash -d 240.0.0.0/4 -j RETURN
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A PREROUTING -i br-lan -p tcp -j openclash
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
if [ "$en_mode_tun" = "1" ]; then
iptables -t nat -A openclash -d 198.18.0.0/16 -j RETURN
fi
if [ "$ipv6_enable" -eq 1 ]; then
ip6tables -t nat -N openclash
ip6tables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
ip6tables -t nat -A PREROUTING -i br-lan -p tcp -j openclash
fi
echo "第八步: 重启 Dnsmasq 程序..." >$START_LOG
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep dpt:53 |wc -l)" -gt 2 ]; then
echo "发现53端口被劫持如连接异常请将OpenClash设置为劫持53端口程序的上游DNS服务器" >$START_LOG
echo "${LOGTIME} Warring: OpenClash May Can Not Take Over DNS, Please Use OpenClash for Upstream DNS Resolve Server" >> $LOG_FILE
sleep 5
fi
change_dns "$enable_redirect_dns" "$disable_masq_cache"
fake_block "$en_mode" "$direct_dns"
/etc/init.d/dnsmasq restart >/dev/null 2>&1
if pidof clash >/dev/null; then
echo "第九步: 添加 OpenClash 计划任务,启动进程守护程序..." >$START_LOG
add_cron
if [ -z "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
echo "OpenClash 启动成功,请等待服务器上线!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful" >> $LOG_FILE
sleep 5
iptables -t nat -A openclash -d 0.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 10.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 127.0.0.0/8 -j RETURN
iptables -t nat -A openclash -d 169.254.0.0/16 -j RETURN
iptables -t nat -A openclash -d 172.16.0.0/12 -j RETURN
iptables -t nat -A openclash -d 192.168.0.0/16 -j RETURN
iptables -t nat -A openclash -d 224.0.0.0/4 -j RETURN
iptables -t nat -A openclash -d 240.0.0.0/4 -j RETURN
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
iptables -t nat -A zone_lan_prerouting -p tcp -j openclash
if [ "$en_mode_tun" != 1 ]; then
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.0/16 -j REDIRECT --to-ports "$proxy_port"
fi
if [ "$ipv6_enable" -eq 1 ]; then
ip6tables -t nat -N openclash
ip6tables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
ip6tables -t nat -A zone_lan_prerouting -p tcp -j openclash
fi
else
echo "OpenClash 启动成功检测到您启用了IPV6的DHCP服务可能会造成连接异常" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
sleep 10
#TUN2模式
ipset create localnetwork hash:net
ipset add localnetwork 127.0.0.0/8
ipset add localnetwork 10.0.0.0/8
ipset add localnetwork 169.254.0.0/16
ipset add localnetwork 192.168.0.0/16
ipset add localnetwork 224.0.0.0/4
ipset add localnetwork 240.0.0.0/4
ipset add localnetwork 172.16.0.0/12
#启动TUN
ip tuntap add user root mode tun clash0
ip link set clash0 up
ip route replace default dev clash0 table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
#设置防火墙
iptables -t mangle -N openclash
iptables -t mangle -F openclash
iptables -t mangle -A openclash -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -I OUTPUT -j openclash
iptables -t mangle -I PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK"
#ipv6
ip6tables -t mangle -I PREROUTING -j MARK --set-mark "$PROXY_FWMARK"
fi
echo "" >$START_LOG
else
if [ "$rule_source" != 0 ] || [ "$enable_custom_clash_rules" != 0 ]; then
echo "错误: OpenClash 启动失败,尝试还原规则并重新启动 Clash 主程序..." >$START_LOG
echo "${LOGTIME} OpenClash Can Not Start, Try Use Backup Rules Start Again" >> $LOG_FILE
mv "$BACKUP_FILE" /etc/openclash/configrules.bak
sed -i -n '/^Rule:/,$p' /etc/openclash/configrules.bak
sed -i '/^Rule:/,$d' "$CONFIG_FILE"
cat /etc/openclash/configrules.bak >> "$CONFIG_FILE"
rm -rf /etc/openclash/configrules.bak
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
sleep 3
if pidof clash >/dev/null; then
add_cron
if [ -z "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 10
echo "第八步: 重启 Dnsmasq 程序..." >$START_LOG
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep dpt:53 |wc -l)" -gt 2 ]; then
echo "发现53端口被劫持如连接异常请将OpenClash设置为劫持53端口程序的上游DNS服务器" >$START_LOG
echo "${LOGTIME} Warring: OpenClash May Can Not Take Over DNS, Please Use OpenClash for Upstream DNS Resolve Server" >> $LOG_FILE
sleep 5
fi
change_dns "$enable_redirect_dns" "$disable_masq_cache"
fake_block "$en_mode" "$direct_dns"
/etc/init.d/dnsmasq restart >/dev/null 2>&1
if pidof clash >/dev/null; then
echo "第九步: 添加 OpenClash 计划任务,启动进程守护程序..." >$START_LOG
add_cron
if [ -z "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
echo "OpenClash 启动成功,请等待服务器上线!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful" >> $LOG_FILE
sleep 5
else
echo "OpenClash 启动成功检测到您启用了IPV6的DHCP服务可能会造成连接异常" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
sleep 10
fi
echo "" >$START_LOG
else
if [ "$rule_source" != 0 ] || [ "$enable_custom_clash_rules" != 0 ]; then
echo "错误: OpenClash 启动失败,尝试还原规则并重新启动 Clash 主程序..." >$START_LOG
echo "${LOGTIME} OpenClash Can Not Start, Try Use Backup Rules Start Again" >> $LOG_FILE
mv "$BACKUP_FILE" /etc/openclash/configrules.bak
sed -i -n '/^Rule:/,$p' /etc/openclash/configrules.bak
sed -i '/^Rule:/,$d' "$CONFIG_FILE"
cat /etc/openclash/configrules.bak >> "$CONFIG_FILE"
rm -rf /etc/openclash/configrules.bak
nohup $CLASH -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
sleep 3
if pidof clash >/dev/null; then
add_cron
if [ -z "$(uci get dhcp.lan.dhcpv6 2>/dev/null)" ]; then
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 10
else
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 10
echo "OpenClash 启动成功检测到您启用了IPV6的DHCP服务可能会造成连接异常" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
sleep 10
fi
echo "" >$START_LOG
else
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
sleep 10
echo "OpenClash 启动成功检测到您启用了IPV6的DHCP服务可能会造成连接异常" >$START_LOG
echo "${LOGTIME} OpenClash Start Successful, Please Note That Network May Abnormal With IPV6's DHCP Server" >> $LOG_FILE
echo "错误: OpenClash 启动失败,请到日志页面查看详细错误信息!" >$START_LOG
echo "${LOGTIME} OpenClash Can Not Start, Please Check The Error Info And Try Again" >> $LOG_FILE
sleep 10
echo "" >$START_LOG
stop && echo "" >$START_LOG
fi
echo "" >$START_LOG
else
echo "错误: OpenClash 启动失败,请到日志页面查看详细错误信息!" >$START_LOG
echo "${LOGTIME} OpenClash Can Not Start, Please Check The Error Info And Try Again" >> $LOG_FILE
@ -526,15 +715,16 @@ EOF
echo "" >$START_LOG
stop && echo "" >$START_LOG
fi
else
echo "错误: OpenClash 启动失败,请到日志页面查看详细错误信息!" >$START_LOG
echo "${LOGTIME} OpenClash Can Not Start, Please Check The Error Info And Try Again" >> $LOG_FILE
sleep 10
echo "" >$START_LOG
stop && echo "" >$START_LOG
fi
fi
fi
else
nohup $CLASH -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
echo "错误: 配置文件完整性检查不通过,已自动还原配置文件,请根据日志信息对照模板格式检查修改配置文件!" >$START_LOG
mv $START_BACKUP $CONFIG_FILE
stop
sleep 5
echo "" >$START_LOG
fi
rm -rf $START_BACKUP 2>/dev/null
else
@ -554,19 +744,15 @@ fi
stop()
{
#禁止多个实例
status=$(ps|grep -c /etc/init.d/openclash)
[ "$status" -gt "3" ] && exit 0
echo "OpenClash 开始关闭..." >$START_LOG
echo "第一步: 删除 OpenClash 防火墙规则..." >$START_LOG
rm -rf /var/etc/openclash.include 2>/dev/null
#ipv4
iptables -t nat -F openclash >/dev/null 2>&1
nat_clashs=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/openclash/=' |sort -rn)
nat_clashs=$(iptables -nvL zone_lan_prerouting -t nat |sed 1,2d |sed -n '/openclash/=' |sort -rn)
for nat_clash in $nat_clashs; do
iptables -t nat -D PREROUTING "$nat_clash" >/dev/null 2>&1
iptables -t nat -D zone_lan_prerouting "$nat_clash" >/dev/null 2>&1
done
iptables -t nat -X openclash >/dev/null 2>&1
@ -579,12 +765,24 @@ stop()
#ipv6
ip6tables -t nat -F openclash >/dev/null 2>&1
nat6_clashs=$(ip6tables -nvL PREROUTING -t nat 2>/dev/null | sed 1,2d | sed -n '/openclash/=' |sort -r)
nat6_clashs=$(ip6tables -nvL zone_lan_prerouting -t nat 2>/dev/null | sed 1,2d | sed -n '/openclash/=' |sort -r)
for nat6_clash in $nat6_clashs; do
ip6tables -t nat -D PREROUTING "$nat6_clash" >/dev/null 2>&1
ip6tables -t nat -D zone_lan_prerouting "$nat6_clash" >/dev/null 2>&1
done
ip6tables -t nat -X openclash >/dev/null 2>&1
#TUN
ip link set dev clash0 down >/dev/null 2>&1
ip tuntap del clash0 mode tun >/dev/null 2>&1
ip route del default dev clash0 table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
ip rule del fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE" >/dev/null 2>&1
iptables -t mangle -D OUTPUT -j openclash >/dev/null 2>&1
iptables -t mangle -D PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK" >/dev/null 2>&1
ip6tables -t mangle -D PREROUTING -j MARK --set-mark "$PROXY_FWMARK" >/dev/null 2>&1
iptables -t mangle -F openclash >/dev/null 2>&1
iptables -t mangle -X openclash >/dev/null 2>&1
ipset destroy localnetwork >/dev/null 2>&1
echo "第二步: 关闭 OpenClash 守护程序..." >$START_LOG
watchdog_pids=$(ps |grep openclash_watchdog.sh |grep -v grep |awk '{print $1}' 2>/dev/null)

View File

@ -116,6 +116,51 @@ Rule:
- DOMAIN-SUFFIX,zlne800.com,Hijacking
- DOMAIN-SUFFIX,zunmi.cn,Hijacking
- DOMAIN-SUFFIX,zzd6.com,Hijacking
- IP-CIDR,39.107.15.115/32,Hijacking,no-resolve
- IP-CIDR,47.89.59.182/32,Hijacking,no-resolve
- IP-CIDR,103.49.209.27/32,Hijacking,no-resolve
- IP-CIDR,123.56.152.96/32,Hijacking,no-resolve
# > ChinaTelecom
- IP-CIDR,61.160.200.223/32,Hijacking,no-resolve
- IP-CIDR,61.160.200.242/32,Hijacking,no-resolve
- IP-CIDR,61.160.200.252/32,Hijacking,no-resolve
- IP-CIDR,61.174.50.214/32,Hijacking,no-resolve
- IP-CIDR,111.175.220.163/32,Hijacking,no-resolve
- IP-CIDR,111.175.220.164/32,Hijacking,no-resolve
- IP-CIDR,122.229.8.47/32,Hijacking,no-resolve
- IP-CIDR,122.229.29.89/32,Hijacking,no-resolve
- IP-CIDR,124.232.160.178/32,Hijacking,no-resolve
- IP-CIDR,175.6.223.15/32,Hijacking,no-resolve
- IP-CIDR,183.59.53.237/32,Hijacking,no-resolve
- IP-CIDR,218.93.127.37/32,Hijacking,no-resolve
- IP-CIDR,221.228.17.152/32,Hijacking,no-resolve
- IP-CIDR,221.231.6.79/32,Hijacking,no-resolve
- IP-CIDR,222.186.61.91/32,Hijacking,no-resolve
- IP-CIDR,222.186.61.95/32,Hijacking,no-resolve
- IP-CIDR,222.186.61.96/32,Hijacking,no-resolve
- IP-CIDR,222.186.61.97/32,Hijacking,no-resolve
# > ChinaUnicom
- IP-CIDR,106.75.231.48/32,Hijacking,no-resolve
- IP-CIDR,119.4.249.166/32,Hijacking,no-resolve
- IP-CIDR,220.196.52.141/32,Hijacking,no-resolve
- IP-CIDR,221.6.4.148/32,Hijacking,no-resolve
# > ChinaMobile
- IP-CIDR,114.247.28.96/32,Hijacking,no-resolve
- IP-CIDR,221.179.131.72/32,Hijacking,no-resolve
- IP-CIDR,221.179.140.145/32,Hijacking,no-resolve
# > Dr.Peng
# - IP-CIDR,10.72.25.0/24,Hijacking,no-resolve
- IP-CIDR,115.182.16.79/32,Hijacking,no-resolve
- IP-CIDR,118.144.88.126/32,Hijacking,no-resolve
- IP-CIDR,118.144.88.215/32,Hijacking,no-resolve
- IP-CIDR,118.144.88.216/32,Hijacking,no-resolve
- IP-CIDR,120.76.189.132/32,Hijacking,no-resolve
- IP-CIDR,124.14.21.147/32,Hijacking,no-resolve
- IP-CIDR,124.14.21.151/32,Hijacking,no-resolve
- IP-CIDR,180.166.52.24/32,Hijacking,no-resolve
- IP-CIDR,211.161.101.106/32,Hijacking,no-resolve
- IP-CIDR,220.115.251.25/32,Hijacking,no-resolve
- IP-CIDR,222.73.156.235/32,Hijacking,no-resolve
# Malware 恶意网站
# > 快压
@ -217,6 +262,8 @@ Rule:
- DOMAIN-SUFFIX,scdn.co,GlobalMedia
- DOMAIN-SUFFIX,spotify.com,GlobalMedia
- DOMAIN-SUFFIX,spoti.fi,GlobalMedia
- DOMAIN-KEYWORD,spotify.com,GlobalMedia
- DOMAIN-KEYWORD,-spotify-com,GlobalMedia
# > TIDAL
# USER-AGENT,TIDAL*,GlobalMedia
- DOMAIN-SUFFIX,tidal.com,GlobalMedia
@ -244,8 +291,13 @@ Rule:
- DOMAIN-SUFFIX,aiv-cdn.net,GlobalMedia
- DOMAIN-SUFFIX,aiv-delivery.net,GlobalMedia
- DOMAIN-SUFFIX,amazonvideo.com,GlobalMedia
- DOMAIN-SUFFIX,media-amazon.com,GlobalMedia
- DOMAIN-SUFFIX,primevideo.com,GlobalMedia
- DOMAIN,avodmp4s3ww-a.akamaihd.net,GlobalMedia
- DOMAIN,d25xi40x97liuc.cloudfront.net,GlobalMedia
- DOMAIN,dmqdd6hw24ucf.cloudfront.net,GlobalMedia
- DOMAIN,d22qjgkvxw22r6.cloudfront.net,GlobalMedia
- DOMAIN,d1v5ir2lpwr8os.cloudfront.net,GlobalMedia
- DOMAIN-KEYWORD,avoddashs,GlobalMedia
# > Bahamut
# USER-AGENT,Anime*,GlobalMedia
- DOMAIN-SUFFIX,bahamut.com.tw,GlobalMedia
@ -359,6 +411,15 @@ Rule:
- DOMAIN-SUFFIX,netflixdnstest7.com,GlobalMedia
- DOMAIN-SUFFIX,netflixdnstest8.com,GlobalMedia
- DOMAIN-SUFFIX,netflixdnstest9.com,GlobalMedia
- IP-CIDR,23.246.0.0/18,GlobalMedia,no-resolve
- IP-CIDR,37.77.184.0/21,GlobalMedia,no-resolve
- IP-CIDR,45.57.0.0/17,GlobalMedia,no-resolve
- IP-CIDR,64.120.128.0/17,GlobalMedia,no-resolve
- IP-CIDR,66.197.128.0/17,GlobalMedia,no-resolve
- IP-CIDR,108.175.32.0/20,GlobalMedia,no-resolve
- IP-CIDR,192.173.64.0/18,GlobalMedia,no-resolve
- IP-CIDR,198.38.96.0/19,GlobalMedia,no-resolve
- IP-CIDR,198.45.48.0/20,GlobalMedia,no-resolve
# > niconico
# USER-AGENT,Niconico*,GlobalMedia
- DOMAIN-SUFFIX,dmc.nico,GlobalMedia
@ -407,6 +468,7 @@ Rule:
# (DNS Cache Pollution Protection)
# > Google
- DOMAIN-SUFFIX,ampproject.org,PROXY
- DOMAIN-SUFFIX,appspot.com,PROXY
- DOMAIN-SUFFIX,blogger.com,PROXY
- DOMAIN-SUFFIX,getoutline.org,PROXY
@ -436,6 +498,15 @@ Rule:
- DOMAIN-SUFFIX,whatsapp.com,PROXY
- DOMAIN-SUFFIX,whatsapp.net,PROXY
- DOMAIN-KEYWORD,facebook,PROXY
- IP-CIDR,3.123.36.126/32,PROXY,no-resolve
- IP-CIDR,35.157.215.84/32,PROXY,no-resolve
- IP-CIDR,35.157.217.255/32,PROXY,no-resolve
- IP-CIDR,52.58.209.134/32,PROXY,no-resolve
- IP-CIDR,54.93.124.31/32,PROXY,no-resolve
- IP-CIDR,54.162.243.80/32,PROXY,no-resolve
- IP-CIDR,54.173.34.141/32,PROXY,no-resolve
- IP-CIDR,54.235.23.242/32,PROXY,no-resolve
- IP-CIDR,169.45.248.118/32,PROXY,no-resolve
# > Twitter
- DOMAIN-SUFFIX,pscp.tv,PROXY
- DOMAIN-SUFFIX,periscope.tv,PROXY
@ -451,11 +522,21 @@ Rule:
- DOMAIN-SUFFIX,telegra.ph,PROXY
- DOMAIN-SUFFIX,telegram.me,PROXY
- DOMAIN-SUFFIX,telegram.org,PROXY
- IP-CIDR,91.108.4.0/22,PROXY,no-resolve
- IP-CIDR,91.108.8.0/22,PROXY,no-resolve
- IP-CIDR,91.108.12.0/22,PROXY,no-resolve
- IP-CIDR,91.108.16.0/22,PROXY,no-resolve
- IP-CIDR,91.108.56.0/22,PROXY,no-resolve
- IP-CIDR,149.154.160.0/20,PROXY,no-resolve
# > Line
- DOMAIN-SUFFIX,line.me,PROXY
- DOMAIN-SUFFIX,line-apps.com,PROXY
- DOMAIN-SUFFIX,line-scdn.net,PROXY
- DOMAIN-SUFFIX,naver.jp,PROXY
- IP-CIDR,103.2.30.0/23,PROXY,no-resolve
- IP-CIDR,125.209.208.0/20,PROXY,no-resolve
- IP-CIDR,147.92.128.0/17,PROXY,no-resolve
- IP-CIDR,203.104.144.0/21,PROXY,no-resolve
# > Other
- DOMAIN-SUFFIX,4shared.com,PROXY
- DOMAIN-SUFFIX,520cc.cc,PROXY
@ -692,6 +773,7 @@ Rule:
- DOMAIN-SUFFIX,shopee.tw,PROXY
- DOMAIN-SUFFIX,slideshare.net,PROXY
- DOMAIN-SUFFIX,softfamous.com,PROXY
- DOMAIN-SUFFIX,soundcloud.com,PROXY
- DOMAIN-SUFFIX,ssrcloud.org,PROXY
- DOMAIN-SUFFIX,startpage.com,PROXY
- DOMAIN-SUFFIX,steamcommunity.com,PROXY
@ -1135,8 +1217,10 @@ Rule:
- DOMAIN-SUFFIX,gazellegames.net,DIRECT
- DOMAIN-SUFFIX,hdchina.org,DIRECT
- DOMAIN-SUFFIX,hdsky.me,DIRECT
- DOMAIN-SUFFIX,icetorrent.org,DIRECT
- DOMAIN-SUFFIX,jpopsuki.eu,DIRECT
- DOMAIN-SUFFIX,keepfrds.com,DIRECT
- DOMAIN-SUFFIX,madsrevolution.net,DIRECT
- DOMAIN-SUFFIX,m-team.cc,DIRECT
- DOMAIN-SUFFIX,nanyangpt.com,DIRECT
- DOMAIN-SUFFIX,ncore.cc,DIRECT
@ -1148,6 +1232,63 @@ Rule:
- DOMAIN-SUFFIX,springsunday.net,DIRECT
- DOMAIN-SUFFIX,tjupt.org,DIRECT
- DOMAIN-SUFFIX,totheglory.im,DIRECT
# > Scholar
- DOMAIN-SUFFIX,acm.org,DIRECT
- DOMAIN-SUFFIX,acs.org,DIRECT
- DOMAIN-SUFFIX,aip.org,DIRECT
- DOMAIN-SUFFIX,ams.org,DIRECT
- DOMAIN-SUFFIX,annualreviews.org,DIRECT
- DOMAIN-SUFFIX,aps.org,DIRECT
- DOMAIN-SUFFIX,ascelibrary.org,DIRECT
- DOMAIN-SUFFIX,asm.org,DIRECT
- DOMAIN-SUFFIX,asme.org,DIRECT
- DOMAIN-SUFFIX,astm.org,DIRECT
- DOMAIN-SUFFIX,bmj.com,DIRECT
- DOMAIN-SUFFIX,cambridge.org,DIRECT
- DOMAIN-SUFFIX,cas.org,DIRECT
- DOMAIN-SUFFIX,clarivate.com,DIRECT
- DOMAIN-SUFFIX,ebscohost.com,DIRECT
- DOMAIN-SUFFIX,emerald.com,DIRECT
- DOMAIN-SUFFIX,engineeringvillage.com,DIRECT
- DOMAIN-SUFFIX,icevirtuallibrary.com,DIRECT
- DOMAIN-SUFFIX,ieee.org,DIRECT
- DOMAIN-SUFFIX,imf.org,DIRECT
- DOMAIN-SUFFIX,iop.org,DIRECT
- DOMAIN-SUFFIX,jamanetwork.com,DIRECT
- DOMAIN-SUFFIX,jhu.edu,DIRECT
- DOMAIN-SUFFIX,jstor.org,DIRECT
- DOMAIN-SUFFIX,karger.com,DIRECT
- DOMAIN-SUFFIX,libguides.com,DIRECT
- DOMAIN-SUFFIX,madsrevolution.net,DIRECT
- DOMAIN-SUFFIX,mpg.de,DIRECT
- DOMAIN-SUFFIX,myilibrary.com,DIRECT
- DOMAIN-SUFFIX,nature.com,DIRECT
- DOMAIN-SUFFIX,oecd-ilibrary.org,DIRECT
- DOMAIN-SUFFIX,osapublishing.org,DIRECT
- DOMAIN-SUFFIX,oup.com,DIRECT
- DOMAIN-SUFFIX,ovid.com,DIRECT
- DOMAIN-SUFFIX,oxfordartonline.com,DIRECT
- DOMAIN-SUFFIX,oxfordbibliographies.com,DIRECT
- DOMAIN-SUFFIX,oxfordmusiconline.com,DIRECT
- DOMAIN-SUFFIX,pnas.org,DIRECT
- DOMAIN-SUFFIX,proquest.com,DIRECT
- DOMAIN-SUFFIX,rsc.org,DIRECT
- DOMAIN-SUFFIX,sagepub.com,DIRECT
- DOMAIN-SUFFIX,sciencedirect.com,DIRECT
- DOMAIN-SUFFIX,sciencemag.org,DIRECT
- DOMAIN-SUFFIX,scopus.com,DIRECT
- DOMAIN-SUFFIX,siam.org,DIRECT
- DOMAIN-SUFFIX,spiedigitallibrary.org,DIRECT
- DOMAIN-SUFFIX,springer.com,DIRECT
- DOMAIN-SUFFIX,springerlink.com,DIRECT
- DOMAIN-SUFFIX,tandfonline.com,DIRECT
- DOMAIN-SUFFIX,un.org,DIRECT
- DOMAIN-SUFFIX,uni-bielefeld.de,DIRECT
- DOMAIN-SUFFIX,webofknowledge.com,DIRECT
- DOMAIN-SUFFIX,westlaw.com,DIRECT
- DOMAIN-SUFFIX,wiley.com,DIRECT
- DOMAIN-SUFFIX,worldbank.org,DIRECT
- DOMAIN-SUFFIX,worldscientific.com,DIRECT
# > Other
- DOMAIN-SUFFIX,cn,DIRECT
- DOMAIN-SUFFIX,360in.com,DIRECT
@ -1275,7 +1416,7 @@ Rule:
- DOMAIN-SUFFIX,me.com,Apple
- DOMAIN-SUFFIX,mzstatic.com,Apple
- DOMAIN,www-cdn.icloud.com.akadns.net,Apple
- IP-CIDR,17.0.0.0/8,Apple
- IP-CIDR,17.0.0.0/8,Apple,no-resolve
# Local Area Network
- IP-CIDR,192.168.0.0/16,DIRECT
@ -1284,128 +1425,8 @@ Rule:
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,100.64.0.0/10,DIRECT
# Internet Service Provider Hijacking 运营商劫持
- IP-CIDR,39.107.15.115/32,Hijacking
- IP-CIDR,47.89.59.182/32,Hijacking
- IP-CIDR,103.49.209.27/32,Hijacking
- IP-CIDR,123.56.152.96/32,Hijacking
# > ChinaNet
- IP-CIDR,61.160.200.223/32,Hijacking
- IP-CIDR,61.160.200.242/32,Hijacking
- IP-CIDR,61.160.200.252/32,Hijacking
- IP-CIDR,61.174.50.214/32,Hijacking
- IP-CIDR,111.175.220.163/32,Hijacking
- IP-CIDR,111.175.220.164/32,Hijacking
- IP-CIDR,124.232.160.178/32,Hijacking
- IP-CIDR,175.6.223.15/32,Hijacking
- IP-CIDR,183.59.53.237/32,Hijacking
- IP-CIDR,218.93.127.37/32,Hijacking
- IP-CIDR,221.228.17.152/32,Hijacking
- IP-CIDR,221.231.6.79/32,Hijacking
- IP-CIDR,222.186.61.91/32,Hijacking
- IP-CIDR,222.186.61.95/32,Hijacking
- IP-CIDR,222.186.61.96/32,Hijacking
- IP-CIDR,222.186.61.97/32,Hijacking
# > ChinaUnicom
- IP-CIDR,106.75.231.48/32,Hijacking
- IP-CIDR,119.4.249.166/32,Hijacking
- IP-CIDR,220.196.52.141/32,Hijacking
- IP-CIDR,221.6.4.148/32,Hijacking
# > ChinaMobile
- IP-CIDR,114.247.28.96/32,Hijacking
- IP-CIDR,221.179.131.72/32,Hijacking
- IP-CIDR,221.179.140.145/32,Hijacking
# > Dr.Peng
- IP-CIDR,10.72.25.0/24,Hijacking
- IP-CIDR,115.182.16.79/32,Hijacking
- IP-CIDR,118.144.88.126/32,Hijacking
- IP-CIDR,118.144.88.215/32,Hijacking
- IP-CIDR,118.144.88.216/32,Hijacking
- IP-CIDR,120.76.189.132/32,Hijacking
- IP-CIDR,124.14.21.147/32,Hijacking
- IP-CIDR,124.14.21.151/32,Hijacking
- IP-CIDR,180.166.52.24/32,Hijacking
- IP-CIDR,211.161.101.106/32,Hijacking
- IP-CIDR,220.115.251.25/32,Hijacking
- IP-CIDR,222.73.156.235/32,Hijacking
# (Extra IP-CIRD)
# > Google
- IP-CIDR,35.190.247.0/24,PROXY
- IP-CIDR,64.233.160.0/19,PROXY
- IP-CIDR,66.102.0.0/20,PROXY
- IP-CIDR,66.249.80.0/20,PROXY
- IP-CIDR,72.14.192.0/18,PROXY
- IP-CIDR,74.125.0.0/16,PROXY
- IP-CIDR,108.177.8.0/21,PROXY
- IP-CIDR,172.217.0.0/16,PROXY
- IP-CIDR,173.194.0.0/16,PROXY
- IP-CIDR,209.85.128.0/17,PROXY
- IP-CIDR,216.58.192.0/19,PROXY
- IP-CIDR,216.239.32.0/19,PROXY
# > Facebook
- IP-CIDR,31.13.24.0/21,PROXY
- IP-CIDR,31.13.64.0/18,PROXY
- IP-CIDR,45.64.40.0/22,PROXY
- IP-CIDR,66.220.144.0/20,PROXY
- IP-CIDR,69.63.176.0/20,PROXY
- IP-CIDR,69.171.224.0/19,PROXY
- IP-CIDR,74.119.76.0/22,PROXY
- IP-CIDR,103.4.96.0/22,PROXY
- IP-CIDR,129.134.0.0/17,PROXY
- IP-CIDR,157.240.0.0/17,PROXY
- IP-CIDR,173.252.64.0/19,PROXY
- IP-CIDR,173.252.96.0/19,PROXY
- IP-CIDR,179.60.192.0/22,PROXY
- IP-CIDR,185.60.216.0/22,PROXY
- IP-CIDR,204.15.20.0/22,PROXY
# > WhatsApp
- IP-CIDR,3.123.36.126/32,PROXY
- IP-CIDR,35.157.215.84/32,PROXY
- IP-CIDR,35.157.217.255/32,PROXY
- IP-CIDR,52.58.209.134/32,PROXY
- IP-CIDR,54.93.124.31/32,PROXY
- IP-CIDR,54.162.243.80/32,PROXY
- IP-CIDR,54.173.34.141/32,PROXY
- IP-CIDR,54.235.23.242/32,PROXY
- IP-CIDR,169.45.248.118/32,PROXY
# > Twitter
- IP-CIDR,69.195.160.0/19,PROXY
- IP-CIDR,104.244.42.0/21,PROXY
- IP-CIDR,192.133.76.0/22,PROXY
- IP-CIDR,199.16.156.0/22,PROXY
- IP-CIDR,199.59.148.0/22,PROXY
- IP-CIDR,199.96.56.0/21,PROXY
- IP-CIDR,202.160.128.0/22,PROXY
- IP-CIDR,209.237.192.0/19,PROXY
# > Telegram
- IP-CIDR,67.198.55.0/24,PROXY
- IP-CIDR,91.108.4.0/22,PROXY
- IP-CIDR,91.108.8.0/22,PROXY
- IP-CIDR,91.108.12.0/22,PROXY
- IP-CIDR,91.108.16.0/22,PROXY
- IP-CIDR,91.108.56.0/22,PROXY
- IP-CIDR,109.239.140.0/24,PROXY
- IP-CIDR,149.154.160.0/20,PROXY
- IP-CIDR,205.172.60.0/22,PROXY
# > Line
- IP-CIDR,103.2.30.0/23,PROXY
- IP-CIDR,125.209.208.0/20,PROXY
- IP-CIDR,147.92.128.0/17,PROXY
- IP-CIDR,203.104.144.0/21,PROXY
# > Netflix
- IP-CIDR,23.246.0.0/18,GlobalMedia
- IP-CIDR,37.77.184.0/21,GlobalMedia
- IP-CIDR,45.57.0.0/17,GlobalMedia
- IP-CIDR,64.120.128.0/17,GlobalMedia
- IP-CIDR,66.197.128.0/17,GlobalMedia
- IP-CIDR,108.175.32.0/20,GlobalMedia
- IP-CIDR,192.173.64.0/18,GlobalMedia
- IP-CIDR,198.38.96.0/19,GlobalMedia
- IP-CIDR,198.45.48.0/20,GlobalMedia
# DNSPod Public DNS+
- IP-CIDR,119.28.28.28/32,DIRECT
- IP-CIDR,119.28.28.28/32,DIRECT,no-resolve
# GeoIP China
- GEOIP,CN,DIRECT

File diff suppressed because one or more lines are too long

View File

@ -19,15 +19,26 @@ function index()
entry({"admin", "services", "openclash", "coreupdate"},call("action_coreupdate"))
entry({"admin", "services", "openclash", "ping"}, call("act_ping"))
entry({"admin", "services", "openclash", "settings"},cbi("openclash/settings"),_("Global Settings"), 30).leaf = true
entry({"admin", "services", "openclash", "servers"},cbi("openclash/servers"),_("Severs&Groups"), 40).leaf = true
entry({"admin", "services", "openclash", "servers"},cbi("openclash/servers"),_("Severs and Groups"), 40).leaf = true
entry({"admin", "services", "openclash", "config-subscribe"},cbi("openclash/config-subscribe"),_("Config Update"), 50).leaf = true
entry({"admin", "services", "openclash", "servers-config"},cbi("openclash/servers-config"), nil).leaf = true
entry({"admin", "services", "openclash", "groups-config"},cbi("openclash/groups-config"), nil).leaf = true
entry({"admin", "services", "openclash", "config"},form("openclash/config"),_("Server Config"), 50).leaf = true
entry({"admin", "services", "openclash", "log"},form("openclash/log"),_("Logs"), 60).leaf = true
entry({"admin", "services", "openclash", "proxy-provider-config"},cbi("openclash/proxy-provider-config"), nil).leaf = true
entry({"admin", "services", "openclash", "config"},form("openclash/config"),_("Server Config"), 60).leaf = true
entry({"admin", "services", "openclash", "log"},form("openclash/log"),_("Logs"), 70).leaf = true
end
local fs = require "luci.openclash"
CONFIG_FILE=string.sub(luci.sys.exec("uci get openclash.config.config_path"), 1, -2)
if CONFIG_FILE == "" or not fs.isfile(CONFIG_FILE) then
CONFIG_FILE_FIRST=luci.sys.exec("ls -lt '/etc/openclash/config/' | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}'")
if CONFIG_FILE_FIRST ~= "" then
CONFIG_FILE="/etc/openclash/config/" .. string.sub(CONFIG_FILE_FIRST, 1, -2)
else
CONFIG_FILE = ""
end
end
local function is_running()
return luci.sys.call("pidof clash >/dev/null") == 0
@ -42,25 +53,23 @@ local function is_watchdog()
end
local function config_check()
local yaml = luci.sys.call("ls -l /etc/openclash/config.yaml >/dev/null 2>&1")
local yml = luci.sys.call("ls -l /etc/openclash/config.yml >/dev/null 2>&1")
local yaml = fs.isfile(CONFIG_FILE)
local proxy,group,rule
if (yaml == 0) then
proxy = luci.sys.call("egrep '^ {0,}Proxy:' /etc/openclash/config.yaml >/dev/null 2>&1")
group = luci.sys.call("egrep '^ {0,}Proxy Group:' /etc/openclash/config.yaml >/dev/null 2>&1")
rule = luci.sys.call("egrep '^ {0,}Rule:' /etc/openclash/config.yaml >/dev/null 2>&1")
else
if (yml == 0) then
proxy = luci.sys.call("egrep '^ {0,}Proxy:' /etc/openclash/config.yml >/dev/null 2>&1")
group = luci.sys.call("egrep '^ {0,}Proxy Group:' /etc/openclash/config.yml >/dev/null 2>&1")
rule = luci.sys.call("egrep '^ {0,}Rule:' /etc/openclash/config.yml >/dev/null 2>&1")
end
if yaml then
proxy_provier = luci.sys.call(string.format('egrep "^ {0,}proxy-provider:" "%s" >/dev/null 2>&1',CONFIG_FILE))
proxy = luci.sys.call(string.format('egrep "^ {0,}Proxy:" "%s" >/dev/null 2>&1',CONFIG_FILE))
group = luci.sys.call(string.format('egrep "^ {0,}Proxy Group:" "%s" >/dev/null 2>&1',CONFIG_FILE))
rule = luci.sys.call(string.format('egrep "^ {0,}Rule:" "%s" >/dev/null 2>&1',CONFIG_FILE))
end
if (yaml == 0) or (yml == 0) then
if yaml then
if (proxy == 0) then
proxy = ""
else
proxy = " - 代理服务器"
if (proxy_provier == 0) then
proxy = ""
else
proxy = " - 代理服务器"
end
end
if (group == 0) then
group = ""
@ -73,7 +82,7 @@ local function config_check()
rule = " - 规则"
end
return proxy..group..rule
elseif (yaml ~= 0) and (yml ~= 0) then
elseif (yaml ~= 0) then
return "1"
end
end
@ -87,38 +96,27 @@ local function mode()
end
local function config()
local config_update = luci.sys.exec("ls -l --full-time /etc/openclash/config.bak 2>/dev/null |awk '{print $6,$7;}'")
if (config_update ~= "") then
return config_update
if CONFIG_FILE ~= "" then
return string.sub(CONFIG_FILE, 23, -1)
else
local yaml = luci.sys.call("ls -l /etc/openclash/config.yaml >/dev/null 2>&1")
if (yaml == 0) then
return "0"
else
local yml = luci.sys.call("ls -l /etc/openclash/config.yml >/dev/null 2>&1")
if (yml == 0) then
return "0"
else
return "1"
end
end
return "1"
end
end
local function ipdb()
return luci.sys.exec("ls -l --full-time /etc/openclash/Country.mmdb 2>/dev/null |awk '{print $6,$7;}'")
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/etc/openclash/Country.mmdb"))
end
local function lhie1()
return luci.sys.exec("ls -l --full-time /etc/openclash/lhie1.yaml 2>/dev/null |awk '{print $6,$7;}'")
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/etc/openclash/lhie1.yaml"))
end
local function ConnersHua()
return luci.sys.exec("ls -l --full-time /etc/openclash/ConnersHua.yaml 2>/dev/null |awk '{print $6,$7;}'")
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/etc/openclash/ConnersHua.yaml"))
end
local function ConnersHua_return()
return luci.sys.exec("ls -l --full-time /etc/openclash/ConnersHua_return.yaml 2>/dev/null |awk '{print $6,$7;}'")
return os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/etc/openclash/ConnersHua_return.yaml"))
end
local function daip()
@ -187,10 +185,10 @@ local function corever()
end
local function upchecktime()
local corecheck = luci.sys.exec("ls -l --full-time /tmp/clash_last_version 2>/dev/null |awk '{print $6,$7;}'")
local corecheck = os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/tmp/clash_last_version"))
local opcheck
if not corecheck or corecheck == "" then
opcheck = luci.sys.exec("ls -l --full-time /tmp/openclash_last_version 2>/dev/null |awk '{print $6,$7;}'")
opcheck = os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/tmp/openclash_last_version"))
if not opcheck or opcheck == "" then
return "1"
else

View File

@ -4,35 +4,9 @@ local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local fs = require "luci.openclash"
local uci = require("luci.model.uci").cursor()
local t = {
{enable, disable}
}
a = SimpleForm("apply")
a.reset = false
a.submit = false
s = a:section(Table, t)
o = s:option(Button, "enable")
o.inputtitle = translate("Enable Clash")
o.inputstyle = "apply"
o.write = function()
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
end
o = s:option(Button, "disable")
o.inputtitle = translate("Disable Clash")
o.inputstyle = "reset"
o.write = function()
uci:set("openclash", "config", "enable", 0)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &")
end
m = Map("openclash")
m.title = translate("OpenClash")
m.description = translate("A Clash Client For OpenWrt")
@ -40,11 +14,94 @@ m.pageaction = false
m:section(SimpleSection).template = "openclash/status"
m:section(SimpleSection).template = "openclash/state"
m:section(SimpleSection).template = "openclash/myip"
local e,a={}
for t,o in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(o)
if a then
e[t]={}
e[t].name=fs.basename(o)
BACKUP_FILE="/etc/openclash/backup/".. e[t].name
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(BACKUP_FILE)) or os.date("%Y-%m-%d %H:%M:%S",a.mtime)
if string.sub(luci.sys.exec("uci get openclash.config.config_path"), 23, -2) == e[t].name then
e[t].state=translate("Enable")
else
e[t].state=translate("Disable")
end
e[t].size=tostring(a.size)
e[t].remove=0
e[t].enable=false
end
end
form=SimpleForm("filelist")
form.reset=false
form.submit=false
tb=form:section(Table,e)
st=tb:option(DummyValue,"state",translate("State"))
nm=tb:option(DummyValue,"name",translate("File Name"))
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e==".yaml"
end
btnis=tb:option(Button,"switch",translate("Switch Config"))
btnis.template="openclash/other_button"
btnis.render=function(o,t,a)
if not e[t]then return false end
if IsYamlFile(e[t].name)then
a.display=""
else
a.display="none"
end
o.inputstyle="apply"
Button.render(o,t,a)
end
btnis.write=function(a,t)
luci.sys.exec(string.format('uci set openclash.config.config_path="/etc/openclash/config/%s"',e[t].name))
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "client"))
end
s = Map("openclash")
s.pageaction = false
s:section(SimpleSection).template = "openclash/myip"
local t = {
{enable, disable}
}
ap = SimpleForm("apply")
ap.reset = false
ap.submit = false
ss = ap:section(Table, t)
o = ss:option(Button, "enable")
o.inputtitle = translate("Enable Clash")
o.inputstyle = "apply"
o.write = function()
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
end
o = ss:option(Button, "disable")
o.inputtitle = translate("Disable Clash")
o.inputstyle = "reset"
o.write = function()
uci:set("openclash", "config", "enable", 0)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &")
end
d = Map("openclash")
d.title = translate("Technical Support")
d.pageaction = false
d:section(SimpleSection).template = "openclash/developer"
return m, a, d
return m, form, s, ap, d

View File

@ -0,0 +1,126 @@
local m, s, o
local openclash = "openclash"
local NXFS = require "nixio.fs"
local SYS = require "luci.sys"
local HTTP = require "luci.http"
local DISP = require "luci.dispatcher"
local UTIL = require "luci.util"
local uci = require "luci.model.uci".cursor()
font_red = [[<font color="red">]]
font_off = [[</font>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
m = Map(openclash, translate("Config Update"))
m.pageaction = false
s = m:section(TypedSection, "openclash")
s.anonymous = true
---- update Settings
o = s:option(ListValue, "auto_update", translate("Auto Update"))
o.description = translate("Auto Update Server subscription")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:option(ListValue, "config_update_week_time", translate("Update Time (Every Week)"))
o:value("*", translate("Every Day"))
o:value("1", translate("Every Monday"))
o:value("2", translate("Every Tuesday"))
o:value("3", translate("Every Wednesday"))
o:value("4", translate("Every Thursday"))
o:value("5", translate("Every Friday"))
o:value("6", translate("Every Saturday"))
o:value("0", translate("Every Sunday"))
o.default=1
o = s:option(ListValue, "auto_update_time", translate("Update time (every day)"))
for t = 0,23 do
o:value(t, t..":00")
end
o.default=0
o.rmempty = false
o = s:option(Button, translate("Config File Update"))
o.title = translate("Update Subcription")
o.inputtitle = translate("Check And Update")
o.inputstyle = "reload"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
local config_name=string.sub(luci.sys.exec("uci get openclash.config.config_path"), 23, -2)
SYS.call("rm -rf /etc/openclash/backup/* 2>/dev/null")
SYS.call("/usr/share/openclash/openclash.sh >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
-- [[ Edit Server ]] --
s = m:section(TypedSection, "config_subscribe")
s.anonymous = true
s.addremove = true
s.sortable = false
s.template = "cbi/tblsection"
s.rmempty = false
---- enable flag
o = s:option(Flag, "enabled", translate("Enable"), font_red..bold_on..translate("(Enable or Disable Subscribe)")..bold_off..font_off)
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
---- name
o = s:option(Value, "name", translate("Config Alias"))
o.description = font_red..bold_on..translate("(Name For Distinguishing)")..bold_off..font_off
o.placeholder = translate("config")
o.rmempty = true
---- type
o = s:option(ListValue, "type", translate("Subscribe Type"))
o.description = font_red..bold_on..translate("(Power By fndroid)")..bold_off..font_off
o:value("clash", translate("Clash"))
o:value("v2rayn", translate("V2rayN"))
o:value("surge", translate("Surge"))
o.default="clash"
o.rempty = false
---- address
o = s:option(Value, "address", translate("Subscribe Address"))
o.description = font_red..bold_on..translate("(Not Null)")..bold_off..font_off
o.placeholder = translate("Not Null")
o.datatype = "or(host, string)"
o.rmempty = true
---- key
o = s:option(DynamicList, "keyword", font_red..bold_on..translate("Keyword Match")..bold_off..font_off)
o.description = font_red..bold_on..translate("(eg: hk or tw&bgp)")..bold_off..font_off
o.rmempty = true
local t = {
{Commit, Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Commit")
o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:commit("openclash")
end
o = a:option(Button, "Apply")
o.inputtitle = translate("Apply Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
return m

View File

@ -8,7 +8,18 @@ local fs = require "luci.openclash"
local uci = require("luci.model.uci").cursor()
local CHIF = "0"
ful = SimpleForm("upload", translate("Server Configuration"), nil)
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
ful = SimpleForm("upload", translate("Server Config"), nil)
ful.reset = false
ful.submit = false
@ -20,13 +31,24 @@ um.template = "openclash/dvalue"
local dir, fd, clash
clash = "/etc/openclash/clash"
dir = "/etc/openclash/"
dir = "/etc/openclash/config/"
bakck_dir="/etc/openclash/backup"
proxy_pro_dir="/etc/openclash/proxy_provider/"
create_bakck_dir=fs.mkdir(bakck_dir)
create_proxy_pro_dir=fs.mkdir(proxy_pro_dir)
HTTP.setfilehandler(
function(meta, chunk, eof)
local fp = HTTP.formvalue("file_type")
if not fd then
if not meta then return end
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
if fp == "config" then
if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end
elseif fp == "proxy-provider" then
if meta and chunk then fd = nixio.open(proxy_pro_dir .. meta.file, "w") end
end
if not fd then
um.value = translate("upload file error.")
@ -39,17 +61,22 @@ HTTP.setfilehandler(
if eof and fd then
fd:close()
fd = nil
if (meta.file == "config.yml") then
SYS.call("mv /etc/openclash/config.yml /etc/openclash/config.yaml")
SYS.call("cp /etc/openclash/config.yaml /etc/openclash/config.bak")
elseif (meta.file == "config.yaml") then
SYS.call("cp /etc/openclash/config.yaml /etc/openclash/config.bak")
if IsYamlFile(meta.file) and fp ~= "proxy-provider" then
local yamlbackup="/etc/openclash/backup/" .. meta.file
local c=fs.copy(dir .. meta.file,yamlbackup)
end
if IsYmlFile(meta.file) and fp ~= "proxy-provider" then
local ymlname=string.lower(string.sub(meta.file,0,-5))
local ymlbackup="/etc/openclash/backup/".. ymlname .. ".yaml"
local c=fs.rename(dir .. meta.file,"/etc/openclash/config/".. ymlname .. ".yaml")
local c=fs.copy("/etc/openclash/config/".. ymlname .. ".yaml",ymlbackup)
end
if fp ~= "proxy-provider" then
um.value = translate("File saved to") .. ' "/etc/openclash/config/"'
CHIF = "1"
else
um.value = translate("File saved to") .. ' "/etc/openclash/proxy_provider/"'
end
if (meta.file == "clash") then
NXFS.chmod(clash, 755)
end
um.value = translate("File saved to") .. ' "/etc/openclash"'
CHIF = "1"
end
end
)
@ -61,78 +88,72 @@ if HTTP.formvalue("upload") then
end
end
m = SimpleForm("openclash")
m.reset = false
m.submit = false
local tab = {
{user, default}
}
s = m:section(Table, tab)
local conf = "/etc/openclash/config.yaml"
local yconf = "/etc/openclash/config.yml"
local dconf = "/etc/openclash/default.yaml"
local bconf = "/etc/openclash/config.bak"
sev = s:option(Value, "user")
sev.template = "cbi/tvalue"
sev.description = translate("You Can Modify config file Here, Except The Settings That Were Taken Over")
sev.rows = 20
sev.wrap = "off"
sev.cfgvalue = function(self, section)
return NXFS.readfile(conf) or NXFS.readfile(yconf) or NXFS.readfile(bconf) or NXFS.readfile(dconf) or ""
local e,a={}
for t,o in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(o)
if a then
e[t]={}
e[t].name=fs.basename(o)
BACKUP_FILE="/etc/openclash/backup/".. e[t].name
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(BACKUP_FILE)) or os.date("%Y-%m-%d %H:%M:%S",a.mtime)
if string.sub(luci.sys.exec("uci get openclash.config.config_path"), 23, -2) == e[t].name then
e[t].state=translate("Enable")
else
e[t].state=translate("Disable")
end
sev.write = function(self, section, value)
if (CHIF == "0") then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/openclash/config.yaml", value)
e[t].size=tostring(a.size)
e[t].remove=0
e[t].enable=false
end
end
def = s:option(Value, "default")
def.template = "cbi/tvalue"
def.description = translate("Default Config File With Correct General-Settings")
def.rows = 20
def.wrap = "off"
def.readonly = true
def.cfgvalue = function(self, section)
return NXFS.readfile(dconf) or ""
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
def.write = function(self, section, value)
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
form=SimpleForm("config_file_list",translate("Config File List"))
form.reset=false
form.submit=false
tb=form:section(Table,e)
st=tb:option(DummyValue,"state",translate("State"))
nm=tb:option(DummyValue,"name",translate("File Name"))
mt=tb:option(DummyValue,"mtime",translate("Update Time"))
sz=tb:option(DummyValue,"size",translate("Size"))
btnis=tb:option(Button,"switch",translate("Switch Config"))
btnis.template="openclash/other_button"
btnis.render=function(o,t,a)
if not e[t] then return false end
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
a.display=""
else
a.display="none"
end
o.inputstyle="apply"
Button.render(o,t,a)
end
btnis.write=function(a,t)
luci.sys.exec(string.format('uci set openclash.config.config_path="/etc/openclash/config/%s"',e[t].name))
uci:commit("openclash")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config"))
end
local t = {
{Commit, Apply, Download}
}
a = m:section(Table, t)
o = a:option(Button, "Commit")
o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
uci:commit("openclash")
btndl = tb:option(Button,"download",translate("Download Configurations"))
btndl.template="openclash/other_button"
btndl.render=function(e,t,a)
e.inputstyle="remove"
Button.render(e,t,a)
end
o = a:option(Button, "Apply")
o.inputtitle = translate("Apply Configurations")
o.inputstyle = "apply"
o.write = function()
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
o = a:option(Button, "Download")
o.inputtitle = translate("Download Configurations")
o.inputstyle = "apply"
o.write = function ()
btndl.write = function (a,t)
local sPath, sFile, fd, block
sPath = "/etc/openclash/config.yaml"
sPath = "/etc/openclash/config/"..e[t].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
@ -157,4 +178,145 @@ o.write = function ()
HTTP.close()
end
return ful , m
btnrm=tb:option(Button,"remove",translate("Remove"))
btnrm.render=function(e,t,a)
e.inputstyle="reset"
Button.render(e,t,a)
end
btnrm.write=function(a,t)
local a=fs.unlink("/etc/openclash/config/"..luci.openclash.basename(e[t].name))
local db=fs.unlink("/etc/openclash/backup/"..luci.openclash.basename(e[t].name))
if a then table.remove(e,t)end
return a
end
local p,r={}
for x,y in ipairs(fs.glob("/etc/openclash/proxy_provider/*"))do
r=fs.stat(y)
if r then
p[x]={}
p[x].name=fs.basename(y)
p[x].mtime=os.date("%Y-%m-%d %H:%M:%S",r.mtime)
p[x].size=tostring(r.size)
p[x].remove=0
p[x].enable=false
end
end
proxy_form=SimpleForm("proxy_provider_file_list",translate("Proxy Provider File List"))
proxy_form.reset=false
proxy_form.submit=false
tb1=proxy_form:section(Table,p)
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.template="openclash/other_button"
btndl1.render=function(y,x,r)
y.inputstyle="remove"
Button.render(y,x,r)
end
btndl1.write = function (r,x)
local sPath, sFile, fd, block
sPath = "/etc/openclash/proxy_provider/"..p[x].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
btnrm1=tb1:option(Button,"remove1",translate("Remove"))
btnrm1.render=function(p,x,r)
p.inputstyle="reset"
Button.render(p,x,r)
end
btnrm1.write=function(r,x)
local r=fs.unlink("/etc/openclash/proxy_provider/"..luci.openclash.basename(p[x].name))
if r then table.remove(p,x)end
return r
end
m = SimpleForm("openclash")
m.reset = false
m.submit = false
local tab = {
{user, default}
}
s = m:section(Table, tab)
local conf = string.sub(luci.sys.exec("uci get openclash.config.config_path"), 1, -2)
local dconf = "/etc/openclash/default.yaml"
sev = s:option(Value, "user")
sev.template = "cbi/tvalue"
sev.description = translate("You Can Modify config file Here, Except The Settings That Were Taken Over")
sev.rows = 20
sev.wrap = "off"
sev.cfgvalue = function(self, section)
return NXFS.readfile(conf) or NXFS.readfile(dconf) or ""
end
sev.write = function(self, section, value)
if (CHIF == "0") then
value = value:gsub("\r\n?", "\n")
NXFS.writefile(conf, value)
end
end
def = s:option(Value, "default")
def.template = "cbi/tvalue"
def.description = translate("Default Config File With Correct General-Settings")
def.rows = 20
def.wrap = "off"
def.readonly = true
def.cfgvalue = function(self, section)
return NXFS.readfile(dconf) or ""
end
def.write = function(self, section, value)
end
local t = {
{Commit, Apply}
}
a = m:section(Table, t)
o = a:option(Button, "Commit")
o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
uci:commit("openclash")
end
o = a:option(Button, "Apply")
o.inputtitle = translate("Apply Configurations")
o.inputstyle = "apply"
o.write = function()
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
return ful , form , proxy_form , m

View File

@ -2,7 +2,7 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "nixio.fs"
local fs = require "luci.openclash"
local sys = require "luci.sys"
local sid = arg[1]
@ -11,6 +11,17 @@ font_off = [[</font>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
m = Map(openclash, translate("Edit Group"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/servers")
@ -24,6 +35,20 @@ s = m:section(NamedSection, sid, "groups")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
o = s:option(ListValue, "type", translate("Group Type"))
o.rmempty = true
o.description = translate("Choose The Operation Mode")

View File

@ -0,0 +1,128 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local sys = require "luci.sys"
local sid = arg[1]
local fs = require "luci.openclash"
font_red = [[<font color="red">]]
font_off = [[</font>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
m = Map(openclash, translate("Edit Proxy-Provider"))
m.pageaction = false
m.redirect = luci.dispatcher.build_url("admin/services/openclash/servers")
if m.uci:get(openclash, sid) ~= "proxy-provider" then
luci.http.redirect(m.redirect)
return
end
-- [[ Provider Setting ]]--
s = m:section(NamedSection, sid, "proxy-provider")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
o = s:option(ListValue, "type", translate("Provider Type"))
o.rmempty = true
o.description = translate("Choose The Provider Type")
o:value("http")
o:value("file")
o = s:option(Value, "name", translate("Provider Name"))
o.rmempty = false
o = s:option(ListValue, "path", translate("Provider Path"))
o.description = translate("Update Your Proxy Provider File From Config Luci Page")
local p,h={}
for t,f in ipairs(fs.glob("/etc/openclash/proxy_provider/*"))do
h=fs.stat(f)
if h then
p[t]={}
p[t].name=fs.basename(f)
if IsYamlFile(p[t].name) or IsYmlFile(p[t].name) then
o:value("./proxy_provider/"..p[t].name)
end
end
end
o.rmempty = false
o:depends("type", "file")
o = s:option(Value, "provider_url", translate("Provider URL"))
o.rmempty = false
o:depends("type", "http")
o = s:option(Value, "provider_interval", translate("Provider Interval(s)"))
o.default = "3600"
o.rmempty = false
o:depends("type", "http")
o = s:option(ListValue, "health_check", translate("Provider Health Check"))
o:value("false", translate("Disable"))
o:value("true", translate("Enable"))
o.default=true
o = s:option(Value, "health_check_url", translate("Health Check URL"))
o.default = "http://www.gstatic.com/generate_204"
o.rmempty = false
o = s:option(Value, "health_check_interval", translate("Health Check Interval(s)"))
o.default = "300"
o.rmempty = false
o = s:option(DynamicList, "groups", translate("Proxy Group"))
o.description = font_red..bold_on..translate("No Need Set when Config Create, The added Proxy Groups Must Exist")..bold_off..font_off
o.rmempty = true
m.uci:foreach("openclash", "groups",
function(s)
o:value(s.name)
end)
local t = {
{Commit, Back}
}
a = m:section(Table, t)
o = a:option(Button,"Commit")
o.inputtitle = translate("Commit Configurations")
o.inputstyle = "apply"
o.write = function()
m.uci:commit(openclash)
luci.http.redirect(m.redirect)
end
o = a:option(Button,"Back")
o.inputtitle = translate("Back Configurations")
o.inputstyle = "reset"
o.write = function()
m.uci:revert(openclash)
luci.http.redirect(m.redirect)
end
return m

View File

@ -2,7 +2,7 @@
local m, s, o
local openclash = "openclash"
local uci = luci.model.uci.cursor()
local fs = require "nixio.fs"
local fs = require "luci.openclash"
local sys = require "luci.sys"
local sid = arg[1]
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
@ -12,6 +12,17 @@ font_off = [[</font>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
function IsYamlFile(e)
e=e or""
local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml"
end
function IsYmlFile(e)
e=e or""
local e=string.lower(string.sub(e,-4,-1))
return e == ".yml"
end
local encrypt_methods_ss = {
-- stream
@ -52,13 +63,26 @@ s = m:section(NamedSection, sid, "servers")
s.anonymous = true
s.addremove = false
o = s:option(ListValue, "config", translate("Config File"))
o:value("all", translate("Use For All Config File"))
local e,a={}
for t,f in ipairs(fs.glob("/etc/openclash/config/*"))do
a=fs.stat(f)
if a then
e[t]={}
e[t].name=fs.basename(f)
if IsYamlFile(e[t].name) or IsYmlFile(e[t].name) then
o:value(e[t].name)
end
end
end
o = s:option(ListValue, "type", translate("Server Node Type"))
o:value("ss", translate("Shadowsocks"))
o:value("vmess", translate("Vmess"))
o:value("snell", translate("Snell"))
o:value("socks5", translate("Socks5"))
o:value("http", translate("HTTP(S)"))
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
o = s:option(Value, "name", translate("Server Alias"))

View File

@ -57,6 +57,11 @@ function s.create(...)
end
end
o = s:option(DummyValue, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "type", translate("Group Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
@ -67,6 +72,43 @@ function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
-- [[ Proxy-Provider Manage ]]--
s = m:section(TypedSection, "proxy-provider", translate("Proxy-Provider"))
s.anonymous = true
s.addremove = true
s.sortable = true
s.template = "cbi/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/openclash/proxy-provider-config/%s")
function s.create(...)
local sid = TypedSection.create(...)
if sid then
luci.http.redirect(s.extedit % sid)
return
end
end
o = s:option(Flag, "enabled", translate("Enable"))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
o = s:option(DummyValue, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "type", translate("Provider Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
o = s:option(DummyValue, "name", translate("Provider Name"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
end
-- [[ Servers Manage ]]--
s = m:section(TypedSection, "servers", translate("Proxys"))
s.anonymous = true
@ -90,6 +132,11 @@ o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
o = s:option(DummyValue, "config", translate("Config File"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("all")
end
o = s:option(DummyValue, "type", translate("Type"))
function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None")
@ -115,7 +162,7 @@ o.template="openclash/ping"
o.width="10%"
local tt = {
{Delete_Unused_Servers, Delete_Severs, Delete_Groups}
{Delete_Unused_Servers, Delete_Severs, Delete_Proxy_Provider, Delete_Groups}
}
b = m:section(Table, tt)
@ -140,6 +187,16 @@ o.write = function()
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
o = b:option(Button,"Delete_Proxy_Provider")
o.inputtitle = translate("Delete Proxy Provider")
o.inputstyle = "reset"
o.write = function()
m.uci:set("openclash", "config", "enable", 0)
m.uci:delete_all("openclash", "proxy-provider", function(s) return true end)
m.uci:commit("openclash")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
end
o = b:option(Button,"Delete_Groups")
o.inputtitle = translate("Delete Groups")
o.inputstyle = "reset"

View File

@ -21,7 +21,6 @@ s:tab("settings", translate("General Settings"))
s:tab("dns", translate("DNS Setting"))
s:tab("rules", translate("Rules Setting"))
s:tab("dashboard", translate("Dashboard Settings"))
s:tab("config_update", translate("Config Update"))
s:tab("rules_update", translate("Rules Update"))
s:tab("geo_update", translate("GEOIP Update"))
s:tab("version_update", translate("Version Update"))
@ -49,6 +48,9 @@ o = s:taboption("settings", ListValue, "en_mode", font_red..bold_on..translate("
o.description = translate("Select Mode For OpenClash Work, Network Error Try Flush DNS Cache")
o:value("redir-host", translate("redir-host"))
o:value("fake-ip", translate("fake-ip"))
o:value("fake-ip-tun", translate("fake-ip(tun mode)"))
o:value("redir-host-vpn", translate("redir-host-vpn(game mode)"))
o:value("fake-ip-vpn", translate("fake-ip-vpn(game mode)"))
o.default = "redir-host"
o = s:taboption("settings", ListValue, "proxy_mode", font_red..bold_on..translate("Proxy Mode")..bold_off..font_off)
@ -151,13 +153,13 @@ custom_fake_black.wrap = "off"
custom_fake_black:depends("dns_advanced_setting", "1")
function custom_fake_black.cfgvalue(self, section)
return NXFS.readfile("/etc/config/openclash_custom_fake_black.conf") or ""
return NXFS.readfile("/etc/openclash/custom/openclash_custom_fake_black.conf") or ""
end
function custom_fake_black.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/config/openclash_custom_fake_black.conf", value)
NXFS.writefile("/etc/openclash/custom/openclash_custom_fake_black.conf", value)
end
end
@ -201,14 +203,32 @@ o:depends("rule_source", "ConnersHua_return")
end
file:seek("set")
o = s:taboption("rules", ListValue, "Apple", translate("Apple"))
---- o:depends("rule_source", "lhie1")
o:depends("rule_source", "lhie1")
o:depends("rule_source", "ConnersHua")
for l in file:lines() do
o:value(l)
end
file:seek("set")
o = s:taboption("rules", ListValue, "Netease_Music", translate("Netease Music"))
o:depends("rule_source", "lhie1")
for l in file:lines() do
o:value(l)
end
file:seek("set")
o = s:taboption("rules", ListValue, "Speedtest", translate("Speedtest"))
o:depends("rule_source", "lhie1")
for l in file:lines() do
o:value(l)
end
file:seek("set")
o = s:taboption("rules", ListValue, "Telegram", translate("Telegram"))
o:depends("rule_source", "lhie1")
for l in file:lines() do
o:value(l)
end
file:seek("set")
o = s:taboption("rules", ListValue, "AdBlock", translate("AdBlock"))
---- o:depends("rule_source", "lhie1")
o:depends("rule_source", "lhie1")
o:depends("rule_source", "ConnersHua")
for l in file:lines() do
o:value(l)
@ -232,58 +252,6 @@ o.description = translate("Choose Proxy Group, Base On Your Servers Group in con
file:close()
---- update Settings
o = s:taboption("config_update", ListValue, "auto_update", translate("Auto Update"))
o.description = translate("Auto Update Server subscription")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("config_update", DynamicList, "servers_update_keyword", font_red..bold_on..translate("Keyword Matching Setting")..bold_off..font_off)
o.description = font_red..bold_on..translate("Only Keep Servers which Matching Keywords, eg: hk or tw&bgp")..bold_off..font_off
o.rmempty = true
o = s:taboption("config_update", ListValue, "config_update_week_time", translate("Update Time (Every Week)"))
o:value("*", translate("Every Day"))
o:value("1", translate("Every Monday"))
o:value("2", translate("Every Tuesday"))
o:value("3", translate("Every Wednesday"))
o:value("4", translate("Every Thursday"))
o:value("5", translate("Every Friday"))
o:value("6", translate("Every Saturday"))
o:value("0", translate("Every Sunday"))
o.default=1
o = s:taboption("config_update", ListValue, "auto_update_time", translate("Update time (every day)"))
for t = 0,23 do
o:value(t, t..":00")
end
o.default=0
o.rmempty = false
o = s:taboption("config_update", ListValue, "config_update_url_type", translate("Update Url Type"))
o:value("clash", translate("Clash"))
o:value("v2rayn", translate("V2rayN"))
o:value("surge", translate("Surge"))
o.description = translate("Power By fndroidUse Other Rules If V2rayN Subcription")
o.default="clash"
o = s:taboption("config_update", Value, "subscribe_url")
o.title = translate("Subcription Url")
o.description = translate("Server Subscription Address")
o.rmempty = true
o = s:taboption("config_update", Button, translate("Config File Update"))
o.title = translate("Update Subcription")
o.inputtitle = translate("Check And Update")
o.inputstyle = "reload"
o.write = function()
m.uci:set("openclash", "config", "enable", 1)
m.uci:commit("openclash")
SYS.call("rm -rf /etc/openclash/config.bak 2>/dev/null")
SYS.call("/usr/share/openclash/openclash.sh >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
o = s:taboption("rules_update", ListValue, "other_rule_auto_update", translate("Auto Update"))
o.description = font_red..bold_on..translate("Auto Update Other Rules")..bold_off..font_off
o:value("0", translate("Disable"))
@ -455,12 +423,12 @@ custom_rules.rows = 20
custom_rules.wrap = "off"
function custom_rules.cfgvalue(self, section)
return NXFS.readfile("/etc/config/openclash_custom_rules.list") or ""
return NXFS.readfile("/etc/openclash/custom/openclash_custom_rules.list") or ""
end
function custom_rules.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/config/openclash_custom_rules.list", value)
NXFS.writefile("/etc/openclash/custom/openclash_custom_rules.list", value)
end
end
@ -474,12 +442,12 @@ custom_hosts.rows = 20
custom_hosts.wrap = "off"
function custom_hosts.cfgvalue(self, section)
return NXFS.readfile("/etc/config/openclash_custom_hosts.list") or ""
return NXFS.readfile("/etc/openclash/custom/openclash_custom_hosts.list") or ""
end
function custom_hosts.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/config/openclash_custom_hosts.list", value)
NXFS.writefile("/etc/openclash/custom/openclash_custom_hosts.list", value)
end
end

View File

@ -1,11 +1,244 @@
--[[
LuCI - Filesystem tools
Description:
A module offering often needed filesystem manipulation functions
FileId:
$Id$
License:
Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
local io = require "io"
local os = require "os"
local ltn12 = require "luci.ltn12"
local fs = require "nixio.fs"
local nutil = require "nixio.util"
local type = type
--- LuCI filesystem library.
module "luci.openclash"
--- LuCI filesystem library.
--- Test for file access permission on given path.
-- @class function
-- @name access
-- @param str String value containing the path
-- @return Number containing the return code, 0 on sucess or nil on error
-- @return String containing the error description (if any)
-- @return Number containing the os specific errno (if any)
access = fs.access
--- Evaluate given shell glob pattern and return a table containing all matching
-- file and directory entries.
-- @class function
-- @name glob
-- @param filename String containing the path of the file to read
-- @return Table containing file and directory entries or nil if no matches
-- @return String containing the error description (if no matches)
-- @return Number containing the os specific errno (if no matches)
function glob(...)
local iter, code, msg = fs.glob(...)
if iter then
return nutil.consume(iter)
else
return nil, code, msg
end
end
--- Checks wheather the given path exists and points to a regular file.
-- @param filename String containing the path of the file to test
-- @return Boolean indicating wheather given path points to regular file
function isfile(filename)
return fs.stat(filename, "type") == "reg"
end
--- Checks wheather the given path exists and points to a directory.
-- @param dirname String containing the path of the directory to test
-- @return Boolean indicating wheather given path points to directory
function isdirectory(dirname)
return fs.stat(dirname, "type") == "dir"
end
--- Read the whole content of the given file into memory.
-- @param filename String containing the path of the file to read
-- @return String containing the file contents or nil on error
-- @return String containing the error message on error
readfile = fs.readfile
--- Write the contents of given string to given file.
-- @param filename String containing the path of the file to read
-- @param data String containing the data to write
-- @return Boolean containing true on success or nil on error
-- @return String containing the error message on error
writefile = fs.writefile
--- Copies a file.
-- @param source Source file
-- @param dest Destination
-- @return Boolean containing true on success or nil on error
copy = fs.datacopy
--- Renames a file.
-- @param source Source file
-- @param dest Destination
-- @return Boolean containing true on success or nil on error
rename = fs.move
--- Get the last modification time of given file path in Unix epoch format.
-- @param path String containing the path of the file or directory to read
-- @return Number containing the epoch time or nil on error
-- @return String containing the error description (if any)
-- @return Number containing the os specific errno (if any)
function mtime(path)
return fs.stat(path, "mtime")
end
--- Set the last modification time of given file path in Unix epoch format.
-- @param path String containing the path of the file or directory to read
-- @param mtime Last modification timestamp
-- @param atime Last accessed timestamp
-- @return 0 in case of success nil on error
-- @return String containing the error description (if any)
-- @return Number containing the os specific errno (if any)
function utime(path, mtime, atime)
return fs.utimes(path, atime, mtime)
end
--- Return the last element - usually the filename - from the given path with
-- the directory component stripped.
-- @class function
-- @name basename
-- @param path String containing the path to strip
-- @return String containing the base name of given path
-- @see dirname
basename = fs.basename
--- Return the directory component of the given path with the last element
-- stripped of.
-- @class function
-- @name dirname
-- @param path String containing the path to strip
-- @return String containing the directory component of given path
-- @see basename
dirname = fs.dirname
--- Return a table containing all entries of the specified directory.
-- @class function
-- @name dir
-- @param path String containing the path of the directory to scan
-- @return Table containing file and directory entries or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function dir(...)
local iter, code, msg = fs.dir(...)
if iter then
local t = nutil.consume(iter)
t[#t+1] = "."
t[#t+1] = ".."
return t
else
return nil, code, msg
end
end
--- Create a new directory, recursively on demand.
-- @param path String with the name or path of the directory to create
-- @param recursive Create multiple directory levels (optional, default is true)
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function mkdir(path, recursive)
return recursive and fs.mkdirr(path) or fs.mkdir(path)
end
--- Remove the given empty directory.
-- @class function
-- @name rmdir
-- @param path String containing the path of the directory to remove
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
rmdir = fs.rmdir
local stat_tr = {
reg = "regular",
dir = "directory",
lnk = "link",
chr = "character device",
blk = "block device",
fifo = "fifo",
sock = "socket"
}
--- Get information about given file or directory.
-- @class function
-- @name stat
-- @param path String containing the path of the directory to query
-- @return Table containing file or directory properties or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function stat(path, key)
local data, code, msg = fs.stat(path)
if data then
data.mode = data.modestr
data.type = stat_tr[data.type] or "?"
end
return key and data and data[key] or data, code, msg
end
--- Set permissions on given file or directory.
-- @class function
-- @name chmod
-- @param path String containing the path of the directory
-- @param perm String containing the permissions to set ([ugoa][+-][rwx])
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
chmod = fs.chmod
--- Create a hard- or symlink from given file (or directory) to specified target
-- file (or directory) path.
-- @class function
-- @name link
-- @param path1 String containing the source path to link
-- @param path2 String containing the destination path for the link
-- @param symlink Boolean indicating wheather to create a symlink (optional)
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
function link(src, dest, sym)
return sym and fs.symlink(src, dest) or fs.link(src, dest)
end
--- Remove the given file.
-- @class function
-- @name unlink
-- @param path String containing the path of the file to remove
-- @return Number with the return code, 0 on sucess or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
unlink = fs.unlink
--- Retrieve target of given symlink.
-- @class function
-- @name readlink
-- @param path String containing the path of the symlink to read
-- @return String containing the link target or nil on error
-- @return String containing the error description on error
-- @return Number containing the os specific errno on error
readlink = fs.readlink

View File

@ -1,7 +1,7 @@
<%+cbi/valueheader%>
<div style="text-align: center; margin:0 auto; display: block; width: 100%; text-overflow: ellipsis;">
<div>
<%:Rename your config file to config.yaml before upload what would be save to /etc/openclash%>
<%:Only Support yaml what would be save to /etc/openclash/config/%>
</div>
<div style="color: green; transform:translateY(80%);">
<%

View File

@ -7,14 +7,14 @@
<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="//cdn.jsdelivr.net">
<link rel="dns-prefetch" href="//whois.pconline.com.cn">
<link rel="dns-prefetch" href="//ipv4.ip.sb">
<link rel="dns-prefetch" href="//api-ipv4.ip.sb">
<link rel="dns-prefetch" href="//myip.ipip.net">
<link rel="dns-prefetch" href="//api.ipify.org">
<link rel="dns-prefetch" href="//api.ttt.sh">
<link rel="dns-prefetch" href="//api.skk.moe">
<link rel="dns-prefetch" href="//d.skk.moe">
<link rel="preconnect" href="https://whois.pconline.com.cn">
<link rel="preconnect" href="https://ip.sb">
<link rel="preconnect" href="https://api-ipv4.ip.sb">
<link rel="preconnect" href="https://myip.ipip.net">
<link rel="preconnect" href="https://api.ipify.org">
<link rel="preconnect" href="https://api.ttt.sh">
@ -309,8 +309,8 @@
$$.getElementById('ip-pcol-ipip').innerHTML = `${data.pro} ${data.city} ${data.region} ${pcisp[1]}`;
};
function getIpsbIP(data){
$$.getElementById('ip-ipsb').innerHTML = data.address;
$$.getElementById('ip-ipsb-geo').innerHTML = `${data.country} ${data.province} ${data.city} ${data.isp.name}`
$$.getElementById('ip-ipsb').innerHTML = data.ip;
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
};
window.onload=myip_Load();
@ -326,7 +326,7 @@
var sbip = document.getElementsByTagName('HEAD').item(0);
var sbipScript= document.createElement("script");
sbipScript.defer = "defer";
sbipScript.src='https://ip.sb/addrinfo?callback=getIpsbIP';
sbipScript.src='https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP';
sbip.appendChild(sbipScript);
const $$ = document;
@ -342,8 +342,8 @@
$$.getElementById('ip-pcol-ipip').innerHTML = `${data.pro} ${data.city} ${data.region} ${pcisp[1]}`;
};
function getIpsbIP(data){
$$.getElementById('ip-ipsb').innerHTML = data.address;
$$.getElementById('ip-ipsb-geo').innerHTML = `${data.country} ${data.province} ${data.city} ${data.isp.name}`
$$.getElementById('ip-ipsb').innerHTML = data.ip;
IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
};
setTimeout("myip_Load()",1000*10);
@ -351,7 +351,7 @@
</script>
<script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP"></script>
<script defer="defer" src="https://ip.sb/addrinfo?callback=getIpsbIP"></script>
<script defer="defer" src="https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP"></script>
</body>
</html>

View File

@ -0,0 +1,7 @@
<%+cbi/valueheader%>
<% if self:cfgvalue(section) ~= false then %>
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
<% else %>
-
<% end %>
<%+cbi/valuefooter%>

View File

@ -6,7 +6,7 @@
<b> 一些必要的状态显示,运行前请确保各项目显示正常,需要更新请到全局设置页面操作 </b>
</p>
</td></tr>
<tr><td width="25%"> 启动参数检查(配置文件) </td><td width="25%" align="left" id="_config_check"><%:Collecting data...%></td><td width="25%"> 配置文件更新日期 </td><td width="25%" align="left" id="_config"><%:Collecting data...%></td></tr>
<tr><td width="25%"> 正在使用的配置文件 </td><td width="25%" align="left" id="_config"><%:Collecting data...%></td><td width="25%"> 启动参数检查(配置文件) </td><td width="25%" align="left" id="_config_check"><%:Collecting data...%></td></tr>
<tr><td width="25%"> GEOIPBy MaxMind数据库日期 </td><td width="25%" align="left" id="_ipdb"><%:Collecting data...%></td><td width="25%"> lhie1 规则更新日期 </td><td width="25%" align="left" id="_lhie1"><%:Collecting data...%></td></tr>
<tr><td width="25%"> ConnersHua 规则更新日期 </td><td width="25%" align="left" id="_ConnersHua"><%:Collecting data...%></td><td width="25%"> ConnersHua 回国规则更新日期 </td><td width="25%" align="left" id="_ConnersHua_return"><%:Collecting data...%></td></tr>
</table>
@ -33,9 +33,6 @@
if (status.config == "1") {
config.innerHTML = "<b><font color=red><%:未找到配置文件%></font></b>";
}
else if (status.config == "0") {
config.innerHTML = "<b><font color=green><%:原始配置文件%></font></b>";
}
else {
config.innerHTML = "<b><font color=green>"+status.config+"</font></b>";
}
@ -59,9 +56,6 @@
if (status.config == "1") {
config.innerHTML = "<b><font color=red><%:未找到配置文件%></font></b>";
}
else if (status.config == "0") {
config.innerHTML = "<b><font color=green><%:原始配置文件%></font></b>";
}
else {
config.innerHTML = "<b><font color=green>"+status.config+"</font></b>";
}

View File

@ -55,6 +55,10 @@
{
mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host兼容模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
}
else
{
mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IPTUN模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
}
watchdog.innerHTML = status.watchdog ? '<b><font color=green><%:RUNNING%></font> </b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
dase.innerHTML = status.dase ? "<b><font color=green>"+status.dase+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
@ -74,6 +78,10 @@
{
mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host兼容模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
}
else
{
mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IPTUN模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
}
watchdog.innerHTML = status.watchdog ? '<b><font color=green><%:RUNNING%></font> </b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
dase.innerHTML = status.dase ? "<b><font color=green>"+status.dase+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";

View File

@ -1,6 +1,10 @@
<%+cbi/valueheader%>
<div style="text-align: center; margin:0 auto; display:block; white-space: nowrap;">
<label class="cbi-value" style="display:inline-block; width: 100%;" for="ulfile"><%:Upload Config%>&nbsp;&nbsp;&nbsp;
<label class="cbi-value" style="display:inline-block; width: 100%;" for="ulfile"><%:Upload File Type%>&nbsp;&nbsp;&nbsp;
<select name="file_type" style="width:auto">&nbsp;&nbsp;&nbsp;
<option value="config" selected="selected"><%:Config File%></option>
<option value="proxy-provider"><%:Proxy Provider File%></option>
</select>
<input class="cbi-input-file" style="width: 30%" type="file" id="ulfile" name="ulfile" />
<input type="submit" class="cbi-button cbi-input-reload" name="upload" value="<%:Upload%>" />
</div>

View File

@ -4,7 +4,7 @@ status=$(ps|grep -c /usr/share/openclash/cfg_servers_address_fake_block.sh)
[ "$status" -gt "3" ] && exit 0
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
if pidof clash >/dev/null && [ "$en_mode" = "fake-ip" ]; then
if pidof clash >/dev/null && [ "$en_mode" != "redir-host" ]; then
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
/usr/share/openclash/openclash_fake_block.sh
mkdir -p /tmp/dnsmasq.d

View File

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png" />
<title>Clash</title>
<link href="main.aee3e3fc24cd46786598.css" rel="stylesheet"></head>
<link href="main.0bddb85299f970595cb5.css" rel="stylesheet"></head>
<body>
<div id="root"></div>
<script type="text/javascript" src="js/1.bundle.aee3e3fc24cd46786598.min.js"></script><script type="text/javascript" src="js/bundle.aee3e3fc24cd46786598.min.js"></script></body>
<script type="text/javascript" src="js/1.bundle.0bddb85299f970595cb5.min.js"></script><script type="text/javascript" src="js/bundle.0bddb85299f970595cb5.min.js"></script></body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,21 @@
http://jedwatson.github.io/classnames
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/*
object-assign
(c) Sindre Sorhus

File diff suppressed because one or more lines are too long

View File

@ -15,13 +15,13 @@
.tag{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;height:24px;font-size:12px;padding:0 12px;text-align:center;background-color:#fff;border:2px solid #2c8af8;color:#2c8af8;border-radius:12px}
.spinner{position:relative;width:80px;height:80px;border-radius:100%;-webkit-animation:spinner 5s infinite linear;animation:spinner 5s infinite linear}.spinner-circle{position:absolute;width:100%;height:100%;-webkit-transform-origin:48% 48%;transform-origin:48% 48%}.spinner-inner{width:100%;height:100%;border-radius:100%;border:5px solid rgba(44,138,248,.7);border-right:none;border-top:none;background-clip:padding-box;box-shadow:inset 0 0 10px rgba(44,138,248,.15)}@-webkit-keyframes spinner{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.spinner-circle:nth-of-type(0){-webkit-transform:rotate(0deg);transform:rotate(0deg)}.spinner-circle:nth-of-type(0) .spinner-inner{-webkit-animation:spinner 2s infinite linear;animation:spinner 2s infinite linear}.spinner-circle:nth-of-type(1){-webkit-transform:rotate(70deg);transform:rotate(70deg)}.spinner-circle:nth-of-type(1) .spinner-inner{-webkit-animation:spinner 2s infinite linear;animation:spinner 2s infinite linear}.spinner-circle:nth-of-type(2){-webkit-transform:rotate(140deg);transform:rotate(140deg)}.spinner-circle:nth-of-type(2) .spinner-inner{-webkit-animation:spinner 2s infinite linear;animation:spinner 2s infinite linear}
.loading{position:absolute;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;top:0;left:0;bottom:0;right:0;background-color:rgba(255,255,255,.9);box-shadow:inset 0 0 80px rgba(0,0,0,.1);z-index:1000}
.proxy-item{position:relative;width:100%;height:110px;padding:10px;border-radius:4px;background:#fff;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;box-shadow:2px 5px 20px -3px rgba(44,138,248,.2);-webkit-transition:all 300ms ease;transition:all 300ms ease}.proxy-item .proxy-type{padding:2px 5px;font-size:10px;color:#fff;border-radius:2px}.proxy-item .proxy-name{max-height:30px;margin-top:10px;color:#54759a;font-size:10px;overflow:hidden;word-break:keep-all;white-space:nowrap;text-overflow:ellipsis}.proxy-item .proxy-delay{position:absolute;left:10px;bottom:13px;font-size:10px;color:rgba(84,117,154,.8)}.proxy-item .proxy-editor{position:absolute;right:10px;bottom:10px;cursor:pointer;color:rgba(84,117,154,.8);opacity:0;pointer-events:none;-webkit-transition:all 300ms ease;transition:all 300ms ease}.proxy-item:hover{box-shadow:0 14px 20px -4px rgba(84,117,154,.4)}.proxy-item:hover .proxy-editor{opacity:1;pointer-events:visible}.proxy-error{opacity:.5}.proxy-error .proxy-type{background-color:#909399}@media(max-width: 768px){.proxy-item{height:70px}.proxy-item .proxy-delay{left:unset;bottom:unset;top:0;right:20px;height:70px;line-height:70px}}
.proxy-group{display:-webkit-box;display:flex;-webkit-box-align:start;align-items:flex-start;font-size:14px;color:#546b87}.proxy-group-part{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;height:60px}.proxy-group-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 20px;width:120px}.proxies-group-card{padding:0}.proxies-group-item{border-bottom:1px solid #d8dee2}.proxies-group-item:last-child{border-bottom:none}.proxy-group-tags-container{padding:15px 0}.proxy-group-tags{-webkit-box-flex:1;flex:1;margin-left:30px}@media(max-width: 768px){.proxy-group{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.proxy-group-name{width:140px}.proxy-group-part{width:100%;height:42px;margin-top:6px;-webkit-box-pack:justify;justify-content:space-between}.proxy-group-type{margin-right:20px}.proxy-group-tags-container{padding:5px 0 10px}.proxy-group-tags{margin-left:20px}}
.proxy-item{position:relative;width:100%;height:110px;padding:10px;border-radius:4px;background:#fff;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;box-shadow:2px 5px 20px -3px rgba(44,138,248,.2);-webkit-transition:all 300ms ease;transition:all 300ms ease}.proxy-item .proxy-type{padding:2px 5px;font-size:10px;color:#fff;border-radius:2px}.proxy-item .proxy-name{display:-webkit-box;margin-top:10px;color:#54759a;font-size:10px;overflow:hidden;word-break:break-word;-webkit-line-clamp:2;-webkit-box-orient:vertical}.proxy-item .proxy-delay{position:absolute;left:10px;bottom:13px;font-size:10px;color:rgba(84,117,154,.8)}.proxy-item .proxy-editor{position:absolute;right:10px;bottom:10px;cursor:pointer;color:rgba(84,117,154,.8);opacity:0;pointer-events:none;-webkit-transition:all 300ms ease;transition:all 300ms ease}.proxy-item:hover{box-shadow:0 14px 20px -4px rgba(84,117,154,.4)}.proxy-item:hover .proxy-editor{opacity:1;pointer-events:visible}.proxy-error{opacity:.5}.proxy-error .proxy-type{background-color:#909399}@media(max-width: 768px){.proxy-item{height:70px}.proxy-item .proxy-delay{left:unset;bottom:unset;top:0;right:20px;height:70px;line-height:70px}}
.proxy-group{display:-webkit-box;display:flex;-webkit-box-align:start;align-items:flex-start;font-size:14px;color:#546b87}.proxy-group-part{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;height:60px}.proxy-group-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 20px;width:120px;height:18px}.proxies-group-card{padding:0}.proxies-group-item{border-bottom:1px solid #d8dee2}.proxies-group-item:last-child{border-bottom:none}.proxy-group-tags-container{padding:15px 0}.proxy-group-tags{-webkit-box-flex:1;flex:1;margin-left:30px}@media(max-width: 768px){.proxy-group{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.proxy-group-name{width:140px}.proxy-group-part{width:100%;height:42px;margin-top:6px;-webkit-box-pack:justify;justify-content:space-between}.proxy-group-type{margin-right:20px}.proxy-group-tags-container{padding:5px 0 10px}.proxy-group-tags{margin-left:20px}}
.proxy-provider{position:relative;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;font-size:16px;padding:20px;color:#546b87}.proxy-provider-header{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:justify;justify-content:space-between}.proxy-provider-header-part{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.proxy-provider-name{margin-right:24px}.proxy-provider-proxies{list-style:none}.proxy-provider-item{box-shadow:0 0 24px 0 rgba(44,138,248,.2)}.proxy-provider-item:hover{box-shadow:0 0 24px 0 rgba(84,117,154,.4)}.proxy-provider-update{line-height:14px;font-size:14px}.proxy-provider-icon{margin-left:20px;cursor:pointer}.proxy-provider-icon.healthcheck{color:#f56c6c}@media(max-width: 768px){.proxy-provider-header{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:start;align-items:flex-start}.proxy-provider-header-part{margin:6px 0}}
.proxies-list{--item-width: calc(100% / (var(--columns) + 1));--gap: calc(var(--item-width) / var(--columns));display:-webkit-box;display:flex;margin-right:calc(-1 * var(--gap));margin-top:20px;flex-wrap:wrap;align-content:flex-start;list-style:none}@media(min-width: 2001px){.proxies-list{--columns: 12}}@media(max-width: 2000px){.proxies-list{--columns: 10}}@media(max-width: 1600px){.proxies-list{--columns: 8}}@media(max-width: 1340px){.proxies-list{--columns: 7}}@media(max-width: 960px){.proxies-list{--columns: 6}}@media(max-width: 860px){.proxies-list{--columns: 5}}@media(max-width: 760px){.proxies-list{--columns: 3}}.proxies-list>li{display:inline-block;width:var(--item-width);margin-right:var(--gap);flex-shrink:0;margin-bottom:10px}.proxies-group-list{list-style:none}.proxies-group-card{margin:20px 0}.proxies-container .proxies-action-icon{margin-left:10px}.proxies-speed-test{line-height:32px;margin:0 2px 0 6px;color:#2c8af8;text-shadow:0 2px 6px rgba(44,138,248,.4);cursor:pointer}.proxies-providers-item{margin:20px 0}.proxies-providers-list{list-style:none}@media(max-width: 768px){.proxies-group-card{margin:12px 0}.proxies-list{margin-right:0;padding-bottom:20px;flex-wrap:unset;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.proxies-list>li{width:100%;margin-right:0;margin-bottom:10px}}
.logs-card{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-flex:1;flex:1;margin-top:10px}.logs-panel{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-flex:1;flex-grow:1;flex-basis:0;list-style:none;padding:10px;border-radius:2px;background-color:#f3f6f9;font-size:12px;color:#73808f;overflow-y:auto;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace}.logs-panel li{line-height:20px;display:inline-block}.logs-panel-time{margin-right:10px;color:#adb7c3}
.rules-card{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-flex:1;flex:1;margin-top:10px;padding:0}.rules-card:focus{outline:none}.rules-card .rules{-webkit-box-flex:1;flex:1 0 auto}.rule-item{line-height:30px;padding:5px 0;height:50px;overflow:hidden;list-style:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-bottom:1px solid rgba(228,234,239,.5)}.rule-item .rule-item-row{padding:5px 0}.rule-item .drag-handler{cursor:row-resize;margin:0 10px;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center}.rule-item .drag-handler>i{font-weight:bold;color:#b7c5d6}.rule-item .rule-type{font-size:14px;color:#54759a}.rule-item .rule-type>i{margin-left:5px;color:#54759a}.rule-item .payload{font-size:14px;color:#54759a;cursor:pointer}.rule-item .rule-proxy{font-size:14px;color:#54759a}.rule-item .delete-btn{opacity:0;-webkit-transition:all 300ms ease;transition:all 300ms ease}.rule-item .delete-btn span{font-size:14px;color:#f56c6c;cursor:pointer}.rule-item:last-child{border-bottom:none}.rule-item:hover .delete-btn{opacity:1}.rule-proxy-option{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;overflow:hidden}.rule-proxy-option .label{margin-right:5px;height:20px;line-height:20px;padding:0 8px;font-size:10px;border-radius:10px;color:#fff;background:#b7c5d6}.rule-proxy-option .value{line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.settings-card{margin-top:10px;padding:20px 0}.settings-card .column{font-weight:bold;-webkit-box-align:center;align-items:center}.settings-card .value-column{-webkit-box-pack:end;justify-content:flex-end}.settings-card .label{font-size:14px;color:#54759a}.settings-card .external-controller{font-size:14px;color:#54759a;display:-webkit-box;display:flex;-webkit-box-pack:end;justify-content:flex-end;font-weight:normal;line-height:17px}.settings-card .external-controller .modify-btn{color:#2c8af8;cursor:pointer}.clash-version{position:relative;margin-top:10px;padding:20px 45px;display:-webkit-box;display:flex}.clash-version .check-icon{width:24px;height:24px;border-radius:50%;background:linear-gradient(135deg, #57befc, #2c8af8);display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}.clash-version .check-icon>i{-webkit-transform:scale(0.5);transform:scale(0.5);color:#fff;font-weight:bold}.clash-version .version-info{margin-left:10px;font-size:14px;line-height:24px;color:#54759a}.clash-version .check-update-btn{position:absolute;right:45px;font-size:14px;line-height:24px;color:#b7c5d6;cursor:pointer;-webkit-transition:all 150ms ease;transition:all 150ms ease}.clash-version .check-update-btn:hover{color:#54759a}@media(max-width: 768px){.settings-card .row{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;padding-top:0;padding-bottom:0}.settings-card .row>.column{width:100%;margin:10px 0}}
.sidebar{position:fixed;top:0;left:0;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:center;align-items:center;flex-shrink:0;width:140px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.sidebar-logo{margin-top:50px;width:60px;height:60px}.sidebar-menu{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;margin-top:12px}.sidebar-menu .item{display:block;margin-top:18px}.sidebar-menu .item>a{display:block;width:120px;height:36px;line-height:36px;font-size:14px;border-radius:18px;text-align:center}.sidebar-menu .item>a,.sidebar-menu .item a:active,.sidebar-menu .item a:visited{color:#909399;text-decoration:none}.sidebar-menu .item>a.active{background:linear-gradient(135deg, #57befc, #2c8af8);color:#fff;box-shadow:0 2px 8px rgba(44,138,248,.5)}@media(max-width: 768px){.sidebar{width:100%;height:60px;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;background:#f4f5f6;z-index:10}.sidebar-logo{margin:0 15px;width:36px;height:36px}.sidebar-menu{-webkit-box-flex:1;flex:1;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:center;justify-content:center;margin-top:0;overflow-x:scroll;padding:10px}.sidebar-menu::-webkit-scrollbar{display:none}.sidebar-menu .item{margin:0 3px}.sidebar-menu .item>a{width:80px;height:32px;line-height:32px}.sidebar-menu .item.no-mobile{display:none}}
.connections-card{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-flex:1;flex:1;margin-top:10px;padding:0}.connections-card .connections{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-flex:1;flex:1 0 auto;width:100%;overflow:hidden}.connections-card .connections-body{-webkit-box-flex:1;flex:1 0 auto}.connections-card .connections-th{position:relative;text-align:center;color:#909399;background:#f3f6f9;height:30px;line-height:30px;font-weight:500;font-size:14px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.connections-card .connections-resizer{position:absolute;opacity:0;right:-10px;top:8px;bottom:8px;width:20px;-webkit-transition:opacity .3s ease;transition:opacity .3s ease;z-index:10;font-size:14px;font-weight:300}.connections-card .connections-resizer::before{content:"";display:block;position:absolute;left:10px;-webkit-transform:translateX(-2px);transform:translateX(-2px);width:2px;height:100%;background-color:rgba(144,147,153,.6)}.connections-card .connections-tr{white-space:nowrap}.connections-card .connections-tr:hover .connections-resizer{opacity:1}.connections-card .connetions-item{height:36px}.connections-card .connections-block{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;font-size:14px;line-height:36px;padding:0 10px;color:#54759a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.connections-card .connections-block.center{text-align:center}.connections-card .connections-block.completed{background-color:#e9eef4;color:rgba(84,117,154,.5)}.connections-filter{color:#2c8af8;font-size:14px;line-height:20px;margin-left:15px;text-shadow:0 0 6px rgba(44,138,248,.4);cursor:pointer}.connections-filter.dangerous{color:#f56c6c;text-shadow:0 0 6px rgba(87,190,252,.2)}.connections-filter.total{-webkit-box-flex:1;flex:1;cursor:unset}
.connections-card{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-flex:1;flex:1;margin-top:10px;padding:0;overflow:hidden}.connections-card .connections{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;width:100%;-webkit-box-flex:1;flex-grow:1;flex-basis:0;overflow:auto}.connections-card .connections-body{-webkit-box-flex:1;flex:1 0 auto}.connections-card .connections-th{position:relative;text-align:center;color:#909399;background:#f3f6f9;height:30px;line-height:30px;font-weight:500;font-size:14px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.connections-card .connections-resizer{position:absolute;opacity:0;right:-10px;top:8px;bottom:8px;width:20px;-webkit-transition:opacity .3s ease;transition:opacity .3s ease;z-index:10;font-size:14px;font-weight:300}.connections-card .connections-resizer::before{content:"";display:block;position:absolute;left:10px;-webkit-transform:translateX(-2px);transform:translateX(-2px);width:2px;height:100%;background-color:rgba(144,147,153,.6)}.connections-card .connections-header{position:-webkit-sticky;position:sticky;top:0;white-space:nowrap}.connections-card .connections-header:hover .connections-resizer{opacity:1}.connections-card .connetions-item{height:36px}.connections-card .connections-block{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;font-size:14px;line-height:36px;padding:0 10px;color:#54759a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.connections-card .connections-block.center{text-align:center}.connections-card .connections-block.completed{background-color:#e9eef4;color:rgba(84,117,154,.5)}.connections-filter{color:#2c8af8;font-size:14px;line-height:20px;margin-left:15px;text-shadow:0 0 6px rgba(44,138,248,.4);cursor:pointer}.connections-filter.dangerous{color:#f56c6c;text-shadow:0 0 6px rgba(87,190,252,.2)}.connections-filter.total{-webkit-box-flex:1;flex:1;cursor:unset}
.external-controller .row{padding:0}.external-controller .alert{margin:10px 0}.external-controller .title,.external-controller .form{margin:15px 0}.external-controller .title{margin-top:15px;font-size:14px;font-weight:bold}@media(max-width: 768px){.external-controller .row{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:start;align-items:flex-start}.external-controller .title{margin:5px 0}.external-controller .form{margin:5px 0}.external-controller .column{width:100%}.external-controller .alert{display:none}}

View File

@ -1,52 +1,60 @@
#!/bin/bash
#!/bin/bash /etc/rc.common
status=$(ps|grep -c /usr/share/openclash/openclash.sh)
[ "$status" -gt "3" ] && exit 0
START_LOG="/tmp/openclash_start.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
CONFIG_FILE="/etc/openclash/config.yaml"
LOG_FILE="/tmp/openclash.log"
BACKPACK_FILE="/etc/openclash/config.bak"
URL_TYPE=$(uci get openclash.config.config_update_url_type 2>/dev/null)
subscribe_url=$(uci get openclash.config.subscribe_url 2>/dev/null)
en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
CONFIG_PATH=$(uci get openclash.config.config_path 2>/dev/null)
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_update_keyword=$(uci get openclash.config.servers_update_keyword 2>/dev/null)
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
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
config_download()
{
if [ "$URL_TYPE" == "v2rayn" ]; then
echo "开始下载V2rayN配置文件..." >$START_LOG
subscribe_url=`echo $subscribe_url |sed 's/{/%7B/g;s/}/%7D/g;s/:/%3A/g;s/\"/%22/g;s/,/%2C/g;s/?/%3F/g;s/=/%3D/g;s/&/%26/g;s/\//%2F/g'`
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 https://tgbot.lbyczf.com/v2rayn2clash?url="$subscribe_url" -O /tmp/config.yaml
elif [ "$URL_TYPE" == "surge" ]; then
echo "开始下载Surge配置文件..." >$START_LOG
subscribe_url=`echo $subscribe_url |sed 's/{/%7B/g;s/}/%7D/g;s/:/%3A/g;s/\"/%22/g;s/,/%2C/g;s/?/%3F/g;s/=/%3D/g;s/&/%26/g;s/\//%2F/g'`
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 https://tgbot.lbyczf.com/surge2clash?url="$subscribe_url" -O /tmp/config.yaml
else
echo "开始下载Clash配置文件..." >$START_LOG
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 "$subscribe_url" -O /tmp/config.yaml
fi
}
config_cus_up()
{
if [ "$servers_update" -eq "1" ] || [ ! -z "$servers_update_keyword" ]; then
echo "配置文件替换成功,开始挑选节点..." >$START_LOG
echo "${LOGTIME} Config Update Successful" >>$LOG_FILE
if [ -z "$CONFIG_PATH" ]; then
CONFIG_PATH="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
uci set openclash.config.config_path="$CONFIG_PATH"
uci commit openclash
fi
if [ "$servers_update" -eq "1" ] || [ ! -z "$keyword" ]; then
echo "配置文件【$name】替换成功,开始挑选节点..." >$START_LOG
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
uci set openclash.config.config_update_path="/etc/openclash/config/$name.yaml"
uci set openclash.config.servers_if_update=1
uci commit openclash
/usr/share/openclash/yml_groups_get.sh
uci set openclash.config.servers_if_update=1
uci commit openclash
/usr/share/openclash/yml_groups_set.sh
else
echo "配置文件替换成功,开始启动 OpenClash ..." >$START_LOG
echo "${LOGTIME} Config Update Successful" >>$LOG_FILE
/etc/init.d/openclash restart 2>/dev/null
if [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
if_restart=1
fi
elif [ "$CONFIG_FILE" == "$CONFIG_PATH" ]; then
echo "配置文件【$name】替换成功 ..." >$START_LOG
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
sleep 3
if_restart=1
else
echo "配置文件【$name】替换成功 ..." >$START_LOG
echo "${LOGTIME} Config 【$name】 Update Successful" >>$LOG_FILE
sleep 3
echo "" >$START_LOG
fi
}
@ -56,15 +64,15 @@ config_su_check()
if [ -f "$CONFIG_FILE" ]; then
cmp -s "$BACKPACK_FILE" /tmp/config.yaml
if [ "$?" -ne "0" ]; then
echo "配置文件有更新,开始替换..." >$START_LOG
echo "配置文件$name有更新,开始替换..." >$START_LOG
mv /tmp/config.yaml "$CONFIG_FILE" 2>/dev/null
cp "$CONFIG_FILE" "$BACKPACK_FILE"
config_cus_up
else
echo "配置文件没有任何更新,停止继续操作..." >$START_LOG
echo "配置文件$name没有任何更新,停止继续操作..." >$START_LOG
rm -rf /tmp/config.yaml
change_dns
echo "${LOGTIME} Updated Config No Change, Do Nothing" >>$LOG_FILE
echo "${LOGTIME} Updated Config$name No Change, Do Nothing" >>$LOG_FILE
sleep 5
echo "" >$START_LOG
fi
@ -78,8 +86,8 @@ config_su_check()
config_error()
{
echo "配置文件下载失败,请检查网络或稍后再试!" >$START_LOG
echo "${LOGTIME} Config Update Error" >>$LOG_FILE
echo "配置文件$name下载失败,请检查网络或稍后再试!" >$START_LOG
echo "${LOGTIME} Config $nameUpdate Error" >>$LOG_FILE
rm -rf /tmp/config.yaml 2>/dev/null
sleep 5
echo "" >$START_LOG
@ -103,36 +111,78 @@ change_dns()
fi
}
config_download
sub_info_get()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
config_get "name" "$section" "name" ""
config_get "type" "$section" "type" ""
config_get "address" "$section" "address" ""
config_get "keyword" "$section" "keyword" ""
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/config.yaml |awk '{print int($5/1024)}')" -ne 0 ]; then
config_su_check
else
if pidof clash >/dev/null; then
echo "配置文件下载失败,尝试不使用代理下载配置文件..." >$START_LOG
watchdog_pids=$(ps |grep openclash_watchdog.sh |grep -v grep |awk '{print $1}' 2>/dev/null)
for watchdog_pid in $watchdog_pids; do
kill -9 "$watchdog_pid" >/dev/null 2>&1
done
if [ "$enabled" = "0" ]; then
return
fi
if [ -z "$address" ]; then
return
else
subscribe_url="$address"
fi
if [ -z "$name" ]; then
name="config"
CONFIG_FILE="/etc/openclash/config/config.yaml"
BACKPACK_FILE="/etc/openclash/backup/config.yaml"
else
CONFIG_FILE="/etc/openclash/config/$name.yaml"
BACKPACK_FILE="/etc/openclash/backup/$name.yaml"
fi
URL_TYPE="$type"
echo "开始更新配置文件【$name】..." >$START_LOG
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0
uci delete dhcp.@dnsmasq[0].cachesize
uci commit dhcp
/etc/init.d/dnsmasq restart >/dev/null 2>&1
sleep 3
config_download
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/config.yaml |awk '{print int($5/1024)}')" -ne 0 ]; then
config_su_check
else
if pidof clash >/dev/null; then
echo "配置文件【$name】下载失败,尝试不使用代理下载配置文件..." >$START_LOG
config_download
watchdog_pids=$(ps |grep openclash_watchdog.sh |grep -v grep |awk '{print $1}' 2>/dev/null)
for watchdog_pid in $watchdog_pids; do
kill -9 "$watchdog_pid" >/dev/null 2>&1
done
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0
uci delete dhcp.@dnsmasq[0].cachesize
uci commit dhcp
/etc/init.d/dnsmasq restart >/dev/null 2>&1
sleep 3
config_download
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/config.yaml |awk '{print int($5/1024)}')" -ne 0 ]; then
config_su_check
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/config.yaml |awk '{print int($5/1024)}')" -ne 0 ]; then
config_su_check
else
change_dns
config_error
fi
else
change_dns
config_error
fi
else
config_error
fi
fi
}
#分别获取订阅信息进行处理
config_load "openclash"
config_foreach sub_info_get "config_subscribe"
uci delete openclash.config.config_update_path
uci commit openclash
[ "$if_restart" == "1" ] && /etc/init.d/openclash restart >/dev/null 2>&1

View File

@ -8,7 +8,7 @@ direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
direct_dns="114.114.114.114"
}
rm -rf /etc/openclash/dnsmasq_fake_block.conf 2>/dev/null
for i in `cat /etc/config/openclash_custom_fake_black.conf`
for i in `cat /etc/openclash/custom/openclash_custom_fake_black.conf`
do
if [ -z "$(echo $i |grep '^ \{0,\}#' 2>/dev/null)" ]; then
echo "server=/$i/$direct_dns" >>/etc/openclash/dnsmasq_fake_block.conf

View File

@ -3,19 +3,17 @@
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
LOG_FILE="/tmp/openclash.log"
echo "开始下载 GEOIP 数据库..." >$START_LOG
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz -O /tmp/ipdb.tar.gz
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/ipdb.tar.gz |awk '{print int($5/1024)}')" -ne 0 ]; then
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 https://static.clash.to/GeoIP2/GeoIP2-Country.mmdb -O /tmp/Country.mmdb
if [ "$?" -eq "0" ] && [ "$(ls -l /tmp/Country.mmdb |awk '{print int($5/1024)}')" -ne 0 ]; then
echo "GEOIP 数据库下载成功,检查数据库版本是否更新..." >$START_LOG
tar zxvf /tmp/ipdb.tar.gz -C /tmp >/dev/null 2>&1\
&& rm -rf /tmp/ipdb.tar.gz >/dev/null 2>&1
cmp -s /tmp/GeoLite2-Country_*/GeoLite2-Country.mmdb /etc/openclash/Country.mmdb
cmp -s /tmp/Country.mmdb /etc/openclash/Country.mmdb
if [ "$?" -ne "0" ]; then
/etc/init.d/openclash stop
echo "数据库版本有更新,开始替换数据库版本..." >$START_LOG\
&& mv /tmp/GeoLite2-Country_*/GeoLite2-Country.mmdb /etc/openclash/Country.mmdb >/dev/null 2>&1\
&& mv /tmp/Country.mmdb /etc/openclash/Country.mmdb >/dev/null 2>&1\
&& /etc/init.d/openclash start\
&& echo "删除下载缓存..." >$START_LOG\
&& rm -rf /tmp/GeoLite2-Country_* >/dev/null 2>&1
&& rm -rf /tmp/Country.mmdb >/dev/null 2>&1
echo "GEOIP 数据库更新成功!" >$START_LOG
echo "${LOGTIME} GEOIP Database Update Successful" >>$LOG_FILE
sleep 10
@ -23,13 +21,13 @@
else
echo "数据库版本没有更新,停止继续操作..." >$START_LOG
echo "${LOGTIME} Updated GEOIP Database No Change, Do Nothing" >>$LOG_FILE
rm -rf /tmp/GeoLite2-Country_* >/dev/null 2>&1
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
sleep 5
echo "" >$START_LOG
fi
else
echo "GEOIP 数据库下载失败,请检查网络或稍后再试!" >$START_LOG
rm -rf /tmp/ipdb.tar.gz >/dev/null 2>&1
rm -rf /tmp/Country.mmdb >/dev/null 2>&1
echo "${LOGTIME} GEOIP Database Update Error" >>$LOG_FILE
sleep 10
echo "" >$START_LOG

View File

@ -7,6 +7,7 @@
echo "开始下载使用中的第三方规则..." >$START_LOG
if [ "$rule_source" = "lhie1" ]; then
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 https://raw.githubusercontent.com/lhie1/Rules/master/Clash/Rule.yml -O /tmp/rules.yaml
sed -i '1i Rule:' /tmp/rules.yaml
elif [ "$rule_source" = "ConnersHua" ]; then
wget-ssl --no-check-certificate --quiet --timeout=10 --tries=2 https://raw.githubusercontent.com/ConnersHua/Profiles/master/Clash/Pro.yaml -O /tmp/rules.yaml
sed -i -n '/^Rule:/,$p' /tmp/rules.yaml
@ -45,4 +46,5 @@
echo "${LOGTIME} Other Rules Update Error" >>$LOG_FILE
sleep 10
echo "" >$START_LOG
fi
fi
sed ':label;N;s/\n//;b label' /etc/openclash/lhie1.yaml

View File

@ -13,8 +13,9 @@ do
if [ "$enable" -eq 1 ]; then
if ! pidof clash >/dev/null; then
CONFIG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
echo "${LOGTIME} Watchdog: Clash Core Problem, Restart." >>$LOG_FILE
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
nohup $CLASH -d "$CLASH_CONFIG" -f "$CONFIG_FILE" >> $LOG_FILE 2>&1 &
fi
fi
@ -23,15 +24,6 @@ fi
if [ "$LOGSIZE" -gt 90 ]; then
echo "$LOGTIME Watchdog: Size Limit, Clean Up All Log Records." >$LOG_FILE
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)
if [ "$last_line" -ne "$op_line" ]; then
iptables -t nat -D PREROUTING -i br-lan -p tcp -j openclash
iptables -t nat -A PREROUTING -i br-lan -p tcp -j openclash
echo "$LOGTIME Watchdog: Reset Firewall For Enabling Redirect." >>$LOG_FILE
fi
## DNS转发劫持
if [ "$enable_redirect_dns" != "0" ]; then

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/*! modern-normalize | MIT License | https://github.com/sindresorhus/modern-normalize */html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}:root{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}hr{height:0}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{padding:0}progress{vertical-align:initial}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
/*! modern-normalize v0.6.0 | MIT License | https://github.com/sindresorhus/modern-normalize */*,:after,:before{box-sizing:border-box}:root{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}hr{height:0}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{padding:0}progress{vertical-align:initial}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
._2MMSFnbhST{stroke-dasharray:890;stroke-dashoffset:890;-webkit-animation:apL4DUAKgd 3s ease-in-out infinite normal forwards;animation:apL4DUAKgd 3s ease-in-out infinite normal forwards}@-webkit-keyframes apL4DUAKgd{0%{stroke-dashoffset:890}to{stroke-dashoffset:0}}@keyframes apL4DUAKgd{0%{stroke-dashoffset:890}to{stroke-dashoffset:0}}
._3oi0NFbeOm{opacity:.5;width:100%;height:100%;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}
._1rJPiLWN4s{position:fixed;top:0;bottom:0;left:0;right:0;overflow:hidden;padding:20px;background:var(--color-background);color:var(--color-text);text-align:center}._3h_IywJG1l{color:#2a477a;opacity:.6;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;padding:40px}.aXXDDfyTjE,._3h_IywJG1l{-webkit-box-align:center;align-items:center}.aXXDDfyTjE{display:-webkit-inline-box;display:inline-flex;color:var(--color-text-secondary)}.aXXDDfyTjE:active,.aXXDDfyTjE:hover{color:#387cec}.aXXDDfyTjE svg{margin-right:5px}
@ -12,15 +12,17 @@
input.nJQwngxVo8[type=checkbox]{--white:#fff;--grey:#d3d3d3;--color-theme:#047aff;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;background-color:darken(var(--white),2%);border:1px solid var(--grey);border-radius:26px;box-shadow:inset 0 0 0 1px var(--grey);cursor:pointer;height:28px;position:relative;-webkit-transition:border .25s .15s,box-shadow .25s .3s,padding .25s;transition:border .25s .15s,box-shadow .25s .3s,padding .25s;width:44px;vertical-align:top}input.nJQwngxVo8[type=checkbox]:after{background-color:var(--white);border:1px solid var(--grey);border-radius:24px;box-shadow:inset 0 -3px 3px rgba(0,0,0,.025),0 1px 4px rgba(0,0,0,.15),0 4px 4px rgba(0,0,0,.1);content:"";display:block;height:26px;left:0;position:absolute;right:16px;top:0;-webkit-transition:border .25s .15s,left .25s .1s,right .15s .175s;transition:border .25s .15s,left .25s .1s,right .15s .175s}input.nJQwngxVo8[type=checkbox]:checked{border-color:var(--color-theme);box-shadow:inset 0 0 0 13px var(--color-theme);padding-left:18px;-webkit-transition:border .25s,box-shadow .25s,padding .25s .15s;transition:border .25s,box-shadow .25s,padding .25s .15s}input.nJQwngxVo8[type=checkbox]:checked:after{border-color:var(--color-theme);left:16px;right:0;-webkit-transition:border .25s,left .15s .25s,right .25s .175s;transition:border .25s,left .15s .25s,right .25s .175s}
._3evbv-Ui87{-webkit-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #525252;color:var(--color-text);background:var(--color-toggle-bg);display:-webkit-box;display:flex;position:relative}._3evbv-Ui87 input{position:absolute;left:0;opacity:0}._3evbv-Ui87 label{-webkit-box-flex:1;flex:1;z-index:2;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;padding:10px 0;cursor:pointer}._1ok8KIb1RH{z-index:1;position:absolute;display:block;left:0;height:100%;-webkit-transition:left .2s ease-out;transition:left .2s ease-out;background:var(--color-toggle-selected)}
._2S85tjFa1n{-webkit-appearance:none;background-color:var(--color-input-bg);background-image:none;border-radius:4px;border:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 15px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._2S85tjFa1n:focus{border-color:var(--color-focus-blue)}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
._2A0HoxnDqc{-webkit-appearance:none;outline:none;color:var(--color-btn-fg);background:var(--color-btn-bg);border:1px solid #555;border-radius:100px;-webkit-user-select:none;-ms-user-select:none;user-select:none;font-size:.85em;padding:5px 8px}._2A0HoxnDqc:focus{border-color:var(--color-focus-blue)}._2A0HoxnDqc:hover{background:#387cec;border:1px solid #387cec;color:#fff}._2A0HoxnDqc:active{-webkit-transform:scale(.97);transform:scale(.97)}@media screen and (min-width:30em){._2A0HoxnDqc{font-size:1em;padding:6px 12px}}._18N5yOTffn{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}._18N5yOTffn ._2zDvzE8SFX{margin-left:5px}
h2._1p7G03ShKD{margin:0;font-size:1.3em}@media screen and (min-width:30em){h2._1p7G03ShKD{font-size:1.5em}}h2._1p7G03ShKD span:nth-child(2){font-size:12px;color:#777;font-weight:400;margin:0 .3em}body.light{--loading-dot-1-1:rgba(0,0,0,0.1);--loading-dot-1-2:rgba(0,0,0,0.5);--loading-dot-1-3:rgba(0,0,0,0.3);--loading-dot-2-1:rgba(0,0,0,0.3);--loading-dot-2-2:rgba(0,0,0,0.1);--loading-dot-2-3:rgba(0,0,0,0.5);--loading-dot-3-1:rgba(0,0,0,0.5);--loading-dot-3-2:rgba(0,0,0,0.3);--loading-dot-3-3:rgba(0,0,0,0.1)}body.dark{--loading-dot-1-1:hsla(0,0%,100%,0.5);--loading-dot-1-2:hsla(0,0%,100%,0.1);--loading-dot-1-3:hsla(0,0%,100%,0.3);--loading-dot-2-1:hsla(0,0%,100%,0.3);--loading-dot-2-2:hsla(0,0%,100%,0.5);--loading-dot-2-3:hsla(0,0%,100%,0.1);--loading-dot-3-1:hsla(0,0%,100%,0.1);--loading-dot-3-2:hsla(0,0%,100%,0.3);--loading-dot-3-3:hsla(0,0%,100%,0.5)}._1l_b31nvKC,._1l_b31nvKC:after,._1l_b31nvKC:before{display:inline-block;vertical-align:middle;width:6px;height:6px;border-radius:50%;font-size:0}._1l_b31nvKC{position:relative;background-color:var(--loading-dot-2-1);-webkit-animation:AmeWPxQSDb 1s step-start infinite;animation:AmeWPxQSDb 1s step-start infinite}._1l_b31nvKC:before{content:"";position:absolute;left:-12px;background-color:var(--loading-dot-1-1);-webkit-animation:_1C49ms67Ai 1s step-start infinite;animation:_1C49ms67Ai 1s step-start infinite}._1l_b31nvKC:after{content:"";position:absolute;right:-12px;background-color:var(--loading-dot-3-1);-webkit-animation:p_etI2Ova8 1s step-start infinite;animation:p_etI2Ova8 1s step-start infinite}@-webkit-keyframes _1C49ms67Ai{0%,to{background-color:var(--loading-dot-1-1)}33%{background-color:var(--loading-dot-1-2)}66%{background-color:var(--loading-dot-1-3)}}@keyframes _1C49ms67Ai{0%,to{background-color:var(--loading-dot-1-1)}33%{background-color:var(--loading-dot-1-2)}66%{background-color:var(--loading-dot-1-3)}}@-webkit-keyframes AmeWPxQSDb{0%,to{background-color:var(--loading-dot-2-1)}33%{background-color:var(--loading-dot-2-2)}66%{background-color:var(--loading-dot-2-3)}}@keyframes AmeWPxQSDb{0%,to{background-color:var(--loading-dot-2-1)}33%{background-color:var(--loading-dot-2-2)}66%{background-color:var(--loading-dot-2-3)}}@-webkit-keyframes p_etI2Ova8{0%,to{background-color:var(--loading-dot-3-1)}33%{background-color:var(--loading-dot-3-2)}66%{background-color:var(--loading-dot-3-3)}}@keyframes p_etI2Ova8{0%,to{background-color:var(--loading-dot-3-1)}33%{background-color:var(--loading-dot-3-2)}66%{background-color:var(--loading-dot-3-3)}}
._2A0HoxnDqc{-webkit-appearance:none;outline:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;position:relative;display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;color:var(--color-btn-fg);background:var(--color-btn-bg);border:1px solid #555;border-radius:100px;font-size:.85em;padding:4px 7px}._2A0HoxnDqc:focus{border-color:var(--color-focus-blue)}._2A0HoxnDqc:hover{background:#387cec;border:1px solid #387cec;color:#fff}._2A0HoxnDqc:active{-webkit-transform:scale(.97);transform:scale(.97)}@media screen and (min-width:30em){._2A0HoxnDqc{font-size:1em;padding:6px 12px}}._2A0HoxnDqc.rBrOhcv1IU{border-color:transparent;background:none}._2A0HoxnDqc.rBrOhcv1IU:focus{border-color:var(--color-focus-blue)}._2A0HoxnDqc.rBrOhcv1IU:hover{color:#fff;background:#387cec;border:1px solid #387cec}.CtvjIaf7QB{margin-right:5px;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center}.CtvjIaf7QB,._2KAqQdptfT{display:-webkit-inline-box;display:inline-flex}._2KAqQdptfT{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}
._2id19fefQX{display:-webkit-box;display:flex;flex-wrap:wrap}._2QQQyNTKoG{-webkit-box-flex:0;flex-grow:0;margin-right:10px;margin-bottom:10px;cursor:pointer;border:2px solid transparent}.XJkW0wZSAx{border-color:#387cec}
._2OZZRrEL0J>div{min-width:345px}@media screen and (min-width:30em){._2OZZRrEL0J>div{width:360px}}._2OZZRrEL0J,.lF_ZoyIdZN{padding:6px 15px 15px}@media screen and (min-width:30em){._2OZZRrEL0J,.lF_ZoyIdZN{padding:10px 40px 40px}}.VduFBb2hWX{padding:0 15px}@media screen and (min-width:30em){.VduFBb2hWX{padding:0 40px}}.VduFBb2hWX>div{border-top:1px dashed #373737}._2NQoBOQcGA{padding:16px 0}
._29HgaNl_dV ._73r9mFp69q{display:grid;grid-template-columns:repeat(11,-webkit-max-content);grid-template-columns:repeat(11,max-content)}.hEAcjybq1r{padding:8px 10px;height:50px;background:var(--color-background);position:-webkit-sticky;position:sticky;top:0;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:justify;justify-content:space-between}._1x7JSEXzR8{padding:8px 13px;font-size:.9em;font-family:var(--font-normal)}._1x7JSEXzR8._3n5sGVMC-F{background:var(--color-row-odd)}._26SQDJZWya{text-align:right}._3LKH-WXUjR{display:-webkit-inline-box;display:inline-flex;margin-left:10px;width:16px;height:16px}._1CoVX1S_So{-webkit-transform:rotate(180deg);transform:rotate(180deg)}
.ctrHyq7uir{position:fixed;top:0;right:0;left:0;bottom:0;background:#444;z-index:1024}._17mHpKiOUD{outline:none;position:absolute;color:#ddd;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background:#444;padding:20px;border-radius:10px}
._3R-iKwDVj-{background-color:rgba(0,0,0,.6)}._1vh9rFTHqn{background-color:var(--bg-modal);color:var(--color-text);max-width:300px;line-height:1.4;-webkit-transform:translate(-50%,-50%) scale(1.5);transform:translate(-50%,-50%) scale(1.5);opacity:.6;-webkit-transition:all .3s ease;transition:all .3s ease}._3bTCBReMiZ{opacity:1;-webkit-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}._1lwetyauPD{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;margin-top:30px}
.duOnUwq-nI{height:100%;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;color:var(--color-background);opacity:.1}
.react-tabs{-webkit-tap-highlight-color:transparent}.react-tabs__tab-list{margin:0 0 10px;padding:0 30px}.react-tabs__tab{display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;border:1px solid transparent;border-radius:5px;bottom:-1px;position:relative;list-style:none;padding:6px 10px;cursor:pointer;font-size:1.2em;opacity:.5}.react-tabs__tab--selected{opacity:1}.react-tabs__tab--disabled{color:GrayText;cursor:default}.react-tabs__tab:focus{border-color:#0188fe;outline:none}.react-tabs__tab:focus:after{content:"";position:absolute}.react-tabs__tab-panel{display:none}.react-tabs__tab-panel--selected{display:block}
.duOnUwq-nI{height:100%;display:-webkit-box;display:flex;color:var(--color-background);opacity:.1}.CCpULSE9Uh,.duOnUwq-nI{-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center}.CCpULSE9Uh{font-family:var(--font-normal);font-size:.75em;margin-left:3px;padding:2px 7px;display:-webkit-inline-box;display:inline-flex;background-color:var(--bg-near-transparent);border-radius:30px}
._1r-KsYFNaj{position:relative;padding:10px 0}._1r-KsYFNaj input{-webkit-appearance:none;background-color:initial;background-image:none;border:none;border-radius:0;border-bottom:1px solid var(--color-input-border);box-sizing:border-box;color:#c1c1c1;display:inline-block;font-size:inherit;height:40px;outline:none;padding:0 8px;-webkit-transition:border-color .2s cubic-bezier(.645,.045,.355,1);transition:border-color .2s cubic-bezier(.645,.045,.355,1);width:100%}._1r-KsYFNaj input:focus{border-color:var(--color-focus-blue)}._1r-KsYFNaj label{position:absolute;left:8px;bottom:22px;-webkit-transition:-webkit-transform .15s ease-in-out;transition:-webkit-transform .15s ease-in-out;transition:transform .15s ease-in-out;transition:transform .15s ease-in-out,-webkit-transform .15s ease-in-out;-webkit-transform-origin:0 0;transform-origin:0 0}._1r-KsYFNaj input:focus+label,._1r-KsYFNaj label.Hn6h5kxOg7{-webkit-transform:scale(.75) translateY(-25px);transform:scale(.75) translateY(-25px)}._1r-KsYFNaj input:focus+label{color:var(--color-focus-blue)}
._3hz7LVhvUv:focus{outline:none}._3HF-KB9mgO{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}._3HF-KB9mgO ._3HzgPICn91{color:#2d2d30;opacity:.4;-webkit-transition:opacity .4s;transition:opacity .4s}._3HF-KB9mgO ._3HzgPICn91:hover{opacity:.7}._1wpZuvoD5I{padding:30px 0 10px}.L7jTy-EFJ2{display:-webkit-box;display:flex}.L7jTy-EFJ2 div{-webkit-box-flex:1;flex:1 1 auto}.L7jTy-EFJ2 div:nth-child(2){-webkit-box-flex:0;flex-grow:0;flex-basis:120px;margin-left:10px}._2fehqRU9GV{padding:30px 0 10px;display:-webkit-box;display:flex;-webkit-box-pack:end;justify-content:flex-end;-webkit-box-align:center;align-items:center}
._3D3ZNp4oBz{background:none;position:fixed;top:0;bottom:0;left:0;right:0;-webkit-transform:none;transform:none;padding:0;border-radius:0}.tgH3yv-xGR{position:absolute;top:10%;left:50%;-webkit-transform:translate(-50%);transform:translate(-50%);max-width:376px;margin:0 auto}._3MMuzHtwZL{background:#222}
@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local("RobotoMono-Regular"),url(https://cdn.jsdelivr.net/npm/@hsjs/fonts@0.0.1/robotomono/v5/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}.border-bottom,.border-left,.border-top{position:relative}.border-top:before{top:0}.border-bottom:after,.border-top:before{position:absolute;content:"";height:1px;width:100%;-webkit-transform:scaleY(.5) translateZ(0);transform:scaleY(.5) translateZ(0);left:0;right:0;background:#555}.border-bottom:after{bottom:0}.border-left:before{position:absolute;content:"";height:100%;width:1px;-webkit-transform:scaleX(.5) translateZ(0);transform:scaleX(.5) translateZ(0);top:0;bottom:0;background:#555;left:0}*,:after,:before{box-sizing:border-box}:root{--font-mono:"Roboto Mono",Menlo,monospace;--font-normal:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,"PingFang SC","Microsoft YaHei","微软雅黑",Arial,sans-serif;--color-focus-blue:#1a73e8}body{font-family:Merriweather Sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,PingFang SC,Microsoft YaHei,;margin:0;padding:0}body,body.dark{--color-background:#202020;--color-text:#ddd;--color-text-secondary:#ccc;--color-bg-sidebar:#2d2d30;--color-sb-active-row-bg:#494b4e;--color-input-bg:#2d2d30;--color-input-border:#3f3f3f;--color-toggle-bg:#353535;--color-toggle-selected:#181818;--color-icon:#c7c7c7;--color-btn-bg:#232323;--color-btn-fg:#bebebe;--color-bg-proxy-selected:#303030;--color-row-odd:#282828;--bg-modal:#1f1f20}body.light{--color-background:#fbfbfb;--color-text:#222;--color-text-secondary:#646464;--color-bg-sidebar:#e7e7e7;--color-sb-active-row-bg:#d0d0d0;--color-input-bg:#fff;--color-input-border:silver;--color-toggle-bg:#fff;--color-toggle-selected:#d7d7d7;--color-icon:#5b5b5b;--color-btn-bg:#f4f4f4;--color-btn-fg:#101010;--color-bg-proxy-selected:#cfcfcf;--color-row-odd:#f5f5f5;--bg-modal:#fbfbfb}.fabgrp{position:fixed;z-index:3;right:20px;bottom:20px}
@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local("RobotoMono-Regular"),url(https://cdn.jsdelivr.net/npm/@hsjs/fonts@0.0.1/robotomono/v5/L0x5DF4xlVMF-BfR8bXMIjhLq3-cXbKD.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+2000-206f,u+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}.border-bottom,.border-left,.border-top,.relative{position:relative}.border-top:before{top:0}.border-bottom:after,.border-top:before{position:absolute;content:"";height:1px;width:100%;-webkit-transform:scaleY(.5) translateZ(0);transform:scaleY(.5) translateZ(0);left:0;right:0;background:#555}.border-bottom:after{bottom:0}.border-left:before{position:absolute;content:"";height:100%;width:1px;-webkit-transform:scaleX(.5) translateZ(0);transform:scaleX(.5) translateZ(0);top:0;bottom:0;background:#555;left:0}*,:after,:before{box-sizing:border-box}:root{--font-mono:"Roboto Mono",Menlo,monospace;--font-normal:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,"PingFang SC","Microsoft YaHei","微软雅黑",Arial,sans-serif;--color-focus-blue:#1a73e8}body{font-family:Merriweather Sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,PingFang SC,Microsoft YaHei,;margin:0;padding:0}body,body.dark{--color-background:#202020;--color-text:#ddd;--color-text-secondary:#ccc;--color-bg-sidebar:#2d2d30;--color-sb-active-row-bg:#494b4e;--color-input-bg:#2d2d30;--color-input-border:#3f3f3f;--color-toggle-bg:#353535;--color-toggle-selected:#181818;--color-icon:#c7c7c7;--color-btn-bg:#232323;--color-btn-fg:#bebebe;--color-bg-proxy-selected:#303030;--color-row-odd:#282828;--bg-modal:#1f1f20;--bg-near-transparent:hsla(0,0%,100%,0.1)}body.light{--color-background:#fbfbfb;--color-text:#222;--color-text-secondary:#646464;--color-bg-sidebar:#e7e7e7;--color-sb-active-row-bg:#d0d0d0;--color-input-bg:#fff;--color-input-border:silver;--color-toggle-bg:#fff;--color-toggle-selected:#d7d7d7;--color-icon:#5b5b5b;--color-btn-bg:#f4f4f4;--color-btn-fg:#101010;--color-bg-proxy-selected:#cfcfcf;--color-row-odd:#f5f5f5;--bg-modal:#fbfbfb;--bg-near-transparent:rgba(0,0,0,0.1)}.flexCenter{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center}.fabgrp{position:fixed;z-index:3;right:20px;bottom:20px}
._35EMVy62Je{display:-webkit-box;display:flex;background:var(--color-background);color:var(--color-text);min-height:300px;height:100vh}@media (max-width:768px){._35EMVy62Je{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}.AwL8oIubvP{-webkit-box-flex:1;flex-grow:1;overflow:auto}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/** @license React v0.0.0-experimental-b53ea6ca0
/** @license React v0.0.0-experimental-f42431abe
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -25,6 +25,21 @@ object-assign
http://jedwatson.github.io/classnames
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/** @license React v16.6.1
* react-cache.production.min.js
*

File diff suppressed because one or more lines are too long

View File

@ -22,20 +22,20 @@
<meta property="og:description" content="Yet Another Clash Dashboard">
<link href="app.162bce22090b81bd48cc.css" rel="stylesheet">
<link href="app.02ba11cfe63c3d5e1e73.css" rel="stylesheet">
<body>
<div id="app"></div>
<script src="runtime.5dec3cfa22062be75ea8.js" type="text/javascript"></script>
<script src="runtime.ded9d303f4333455472b.js" type="text/javascript"></script>
<script src="core-js~app.d0ad192734a12bf5aec9.js" type="text/javascript"></script>
<script src="core-js~app.bee8eb27b94a9dc46ebe.js" type="text/javascript"></script>
<script src="react~app.6b67113954659e454015.js" type="text/javascript"></script>
<script src="react~app.0e7d4c38821c1ecfbf2f.js" type="text/javascript"></script>
<script src="app.3dcd33240af85fc45c3c.js" type="text/javascript"></script>
<script src="app.9f29cd9cb7f46e88a014.js" type="text/javascript"></script>
</body>

View File

@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{D46e:function(e,r,t){e.exports={header:"_3PCSxT0l14",list:"_1yYRIyvlRd",proxy:"_1OcDlvlM5R",proxySelectable:"_3oAxPKtZFv"}},FWZb:function(e,r,t){e.exports={proxy:"NpfXwxWAxo",now:"_2zD7drviYH",error:"_2bylJNYYdN",proxyType:"_1rVl-Kdmss",proxyName:"_3kdi5nima5",proxyLatencyWrap:"_12JM32OJa5"}},L5YO:function(e,r,t){e.exports={body:"pWc1mov26e",group:"_1myfcMimT9"}},RbL9:function(e,r,t){e.exports={proxyLatency:"_2V-RqIAl7n"}},wyCT:function(e,r,t){"use strict";t.r(r);t("2B1R"),t("07d7"),t("5s+n");var a=t("o0o1"),n=t.n(a),o=(t("ls82"),t("q1tI")),c=t.n(o),l=t("u4Dv"),s=t("DKqX"),i=(t("sMBO"),t("rePB")),p=t("17x9"),u=t.n(p),m=t("TSYQ"),y=t.n(m),f=t("RbL9"),b=t.n(f),d={good:"#67C23A",normal:"#E6A23C",bad:"#F56C6C",na:"#909399"};function v(e){var r=e.latency,t=r.number,a=r.error,n=Object(o.useMemo)((function(){return function(e,r){return""!==r?d.na:e<200?d.good:e<400?d.normal:d.bad}(t,a)}),[t,a]);return c.a.createElement("span",{className:b.a.proxyLatency,style:{color:n}},""!==a?c.a.createElement("span",null,a):c.a.createElement("span",null,t," ms"))}v.propTypes={latency:u.a.shape({number:u.a.number,error:u.a.string})};var x=t("FWZb"),O=t.n(x),E=t("EQlU"),w=function(e){return{proxies:Object(E.d)(e),delay:Object(E.c)(e)}};function g(e){var r,t=e.now,a=e.name,n=Object(l.c)(w),o=n.proxies,s=n.delay[a],p=o[a];return c.a.createElement("div",{className:y()(O.a.proxy,(r={},Object(i.a)(r,O.a.now,t),Object(i.a)(r,O.a.error,s&&s.error),r))},c.a.createElement("div",{className:O.a.proxyName},a),c.a.createElement("div",{className:O.a.proxyType,style:{opacity:t?.6:.2}},p.type),c.a.createElement("div",{className:O.a.proxyLatencyWrap},s&&s.number?c.a.createElement(v,{latency:s}):null))}g.propTypes={now:u.a.bool,name:u.a.string};var h=g,j=t("D46e"),N=t.n(j),k=function(e){return{proxies:Object(E.d)(e)}};function P(e){var r=e.name,t=Object(l.c)(k).proxies,a=Object(l.b)({switchProxy:E.g}),n=t[r],o=n.all;return c.a.createElement("div",{className:N.a.group},c.a.createElement("div",{className:N.a.header},c.a.createElement("h2",null,c.a.createElement("span",null,r),c.a.createElement("span",null,n.type))),c.a.createElement("div",{className:N.a.list},o.map((function(e){var t="Selector"===n.type,o=y()(N.a.proxy,Object(i.a)({},N.a.proxySelectable,t));return c.a.createElement("div",{className:o,key:e,onClick:function(){t&&a.switchProxy(r,e)}},c.a.createElement(h,{isSelectable:t,name:e,now:e===n.now}))}))))}P.propTypes={name:u.a.string};var T=t("5Wrh");function L(){return(L=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}function _(e,r){if(null==e)return{};var t,a,n=function(e,r){if(null==e)return{};var t,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var C=function(e){var r=e.color,t=e.size,a=_(e,["color","size"]);return c.a.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a),c.a.createElement("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"}))};C.propTypes={color:u.a.string,size:u.a.oneOfType([u.a.string,u.a.number])},C.defaultProps={color:"currentColor",size:"24"};var D=C,S=t("L5YO"),W=t.n(S);t.d(r,"default",(function(){return q}));var A=c.a.useEffect,R=c.a.useMemo,Y=function(e){return{proxies:Object(E.d)(e),groupNames:Object(E.e)(e)}},M={fetchProxies:E.b,requestDelayAll:E.f};function q(){var e=Object(l.b)(M),r=e.fetchProxies,t=e.requestDelayAll;A((function(){n.a.async((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.a.awrap(r());case 2:case"end":return e.stop()}}))}),[r,t]);var a=Object(l.c)(Y).groupNames,o=R((function(){return c.a.createElement(D,{width:16})}),[]);return c.a.createElement(c.a.Fragment,null,c.a.createElement(s.a,{title:"Proxies"}),c.a.createElement("div",{className:W.a.body},c.a.createElement("div",{className:"fabgrp"},c.a.createElement(T.a,{text:"Test Latency",icon:o,onClick:t})),a.map((function(e){return c.a.createElement("div",{className:W.a.group,key:e},c.a.createElement(P,{name:e}))}))))}}}]);

File diff suppressed because one or more lines are too long

View File

@ -1,4 +0,0 @@
._2V-RqIAl7n{border-radius:20px;padding:3px 0;color:#eee;font-size:.6em}@media screen and (min-width:30em){._2V-RqIAl7n{font-size:1em}}
.NpfXwxWAxo{position:relative;padding:5px;border-radius:8px;background-color:var(--color-bg-proxy-selected)}@media screen and (min-width:30em){.NpfXwxWAxo{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}}._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}}._12JM32OJa5{height:30px;display:-webkit-box;display:flex;-webkit-box-align:end;align-items:flex-end}
._3PCSxT0l14>h2{margin-top:0;font-size:1.3em}@media screen and (min-width:30em){._3PCSxT0l14>h2{font-size:1.5em}}._3PCSxT0l14>h2 span:nth-child(2){font-size:12px;color:#777;font-weight:400;margin:0 .3em}._1yYRIyvlRd{display:-webkit-box;display:flex;flex-wrap:wrap}._1OcDlvlM5R{max-width:280px;margin:2px;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out}@media screen and (min-width:30em){._1OcDlvlM5R{min-width:150px;margin:10px}}._1OcDlvlM5R._3oAxPKtZFv{cursor:pointer}._1OcDlvlM5R._3oAxPKtZFv:hover{-webkit-transform:translateY(-2px);transform:translateY(-2px)}
.pWc1mov26e{padding-bottom:50px}._1myfcMimT9{padding:10px 15px}@media screen and (min-width:30em){._1myfcMimT9{padding:10px 40px}}

View File

@ -0,0 +1,5 @@
._2V-RqIAl7n{border-radius:20px;padding:3px 0;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-selected)}@media screen and (min-width:30em){.NpfXwxWAxo{min-width:150px;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}}._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}}._12JM32OJa5{height:30px;display:-webkit-box;display:flex;-webkit-box-align:end;align-items:flex-end}._3NpxWygDxO{width:12px;height:12px;border-radius:8px}._3NpxWygDxO ._2zD7drviYH{outline:1px solid pink}
._3PCSxT0l14{margin-bottom:12px}._1yYRIyvlRd{display:-webkit-box;display:flex;flex-wrap:wrap;margin-top:8px}._1OcDlvlM5R{margin-right:5px;margin-bottom:5px;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-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{-webkit-transform:translateY(-2px);transform:translateY(-2px)}
._1cq9WGaZ9s{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;cursor:pointer}._1cq9WGaZ9s ._1cAwPwoPmt{display:-webkit-inline-box;display:inline-flex;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}._1cq9WGaZ9s ._1cAwPwoPmt.sDt5qh1OfE{-webkit-transform:rotate(180deg);transform:rotate(180deg)}._1cq9WGaZ9s ._1cAwPwoPmt:focus{outline:var(--color-focus-blue) solid 1px}._3GVE9k27aM{margin-bottom:12px}._3GVE9k27aM small{color:#777}._1PV2l5z2zN{padding:10px 15px}@media screen and (min-width:30em){._1PV2l5z2zN{padding:10px 40px}}._1b5XrAhEUm{display:-webkit-box;display:flex}._1b5XrAhEUm button{margin:0 5px}._1b5XrAhEUm button:first-child{margin-left:0}._2t6Q6BkZ73{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;cursor:pointer}
._1myfcMimT9{padding:10px 15px}@media screen and (min-width:30em){._1myfcMimT9{padding:10px 40px}}

File diff suppressed because one or more lines are too long

View File

@ -1,22 +1,4 @@
/** @license React v0.16.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.10.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v0.0.0-experimental-b53ea6ca0
/** @license React v0.0.0-experimental-f42431abe
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -24,3 +6,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v0.0.0-experimental-f42431abe
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{BVyM:function(e,t,r){"use strict";r.r(t);var a=r("ODXe"),n=r("q1tI"),c=r.n(n),l=r("u4Dv"),o=r("5Wrh"),i=r("iR1w"),u=r("17x9"),s=r.n(u);function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function p(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},c=Object.keys(e);for(a=0;a<c.length;a++)r=c[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)r=c[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var m=function(e){var t=e.color,r=e.size,a=p(e,["color","size"]);return c.a.createElement("svg",f({xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a),c.a.createElement("polyline",{points:"23 4 23 10 17 10"}),c.a.createElement("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))};m.propTypes={color:s.a.string,size:s.a.oneOfType([s.a.string,s.a.number])},m.defaultProps={color:"currentColor",size:"24"};var d=m,v=r("DKqX"),y=r("xrux"),b=r.n(y),h={_default:"#59caf9",DIRECT:"#f5bc41",REJECT:"#cb3166"};function E(e){var t=e.type,r=e.payload,a=e.proxy,n=e.id,l=function(e){var t=e.proxy,r=h._default;return h[t]&&(r=h[t]),{color:r}}({proxy:a});return c.a.createElement("div",{className:b.a.rule},c.a.createElement("div",{className:b.a.left},n),c.a.createElement("div",null,c.a.createElement("div",{className:b.a.b},r),c.a.createElement("div",{className:b.a.a},c.a.createElement("div",{className:b.a.type},t),c.a.createElement("div",{style:l},a))))}E.propTypes={id:s.a.number,type:s.a.string,payload:s.a.string,proxy:s.a.string};var O=E,g=r("II4a"),w=r("Tvb5"),x={updateSearchText:w.f},j=Object(g.a)({mapStateToProps:function(e){return{searchText:Object(w.e)(e)}},actions:x}),k=r("Kv4h");r.d(t,"default",(function(){return D}));var N=c.a.memo,R=c.a.useEffect,T=c.a.useMemo,I=30,S=function(e){return{rules:Object(w.d)(e)}},_={fetchRules:w.b,fetchRulesOnce:w.c};function z(e,t){return t[e].id}var C=N((function(e){var t=e.index,r=e.style,a=e.data[t];return c.a.createElement("div",{style:r},c.a.createElement(O,a))}),i.b);function D(){var e=Object(l.b)(_),t=e.fetchRulesOnce,r=e.fetchRules,n=Object(l.c)(S).rules;R((function(){t()}),[t]);var u=Object(k.a)(),s=Object(a.a)(u,2),f=s[0],p=s[1],m=T((function(){return c.a.createElement(d,{width:16})}),[]);return c.a.createElement("div",null,c.a.createElement(v.a,{title:"Rules"}),c.a.createElement(j,null),c.a.createElement("div",{ref:f,style:{paddingBottom:I}},c.a.createElement(i.a,{height:p-I,width:"100%",itemCount:n.length,itemSize:80,itemData:n,itemKey:z},C)),c.a.createElement("div",{className:"fabgrp"},c.a.createElement(o.a,{text:"Refresh",icon:m,onClick:r})))}},xrux:function(e,t,r){e.exports={rule:"_3eSLieOhVX",left:"_2n1pW09UvV",a:"t1XJIwvW7A",b:"_1fNf8kj0HA",type:"_3yJmN0tON0"}}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{BVyM:function(e,t,a){"use strict";a.r(t);var r=a("ODXe"),n=a("q1tI"),c=a.n(n),i=a("5Wrh"),l=a("iR1w"),o=a("OAQO"),u=a("WfPo"),s=a("OADI"),f=a("DKqX"),p=a("17x9"),m=a.n(p),d=a("xrux"),v=a.n(d),b={_default:"#59caf9",DIRECT:"#f5bc41",REJECT:"#cb3166"};function y(e){var t=e.type,a=e.payload,r=e.proxy,n=e.id,i=function(e){var t=e.proxy,a=b._default;return b[t]&&(a=b[t]),{color:a}}({proxy:r});return c.a.createElement("div",{className:v.a.rule},c.a.createElement("div",{className:v.a.left},n),c.a.createElement("div",null,c.a.createElement("div",{className:v.a.b},a),c.a.createElement("div",{className:v.a.a},c.a.createElement("div",{className:v.a.type},t),c.a.createElement("div",{style:i},r))))}y.propTypes={id:m.a.number,type:m.a.string,payload:m.a.string,proxy:m.a.string};var O=y,E=a("II4a"),h=a("EwbC"),g=Object(u.a)((function(e){return{searchText:Object(h.d)(e),updateSearchText:h.f}}))(E.a),w=a("Kv4h"),x=c.a.memo,j=c.a.useEffect,k=c.a.useMemo,C=c.a.useCallback,N=30;function I(e,t){return t[e].id}var T=x((function(e){var t=e.index,a=e.style,r=e.data[t];return c.a.createElement("div",{style:a},c.a.createElement(O,r))}),l.b);t.default=Object(u.a)((function(e){return{apiConfig:Object(s.b)(e),rules:Object(h.c)(e)}}))((function(e){var t=e.dispatch,a=e.apiConfig,n=e.rules,u=C((function(){t(Object(h.a)(a))}),[a,t]);j((function(){t(Object(h.b)(a))}),[t,a]);var s=Object(w.a)(),p=Object(r.a)(s,2),m=p[0],d=p[1],v=k((function(){return c.a.createElement(o.a,{width:16})}),[]);return c.a.createElement("div",null,c.a.createElement(f.a,{title:"Rules"}),c.a.createElement(g,null),c.a.createElement("div",{ref:m,style:{paddingBottom:N}},c.a.createElement(l.a,{height:d-N,width:"100%",itemCount:n.length,itemSize:80,itemData:n,itemKey:I},T)),c.a.createElement("div",{className:"fabgrp"},c.a.createElement(i.a,{text:"Refresh",start:v,onClick:u})))}))},OAQO:function(e,t,a){"use strict";var r=a("q1tI"),n=a.n(r),c=a("17x9"),i=a.n(c);function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},c=Object.keys(e);for(r=0;r<c.length;r++)a=c[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)a=c[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var u=function(e){var t=e.color,a=e.size,r=o(e,["color","size"]);return n.a.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},r),n.a.createElement("polyline",{points:"23 4 23 10 17 10"}),n.a.createElement("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))};u.propTypes={color:i.a.string,size:i.a.oneOfType([i.a.string,i.a.number])},u.defaultProps={color:"currentColor",size:"24"},t.a=u},xrux:function(e,t,a){e.exports={rule:"_3eSLieOhVX",left:"_2n1pW09UvV",a:"t1XJIwvW7A",b:"_1fNf8kj0HA",type:"_3yJmN0tON0"}}}]);

View File

@ -1 +0,0 @@
!function(e){function t(t){for(var n,o,i=t[0],l=t[1],f=t[2],s=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),c.push.apply(c,s);h.length;)h.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var f=r[o];0!==a[f]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return 0===u.length&&(c.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)}})),c.length=0),e}var n={},o={5:0},a={5:0},u=[],c=[];function i(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"54d9dc6178af6177acdd",4:"0860925fbd80318b7939",6:"447e3b00d64ad017b55d",7:"5ab3a74114a4ce051b05"}[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"}[e]||e)+"."+{2:"b5e30dff13c011457565",4:"f60a65ba29535b87ba96",6:"31d6cfe0d16ae931b73c",7:"31d6cfe0d16ae931b73c"}[e]+".css",a=l.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var i=(s=u[c]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(i===n||i===a))return t()}var f=document.getElementsByTagName("style");for(c=0;c<f.length;c++){var s;if((i=(s=f[c]).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,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},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 u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,l.nc&&c.setAttribute("nonce",l.nc),c.src=i(e);var f=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);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;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var s=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}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 f=window.webpackJsonp=window.webpackJsonp||[],s=f.push.bind(f);f.push=t,f=f.slice();for(var d=0;d<f.length;d++)t(f[d]);var p=s;r()}([]);

View File

@ -0,0 +1 @@
!function(e){function t(t){for(var n,o,i=t[0],l=t[1],f=t[2],d=t[3]||[],s=0,h=[];s<i.length;s++)o=i[s],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,d);h.length;)h.shift()();return c.push.apply(c,f||[]),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 f=r[o];0!==a[f]&&(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:"6cc15bdf1bc70c0d1a8d",4:"32658050e64361773fc6",6:"0775b8169f7ef69511b0",7:"7b8f1dc3f02b17f47fdd",8:"788ab61adcbd1ce75d98"}[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:"d435411ad74e5f59ce94",4:"f60a65ba29535b87ba96",6:"31d6cfe0d16ae931b73c",7:"31d6cfe0d16ae931b73c",8:"31d6cfe0d16ae931b73c"}[e]+".css",a=l.p+n,c=document.getElementsByTagName("link"),u=0;u<c.length;u++){var i=(d=c[u]).getAttribute("data-href")||d.getAttribute("href");if("stylesheet"===d.rel&&(i===n||i===a))return t()}var f=document.getElementsByTagName("style");for(u=0;u<f.length;u++){var d;if((i=(d=f[u]).getAttribute("data-href"))===n||i===a)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.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],s.parentNode.removeChild(s),r(c)},s.href=a,document.getElementsByTagName("head")[0].appendChild(s)})).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 f=new Error;c=function(t){u.onerror=u.onload=null,clearTimeout(d);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;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var d=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 f=window.webpackJsonp=window.webpackJsonp||[],d=f.push.bind(f);f.push=t,f=f.slice();for(var s=0;s<f.length;s++)t(f[s]);var p=d;r()}([]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */

View File

@ -99,6 +99,10 @@
sed -i "/^dns:/i\secret: \"${4}\"" "$7"
fi
fi
sed -i '/^ \{0,\}tun:/,/^ \{0,\}enable:/d' "$7" 2>/dev/null
sed -i '/^ \{0,\}device-url:/d' "$7" 2>/dev/null
sed -i '/^ \{0,\}dns-listen:/d' "$7" 2>/dev/null
if [ -z "$(grep "^ enable: true" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}enable:" "$7")" ]; then
@ -144,6 +148,17 @@
fi
fi
fi
#TUN
if [ "$15" -eq 1 ]; then
sed -i "/^dns:/i\tun:" "$7"
sed -i "/^dns:/i\ enable: true" "$7"
elif [ ! -z "$15" ]; then
sed -i "/^dns:/i\tun:" "$7"
sed -i "/^dns:/i\ enable: true" "$7"
sed -i "/^dns:/i\ device-url: dev://clash0" "$7"
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
sed -i "/^dns:/i\ dns-listen: 0.0.0.0:${dns_port}" "$7"
fi
#添加自定义Hosts设置
@ -157,6 +172,6 @@
fi
sed -i '/^hosts:/a\##Custom HOSTS END##' "$7" 2>/dev/null
sed -i '/^hosts:/a\##Custom HOSTS##' "$7" 2>/dev/null
sed -i '/##Custom HOSTS##/r/etc/config/openclash_custom_hosts.list' "$7" 2>/dev/null
sed -i '/##Custom HOSTS##/r/etc/openclash/custom/openclash_custom_hosts.list' "$7" 2>/dev/null
sed -i "/^hosts:/,/^dns:/ {s/^ \{0,\}'/ '/}" "$7" 2>/dev/null #修改参数空格
fi

View File

@ -7,41 +7,85 @@ CFG_FILE="/etc/config/openclash"
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
rulesource=$(uci get openclash.config.rule_source 2>/dev/null)
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)
if [ ! -f "/etc/openclash/config.yml" ] && [ ! -f "/etc/openclash/config.yaml" ]; then
exit 0
elif [ ! -f "/etc/openclash/config.yaml" ] && [ "$(ls -l /etc/openclash/config.yml 2>/dev/null |awk '{print int($5/1024)}')" -gt 0 ]; then
mv "/etc/openclash/config.yml" "/etc/openclash/config.yaml"
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
CONFIG_FILE="$UPDATE_CONFIG_FILE"
CONFIG_NAME="$UPDATE_CONFIG_NAME"
fi
echo "开始更新策略组配置..." >$START_LOG
if [ -z "$CONFIG_FILE" ]; then
CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
CONFIG_NAME=$(echo $CONFIG_FILE |awk -F '/' '{print $5}' 2>/dev/null)
fi
if [ -z "$CONFIG_NAME" ]; then
CONFIG_FILE="/etc/openclash/config/config.yaml"
CONFIG_NAME="config.yaml"
fi
BACKUP_FILE="/etc/openclash/backup/$(echo $CONFIG_FILE |awk -F '/' '{print $5}' 2>/dev/null)"
if [ ! -s $CONFIG_FILE ] && [ ! -s $BACKUP_FILE ]; then
exit 0
elif [ ! -s $CONFIG_FILE ] && [ -s $BACKUP_FILE ]; then
mv $BACKUP_FILE $CONFIG_FILE
fi
echo "开始更新【$CONFIG_NAME】的策略组配置..." >$START_LOG
/usr/share/openclash/yml_groups_name_get.sh
[ ! -z "$(grep "读取错误" /tmp/Proxy_Group)"] && {
echo "读取错误,配置文件异常!" >$START_LOG
echo "读取错误,配置文件$CONFIG_NAME异常!" >$START_LOG
uci commit openclash
sleep 5
echo "" >$START_LOG
exit 0
}
awk '/Proxy Group:/,/Rule:/{print}' /etc/openclash/config.yaml 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
#判断各个区位置
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$CONFIG_FILE" 2>/dev/null)
provider_len=$(sed -n '/^ \{0,\}proxy-provider:/=' "$CONFIG_FILE" 2>/dev/null)
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
if [ "$servers_update" -ne "1" ] || [ "$servers_if_update" != "1" ] || [ -z "$(grep "config groups" "$CFG_FILE")" ]; then
echo "正在删除旧配置..." >$START_LOG
#删除策略组
while [[ ! -z "$(grep "config groups" "$CFG_FILE")" ]]
do
uci delete openclash.@groups[0] 2>/dev/null
uci commit openclash
done
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
uci delete openclash.@groups["$i"] 2>/dev/null
uci commit openclash
fi
done
#删除启用节点
server_num=$(grep "config servers" "$CFG_FILE" |wc -l)
for ((i=$server_num;i>=0;i--))
do
echo $(uci get openclash.@servers["$i"].enabled)
if [ "$(uci get openclash.@servers["$i"].enabled)" = "1" ]; then
uci delete openclash.@servers["$i"] 2>/dev/null
uci commit openclash
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
uci delete openclash.@servers["$i"] 2>/dev/null
uci commit openclash
fi
fi
done
#删除启用代理集
provider_num=$(grep "config proxy-provider" "$CFG_FILE" |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"].enabled)" = "1" ]; then
uci delete openclash.@proxy-provider["$i"] 2>/dev/null
uci commit openclash
fi
fi
done
else
@ -88,12 +132,17 @@ do
#test_interval
group_test_interval="$(cfg_get "interval:" "$single_group")"
echo "正在读取【$group_type】-【$group_name】策略组配置..." >$START_LOG
echo "正在读取【$CONFIG_NAME】-【$group_type】-【$group_name】策略组配置..." >$START_LOG
name=openclash
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}name="$group_name"
${uci_set}old_name="$group_name"
${uci_set}old_name_cfg="$group_name"
@ -110,12 +159,24 @@ do
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)
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)
name2_len=$(sed -n "/${group_name2}/=" $single_group 2>/dev/null)
if [ -z "$group_name1" ] && [ -z "$group_name2" ]; then
continue
elif [ ! -z "$group_name1" ] && [ -z "$group_name2" ]; then
if [ ! -z "$(grep -F "$group_name1" $match_group_file)" ] && [ "$group_name1" != "$group_name" ]; then
${uci_add}other_group="$group_name1"
fi
if [ ! -z "$group_name1" ] && [ -z "$group_name2" ]; then
if [ "$proxies_len" -le "$use_len" ]; then
if [ "$name1_len" -le "$use_len" ] && [ ! -z "$(grep -F "$group_name1" $match_group_file)" ] && [ "$group_name1" != "$group_name" ]; then
${uci_add}other_group="$group_name1"
fi
else
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
elif [ -z "$group_name1" ] && [ ! -z "$group_name2" ]; then
group_num=$(expr $(echo "$group_name2" |grep -c "#,#") + 1)

View File

@ -1,5 +1,15 @@
#!/bin/sh
CFG_FILE="/etc/openclash/config.yaml"
CFG_FILE=$(uci get openclash.config.config_path 2>/dev/null)
UPDATE_CONFIG_FILE=$(uci get openclash.config.config_update_path 2>/dev/null)
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
CFG_FILE="$UPDATE_CONFIG_FILE"
fi
if [ -z "$CFG_FILE" ]; then
CFG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
fi
if [ -f "$CFG_FILE" ]; then
#检查关键字避免后续操作出错
@ -8,6 +18,11 @@ if [ -f "$CFG_FILE" ]; then
sed -i '/^ \{0,\}\"Proxy\":/c\Proxy:' "$CFG_FILE"
}
[ ! -z "$(grep "^ \{0,\}'proxy-provider':" "$CFG_FILE")" ] || [ ! -z "$(grep '^ \{0,\}"proxy-provider":' "$CFG_FILE")" ] && {
sed -i "/^ \{0,\}\'proxy-provider\:'/c\proxy-provider:" "$3"
sed -i '/^ \{0,\}\"proxy-provider\":/c\proxy-provider:' "$3"
}
[ ! -z "$(grep "^ \{0,\}'Proxy Group':" "$CFG_FILE")" ] || [ ! -z "$(grep '^ \{0,\}"Proxy Group":' "$CFG_FILE")" ] && {
sed -i "/^ \{0,\}\'Proxy Group\':/c\Proxy Group:" "$CFG_FILE"
sed -i '/^ \{0,\}\"Proxy Group\":/c\Proxy Group:' "$CFG_FILE"
@ -23,7 +38,15 @@ if [ -f "$CFG_FILE" ]; then
sed -i '/^ \{0,\}\"dns\":/c\dns:' "$CFG_FILE"
}
awk '/Proxy Group:/,/Rule:/{print}' /etc/openclash/config.yaml 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
#判断各个区位置
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$CONFIG_FILE" 2>/dev/null)
provider_len=$(sed -n '/^ \{0,\}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
awk '/Proxy Group:/,/Rule:/{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
fi
if [ "$?" -eq "0" ]; then
echo 'DIRECT' >>/tmp/Proxy_Group
echo 'REJECT' >>/tmp/Proxy_Group

View File

@ -4,8 +4,27 @@ status=$(ps|grep -c /usr/share/openclash/yml_groups_set.sh)
START_LOG="/tmp/openclash_start.log"
GROUP_FILE="/tmp/yaml_groups.yaml"
CONFIG_FILE="/etc/openclash/config.yaml"
CFG_FILE="/etc/config/openclash"
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
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)
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
CONFIG_FILE="$UPDATE_CONFIG_FILE"
CONFIG_NAME="$UPDATE_CONFIG_NAME"
fi
if [ -z "$CONFIG_FILE" ]; then
CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
CONFIG_NAME=$(echo $CONFIG_FILE |awk -F '/' '{print $5}' 2>/dev/null)
fi
if [ -z "$CONFIG_NAME" ]; then
CONFIG_FILE="/etc/openclash/config/config.yaml"
CONFIG_NAME="config.yaml"
fi
#加入节点
yml_servers_add()
@ -13,6 +32,12 @@ yml_servers_add()
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
config_get "config" "$section" "config" ""
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ]; then
return
fi
if [ "$enabled" = "0" ]; then
return
else
@ -29,33 +54,74 @@ set_groups()
fi
if [ "$1" = "$3" ]; then
set_group=1
echo " - \"${2}\"" >>$GROUP_FILE
fi
}
#加入其它策略组
set_other_groups()
{
if [ -z "$1" ]; then
return
fi
set_group=1
echo " - ${1}" >>$GROUP_FILE
}
#加入代理集
set_proxy_provider()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
config_get "config" "$section" "config" ""
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ]; then
return
fi
if [ "$enabled" = "0" ]; then
return
else
config_get "name" "$section" "name" ""
config_list_foreach "$section" "groups" set_provider_groups "$name" "$2"
fi
}
set_provider_groups()
{
if [ -z "$1" ]; then
return
fi
if [ "$1" = "$3" ]; then
set_proxy_provider=1
echo " - ${2}" >>$GROUP_FILE
fi
}
#创建策略组
yml_groups_set()
{
local section="$1"
config_get "config" "$section" "config" ""
config_get "type" "$section" "type" ""
config_get "name" "$section" "name" ""
config_get "old_name" "$section" "old_name" ""
config_get "test_url" "$section" "test_url" ""
config_get "test_interval" "$section" "test_interval" ""
if [ "$servers_update" -eq "1" ] && [ "$config" != "all" ]; then
return
fi
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
return
fi
if [ -z "$type" ]; then
return
fi
@ -68,11 +134,12 @@ yml_groups_set()
return
fi
echo "正在写入【$type】-【$name】策略组到配置文件..." >$START_LOG
echo "正在写入【$type】-【$name】策略组到配置文件$CONFIG_NAME..." >$START_LOG
echo "- name: $name" >>$GROUP_FILE
echo " type: $type" >>$GROUP_FILE
echo " proxies:" >>$GROUP_FILE
group_name="$name"
echo " proxies: $group_name" >>$GROUP_FILE
#名字变化时处理规则部分
if [ "$name" != "$old_name" ] && [ ! -z "$old_name" ]; then
@ -82,8 +149,27 @@ yml_groups_set()
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" #加入服务器节点
echo " use: $group_name" >>$GROUP_FILE
config_foreach set_proxy_provider "proxy-provider" "$group_name" #加入代理集
if [ "$set_group" -eq 1 ]; then
sed -i "/^ \{0,\}proxies: ${group_name}/c\ proxies:" $GROUP_FILE
else
sed -i "/proxies: ${group_name}/d" $GROUP_FILE 2>/dev/null
fi
if [ "$set_proxy_provider" -eq 1 ]; then
sed -i "/^ \{0,\}use: ${group_name}/c\ use:" $GROUP_FILE
else
sed -i "/use: ${group_name}/d" $GROUP_FILE 2>/dev/null
fi
[ ! -z "$test_url" ] && {
echo " url: $test_url" >>$GROUP_FILE
@ -97,19 +183,19 @@ create_config=$(uci get openclash.config.create_config 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ]; then
/usr/share/openclash/yml_groups_name_get.sh
if [ -z "$(grep "^ \{0,\}Proxy:" /etc/openclash/config.yaml)" ] || [ -z "$(grep "^ \{0,\}Rule:" /etc/openclash/config.yaml)" ]; then
echo "配置文件信息读取失败,无法进行修改,请选择一键创建配置文件..." >$START_LOG
if [ ! -z "$(grep "读取错误" /tmp/Proxy_Group)"]; then
echo "配置文件$CONFIG_NAME】的信息读取失败,无法进行修改,请选择一键创建配置文件..." >$START_LOG
uci commit openclash
sleep 5
echo "" >$START_LOG
exit 0
else
echo "开始写入配置文件策略组信息..." >$START_LOG
echo "开始写入配置文件【$CONFIG_NAME】的策略组信息..." >$START_LOG
echo "Proxy Group:" >$GROUP_FILE
config_load "openclash"
config_foreach yml_groups_set "groups"
sed -i "s/#d//g" $CONFIG_FILE 2>/dev/null
echo "Rule:" >>$GROUP_FILE
echo "配置文件策略组写入完成!" >$START_LOG
echo "配置文件【$CONFIG_NAME】的策略组写入完成!" >$START_LOG
fi
fi
/usr/share/openclash/yml_proxys_set.sh >/dev/null 2>&1
/usr/share/openclash/yml_proxys_set.sh

View File

@ -3,46 +3,295 @@ status=$(ps|grep -c /usr/share/openclash/yml_proxys_get.sh)
[ "$status" -gt "3" ] && exit 0
START_LOG="/tmp/openclash_start.log"
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)
if [ ! -f "/etc/openclash/config.yml" ] && [ ! -f "/etc/openclash/config.yaml" ]; then
exit 0
elif [ ! -f "/etc/openclash/config.yaml" ] && [ "$(ls -l /etc/openclash/config.yml 2>/dev/null |awk '{print int($5/1024)}')" -gt 0 ]; then
mv "/etc/openclash/config.yml" "/etc/openclash/config.yaml"
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
CONFIG_FILE="$UPDATE_CONFIG_FILE"
CONFIG_NAME="$UPDATE_CONFIG_NAME"
fi
echo "开始更新服务器节点配置..." >$START_LOG
awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{print}' /etc/openclash/config.yaml 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_proxy.yaml 2>&1
if [ -z "$CONFIG_FILE" ]; then
CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
CONFIG_NAME=$(echo $CONFIG_FILE |awk -F '/' '{print $5}' 2>/dev/null)
fi
if [ -z "$CONFIG_NAME" ]; then
CONFIG_FILE="/etc/openclash/config/config.yaml"
CONFIG_NAME="config.yaml"
fi
BACKUP_FILE="/etc/openclash/backup/$(echo $CONFIG_FILE |awk -F '/' '{print $5}' 2>/dev/null)"
if [ ! -s $CONFIG_FILE ] && [ ! -s $BACKUP_FILE ]; then
exit 0
elif [ ! -s $CONFIG_FILE ] && [ -s $BACKUP_FILE ]; then
mv $BACKUP_FILE $CONFIG_FILE
fi
#判断各个区位置
proxy_len=$(sed -n '/^ \{0,\}Proxy:/=' "$CONFIG_FILE" 2>/dev/null)
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$CONFIG_FILE" 2>/dev/null)
provider_len=$(sed -n '/^ \{0,\}proxy-provider:/=' "$CONFIG_FILE" 2>/dev/null)
if [ "$provider_len" -ge "$proxy_len" ] && [ "$provider_len" -le "$group_len" ]; then
awk '/^ {0,}Proxy:/,/^ {0,}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_proxy.yaml 2>&1
awk '/^ {0,}proxy-provider:/,/^ {0,}Proxy Group:/{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_provider.yaml 2>&1
elif [ "$provider_len" -le "$proxy_len" ]; then
awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{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_proxy.yaml 2>&1
awk '/^ {0,}proxy-provider:/,/^ {0,}Proxy:/{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_provider.yaml 2>&1
elif [ "$provider_len" -ge "$group_len" ]; then
awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{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_proxy.yaml 2>&1
awk '/^ {0,}proxy-provider:/,/^ {0,}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_provider.yaml 2>&1
elif [ "$provider_len" -le "$group_len" ]; then
awk '/^ {0,}proxy-provider:/,/^ {0,}Proxy Group:/{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_provider.yaml 2>&1
else
awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{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_proxy.yaml 2>&1
fi
CONFIG_FILE="/etc/openclash/config.yaml"
CFG_FILE="/etc/config/openclash"
server_file="/tmp/yaml_proxy.yaml"
provider_file="/tmp/yaml_provider.yaml"
single_server="/tmp/servers.yaml"
single_provider="/tmp/provider.yaml"
single_provider_gen="/tmp/provider_gen.yaml"
single_provider_che="/tmp/provider_che.yaml"
match_servers="/tmp/match_servers.list"
match_provider="/tmp/match_provider.list"
group_num=$(grep -c "name:" /tmp/yaml_group.yaml)
servers_update=$(uci get openclash.config.servers_update 2>/dev/null)
servers_update_keyword=$(uci get openclash.config.servers_update_keyword 2>/dev/null)
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
new_servers_group=$(uci get openclash.config.new_servers_group 2>/dev/null)
count=1
#proxy
line=$(sed -n '/^ \{0,\}-/=' $server_file)
num=$(grep -c "^ \{0,\}-" $server_file)
count=1
#provider
sed -i '/^ *$/d' $provider_file 2>/dev/null
sed -i '/^ \{0,\}#/d' $provider_file 2>/dev/null
sed -i 's/\t/ /g' $provider_file 2>/dev/null
provider_line=$(awk '{print $0"#*#"FNR}' $provider_file |grep -v '^ \{0,\}proxy-provider:\|^ \{0,\}Proxy:\|^ \{0,\}Proxy Group:\|^ \{0,\}Rule:\|^ \{0,\}type:\|^ \{0,\}path:\|^ \{0,\}url:\|^ \{0,\}interval:\|^ \{0,\}health-check:\|^ \{0,\}enable:' |awk -F '#*#' '{print $3}')
provider_num=$(grep -c "^ \{0,\}type:" $provider_file)
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/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//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"
}
provider_nums=$(( $provider_nums + 1 ))
}
cfg_new_provider_groups_get()
{
if [ -z "$1" ]; then
return
fi
${uci_add}groups="${1}"
}
for n in $provider_line
do
[ "$provider_count" -eq 1 ] && {
startLine="$n"
}
provider_count=$(expr "$provider_count" + 1)
if [ "$provider_count" -gt "$provider_num" ]; then
endLine=$(sed -n '$=' $provider_file)
else
endLine=$(expr $(echo "$provider_line" | sed -n "${provider_count}p") - 1)
fi
sed -n "${startLine},${endLine}p" $provider_file >$single_provider
health_check_line=$(sed -n '/^ \{0,\}health-check:/=' $single_provider)
sed -n "1,${health_check_line}p" $single_provider >$single_provider_gen
sed -n "${health_check_line},\$p" $single_provider >$single_provider_che
startLine=$(expr "$endLine" + 1)
#name
provider_name="$(sed -n "${n}p" $provider_file |awk -F ':' '{print $1}' |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null)"
#type
provider_type="$(cfg_get "type:" "$single_provider_gen")"
#path
provider_path="$(cfg_get "path:" "$single_provider_gen")"
#gen_url
provider_gen_url="$(cfg_get "url:" "$single_provider_gen")"
#gen_interval
provider_gen_interval="$(cfg_get "interval:" "$single_provider_gen")"
#che_enable
provider_che_enable="$(cfg_get "enable:" "$single_provider_che")"
#che_url
provider_che_url="$(cfg_get "url:" "$single_provider_che")"
#che_interval
provider_che_interval="$(cfg_get "interval:" "$single_provider_che")"
echo "正在读取【$CONFIG_NAME】-【$provider_name】代理集配置..." >$START_LOG
#代理集存在时获取代理集编号
provider_nums=$(grep -Fw "$provider_name" "$match_provider" |awk -F '.' '{print $1}')
if [ "$servers_update" -eq "1" ] && [ ! -z "$provider_nums" ]; then
sed -i "/^${provider_nums}\./c\#match#" "$match_servers" 2>/dev/null
uci_set="uci -q set openclash.@proxy-provider["$provider_nums"]."
${uci_set}manual="0"
${uci_set}name="$provider_name"
${uci_set}type="$provider_type"
if [ "$provider_type" = "http" ]; then
${uci_set}path="./proxy_provider/$provider_name.yaml"
elif [ "$provider_type" = "file" ]; then
${uci_set}path="$provider_path"
fi
${uci_set}provider_url="$provider_gen_url"
${uci_set}provider_interval="$provider_gen_interval"
${uci_set}health_check="$provider_che_enable"
${uci_set}health_check_url="$provider_che_url"
${uci_set}health_check_interval="$provider_che_interval"
else
#代理集不存在时添加新代理集
name=openclash
uci_name_tmp=$(uci add $name proxy-provider)
uci_set="uci -q set $name.$uci_name_tmp."
uci_add="uci -q add_list $name.$uci_name_tmp."
if [ -z "$new_servers_group" ] && [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq "1" ]; then
${uci_set}enabled="0"
else
${uci_set}enabled="1"
fi
if [ "$servers_if_update" = "1" ]; then
${uci_set}manual="0"
else
${uci_set}manual="1"
fi
${uci_set}config="$CONFIG_NAME"
${uci_set}name="$provider_name"
${uci_set}type="$provider_type"
if [ "$provider_type" = "http" ]; then
${uci_set}path="./proxy_provider/$provider_name.yaml"
elif [ "$provider_type" = "file" ]; then
${uci_set}path="$provider_path"
fi
${uci_set}provider_url="$provider_gen_url"
${uci_set}provider_interval="$provider_gen_interval"
${uci_set}health_check="$provider_che_enable"
${uci_set}health_check_url="$provider_che_url"
${uci_set}health_check_interval="$provider_che_interval"
#加入策略组
if [ "$servers_if_update" = "1" ] && [ ! -z "$new_servers_group" ] && [ ! -z "$(grep "config groups" "$CFG_FILE")" ]; then
#新代理集且设置默认策略组时加入指定策略组
config_load "openclash"
config_list_foreach "config" "new_servers_group" cfg_new_provider_groups_get
else
for ((i=1;i<=$group_num;i++))
do
single_group="/tmp/group_$i.yaml"
use_line=$(sed -n '/^ \{0,\}use:/=' $single_group)
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)
${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)
${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)
${uci_add}groups="$group_name"
fi
fi
done
fi
fi
uci commit openclash
done
#删除订阅中已不存在的代理集
if [ "$servers_if_update" = "1" ]; then
echo "删除【$CONFIG_NAME】订阅中已不存在的代理集..." >$START_LOG
sed -i '/#match#/d' "$match_provider" 2>/dev/null
cat $match_provider |awk -F '.' '{print $1}' |sort -rn |while read line
do
if [ -z "$line" ]; then
continue
fi
if [ "$(uci get openclash.@proxy-provider["$line"].manual)" = "0" ] && [ "$(uci get openclash.@proxy-provider["$line"].config)" = "$CONFIG_NAME" ]; then
uci delete openclash.@proxy-provider["$line"] 2>/dev/null
fi
done
fi
yml_servers_name_get()
{
local section="$1"
config_get "name" "$section" "name" ""
echo "$server_num"."$name" >>"$match_servers"
[ ! -z "$name" ] && {
echo "$server_num"."$name" >>"$match_servers"
}
server_num=$(( $server_num + 1 ))
}
server_key_get()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
if [ "$enabled" = "0" ]; then
return
fi
config_get "name" "$section" "name" ""
config_get "keyword" "$section" "keyword" ""
if [ -z "$name" ]; then
name="config"
fi
if [ ! -z "$keyword" ] && [ "$name.yaml" == "$CONFIG_NAME" ]; then
config_keyword="$keyword"
key_section="$1"
fi
}
server_key_match()
{
if [ "$match" = "true" ] || [ ! -z "$(echo "$1" |grep "^ \{0,\}$")" ] || [ ! -z "$(echo "$1" |grep "^\t\{0,\}$")" ]; then
return
fi
@ -83,19 +332,21 @@ cfg_new_servers_groups_get()
${uci_add}groups="${1}"
}
if [ "$servers_update" -eq "1" ] && [ "$servers_if_update" = "1" ]; then
echo "" >"$match_servers"
server_num=0
config_load "openclash"
config_foreach yml_servers_name_get "servers"
fi
echo "开始更新【$CONFIG_NAME】的服务器节点配置..." >$START_LOG
[ "$servers_update" -eq "1" ] && {
echo "" >"$match_servers"
server_num=0
config_load "openclash"
config_foreach yml_servers_name_get "servers"
}
for n in $line
do
[ "$count" -eq 1 ] && {
startLine="$n"
}
}
count=$(expr "$count" + 1)
if [ "$count" -gt "$num" ]; then
@ -110,15 +361,20 @@ do
#name
server_name="$(cfg_get "name:" "$single_server")"
#节点存在时获取节点编号
config_load "openclash"
config_foreach server_key_get "config_subscribe"
#节点存在时获取节点编号
server_num=$(grep -Fw "$server_name" "$match_servers" |awk -F '.' '{print $1}')
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
sed -i "/^${server_num}\./c\#match#" "$match_servers" 2>/dev/null
fi
#匹配关键字订阅节点
if [ "$servers_if_update" = "1" ]; then
server_num=$(grep -Fw "$server_name" "$match_servers" |awk -F '.' '{print $1}')
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
sed -i "/^${server_num}\./c\#match#" "$match_servers" 2>/dev/null
elif [ ! -z "$servers_update_keyword" ]; then #匹配关键字订阅节点
if [ ! -z "$config_keyword" ]; then
match="false"
config_load "openclash"
config_list_foreach "config" "servers_update_keyword" server_key_match "$server_name"
config_list_foreach "$key_section" "keyword" server_key_match "$server_name"
if [ "$match" = "false" ]; then
echo "跳过【$server_name】服务器节点..." >$START_LOG
continue
@ -174,14 +430,14 @@ do
#username
username="$(cfg_get "username:" "$single_server")"
echo "正在读取【$server_type】-【$server_name】服务器节点配置..." >$START_LOG
echo "正在读取【$CONFIG_NAME】-【$server_type】-【$server_name】服务器节点配置..." >$START_LOG
if [ "$servers_update" -eq "1" ] && [ ! -z "$server_num" ]; then
#更新已有节点
uci_set="uci -q set openclash.@servers["$server_num"]."
${uci_set}manual="0"
${uci_set}type="$server_type" 2>/dev/null
${uci_set}type="$server_type"
${uci_set}server="$server"
${uci_set}port="$port"
if [ "$server_type" = "vmess" ]; then
@ -238,6 +494,7 @@ do
else
${uci_set}manual="1"
fi
${uci_set}config="$CONFIG_NAME"
${uci_set}name="$server_name"
${uci_set}type="$server_type"
${uci_set}server="$server"
@ -280,7 +537,7 @@ do
fi
#加入策略组
if [ "$servers_if_update" = "1" ] && [ "$servers_update" -eq "1" ] && [ ! -z "$new_servers_group" ] && [ ! -z "$(grep "config groups" "$CFG_FILE")" ]; then
if [ "$servers_if_update" = "1" ] && [ ! -z "$new_servers_group" ] && [ ! -z "$(grep "config groups" "$CFG_FILE")" ]; then
#新节点且设置默认策略组时加入指定策略组
config_load "openclash"
config_list_foreach "config" "new_servers_group" cfg_new_servers_groups_get
@ -299,15 +556,15 @@ do
done
#删除订阅中已不存在的节点
if [ "$servers_update" -eq "1" ] && [ "$servers_if_update" = "1" ]; then
echo "删除订阅中已不存在的节点..." >$START_LOG
if [ "$servers_if_update" = "1" ]; then
echo "删除$CONFIG_NAME订阅中已不存在的节点..." >$START_LOG
sed -i '/#match#/d' "$match_servers" 2>/dev/null
cat $match_servers |awk -F '.' '{print $1}' |sort -rn |while read line
do
if [ -z "$line" ]; then
continue
fi
if [ "$(uci get openclash.@servers["$line"].manual)" = "0" ]; then
if [ "$(uci get openclash.@servers["$line"].manual)" = "0" ] && [ "$(uci get openclash.@servers["$line"].config)" = "$CONFIG_NAME" ]; then
uci delete openclash.@servers["$line"] 2>/dev/null
fi
done
@ -316,11 +573,16 @@ fi
uci set openclash.config.servers_if_update=0
uci commit openclash
/usr/share/openclash/cfg_servers_address_fake_block.sh
echo "配置文件读取完成!" >$START_LOG
echo "配置文件$CONFIG_NAME读取完成!" >$START_LOG
sleep 3
echo "" >$START_LOG
rm -rf /tmp/servers.yaml 2>/dev/null
rm -rf /tmp/yaml_proxy.yaml 2>/dev/null
rm -rf /tmp/group_*.yaml 2>/dev/null
rm -rf /tmp/yaml_group.yaml 2>/dev/null
rm -rf /tmp/match_servers.list 2>/dev/null
rm -rf /tmp/match_servers.list 2>/dev/null
rm -rf /tmp/yaml_provider.yaml 2>/dev/null
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

View File

@ -4,8 +4,92 @@ status=$(ps|grep -c /usr/share/openclash/yml_proxys_set.sh)
START_LOG="/tmp/openclash_start.log"
SERVER_FILE="/tmp/yaml_servers.yaml"
PROXY_PROVIDER_FILE="/tmp/yaml_provider.yaml"
servers_if_update=$(uci get openclash.config.servers_if_update 2>/dev/null)
config_auto_update=$(uci get openclash.config.auto_update 2>/dev/null)
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)
if [ ! -z "$UPDATE_CONFIG_FILE" ]; then
CONFIG_FILE="$UPDATE_CONFIG_FILE"
CONFIG_NAME="$UPDATE_CONFIG_NAME"
fi
if [ -z "$CONFIG_FILE" ]; then
CONFIG_FILE="/etc/openclash/config/$(ls -lt /etc/openclash/config/ | grep -E '.yaml|.yml' | head -n 1 |awk '{print $9}')"
CONFIG_NAME=$(echo $CONFIG_FILE |awk -F '/' '{print $5}' 2>/dev/null)
fi
if [ -z "$CONFIG_NAME" ]; then
CONFIG_FILE="/etc/openclash/config/config.yaml"
CONFIG_NAME="config.yaml"
fi
#写入代理集到配置文件
yml_proxy_provider_set()
{
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
config_get "config" "$section" "config" ""
config_get "type" "$section" "type" ""
config_get "name" "$section" "name" ""
config_get "path" "$section" "path" ""
config_get "provider_url" "$section" "provider_url" ""
config_get "provider_interval" "$section" "provider_interval" ""
config_get "health_check" "$section" "health_check" ""
config_get "health_check_url" "$section" "health_check_url" ""
config_get "health_check_interval" "$section" "health_check_interval" ""
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
return
fi
if [ "$enabled" = "0" ]; then
return
fi
if [ -z "$type" ]; then
return
fi
if [ -z "$name" ]; then
return
fi
if [ "$path" != "./proxy_provider/$name.yaml" ] && [ "$type" = "http" ]; then
path="./proxy_provider/$name.yaml"
elif [ -z "$path" ]; then
return
fi
if [ -z "$health_check" ]; then
return
fi
echo "正在写入【$type】-【$name】代理集到配置文件【$CONFIG_NAME】..." >$START_LOG
echo "$name" >> /tmp/Proxy_Provider
cat >> "$PROXY_PROVIDER_FILE" <<-EOF
$name:
type: $type
path: $path
EOF
if [ ! -z "$provider_url" ]; then
cat >> "$PROXY_PROVIDER_FILE" <<-EOF
url: $provider_url
interval: $provider_interval
EOF
fi
cat >> "$PROXY_PROVIDER_FILE" <<-EOF
health-check:
enable: $health_check
url: $health_check_url
interval: $health_check_interval
EOF
}
#写入服务器节点到配置文件
yml_servers_set()
@ -13,6 +97,7 @@ yml_servers_set()
local section="$1"
config_get_bool "enabled" "$section" "enabled" "1"
config_get "config" "$section" "config" ""
config_get "type" "$section" "type" ""
config_get "name" "$section" "name" ""
config_get "server" "$section" "server" ""
@ -36,6 +121,10 @@ yml_servers_set()
config_get "psk" "$section" "psk" ""
config_get "obfs_snell" "$section" "obfs_snell" ""
if [ ! -z "$config" ] && [ "$config" != "$CONFIG_NAME" ] && [ "$config" != "all" ]; then
return
fi
if [ "$enabled" = "0" ]; then
return
fi
@ -60,7 +149,7 @@ yml_servers_set()
return
fi
echo "正在写入【$type】-【$name】节点到配置文件..." >$START_LOG
echo "正在写入【$type】-【$name】节点到配置文件$CONFIG_NAME..." >$START_LOG
if [ "$obfs" != "none" ]; then
if [ "$obfs" = "websocket" ]; then
@ -193,25 +282,52 @@ EOF
#创建配置文件
echo "开始写入配置文件服务器节点信息..." >$START_LOG
echo "Proxy:" >$SERVER_FILE
#proxy-provider
echo "开始写入配置文件【$CONFIG_NAME】的代理集信息..." >$START_LOG
echo "proxy-provider:" >$PROXY_PROVIDER_FILE
rm -rf /tmp/Proxy_Provider
config_load "openclash"
config_foreach yml_servers_set "servers"
echo "Proxy Group:" >>$SERVER_FILE
config_foreach yml_proxy_provider_set "proxy-provider"
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Provider 2>/dev/null #添加参数
if [ "$(grep "-" /tmp/Proxy_Provider |wc -l)" -eq 0 ]; then
rm -rf $PROXY_PROVIDER_FILE
rm -rf /tmp/Proxy_Provider
fi
#proxy
rule_sources=$(uci get openclash.config.rule_sources 2>/dev/null)
create_config=$(uci get openclash.config.create_config 2>/dev/null)
echo "开始写入配置文件【$CONFIG_NAME】的服务器节点信息..." >$START_LOG
echo "Proxy:" >$SERVER_FILE
config_foreach yml_servers_set "servers"
egrep '^ {0,}-' $SERVER_FILE |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,.*//' 2>/dev/null >/tmp/Proxy_Server 2>&1
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Server 2>/dev/null #添加参数
if [ -s "/tmp/Proxy_Server" ]; then
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Server 2>/dev/null #添加参数
else
rm -rf $SERVER_FILE
rm -rf /tmp/Proxy_Server
fi
#一键创建配置文件
if [ "$rule_sources" = "ConnersHua" ] && [ "$servers_if_update" != "1" ]; then
echo "使用ConnersHua规则创建中..." >$START_LOG
echo "Proxy Group:" >>$SERVER_FILE
cat >> "$SERVER_FILE" <<-EOF
- name: Auto - UrlTest
type: url-test
EOF
if [ -f "/tmp/Proxy_Server" ]; then
cat >> "$SERVER_FILE" <<-EOF
proxies:
EOF
fi
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
url: http://www.gstatic.com/generate_204
interval: "600"
@ -222,6 +338,12 @@ cat >> "$SERVER_FILE" <<-EOF
- 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: Domestic
type: select
@ -252,6 +374,12 @@ cat >> "$SERVER_FILE" <<-EOF
- 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: GlobalTV
type: select
@ -260,6 +388,12 @@ cat >> "$SERVER_FILE" <<-EOF
- 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
uci set openclash.config.rule_source="ConnersHua"
uci set openclash.config.GlobalTV="GlobalTV"
uci set openclash.config.AsianTV="AsianTV"
@ -278,12 +412,23 @@ uci set openclash.config.Others="Others"
}
elif [ "$rule_sources" = "lhie1" ] && [ "$servers_if_update" != "1" ]; then
echo "使用lhie1规则创建中..." >$START_LOG
echo "Proxy Group:" >>$SERVER_FILE
cat >> "$SERVER_FILE" <<-EOF
- name: Auto - UrlTest
type: url-test
EOF
if [ -f "/tmp/Proxy_Server" ]; then
cat >> "$SERVER_FILE" <<-EOF
proxies:
EOF
fi
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
url: http://www.gstatic.com/generate_204
interval: "600"
@ -294,6 +439,12 @@ cat >> "$SERVER_FILE" <<-EOF
- 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: Domestic
type: select
@ -306,6 +457,17 @@ cat >> "$SERVER_FILE" <<-EOF
- Proxy
- DIRECT
- Domestic
- name: Apple
type: select
proxies:
- DIRECT
- Proxy
- name: AdBlock
type: select
proxies:
- REJECT
- DIRECT
- Proxy
- name: AsianTV
type: select
proxies:
@ -313,6 +475,12 @@ cat >> "$SERVER_FILE" <<-EOF
- 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: GlobalTV
type: select
@ -321,10 +489,63 @@ cat >> "$SERVER_FILE" <<-EOF
- 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: Speedtest
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: Telegram
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: Netease Music
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
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.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.Domestic="Domestic"
uci set openclash.config.Others="Others"
[ "$config_auto_update" -eq 1 ] && {
@ -334,15 +555,29 @@ uci set openclash.config.Others="Others"
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="Telegram"
uci add_list openclash.config.new_servers_group="Speedtest"
uci add_list openclash.config.new_servers_group="Netease Music"
}
elif [ "$rule_sources" = "ConnersHua_return" ] && [ "$servers_if_update" != "1" ]; then
echo "使用ConnersHua回国规则创建中..." >$START_LOG
echo "Proxy Group:" >>$SERVER_FILE
cat >> "$SERVER_FILE" <<-EOF
- name: Auto - UrlTest
type: url-test
EOF
if [ -f "/tmp/Proxy_Server" ]; then
cat >> "$SERVER_FILE" <<-EOF
proxies:
EOF
fi
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
url: http://www.gstatic.com/generate_204
interval: "600"
@ -353,6 +588,12 @@ cat >> "$SERVER_FILE" <<-EOF
- 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: Others
type: select
@ -370,24 +611,52 @@ uci set openclash.config.Others="Others"
uci add_list openclash.config.new_servers_group="Proxy"
}
fi
if [ "$create_config" != "0" ] && [ "$servers_if_update" != "1" ]; then
echo "Rule:" >>$SERVER_FILE
echo "配置文件创建完成,正在更新服务器、策略组信息..." >$START_LOG
cat "$SERVER_FILE" > "/etc/openclash/config.yaml" 2>/dev/null
echo "配置文件【$CONFIG_NAME】创建完成,正在更新服务器、代理集、策略组信息..." >$START_LOG
cat "$PROXY_PROVIDER_FILE" > "$CONFIG_FILE" 2>/dev/null
cat "$SERVER_FILE" >> "$CONFIG_FILE" 2>/dev/null
/usr/share/openclash/yml_groups_get.sh >/dev/null 2>&1
else
echo "服务器、策略组信息修改完成,正在更新配置文件..." >$START_LOG
sed -i '/^ \{0,\}Proxy:/i\#change server#' "/etc/openclash/config.yaml" 2>/dev/null
sed -i '/^ \{0,\}Proxy:/,/^ \{0,\}Rule:/d' "/etc/openclash/config.yaml" 2>/dev/null
sed -i '/#change server#/r/tmp/yaml_servers.yaml' "/etc/openclash/config.yaml" 2>/dev/null
sed -i '/Proxy Group:/r/tmp/yaml_groups.yaml' "/etc/openclash/config.yaml" 2>/dev/null
sed -i '/#change server#/d' "/etc/openclash/config.yaml" 2>/dev/null
echo "服务器、代理集、策略组信息修改完成,正在更新配置文件【$CONFIG_NAME】..." >$START_LOG
#判断各个区位置
proxy_len=$(sed -n '/^Proxy:/=' "$CONFIG_FILE" 2>/dev/null)
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$CONFIG_FILE" 2>/dev/null)
provider_len=$(sed -n '/^proxy-provider:/=' "$CONFIG_FILE" 2>/dev/null)
if [ "$provider_len" -le "$proxy_len" ]; then
sed -i '/^ \{0,\}proxy-provider:/i\#change server#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Rule:/i\#change server end#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}proxy-provider:/,/#change server end#/d' "$CONFIG_FILE" 2>/dev/null
elif [ "$provider_len" -le "$group_len" ] && [ -z "$proxy_len" ]; then
sed -i '/^ \{0,\}proxy-provider:/i\#change server#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Rule:/i\#change server end#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}proxy-provider:/,/#change server end#/d' "$CONFIG_FILE" 2>/dev/null
elif [ "$provider_len" -ge "$group_len" ] && [ -z "$proxy_len" ]; then
sed -i '/^ \{0,\}Proxy Group:/i\#change server#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Rule:/i\#change server end#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Proxy Group:/,/#change server end#/d' "$CONFIG_FILE" 2>/dev/null
else
sed -i '/^ \{0,\}Proxy:/i\#change server#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Rule:/i\#change server end#' "$CONFIG_FILE" 2>/dev/null
sed -i '/^ \{0,\}Proxy:/,/#change server end#/d' "$CONFIG_FILE" 2>/dev/null
fi
sed -i '/#change server#/r/tmp/yaml_groups.yaml' "$CONFIG_FILE" 2>/dev/null
sed -i '/#change server#/r/tmp/yaml_servers.yaml' "$CONFIG_FILE" 2>/dev/null
sed -i '/#change server#/r/tmp/yaml_provider.yaml' "$CONFIG_FILE" 2>/dev/null
sed -i '/#change server#/d' "$CONFIG_FILE" 2>/dev/null
fi
echo "配置文件写入完成!" >$START_LOG
echo "配置文件【$CONFIG_NAME】写入完成!" >$START_LOG
sleep 3
echo "" >$START_LOG
rm -rf $SERVER_FILE 2>/dev/null
rm -rf /tmp/Proxy_Server 2>/dev/null
rm -rf /tmp/yaml_groups.yaml 2>/dev/null
rm -rf $PROXY_PROVIDER_FILE 2>/dev/null
rm -rf /tmp/Proxy_Provider 2>/dev/null
uci set openclash.config.enable=1 2>/dev/null
[ "$(uci get openclash.config.servers_if_update)" == "0" ] && /etc/init.d/openclash restart >/dev/null 2>&1
uci set openclash.config.servers_if_update=0
uci commit openclash
/etc/init.d/openclash restart >/dev/null 2>&1

View File

@ -27,12 +27,15 @@ if [ "$2" != 0 ]; then
AdBlock=$(grep '##AdBlock:' "$4" |awk -F ':' '{print $2}')
Others=$(grep '##Others:' "$4" |awk -F ':' '{print $2}')
Domestic=$(grep '##Domestic:' "$4" |awk -F ':' '{print $2}')
Netease_Music=$(grep '##Netease_Music:' "$4" |awk -F ':' '{print $2}')
Speedtest=$(grep '##Speedtest:' "$4" |awk -F ':' '{print $2}')
Telegram=$(grep '##Telegram:' "$4" |awk -F ':' '{print $2}')
if [ "$2" = "ConnersHua_return" ]; then
if [ "$(uci get openclash.config.Proxy)" != "$Proxy" ]\
|| [ "$(uci get openclash.config.Others)" != "$Others" ];then
check_def=1
fi
else
elif [ "$2" = "ConnersHua" ]; then
if [ "$(uci get openclash.config.GlobalTV)" != "$GlobalTV" ]\
|| [ "$(uci get openclash.config.AsianTV)" != "$AsianTV" ]\
|| [ "$(uci get openclash.config.Proxy)" != "$Proxy" ]\
@ -42,6 +45,19 @@ if [ "$2" != 0 ]; then
|| [ "$(uci get openclash.config.Domestic)" != "$Domestic" ]; then
check_def=1
fi
elif [ "$2" = "lhie1" ]; then
if [ "$(uci get openclash.config.GlobalTV)" != "$GlobalTV" ]\
|| [ "$(uci get openclash.config.AsianTV)" != "$AsianTV" ]\
|| [ "$(uci get openclash.config.Proxy)" != "$Proxy" ]\
|| [ "$(uci get openclash.config.Apple)" != "$Apple" ]\
|| [ "$(uci get openclash.config.AdBlock)" != "$AdBlock" ]\
|| [ "$(uci get openclash.config.Netease_Music)" != "$Netease_Music" ]\
|| [ "$(uci get openclash.config.Speedtest)" != "$Speedtest" ]\
|| [ "$(uci get openclash.config.Telegram)" != "$Telegram" ]\
|| [ "$(uci get openclash.config.Others)" != "$Others" ]\
|| [ "$(uci get openclash.config.Domestic)" != "$Domestic" ]; then
check_def=1
fi
fi
}
@ -51,6 +67,9 @@ if [ "$2" != 0 ]; then
Proxy=$(uci get openclash.config.Proxy 2>/dev/null)
Apple=$(uci get openclash.config.Apple 2>/dev/null)
AdBlock=$(uci get openclash.config.AdBlock 2>/dev/null)
Netease_Music=$(uci get openclash.config.Netease_Music 2>/dev/null)
Speedtest=$(uci get openclash.config.Speedtest 2>/dev/null)
Telegram=$(uci get openclash.config.Telegram 2>/dev/null)
Domestic=$(uci get openclash.config.Domestic 2>/dev/null)
Others=$(uci get openclash.config.Others 2>/dev/null)
if [ "$2" = "lhie1" ]; then
@ -59,6 +78,11 @@ if [ "$2" != 0 ]; then
sed -i -e "s/,GlobalTV/,${GlobalTV}#d/g" -e "/Rule:/a\##GlobalTV:${GlobalTV}"\
-e "s/,AsianTV/,${AsianTV}#d/g" -e "/Rule:/a\##AsianTV:${AsianTV}"\
-e "s/,Proxy/,${Proxy}#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,Apple/,${Apple}#d/g" -e "/Rule:/a\##Apple:${Apple}"\
-e "s/,AdBlock/,${AdBlock}#d/g" -e "/Rule:/a\##AdBlock:${AdBlock}"\
-e "s/,Netease Music/,${Netease_Music}#d/g" -e "/Rule:/a\##Netease_Music:${Netease_Music}"\
-e "s/,Speedtest/,${Speedtest}#d/g" -e "/Rule:/a\##Speedtest:${Speedtest}"\
-e "s/,Telegram/,${Telegram}#d/g" -e "/Rule:/a\##Telegram:${Telegram}"\
-e "s/,Domestic/,${Domestic}#d/g" -e "/Rule:/a\##Domestic:${Domestic}"\
-e "s/,Others/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
-e "s/#d//g" "$4"
@ -101,7 +125,7 @@ fi
[ "$3" = 1 ] && {
sed -i '/^Rule:/a\##Custom Rules End##' "$4" 2>/dev/null
sed -i '/^Rule:/a\##Custom Rules##' "$4" 2>/dev/null
sed -i '/^##Custom Rules##/r/etc/config/openclash_custom_rules.list' "$4" 2>/dev/null
sed -i '/^##Custom Rules##/r/etc/openclash/custom/openclash_custom_rules.list' "$4" 2>/dev/null
sed -i "s/^ \{0,\}-/-/" "$4" 2>/dev/null #修改参数空格
sed -i "s/^\t\{0,\}-/-/" "$4" 2>/dev/null #修改参数tab
}

View File

@ -62,14 +62,11 @@ msgstr "文件不存在"
msgid "Not Set"
msgstr "未设置"
msgid "Server Configuration"
msgstr "配置文件"
msgid "Server logs"
msgstr "服务器日志"
msgstr "运行日志"
msgid "Logs"
msgstr "服务器日志"
msgstr "运行日志"
msgid "Enable Clash"
msgstr "启动 OpenClash"
@ -95,6 +92,15 @@ msgstr "Redir-Host兼容模式"
msgid "fake-ip"
msgstr "Fake-IP增强模式"
msgid "fake-ip(tun mode)"
msgstr "Fake-IPTUN模式【依赖kmod-tun】"
msgid "redir-host-vpn(game mode)"
msgstr "Redir-Host游戏模式【依赖kmod-tun】"
msgid "fake-ip-vpn(game mode)"
msgstr "Fake-IP游戏模式【依赖kmod-tun】"
msgid "Select Mode For OpenClash Work, Network Error Try Flush DNS Cache"
msgstr "选择运行模式在兼容模式下无法代理路由器自身流量如客户端的网络无法连接请尝试清除DNS缓存"
@ -226,10 +232,13 @@ msgid "Rules Setting"
msgstr "规则设置(访问控制)"
msgid "Server Config"
msgstr "配置文件"
msgstr "配置文件管理"
msgid "Upload Config"
msgstr "上传配置文件"
msgid "Upload File Type"
msgstr "上传文件类型"
msgid "Proxy Provider File"
msgstr "代理集文件"
msgid "Upload"
msgstr "上传"
@ -244,27 +253,15 @@ msgid "No specify upload file."
msgstr "未指定上传文件"
msgid ""
"Rename your config file to config.yaml before upload what would be save to /etc/openclash"
msgstr "注意:上传之前请将配置文件重命名为 config.yaml ,文件将被保存到 /etc/openclash"
"Only Support yaml what would be save to /etc/openclash/config/"
msgstr "注意:只支持【yaml】后缀的文件文件将被保存到 /etc/openclash/config/"
msgid "Keyword Matching Setting"
msgstr "筛选节点"
msgid "Only Keep Servers which Matching Keywords, eg: hk or tw&bgp"
msgstr "仅订阅名字与以上任意一行关键字匹配的节点,不区分大小写,条件且请用(&)表示。格式示例:香港、台湾&bgp"
msgid "Proxy Provider File List"
msgstr "代理集文件列表"
msgid "Please Make Sure Ports Available"
msgstr "请确保端口可用"
msgid "Subcription Url"
msgstr "订阅地址"
msgid "Update Url Type"
msgstr "订阅地址类型"
msgid "Power By fndroidUse Other Rules If V2rayN Subcription"
msgstr "API提供FndroidV2rayN类型的订阅可配合第三方规则使用"
msgid "Update Subcription"
msgstr "更新订阅配置"
@ -394,6 +391,15 @@ msgstr "必须代理的流量"
msgid "Apple"
msgstr "苹果服务流量"
msgid "Netease Music"
msgstr "网易云音乐流量"
msgid "Speedtest"
msgstr "测速流量"
msgid "Telegram"
msgstr "Telegram流量"
msgid "AdBlock"
msgstr "广告流量"
@ -468,8 +474,8 @@ msgid "Only For IPK Install Type Or Not Release Memory"
msgstr ""
"只支持通过IPK安装的版本进行更新因为随系统编译的版本更新后不会释放旧版本的闪存空间"
msgid "Severs&Groups"
msgstr "服务器&策略组"
msgid "Severs and Groups"
msgstr "服务器与策略组管理"
msgid "Load Config"
msgstr "读取配置"
@ -480,6 +486,9 @@ msgstr "删除未启用节点"
msgid "Delete Severs"
msgstr "清空服务器配置"
msgid "Delete Proxy Provider"
msgstr "清空代理集配置"
msgid "Delete Groups"
msgstr "清空策略组配置"
@ -493,7 +502,7 @@ msgid "Keep Settings"
msgstr "保留配置"
msgid "Only Update Servers Below When Subscription"
msgstr "订阅时仅更新节点,保留下方策略组设置,不修改顺序"
msgstr "订阅时仅更新节点和代理集,保留下方策略组设置,不修改顺序"
msgid "New Servers Group"
msgstr "新节点默认策略组"
@ -562,7 +571,7 @@ msgid "Create Config"
msgstr "一键生成配置文件"
msgid "Create Config By One-Click Only Need Proxys"
msgstr "一键生成配置文件功能只需要配置服务器节点信息"
msgstr "一键生成配置文件功能只需要配置服务器节点信息或代理集信息"
msgid "Proxy Groups(No Need Set when Config Create)"
msgstr "策略组配置(使用一键生成配置文件功能时无需设置)"
@ -606,6 +615,9 @@ msgstr "包含其他策略组(请勿重复添加)"
msgid "The Added Proxy Groups Must Exist Except 'DIRECT' & 'REJECT'"
msgstr "注意:除'DIRECT'和'REJECT'外,修改配置文件前添加的其他策略组必须已创建"
msgid "The Added Proxy Provider Must Exist"
msgstr "修改配置文件前添加的代理集必须已创建"
msgid "Proxy Group"
msgstr "添加到策略组(请勿重复添加)"
@ -618,6 +630,93 @@ msgstr "清理日志"
msgid "Refresh Log"
msgstr "刷新日志"
msgid "Config File"
msgstr "配置文件"
msgid "State"
msgstr "状态"
msgid "Update Time"
msgstr "更新时间"
msgid "File Name"
msgstr "文件名"
msgid "Switch Config"
msgstr "切换"
msgid "Size"
msgstr "文件大小"
msgid "Remove"
msgstr "移除"
msgid "(Enable or Disable Subscribe)"
msgstr "(启用或禁用更新)"
msgid "Config Alias"
msgstr "配置文件名"
msgid "(Name For Distinguishing)"
msgstr "(用于区分,请勿重名)"
msgid "Subscribe Address"
msgstr "订阅地址"
msgid "Subscribe Type"
msgstr "订阅地址类型"
msgid "(Power By fndroid)"
msgstr "API提供Fndroid"
msgid "(Not Null)"
msgstr "(空值无效)"
msgid "Keyword Match"
msgstr "筛选节点"
msgid "(eg: hk or tw&bgp)"
msgstr "(格式示例:香港、台湾&bgp"
msgid "Config File List"
msgstr "配置文件列表"
msgid "Use For All Config File"
msgstr "添加到所有配置文件"
msgid "Proxy-Provider"
msgstr "代理集管理"
msgid "Edit Proxy-Provider"
msgstr "编辑代理集配置"
msgid "Provider Type"
msgstr "代理集类型
msgid "Choose The Provider Type"
msgstr "选择代理集的类型"
msgid "Provider Name"
msgstr "代理集别名(请勿重名)"
msgid "Provider Path"
msgstr "代理集路径Path"
msgid "Update Your Proxy Provider File From Config Luci Page"
msgstr "请先在配置文件管理页面上传您的代理集文件"
msgid "Provider URL"
msgstr "代理集URL"
msgid "Provider Interval(s)"
msgstr "代理集更新间隔s"
msgid "Provider Health Check"
msgstr "代理集状态检查"
msgid "Health Check URL"
msgstr "状态检查URL"
msgid "Health Check Interval(s)"
msgstr "状态检查间隔s"