Compare commits

...

2 Commits

Author SHA1 Message Date
ElonJunior
bc238584bf commit diffify geo site 2025-03-15 22:59:54 +08:00
ElonJunior
30f438957c hiddify-geo 2025-03-15 22:58:07 +08:00
2 changed files with 37 additions and 0 deletions

View File

@ -58,6 +58,13 @@ jobs:
path: Iran-sing-box-rules
ref: rule-set
- name: Checkout hiddify-geo
uses: actions/checkout@v4
with:
repository: hiddify/hiddify-geo
path: hiddify-geo
ref: rule-set
- name: IR copy geo rules
env:
NO_SKIP: true

View File

@ -20,6 +20,9 @@ work_dir=$(realpath "$target_dir")
target_dir="${work_dir}/chinese"
sing_exe="${work_dir}/sing-box"
LOG_FILE="merge.log"
# cat /dev/null > $LOG_FILE
# ———————————————————————————————————————————————————————————————————————————————————————————————
@ -69,6 +72,32 @@ function download_adblockfilters() {
}
function merge_hiddify_geo(){
src_dir=$(dirname $work_dir)/hiddify-geo/country
LOG_FILE="${work_dir}/geo/${LOG_FILE}"
echo "merge dir >> ${src_dir}"
# 遍历country目录下所有以geoip或geosite开头的.srs文件
for file1 in $(ls $src_dir/geo*-*.srs); do
filename1=${file1##*/}
# 修正2移除多余的$$符号
caty=${filename1%%-*} # 截取第一个"-"前的部分
country=${filename1#*-} # 截取第一个"-"后的部分
# echo "类型: $caty, 国家代码: $country"
# Check if file exists in folder b with the same name
file2="$work_dir/geo/$caty/$country"
# If file not found, print filename
if [ ! -f $file2 ]; then
cp $file1 $file2
echo "hiddify-geo/country/${filename1}" >> $LOG_FILE
fi
done
}
# ———————————————————————————————————————————————————————————————————————————————————————————————
chmod +x $sing_exe
@ -77,6 +106,7 @@ mkdir $target_dir ; cd $target_dir
echo "start<= ${target_dir}"
download_adblockfilters
merge_hiddify_geo
echo "end<= ${target_dir}"
#END FILE