Skip to content

Fork & Edit

Fork & Edit #8359

Workflow file for this run

# 最后更新时间: 2024-11-22 22:50
name: Fork & Edit
on:
workflow_dispatch:
schedule:
- cron: "0 6,18 * * *"
jobs:
Fork-FLITER-list:
runs-on: ubuntu-latest
env:
TZ: 'Asia/Shanghai'
steps:
- name: Checkout target repository
uses: actions/[email protected]
with:
repository: Repcz/Tool
path: Tool-repo
###### GeoIP
- name: Copy
run: |
mkdir -p Tool/GeoIP
curl -L -o Tool-repo/GeoIP/CN_Country.mmdb "https://raw.githubusercontent.com/Masaiki/GeoIP2-CN/release/Country.mmdb"
curl -L -o Tool-repo/GeoIP/Global_Country.mmdb "https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb"
###### Surge
- name: Copy Surge/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
# 苹果
curl -A "Surge iOS/3367" -L -o Tool-repo/Surge/Rules/APNs.list "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/Surge/Rules/Apple.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/Surge/Rules/AppStore.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/Surge/Rules/AppleID.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/Surge/Rules/AppleMusic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/Surge/Rules/iCloud.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/Surge/Rules/TestFlight.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/Surge/Rules/AppleProxy.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
curl -L -o Tool-repo/Surge/Rules/OpenAI.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Surge/Rules/Claude.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Surge/Rules/AI.list "https://ruleset.skk.moe/List/non_ip/ai.conf"
# 社交媒体
curl -L -o Tool-repo/Surge/Rules/Twitter.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Surge/Rules/Instagram.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Surge/Rules/Facebook.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Surge/Rules/YouTube.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Surge/Rules/Google.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Surge/Rules/Github.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Surge/Rules/OneDrive.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Surge/Rules/Microsoft.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 甲骨文
curl -L -o Tool-repo/Surge/Rules/Oracle.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# 流媒体
curl -A "Surge iOS/3367" -L -o Tool-repo/Surge/Rules/TikTok.list "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Surge/Rules/Netflix.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Netflix.list"
curl -L -o Tool-repo/Surge/Rules/HBO.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Surge/Rules/Disney.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Surge/Rules/Spotify.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Surge/Rules/PrimeVideo.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Surge/Rules/FitnessPlus.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Surge/Rules/AppleMedia.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Surge/Rules/Bahamut.list "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Surge/Rules/ProxyMedia.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
# PayPal
curl -L -o Tool-repo/Surge/Rules/PayPal.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# Cloudflare
curl -L -o Tool-repo/Surge/Rules/Cloudflare.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/Surge/Rules/ProxyGFW.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# 游戏规则
curl -L -o Tool-repo/Surge/Rules/Steam.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Surge/Rules/Epic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
curl -L -o Tool-repo/Surge/Rules/Game.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Game/Game.list"
# 下载CDN
curl -A "Surge iOS/3367" -L -o Tool-repo/Surge/Rules/DownloadCDN_Global.list "https://kelee.one/Tool/Loon/Rule/InternationalDownloadCDN.list"
curl -A "Surge iOS/3367" -L -o Tool-repo/Surge/Rules/DownloadCDN_CN.list "https://kelee.one/Tool/Loon/Rule/ChinaDownloadCDN.list"
# 国内规则
curl -L -o Tool-repo/Surge/Rules/Bilibili.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Surge/Rules/WeChat.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/WeChat.list"
curl -L -o Tool-repo/Surge/Rules/ChinaASN.list "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
curl -L -o Tool-repo/Surge/Rules/ChinaDomain.list "https://ruleset.skk.moe/List/non_ip/domestic.conf"
# 广告规则
curl -L -o Tool-repo/Surge/Rules/Ads_limbopro.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/Surge/rule/Adblock4limbo_surge.list"
curl -L -o Tool-repo/Surge/Rules/Ads_EasyListChina.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Surge/Rules/Ads_EasyListPrivacy.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Surge/Rules/Ads_Dlerio.list "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Surge/Rules/Ads_AWAvenue.list "https://raw.githubusercontent.com/TG-Twilight/AWAvenue-Ads-Rule/main/Filters/AWAvenue-Ads-Rule-Surge.list"
curl -L -o Tool-repo/Surge/Rules/AdGuardChinese.list "https://raw.githubusercontent.com/geekdada/surge-list/master/domain-set/chinese-filter.txt"
# 自定义广告规则
curl -L -o Tool-repo/Surge/Rules/Reject.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Empty.list"
# fmz200
curl -L -o Tool-repo/Surge/Rules/Direct_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliuxiuzheng.list"
curl -L -o Tool-repo/Surge/Rules/Ads_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliu.list"
# SukkaW
curl -L -o Tool-repo/Surge/Rules/Ads_SukkaW.list "https://ruleset.skk.moe/List/domainset/reject.conf"
curl -L -o Tool-repo/Surge/Rules/Ads_SukkaW_NoIP.list "https://ruleset.skk.moe/List/non_ip/reject.conf"
curl -L -o Tool-repo/Surge/Rules/CDN.list "https://ruleset.skk.moe/List/domainset/cdn.conf"
curl -L -o Tool-repo/Surge/Rules/CDN_NoIP.list "https://ruleset.skk.moe/List/non_ip/cdn.conf"
# ConnersHua
curl -L -o Tool-repo/Surge/Rules/Ads_ConnersHua.list "https://raw.githubusercontent.com/ConnersHua/RuleGo/master/Surge/Ruleset/Extra/Reject/Advertising.list"
curl -L -o Tool-repo/Surge/Rules/Hijacking_ConnersHua.list "https://raw.githubusercontent.com/ConnersHua/RuleGo/master/Surge/Ruleset/Extra/Reject/Hijacking.list"
curl -L -o Tool-repo/Surge/Rules/Tracking_ConnersHua.list "https://raw.githubusercontent.com/ConnersHua/RuleGo/master/Surge/Ruleset/Extra/Reject/Tracking.list"
# 适配规则
- name: Edit Surge/Rules
run: |
cd Tool-repo/Surge/Rules
for file in *.list; do
if [ "$file" != "Lan.list" ] ; then
sed -i -e 's/, /,/g' \
-e 's/;/# /g' \
-e 's/host,/HOST,/g' \
-e 's/host-/HOST-/g' \
-e 's/-suffix/-SUFFIX/g' \
-e 's/-keyword/-KEYWORD/g' \
-e 's/ip-cidr/IP-CIDR/g' \
-e 's/-wildcard/-WILDCARD/g' \
-e 's/geoip/GEOIP/g' \
-e 's/HOST,/DOMAIN,/g' \
-e 's/HOST-/DOMAIN-/g' \
-e 's/IP6-CIDR,/IP-CIDR6,/g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e '/# 更新:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/# 数目: /d' \
-e '/# 规则: /d' \
-e '/404: Not Found/d' \
"$file"
# 如果为IP规则且不包含no-resolve 则添加no-resolve
awk '/^IP-/ && !/,no-resolve/ {print $0",no-resolve"; next} {print}' "$file" > tmpfile
mv tmpfile "$file"
else
echo "$file not found."
fi
done
# 转换 domain-set 为 rule-set
for file in AdGuardChinese.list Ads_AWAvenue.list Ads_SukkaW.list CDN.list; do
if [ -f "$file" ]; then
# 将以.开头的行的第一个.替换为 DOMAIN-SUFFIX,
sed -i '/^\./s/^\./DOMAIN-SUFFIX,/' "$file"
# 将除了以#开头、空行和以DOMAIN-SUFFIX开头之外的行,在行首添加 DOMAIN,
sed -i '/^\s*$/b; /^\s*#/b; /^DOMAIN-SUFFIX,/b; s/^\([^#]\)/DOMAIN,\1/' "$file"
else
echo "$file not found."
fi
done
# 追加规则
- name: Copy custom rules
run: |
if [ -f "Tool-repo/Surge/Rules/Reject.list" ] ; then
cat Tool-repo/Surge/Rules/Ads_limbopro.list >> Tool-repo/Surge/Rules/Reject.list
cat Tool-repo/Surge/Rules/Ads_ConnersHua.list >> Tool-repo/Surge/Rules/Reject.list
cat Tool-repo/Surge/Rules/Hijacking_ConnersHua.list >> Tool-repo/Surge/Rules/Reject.list
cat Tool-repo/Surge/Rules/Tracking_ConnersHua.list >> Tool-repo/Surge/Rules/Reject.list
else
echo "$file not found."
fi
if [ -f "Tool-repo/Surge/Rules/Ads_SukkaW.list" ] ; then
cat Tool-repo/Surge/Rules/Ads_SukkaW_NoIP.list >> Tool-repo/Surge/Rules/Ads_SukkaW.list
rm -rf Tool-repo/Surge/Rules/Ads_SukkaW_NoIP.list
else
echo "$file not found."
fi
if [ -f "Tool-repo/Surge/Rules/CDN.list" ] ; then
cat Tool-repo/Surge/Rules/CDN_NoIP.list >> Tool-repo/Surge/Rules/CDN.list
rm -rf Tool-repo/Surge/Rules/CDN_NoIP.list
else
echo "$file not found."
fi
# 去重排序
- name: Remove duplicates and lines
run: |
cd Tool-repo/Surge/Rules
shopt -s nullglob # 避免没有匹配的文件时保留原始通配符
for file in Reject.list CDN.list; do
if [ -f "$file" ]; then
sorted_file="sorted_${file}"
# 使用 grep 去掉包含 # 的行
grep -v '^\s*#' "$file" | grep -v '^\s*$' | sort | uniq > "$sorted_file"
mv "$sorted_file" "$file"
else
echo "$file not found."
fi
done
shell: bash
###### Clash
- name: Copy Clash/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
# 流媒体
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/Clash/Rules/Emby.list
curl -A "Surge iOS/3367" -L -o Tool-repo/Clash/Rules/TikTok.list "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Clash/Rules/Netflix.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/Clash/Rules/HBO.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Clash/Rules/Disney.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Clash/Rules/Spotify.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Clash/Rules/PrimeVideo.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Clash/Rules/FitnessPlus.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Clash/Rules/AppleMedia.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Clash/Rules/Bahamut.list "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Clash/Rules/ProxyMedia.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
# 下载规则
curl -L -o Tool-repo/Clash/Rules/Download.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Download/Download.list"
# 苹果
curl -L -o Tool-repo/Clash/Rules/Apple.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
# OpenAI
curl -L -o Tool-repo/Clash/Rules/OpenAI.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Clash/Rules/Claude.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Clash/Rules/AI.list "https://ruleset.skk.moe/List/non_ip/ai.conf"
# 社交媒体
curl -L -o Tool-repo/Clash/Rules/Telegram.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/Clash/Rules/Twitter.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Clash/Rules/Instagram.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Clash/Rules/Facebook.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Clash/Rules/YouTube.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Clash/Rules/Google.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Clash/Rules/Github.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Clash/Rules/OneDrive.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Clash/Rules/Microsoft.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 甲骨文
curl -L -o Tool-repo/Clash/Rules/Oracle.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# Cloudflare
curl -L -o Tool-repo/Clash/Rules/Cloudflare.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/Clash/Rules/ProxyGFW.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/Clash/Rules/Trust.list
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/Clash/Rules/Talkatone.list
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/Clash/Rules/Talkatone.list
# PayPal
curl -L -o Tool-repo/Clash/Rules/PayPal.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# 国内规则
curl -L -o Tool-repo/Clash/Rules/Bilibili.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Clash/Rules/WeChat.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/Clash/Rules/ChinaDomain.list "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/Clash/Rules/ChinaASN.list "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# 游戏规则
curl -L -o Tool-repo/Clash/Rules/Game.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
curl -L -o Tool-repo/Clash/Rules/Steam.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Clash/Rules/Epic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
# 下载CDN
curl -A "Surge iOS/3367" -L -o Tool-repo/Clash/Rules/DownloadCDN_Global.list "https://kelee.one/Tool/Loon/Rule/InternationalDownloadCDN.list"
curl -A "Surge iOS/3367" -L -o Tool-repo/Clash/Rules/DownloadCDN_CN.list "https://kelee.one/Tool/Loon/Rule/ChinaDownloadCDN.list"
# 广告规则
curl -L -o Tool-repo/Clash/Rules/Ads_EasyListChina.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Clash/Rules/Ads_EasyListPrivacy.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Clash/Rules/Ads_Dlerio.list "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Clash/Rules/Anti-ad.list "https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-surge.txt"
curl -L -o Tool-repo/Clash/Rules/AdGuardChinese.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/Clash/Rules/Reject.list
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/Clash/Rules/Lan.list
# 适配规则
- name: Edit Clash/Rules
run: |
cd Tool-repo/Clash/Rules
for file in *.list; do
if [ "$file" != "ChinaIPv4.list" ] && [ "$file" != "ChinaIPv6.list" ] && [ "$file" != "Lan.list" ]; then
sed -i -e 's/, /,/g' \
-e 's/;/# /g' \
-e 's/host,/HOST,/g' \
-e 's/host-/HOST-/g' \
-e 's/-suffix/-SUFFIX/g' \
-e 's/-keyword/-KEYWORD/g' \
-e 's/ip-cidr/IP-CIDR/g' \
-e 's/geoip/GEOIP/g' \
-e 's/HOST,/DOMAIN,/g' \
-e 's/HOST-/DOMAIN-/g' \
-e 's/IP6-CIDR,/IP-CIDR6,/g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e 's/,extended-matching$//g' \
-e '/\(OR\|AND\|NOT\|USER-AGENT\|URL-REGEX\|IP-ASN\),/ s/^/#/' \
-e '/# 内容:/d' \
-e '/# 数量:/d' \
-e '/# 更新:/d' \
-e '/# NAME:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/404: Not Found/d' \
"$file"
# 如果为IP规则且不包含no-resolve 则添加no-resolve
awk '/^IP-/ && !/,no-resolve/ {print $0",no-resolve"; next} {print}' "$file" > tmpfile
mv tmpfile "$file"
else
echo "$file not found."
fi
done
# Clash 规则转换 yaml 为 text
# - name: Edit Clash/Rules yaml to text
# run: |
# cd Tool-repo/Clash/Rules
# for file in Anti-ad.list ; do
# if [ -f "$file" ]; then
# # 删除payload
# sed -i 's/payload://g' "$file"
# # 删除 - 号和单引号
# sed -i -e 's/# - /# /g' -e 's/ # - /# /g' -e 's/ - //g' -e "s/'//g" "$file"
# else
# echo "$file not found."
# fi
# done
# 追加规则
- name: Copy custom rules
run: |
if [ -f "Tool-repo/Clash/Rules/Reject.list" ] ; then
cat Tool-repo/Clash/Rules/AdGuardChinese.list >> Tool-repo/Clash/Rules/Reject.list
else
echo "$file not found."
fi
# 去重排序
- name: Remove duplicates and lines
run: |
cd Tool-repo/Clash/Rules
shopt -s nullglob # 避免没有匹配的文件时保留原始通配符
for file in Reject.list; do
if [ -f "$file" ]; then
sorted_file="sorted_${file}"
# 使用 grep 去掉包含 # 的行
grep -v '^\s*#' "$file" | grep -v '^\s*$' | sort | uniq > "$sorted_file"
mv "$sorted_file" "$file"
else
echo "$file not found."
fi
done
shell: bash
###### QuantumultX
- name: Copy QuantumultX/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
curl -A "Surge iOS/3367" -L -o Tool-repo/QuantumultX/Rules/APNs.list "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/QuantumultX/Rules/Lan.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/LocalAreaNetwork.list"
curl -L -o Tool-repo/QuantumultX/Rules/Apple.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/QuantumultX/Rules/AppStore.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/QuantumultX/Rules/AppleID.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/QuantumultX/Rules/AppleMusic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/QuantumultX/Rules/TestFlight.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/QuantumultX/Rules/iCloud.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/QuantumultX/Rules/AppleProxy.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
cp -r Tool-repo/Surge/Rules/OpenAI.list Tool-repo/QuantumultX/Rules/OpenAI.list
# Claude AI
curl -L -o Tool-repo/QuantumultX/Rules/Claude.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/QuantumultX/Rules/AI.list "https://ruleset.skk.moe/List/non_ip/ai.conf"
# 社交媒体
curl -L -o Tool-repo/QuantumultX/Rules/Telegram.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/QuantumultX/Rules/Twitter.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/QuantumultX/Rules/Instagram.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/QuantumultX/Rules/Facebook.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/QuantumultX/Rules/YouTube.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/QuantumultX/Rules/Google.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
curl -L -o Tool-repo/QuantumultX/Rules/Github.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
# 微软
curl -L -o Tool-repo/QuantumultX/Rules/OneDrive.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/QuantumultX/Rules/Microsoft.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 流媒体
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/QuantumultX/Rules/Emby.list
curl -A "Surge iOS/3367" -L -o Tool-repo/QuantumultX/Rules/TikTok.list "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/QuantumultX/Rules/Netflix.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/QuantumultX/Rules/HBO.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/QuantumultX/Rules/Disney.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/QuantumultX/Rules/Spotify.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/QuantumultX/Rules/PrimeVideo.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/QuantumultX/Rules/FitnessPlus.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/QuantumultX/Rules/AppleMedia.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/QuantumultX/Rules/Bahamut.list "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/QuantumultX/Rules/ProxyMedia.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
# PayPal
curl -L -o Tool-repo/QuantumultX/Rules/PayPal.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# 甲骨文
curl -L -o Tool-repo/QuantumultX/Rules/Oracle.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# Cloudflare
curl -L -o Tool-repo/QuantumultX/Rules/Cloudflare.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/QuantumultX/Rules/ProxyGFW.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/QuantumultX/Rules/Trust.list
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/QuantumultX/Rules/TronLink.list
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/QuantumultX/Rules/Talkatone.list
# 国内规则
curl -L -o Tool-repo/QuantumultX/Rules/Bilibili.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/QuantumultX/Rules/WeChat.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/QuantumultX/Rules/ChinaDomain.list "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/QuantumultX/Rules/ChinaASN.list "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# 游戏规则
curl -L -o Tool-repo/QuantumultX/Rules/Steam.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/QuantumultX/Rules/Epic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
curl -L -o Tool-repo/QuantumultX/Rules/Game.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
# 防DNS泄漏
cp -r Tool-repo/Surge/Rules/Prevent_DNS_Leaks.list Tool-repo/QuantumultX/Rules/Prevent_DNS_Leaks.list
# 广告规则
curl -L -o Tool-repo/QuantumultX/Rules/Ads_EasyListChina.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/QuantumultX/Rules/Ads_EasyListPrivacy.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/QuantumultX/easyprivacy.list"
curl -L -o Tool-repo/QuantumultX/Rules/Ads_Dlerio.list "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/QuantumultX/Rules/Ads_limbopro.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/Surge/rule/Adblock4limbo_surge.list"
curl -L -o Tool-repo/QuantumultX/Rules/AdGuardChinese.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Ads_SukkaW.list Tool-repo/QuantumultX/Rules/Ads_SukkaW.list
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/QuantumultX/Rules/Reject.list
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/QuantumultX/Rules/Lan.list
# 适配规则
- name: Edit QuantumultX/Rules
run: |
cd Tool-repo/QuantumultX/Rules
for file in *.list; do
if [ -f "$file" ]; then
sed -i -e 's/, /,/g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,PROXY$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e 's/,proxy$//g' \
-e 's/DOMAIN,/HOST,/g' \
-e 's/DOMAIN-/HOST-/g' \
-e 's/IP-CIDR6,/IP6-CIDR,/g' \
-e 's/,no-resolve//g' \
-e 's/,extended-matching$//g' \
-e '/\(OR\|AND\|NOT\|PROCESS-NAME\|URL-REGEX\),/ s/^/#/' \
-e 's| \{1,\}//.*$||' \
-e '/# 更新:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/404: Not Found/d' \
"$file"
else
echo "$file not found."
fi
done
# 添加策略
for file in *.list; do
if [ -f "$file" ]; then
sed -i '/^[[:space:]]*#/!s/\([^[:space:]]\)$/\1,PROXY/' "$file"
if echo "$file" | grep -qE "(Ads_|AdGuardChinese|ConnersHua|Reject)"; then
sed -i 's/,PROXY/,REJECT/g' "$file"
elif echo "$file" | grep -qE "(APNs|Bilibili|WeChat|China|Direct)"; then
sed -i 's/,PROXY/,DIRECT/g' "$file"
fi
else
echo "$file not found."
fi
done
###### Loon
- name: Copy Loon/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
curl -A "Surge iOS/3367" -L -o Tool-repo/Loon/Rules/APNs.list "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/Loon/Rules/Apple.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/Loon/Rules/AppStore.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/Loon/Rules/AppleID.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/Loon/Rules/AppleMusic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/Loon/Rules/iCloud.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/Loon/Rules/TestFlight.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/Loon/Rules/AppleProxy.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
curl -L -o Tool-repo/Loon/Rules/OpenAI.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Loon/Rules/Claude.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Loon/Rules/AI.list "https://ruleset.skk.moe/List/non_ip/ai.conf"
# 社交媒体
curl -L -o Tool-repo/Loon/Rules/Telegram.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/Loon/Rules/Twitter.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Loon/Rules/Instagram.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Loon/Rules/Facebook.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Loon/Rules/YouTube.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Loon/Rules/Google.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Loon/Rules/Github.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Loon/Rules/OneDrive.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Loon/Rules/Microsoft.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 流媒体
curl -A "Surge iOS/3367" -L -o Tool-repo/Loon/Rules/TikTok.list "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Loon/Rules/Netflix.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/Loon/Rules/HBO.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Loon/Rules/Disney.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Loon/Rules/Spotify.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Loon/Rules/PrimeVideo.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Loon/Rules/FitnessPlus.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Loon/Rules/AppleMedia.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Loon/Rules/Bahamut.list "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Loon/Rules/ProxyMedia.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/Loon/Rules/Emby.list
# Cloudflare
curl -L -o Tool-repo/Loon/Rules/Cloudflare.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# PayPal
curl -L -o Tool-repo/Loon/Rules/PayPal.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# 甲骨文
curl -L -o Tool-repo/Loon/Rules/Oracle.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# GFW
curl -L -o Tool-repo/Loon/Rules/ProxyGFW.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/Loon/Rules/Trust.list
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/Loon/Rules/TronLink.list
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/Loon/Rules/Talkatone.list
# 国内规则
curl -L -o Tool-repo/Loon/Rules/Bilibili.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Loon/Rules/WeChat.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/Loon/Rules/ChinaDomain.list "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/Loon/Rules/ChinaASN.list "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# 游戏规则
curl -L -o Tool-repo/Loon/Rules/Game.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
curl -L -o Tool-repo/Loon/Rules/Steam.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Loon/Rules/Epic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
# 广告规则
curl -L -o Tool-repo/Loon/Rules/Ads_EasyListChina.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Loon/Rules/Ads_EasyListPrivacy.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Loon/Rules/Ads_Dlerio.list "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Loon/Rules/Ads_limbopro.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/Surge/rule/Adblock4limbo_surge.list"
curl -L -o Tool-repo/Loon/Rules/AdGuardChinese.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Ads_SukkaW.list Tool-repo/Loon/Rules/Ads_SukkaW.list
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/Loon/Rules/Reject.list
# fmz200
curl -L -o Tool-repo/Loon/Rules/Direct_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliuxiuzheng.list"
curl -L -o Tool-repo/Loon/Rules/Ads_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliu.list"
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/Loon/Rules/Lan.list
# 适配规则
- name: Edit Loon/Rules
run: |
cd Tool-repo/Loon/Rules
for file in *.list; do
if [ "$file" != "Lan.list" ] ; then
sed -i -e 's/, /,/g' \
-e 's/;/# /g' \
-e 's/host,/HOST,/g' \
-e 's/host-/HOST-/g' \
-e 's/-suffix/-SUFFIX/g' \
-e 's/-keyword/-KEYWORD/g' \
-e 's/ip-cidr/IP-CIDR/g' \
-e 's/geoip/GEOIP/g' \
-e 's/HOST,/DOMAIN,/g' \
-e 's/HOST-/DOMAIN-/g' \
-e 's/IP6-CIDR,/IP-CIDR6,/g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e 's/,extended-matching$//g' \
-e '/\(PROCESS-NAME\),/ s/^/#/' \
-e '/# 更新:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/404: Not Found/d' \
"$file"
# 如果为IP规则且不包含no-resolve 则添加no-resolve
awk '/^IP-/ && !/,no-resolve/ {print $0",no-resolve"; next} {print}' "$file" > tmpfile
mv tmpfile "$file"
else
echo "$file not found."
fi
done
###### Shadowrocket
- name: Copy Shadowrocket/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
curl -A "Surge iOS/3367" -L -o Tool-repo/Shadowrocket/Rules/APNs.list "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Apple.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/Shadowrocket/Rules/AppStore.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/Shadowrocket/Rules/AppleID.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/Shadowrocket/Rules/AppleMusic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/Shadowrocket/Rules/iCloud.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/Shadowrocket/Rules/TestFlight.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/Shadowrocket/Rules/AppleProxy.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
curl -L -o Tool-repo/Shadowrocket/Rules/OpenAI.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Shadowrocket/Rules/Claude.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Shadowrocket/Rules/AI.list "https://ruleset.skk.moe/List/non_ip/ai.conf"
# 社交媒体
curl -L -o Tool-repo/Shadowrocket/Rules/Telegram.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Twitter.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Instagram.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Facebook.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Shadowrocket/Rules/YouTube.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Google.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Shadowrocket/Rules/Github.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Shadowrocket/Rules/OneDrive.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Microsoft.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 流媒体
curl -A "Surge iOS/3367" -L -o Tool-repo/Shadowrocket/Rules/TikTok.list "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Netflix.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/Shadowrocket/Rules/HBO.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Disney.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Spotify.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Shadowrocket/Rules/PrimeVideo.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Shadowrocket/Rules/FitnessPlus.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Shadowrocket/Rules/AppleMedia.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Bahamut.list "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Shadowrocket/Rules/ProxyMedia.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/Shadowrocket/Rules/Emby.list
# 甲骨文
curl -L -o Tool-repo/Shadowrocket/Rules/Oracle.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# PayPal
curl -L -o Tool-repo/Shadowrocket/Rules/PayPal.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# Cloudflare
curl -L -o Tool-repo/Shadowrocket/Rules/Cloudflare.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/Shadowrocket/Rules/ProxyGFW.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/Shadowrocket/Rules/Trust.list
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/Shadowrocket/Rules/TronLink.list
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/Shadowrocket/Rules/Talkatone.list
# 国内规则
curl -L -o Tool-repo/Shadowrocket/Rules/Bilibili.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Shadowrocket/Rules/WeChat.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/Shadowrocket/Rules/ChinaDomain.list "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/Shadowrocket/Rules/ChinaASN.list "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# 游戏规则
curl -L -o Tool-repo/Shadowrocket/Rules/Game.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Steam.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Epic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
# 广告规则
curl -L -o Tool-repo/Shadowrocket/Rules/Ads_EasyListChina.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Ads_EasyListPrivacy.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Ads_Dlerio.list "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Ads_limbopro.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/Surge/rule/Adblock4limbo_surge.list"
curl -L -o Tool-repo/Shadowrocket/Rules/AdGuardChinese.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Ads_SukkaW.list Tool-repo/Shadowrocket/Rules/Ads_SukkaW.list
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/Shadowrocket/Rules/Reject.list
# fmz200
curl -L -o Tool-repo/Shadowrocket/Rules/Direct_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliuxiuzheng.list"
curl -L -o Tool-repo/Shadowrocket/Rules/Ads_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliu.list"
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/Shadowrocket/Rules/Lan.list
# 适配规则
- name: Edit Shadowrocket/Rules
run: |
cd Tool-repo/Shadowrocket/Rules
for file in *.list; do
if [ "$file" != "Lan.list" ] ; then
sed -i -e 's/, /,/g' \
-e 's/;/# /g' \
-e 's/host,/HOST,/g' \
-e 's/host-/HOST-/g' \
-e 's/-suffix/-SUFFIX/g' \
-e 's/-keyword/-KEYWORD/g' \
-e 's/ip-cidr/IP-CIDR/g' \
-e 's/geoip/GEOIP/g' \
-e 's/HOST,/DOMAIN,/g' \
-e 's/HOST-/DOMAIN-/g' \
-e 's/IP6-CIDR,/IP-CIDR6,/g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e 's/,extended-matching$//g' \
-e '/\(PROCESS-NAME\),/ s/^/#/' \
-e '/# 更新:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/404: Not Found/d' \
"$file"
# 如果为IP规则且不包含no-resolve 则添加no-resolve
awk '/^IP-/ && !/,no-resolve/ {print $0",no-resolve"; next} {print}' "$file" > tmpfile
mv tmpfile "$file"
else
echo "$file not found."
fi
done
###### Stash
- name: Copy Stash/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
curl -A "Surge iOS/3367" -L -o Tool-repo/Stash/Rules/APNs.yaml "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/Stash/Rules/Apple.yaml "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/Stash/Rules/AppStore.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/Stash/Rules/AppleID.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/Stash/Rules/AppleMusic.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/Stash/Rules/iCloud.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/Stash/Rules/TestFlight.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/Stash/Rules/AppleProxy.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
curl -L -o Tool-repo/Stash/Rules/OpenAI.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Stash/Rules/Claude.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Stash/Rules/AI.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# 社交媒体
curl -L -o Tool-repo/Stash/Rules/Telegram.yaml "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/Stash/Rules/Twitter.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Stash/Rules/Instagram.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Stash/Rules/Facebook.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Stash/Rules/YouTube.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Stash/Rules/Google.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Stash/Rules/Github.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Stash/Rules/OneDrive.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Stash/Rules/Microsoft.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 甲骨文
curl -L -o Tool-repo/Stash/Rules/Oracle.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# 流媒体
curl -A "Surge iOS/3367" -L -o Tool-repo/Stash/Rules/TikTok.yaml "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Stash/Rules/Netflix.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/Stash/Rules/HBO.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Stash/Rules/Disney.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Stash/Rules/Spotify.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Stash/Rules/PrimeVideo.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Stash/Rules/FitnessPlus.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Stash/Rules/AppleMedia.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Stash/Rules/Bahamut.yaml "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Stash/Rules/ProxyMedia.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/Stash/Rules/Emby.yaml
# 国内规则
curl -L -o Tool-repo/Stash/Rules/Bilibili.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Stash/Rules/WeChat.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/Stash/Rules/ChinaDomain.yaml "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/Stash/Rules/ChinaASN.yaml "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# PayPal
curl -L -o Tool-repo/Stash/Rules/PayPal.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# Cloudflare
curl -L -o Tool-repo/Stash/Rules/Cloudflare.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/Stash/Rules/ProxyGFW.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/Stash/Rules/Trust.yaml
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/Stash/Rules/TronLink.yaml
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/Stash/Rules/Talkatone.yaml
# 游戏规则
curl -L -o Tool-repo/Stash/Rules/Game.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
curl -L -o Tool-repo/Stash/Rules/Steam.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Stash/Rules/Epic.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
# 广告规则
curl -L -o Tool-repo/Stash/Rules/Ads_EasyListChina.yaml "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Stash/Rules/Ads_EasyListPrivacy.yaml "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Stash/Rules/Ads_Dlerio.yaml "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Stash/Rules/AdGuardChinese.yaml "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Ads_SukkaW.list Tool-repo/Stash/Rules/Ads_SukkaW.yaml
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/Stash/Rules/Reject.yaml
# fmz200
curl -L -o Tool-repo/Stash/Rules/Direct_fmz200.yaml "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliuxiuzheng.list"
curl -L -o Tool-repo/Stash/Rules/Ads_fmz200.yaml "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliu.list"
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/Stash/Rules/Lan.yaml
curl -A "Surge iOS/3367" -L -o Tool-repo/Stash/Rules/APNs.list "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/Stash/Rules/Apple.list "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/Stash/Rules/AppStore.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/Stash/Rules/AppleID.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/Stash/Rules/AppleMusic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/Stash/Rules/iCloud.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/Stash/Rules/TestFlight.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/Stash/Rules/AppleProxy.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
curl -L -o Tool-repo/Stash/Rules/OpenAI.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Stash/Rules/Claude.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Stash/Rules/AI.list "https://ruleset.skk.moe/List/non_ip/ai.conf"
# 社交媒体
curl -L -o Tool-repo/Stash/Rules/Telegram.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/Stash/Rules/Twitter.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Stash/Rules/Instagram.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Stash/Rules/Facebook.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Stash/Rules/YouTube.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Stash/Rules/Google.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Stash/Rules/Github.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Stash/Rules/OneDrive.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Stash/Rules/Microsoft.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 甲骨文
curl -L -o Tool-repo/Stash/Rules/Oracle.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# 流媒体
curl -A "Surge iOS/3367" -L -o Tool-repo/Stash/Rules/TikTok.list "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Stash/Rules/Netflix.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/Stash/Rules/HBO.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Stash/Rules/Disney.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Stash/Rules/Spotify.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Stash/Rules/PrimeVideo.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Stash/Rules/FitnessPlus.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Stash/Rules/AppleMedia.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Stash/Rules/Bahamut.list "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Stash/Rules/ProxyMedia.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/Stash/Rules/Emby.list
# 国内规则
curl -L -o Tool-repo/Stash/Rules/Bilibili.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Stash/Rules/WeChat.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/Stash/Rules/ChinaDomain.list "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/Stash/Rules/ChinaASN.list "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# PayPal
curl -L -o Tool-repo/Stash/Rules/PayPal.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# Cloudflare
curl -L -o Tool-repo/Stash/Rules/Cloudflare.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/Stash/Rules/ProxyGFW.list "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/Stash/Rules/Trust.list
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/Stash/Rules/TronLink.list
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/Stash/Rules/Talkatone.list
# 游戏规则
curl -L -o Tool-repo/Stash/Rules/Game.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
curl -L -o Tool-repo/Stash/Rules/Steam.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Stash/Rules/Epic.list "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
# 广告规则
curl -L -o Tool-repo/Stash/Rules/Ads_EasyListChina.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Stash/Rules/Ads_EasyListPrivacy.list "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Stash/Rules/Ads_Dlerio.list "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Stash/Rules/AdGuardChinese.list "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Ads_SukkaW.list Tool-repo/Stash/Rules/Ads_SukkaW.list
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/Stash/Rules/Reject.list
# fmz200
curl -L -o Tool-repo/Stash/Rules/Direct_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliuxiuzheng.list"
curl -L -o Tool-repo/Stash/Rules/Ads_fmz200.list "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliu.list"
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/Stash/Rules/Lan.list
# 适配 Stash 规则 yaml
- name: Edit Stash/Rules
run: |
cd Tool-repo/Stash/Rules
for file in *.yaml *.list; do
if [ "$file" != "Lan.yaml" ] && [ "$file" != "Lan.list" ]; then
sed -i -e 's/, /,/g' \
-e 's/;/# /g' \
-e 's/host,/HOST,/g' \
-e 's/host-/HOST-/g' \
-e 's/-suffix/-SUFFIX/g' \
-e 's/-keyword/-KEYWORD/g' \
-e 's/ip-cidr/IP-CIDR/g' \
-e 's/geoip/GEOIP/g' \
-e 's/HOST,/DOMAIN,/g' \
-e 's/HOST-/DOMAIN-/g' \
-e 's/IP6-CIDR,/IP-CIDR6,/g' \
-e 's/,extended-matching$//g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e '/\(USER-AGENT\|URL-REGEX\|OR\|AND\|NOT\),/ s/^/#/' \
-e 's| \{1,\}//.*$||' \
-e '/# 更新:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/404: Not Found/d' \
"$file"
# 如果为IP规则且不包含no-resolve 则添加no-resolve
awk '/^IP-/ && !/,no-resolve/ {print $0",no-resolve"; next} {print}' "$file" > tmpfile
mv tmpfile "$file"
else
echo "$file not found."
fi
done
for file in *.yaml; do
if [ -f "$file" ]; then
# 修改注释
sed -i 's/^#/ #/g' "$file"
# 在首行添加 "payload:"
sed -i '1s/^/payload:\n/' "$file"
# 在非注释或空行前添加“ - ”
awk '!/\/\/|#|payload:|^ *$/ {print " - " $0; next} {print}' "$file" > tmpfile
mv tmpfile "$file"
else
echo "$file not found."
fi
done
###### Egern
- name: Copy Egern/Rules
run: |
mkdir -p Tool/{Clash,Egern,Loon,QuantumultX,Shadowrocket,Stash,Surge}/Rules
curl -A "Surge iOS/3367" -L -o Tool-repo/Egern/Rules/APNs.yaml "https://kelee.one/Tool/Loon/Rule/ApplePushNotificationService.list"
curl -L -o Tool-repo/Egern/Rules/Apple.yaml "https://raw.githubusercontent.com/NobyDa/Script/master/Surge/Apple.list"
curl -L -o Tool-repo/Egern/Rules/AppStore.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/source/rule/AppStore/AppStore.list"
curl -L -o Tool-repo/Egern/Rules/AppleID.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleID/AppleID.list"
curl -L -o Tool-repo/Egern/Rules/AppleMusic.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMusic/AppleMusic.list"
curl -L -o Tool-repo/Egern/Rules/iCloud.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/iCloud/iCloud.list"
curl -L -o Tool-repo/Egern/Rules/TestFlight.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/TestFlight/TestFlight.list"
curl -L -o Tool-repo/Egern/Rules/AppleProxy.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleProxy/AppleProxy.list"
# OpenAI
curl -L -o Tool-repo/Egern/Rules/OpenAI.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# Claude AI
curl -L -o Tool-repo/Egern/Rules/Claude.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Claude.list"
# AIGC
curl -L -o Tool-repo/Egern/Rules/AI.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/refs/heads/master/Clash/Ruleset/OpenAi.list"
# 社交媒体
curl -L -o Tool-repo/Egern/Rules/Telegram.yaml "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/Telegram.list"
curl -L -o Tool-repo/Egern/Rules/Twitter.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Twitter.list"
curl -L -o Tool-repo/Egern/Rules/Instagram.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Instagram.list"
curl -L -o Tool-repo/Egern/Rules/Facebook.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Facebook.list"
# 谷歌
curl -L -o Tool-repo/Egern/Rules/YouTube.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/YouTube.list"
curl -L -o Tool-repo/Egern/Rules/Google.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Google.list"
# 微软
curl -L -o Tool-repo/Egern/Rules/Github.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Github.list"
curl -L -o Tool-repo/Egern/Rules/OneDrive.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/OneDrive.list"
curl -L -o Tool-repo/Egern/Rules/Microsoft.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Microsoft.list"
# 甲骨文
curl -L -o Tool-repo/Egern/Rules/Oracle.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Oracle/Oracle.list"
# 流媒体
curl -A "Surge iOS/3367" -L -o Tool-repo/Egern/Rules/TikTok.yaml "https://kelee.one/Tool/Loon/Rule/TikTok.list"
curl -L -o Tool-repo/Egern/Rules/Netflix.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Netflix/Netflix.list"
curl -L -o Tool-repo/Egern/Rules/HBO.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/HBO/HBO.list"
curl -L -o Tool-repo/Egern/Rules/Disney.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Disney/Disney.list"
curl -L -o Tool-repo/Egern/Rules/Spotify.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Spotify/Spotify.list"
curl -L -o Tool-repo/Egern/Rules/PrimeVideo.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrimeVideo/PrimeVideo.list"
curl -L -o Tool-repo/Egern/Rules/FitnessPlus.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/FitnessPlus/FitnessPlus.list"
curl -L -o Tool-repo/Egern/Rules/AppleMedia.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/AppleMedia/AppleMedia.list"
curl -L -o Tool-repo/Egern/Rules/Bahamut.yaml "https://github.com/ACL4SSR/ACL4SSR/raw/master/Clash/Ruleset/Bahamut.list"
curl -L -o Tool-repo/Egern/Rules/ProxyMedia.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyMedia.list"
cp -r Tool-repo/Surge/Rules/Emby.list Tool-repo/Egern/Rules/Emby.yaml
# PayPal
curl -L -o Tool-repo/Egern/Rules/PayPal.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/PayPal/PayPal.list"
# Cloudflare
curl -L -o Tool-repo/Egern/Rules/Cloudflare.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Cloudflare/Cloudflare.list"
# GFW
curl -L -o Tool-repo/Egern/Rules/ProxyGFW.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/ProxyGFWlist.list"
# Trust
cp -r Tool-repo/Surge/Rules/Trust.list Tool-repo/Egern/Rules/Trust.yaml
# TronLink
cp -r Tool-repo/Surge/Rules/TronLink.list Tool-repo/Egern/Rules/TronLink.yaml
# Talkatone
cp -r Tool-repo/Surge/Rules/Talkatone.list Tool-repo/Egern/Rules/Talkatone.yaml
# 国内规则
curl -L -o Tool-repo/Egern/Rules/Bilibili.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Bilibili.list"
curl -L -o Tool-repo/Egern/Rules/WeChat.yaml "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/Wechat.list"
curl -L -o Tool-repo/Egern/Rules/ChinaDomain.yaml "https://ruleset.skk.moe/List/non_ip/domestic.conf"
curl -L -o Tool-repo/Egern/Rules/ChinaASN.yaml "https://raw.githubusercontent.com/VirgilClyne/GetSomeFries/main/ruleset/ASN.China.list"
# 游戏规则
curl -L -o Tool-repo/Egern/Rules/Game.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Game/Game.list"
curl -L -o Tool-repo/Egern/Rules/Steam.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list"
curl -L -o Tool-repo/Egern/Rules/Epic.yaml "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list"
# 广告规则
curl -L -o Tool-repo/Egern/Rules/Ads_EasyListChina.yaml "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easylistchina_surge.list"
curl -L -o Tool-repo/Egern/Rules/Ads_EasyListPrivacy.yaml "https://raw.githubusercontent.com/limbopro/Adblock4limbo/main/rule/Surge/easyprivacy_surge.list"
curl -L -o Tool-repo/Egern/Rules/Ads_Dlerio.yaml "https://raw.githubusercontent.com/dler-io/Rules/main/Surge/Surge%203/Provider/Reject.list"
curl -L -o Tool-repo/Egern/Rules/Anti-ad.yaml "https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-surge.txt"
curl -L -o Tool-repo/Egern/Rules/AdGuardChinese.yaml "https://raw.githubusercontent.com/Repcz/Tool/X/Surge/Rules/AdGuardChinese.list"
cp -r Tool-repo/Surge/Rules/Ads_SukkaW.list Tool-repo/Egern/Rules/Ads_SukkaW.yaml
cp -r Tool-repo/Surge/Rules/Reject.list Tool-repo/Egern/Rules/Reject.yaml
# fmz200
curl -L -o Tool-repo/Egern/Rules/Direct_fmz200.yaml "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliuxiuzheng.list"
curl -L -o Tool-repo/Egern/Rules/Ads_fmz200.yaml "https://raw.githubusercontent.com/fmz200/wool_scripts/main/QuantumultX/filter/fenliu.list"
# Lan
cp -r Tool-repo/Surge/Rules/Lan.list Tool-repo/Egern/Rules/Lan.yaml
# Direct
cp -r Tool-repo/Surge/Rules/Direct.list Tool-repo/Egern/Rules/Direct.yaml
# 适配规则
- name: Edit Egern/Rules
run: |
cd Tool-repo/Egern/Rules
for file in *.yaml; do
if [ -f "$file" ]; then
# 适配
sed -i -e 's/, /,/g' \
-e 's/;/# /g' \
-e 's/host,/HOST,/g' \
-e 's/host-/HOST-/g' \
-e 's/-suffix/-SUFFIX/g' \
-e 's/-keyword/-KEYWORD/g' \
-e 's/ip-cidr/IP-CIDR/g' \
-e 's/geoip/GEOIP/g' \
-e 's/HOST,/DOMAIN,/g' \
-e 's/HOST-/DOMAIN-/g' \
-e 's/IP6-CIDR,/IP-CIDR6,/g' \
-e 's/,extended-matching$//g' \
-e 's/,REJECT$//g' \
-e 's/,DIRECT$//g' \
-e 's/,reject$//g' \
-e 's/,direct$//g' \
-e '/\(USER-AGENT\|OR\|AND\|NOT\),/ s/^/#/' \
-e 's| \{1,\}//.*$||' \
-e 's/,\*/,.*/g' \
-e '/# 更新:/d' \
-e '/# AUTHOR:/d' \
-e '/# REPO:/d' \
-e '/# UPDATED:/d' \
-e '/404: Not Found/d' \
"$file"
cp "$file" tmpfile
domain_set=""
domain_suffix_set=""
domain_keyword_set=""
domain_regex_set=""
ip_cidr_set=""
ip_cidr6_set=""
asn_set=""
url_regex_set=""
# 处理规则,将匹配的行添加到相应的集合中
awk -F, '
/^DOMAIN,/ {domain_set = domain_set "\n- " $2}
/^DOMAIN-SUFFIX,/ {domain_suffix_set = domain_suffix_set "\n- " $2}
/^DOMAIN-KEYWORD,/ {domain_keyword_set = domain_keyword_set "\n- " $2}
/^DOMAIN-WILDCARD,/ {domain_regex_set = domain_regex_set "\n- " $2}
/^IP-CIDR,/ {ip_cidr_set = ip_cidr_set "\n- " $2}
/^IP-CIDR6,/ {ip_cidr6_set = ip_cidr6_set "\n- " $2}
/^IP-ASN,/ {asn_set = asn_set "\n- '\''" $2 "'\''"}
/^URL-REGEX,/ {url_regex_set = url_regex_set "\n- '\''" $2 "'\''"}
END {
# 输出集合
print "domain_set:" domain_set
print "domain_suffix_set:" domain_suffix_set
print "domain_keyword_set:" domain_keyword_set
print "domain_regex_set:" domain_regex_set
print "ip_cidr_set:" ip_cidr_set
print "ip_cidr6_set:" ip_cidr6_set
print "asn_set:" asn_set
print "url_regex_set:" url_regex_set
}
' tmpfile > "$file"
else
echo "$file not found."
fi
done
# 循环结束后删除tmpfile
rm tmpfile
# 适配 egern 规则 yaml
- name: Edit Egern/Rules add no-resolve
run: |
cd Tool-repo/Egern/Rules
for file in *.yaml; do
if [ -f "$file" ]; then
# 检查文件名是否需要排除
if ! grep -E -q "(Lan|Bilibili|China|Direct|WeChat)" <<< "$file"; then
sed -i '1s/^/no_resolve: true\n/' "$file"
fi
else
echo "$file not found."
fi
done
###### Commit
- name: Add and Commits
run: |
cd Tool-repo
if [[ -n $(git status -s) ]]; then
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto Update $(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M')"
git push origin HEAD
else
echo "No changes to commit."
fi
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 0
keep_minimum_runs: 2