Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
houzi- authored Dec 31, 2022
1 parent a0d1a2e commit 2a66ff0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions koolclash/scripts/koolclash_control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -574,18 +574,18 @@ load_clash_white_black() {
ip_black_old=$(echo $koolclash_firewall_blackip_base64_old | base64_decode | sed '/\#/d')
for ip in $ip_black_old; do
SRC_IP_CIDR=$(echo $ip | sed 's/\/.*//g' | awk -F "." -v OFS='.' '{print $1,$2,$3,$4"\\/32"}' | sort | uniq)
sed -i "s/- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F530 节点选择\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
sed -i "s/- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F1FA\\\U0001F1F3 国外网站\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
done
dbus remove koolclash_firewall_blackip_base64_old
fi
for ip in $ip_black; do
SRC_IP_CIDR=$(echo $ip | sed 's/\/.*//g' | awk -F "." -v OFS='.' '{print $1,$2,$3,$4"\\/32"}' | sort | uniq)
sed -i "s/- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F530 节点选择\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
sed -i "s/- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F1FA\\\U0001F1F3 国外网站\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
done
yaml_line=$(cat $KSROOT/koolclash/config/config.yaml | grep -n "DOMAIN-SUFFIX,local," | awk -F ":" '{print $1}')
for ip in $ip_black; do
SRC_IP_CIDR=$(echo $ip | sed 's/\/.*//g' | awk -F "." -v OFS='.' '{print $1,$2,$3,$4"\\/32"}' | sort | uniq)
sed -i "$yaml_line i\- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F530 节点选择\"" $KSROOT/koolclash/config/config.yaml
sed -i "$yaml_line i\- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F1FA\\\U0001F1F3 国外网站\"" $KSROOT/koolclash/config/config.yaml
done
dbus set koolclash_firewall_blackip_enable=0
dbus set koolclash_firewall_blackip_base64_old=$koolclash_firewall_blackip_base64
Expand All @@ -594,7 +594,7 @@ load_clash_white_black() {
ip_black=$(echo $koolclash_firewall_blackip_base64_old | base64_decode | sed '/\#/d')
for ip in $ip_black; do
SRC_IP_CIDR=$(echo $ip | sed 's/\/.*//g' | awk -F "." -v OFS='.' '{print $1,$2,$3,$4"\\/32"}' | sort | uniq)
sed -i "s/- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F530 节点选择\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
sed -i "s/- \"SRC-IP-CIDR,$SRC_IP_CIDR,\\\U0001F1FA\\\U0001F1F3 国外网站\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
done
dbus remove koolclash_firewall_blackip_base64_old
fi
Expand All @@ -608,24 +608,24 @@ load_clash_white_black() {
if [ ! -z "$koolclash_firewall_blackdomain_base64_old" ]; then
ip_black_domain_old=$(echo $koolclash_firewall_blackdomain_base64_old | base64_decode | sed '/\#/d')
for domain in $ip_black_domain_old; do
sed -i "s/- \"DOMAIN-SUFFIX,$domain,\\\U0001F530 节点选择\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
sed -i "s/- \"DOMAIN-SUFFIX,$domain,\\\U0001F1FA\\\U0001F1F3 国外网站\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
done
dbus remove koolclash_firewall_blackdomain_base64_old
fi
for domain in $ip_black_domain; do
sed -i "s/- \"DOMAIN-SUFFIX,$domain,\\\U0001F530 节点选择\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
sed -i "s/- \"DOMAIN-SUFFIX,$domain,\\\U0001F1FA\\\U0001F1F3 国外网站\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
done
yaml_line=$(cat $KSROOT/koolclash/config/config.yaml | grep -n "DOMAIN-SUFFIX,local," | awk -F ":" '{print $1}')
for domain in $ip_black_domain; do
sed -i "$yaml_line i\- \"DOMAIN-SUFFIX,$domain,\\\U0001F530 节点选择\"" $KSROOT/koolclash/config/config.yaml
sed -i "$yaml_line i\- \"DOMAIN-SUFFIX,$domain,\\\U0001F1FA\\\U0001F1F3 国外网站\"" $KSROOT/koolclash/config/config.yaml
done
dbus set koolclash_firewall_blackdomain_enable=0
dbus set koolclash_firewall_blackdomain_base64_old=$koolclash_firewall_blackdomain_base64
else
if [ ! -z "$koolclash_firewall_blackdomain_base64_old" ]; then
ip_black_domain=$(echo $koolclash_firewall_blackdomain_base64_old | base64_decode | sed '/\#/d')
for domain in $ip_black_domain; do
sed -i "s/- \"DOMAIN-SUFFIX,$domain,\\\U0001F530 节点选择\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
sed -i "s/- \"DOMAIN-SUFFIX,$domain,\\\U0001F1FA\\\U0001F1F3 国外网站\"//g" $KSROOT/koolclash/config/config.yaml;sed -i '/^$/d' $KSROOT/koolclash/config/config.yaml
done
dbus remove koolclash_firewall_blackdomain_base64_old
fi
Expand Down
2 changes: 1 addition & 1 deletion koolclash/scripts/koolclash_subconverter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sub_url_update () {
dbus set koolclash_update_mode=2
start_stop_subconverter
sleep 3s
subconverter_links="http://127.0.0.1:25500/sub?target=clash&new_name=true&url=$koolclash_sub_link&insert=false&config=ruleconfig%2FZHANG.ini&include=&exclude=&append_type=false&emoji=true&udp=false&fdn=true&sort=true&scv=false&tfo=false"
subconverter_links="http://127.0.0.1:25500/sub?target=clash&new_name=true&url=$koolclash_sub_link&insert=false&config=ruleconfig%2FZHANG.ini&include=&exclude=&append_type=false&emoji=true&udp=false&fdn=true&sort=true&scv=false&tfo=false&expand=true"
UA='Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36'
$curl -4sSk --user-agent "$UA" --connect-timeout 30 "$subconverter_links" > $KSROOT/koolclash/config/origin.yml
if [ "$?" == "0" ]; then
Expand Down

0 comments on commit 2a66ff0

Please sign in to comment.