Skip to content

Commit 021d485

Browse files
Released on 202412121400
0 parents  commit 021d485

19 files changed

+395152
-0
lines changed

.github/workflows/adblock.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Build adblock rules files
2+
on:
3+
schedule:
4+
- cron: 0 */6 * * *
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Setup Go 1.x
13+
uses: actions/setup-go@v3
14+
with:
15+
go-version: "^1.14"
16+
17+
- name: Set $GOPATH and more variables
18+
run: |
19+
echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
20+
echo "TAG_NAME=$(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
21+
echo "MODIFIED_TIME=$(date -d "8 hour" -u "+%Y年%m月%d日 %H:%M")" >> $GITHUB_ENV
22+
echo "EASYLIST_URL=https://easylist-downloads.adblockplus.org/easylist.txt" >> $GITHUB_ENV
23+
echo "EASYLISTCHINA_URL=https://easylist-downloads.adblockplus.org/easylistchina.txt" >> $GITHUB_ENV
24+
echo "EASYPRIVACY_URL=https://easylist-downloads.adblockplus.org/easyprivacy.txt" >> $GITHUB_ENV
25+
echo "CJXLIST_URL=https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjxlist.txt" >> $GITHUB_ENV
26+
echo "CJX_ANNOYANCE_URL=https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt" >> $GITHUB_ENV
27+
echo "ANTI_ADBLOCK_KILLER_FILTERS_URL=https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt" >> $GITHUB_ENV
28+
echo "ANTIADBLOCKFILTERS_URL=https://easylist-downloads.adblockplus.org/antiadblockfilters.txt" >> $GITHUB_ENV
29+
echo "ABP_FILTERS_ANTI_CV_URL=https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt" >> $GITHUB_ENV
30+
echo "XINGGSF_MV_URL=https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/mv.txt" >> $GITHUB_ENV
31+
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV
32+
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH
33+
shell: bash
34+
35+
- name: Initialize Git
36+
run: |
37+
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
38+
git config --global user.name github-actions[bot]
39+
40+
- name: Checkout the "master" branch
41+
uses: actions/checkout@v3
42+
with:
43+
ref: master
44+
45+
- name: Get every files
46+
id: download
47+
run: |
48+
mkdir -p ./download/
49+
cd ./download
50+
curl -sSL $EASYLIST_URL | sed -e '/^! /d' -e '1c ! EasyList' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./easylist.txt
51+
curl -sSL $EASYLISTCHINA_URL | sed -e '/^! /d' -e '1c ! EasyList China' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./easylistchina.txt
52+
curl -sSL $EASYPRIVACY_URL | sed -e '/^! /d' -e '1c ! EasyPrivacy' -e '/^!$/d' > ./easyprivacy.txt
53+
curl -sSL $CJXLIST_URL | sed -e '/^! /d' -e '1c ! EasyList Lite' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./cjxlist.txt
54+
curl -sSL $CJX_ANNOYANCE_URL | sed -e '/^! /d' -e "1c ! CJX's Annoyance List" -e '/^!$/d' -e '/The End/d' -e '/^$/d' | sed '/热门话题/,+1d' > ./cjx-annoyance.txt
55+
sed -i '/!#include cjx-ublock.txt/c !#include https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-ublock.txt' ./cjx-annoyance.txt
56+
curl -sSL $XINGGSF_MV_URL | sed '/禁止站内新开窗/,+2d' | sed -e '/^! /d' -e '1c ! 乘风 视频广告过滤规则' -e '/^!$/d' -e '/^$/d' > ./xinggsf-mv.txt
57+
curl -sSL $ANTIADBLOCKFILTERS_URL | sed -e '1c ! Adblock Warning Removal List' -e '/^! Checksum/,/! Please check our guidelines/d' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./antiadblockfilters.txt
58+
curl -sSL $ABP_FILTERS_ANTI_CV_URL | sed -e '1c ! abp-filters-anti-cv' -e '/^! Checksum/,/adblockplus.org/d' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./abp-filters-anti-cv.txt
59+
curl -sSL $ANTI_ADBLOCK_KILLER_FILTERS_URL | sed -e '1c ! AakList (Anti-Adblock Killer)' -e '/^! Title/,/^! RegExpVisualizer/d' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./anti-adblock-killer-filters.txt
60+
for i in $(ls *.txt); do
61+
if [[ `cat $i |wc -l` -eq 0 ]]; then
62+
echo "status=failed">> $GITHUB_OUTPUT
63+
break
64+
else
65+
echo "status=success">> $GITHUB_OUTPUT
66+
echo "" >> $i
67+
fi
68+
done
69+
70+
- name: Generate adblock files
71+
if: steps.download.outputs.status == 'success'
72+
run: |
73+
mkdir -p ./new/
74+
cd ./download
75+
cat ../mod/GeneralBlock.txt ../mod/TiebaBlock.txt easylist.txt easylistchina.txt easyprivacy.txt cjx-annoyance.txt xinggsf-mv.txt > ../new/ad-pc.txt
76+
cat ../mod/GeneralBlock.txt easylist.txt easylistchina.txt easyprivacy.txt cjx-annoyance.txt > ../new/ad-mo.txt
77+
cat ../mod/GeneralBlock.txt ../mod/TiebaBlock.txt xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt > ../new/ad.txt
78+
cat xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt > ../new/ad2.txt
79+
cat xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt easyprivacy.txt > ../new/ad3.txt
80+
cat antiadblockfilters.txt abp-filters-anti-cv.txt anti-adblock-killer-filters.txt > ../new/ad-edentw.txt
81+
for i in $(ls ../new/*.txt); do
82+
sed -i '/^$/d' $i
83+
done
84+
85+
- name: Diff and addChecksum
86+
id: diffResult
87+
if: steps.download.outputs.status == 'success'
88+
run: |
89+
mkdir -p ./old_no_title/
90+
chmod +x ./mod/addChecksum.pl
91+
for i in $(ls ad*.txt); do
92+
sed '1,/^!$/d' $i > ./old_no_title/$i
93+
done
94+
diffFile="$(diff -q new/ old_no_title/ |grep -o '[a-zA-Z0-9-]\+.txt' |sort -u)"
95+
if [ -n "$diffFile" ]; then
96+
for i in $diffFile ; do
97+
titleName=$(echo "$i" |sed 's#.txt#-title.txt#')
98+
cat ./mod/$titleName ./new/$i > ./$i
99+
sed -i -e "s#201412030951#$TAG_NAME#" -e "s#201412030952#$MODIFIED_TIME#" ./$i
100+
perl ./mod/addChecksum.pl ./$i
101+
echo "status=success">> $GITHUB_OUTPUT
102+
done
103+
else
104+
echo "status=failed">> $GITHUB_OUTPUT
105+
fi
106+
107+
- name: Deliver download Dir
108+
uses: actions/upload-artifact@v3
109+
if: steps.download.outputs.status == 'failed'
110+
with:
111+
name: AllFiles
112+
path: |
113+
./download/
114+
115+
- name: Deliver new and old_no_title Di
116+
uses: actions/upload-artifact@v3
117+
if: steps.diffResult.outputs.status == 'failed'
118+
with:
119+
name: AllFiles
120+
path: |
121+
*
122+
!./.git/
123+
124+
- name: Git push assets to github & coding
125+
if: steps.diffResult.outputs.status == 'success'
126+
run: |
127+
rm -rf .git/ download/ new/ old_no_title/
128+
git init
129+
git checkout -b master
130+
git add --all
131+
git commit -m "${{ env.RELEASE_NAME }}"
132+
git remote add origin "https://${{ github.actor }}:${{ secrets.WORKFLOW_TOKEN }}@github.com/${{ github.repository }}"
133+
#git remote set-url --add origin "https://${{ secrets.CODING_ACCOUNT }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/${{ secrets.CODING_NAME }}/list.git"
134+
git push -u -f origin master
135+
136+
- name: Release and Upload Assets
137+
if: steps.diffResult.outputs.status == 'success'
138+
uses: ncipollo/release-action@v1
139+
with:
140+
name: adblock
141+
body: ${{ env.RELEASE_NAME }}
142+
tag: adblock
143+
makeLatest: true
144+
allowUpdates: true
145+
removeArtifacts: true
146+
artifacts: |
147+
*.txt

.github/workflows/pages.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["master"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# Single deploy job since we're just deploying
25+
deploy:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v2
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v1
37+
with:
38+
# Upload entire repository
39+
path: '.'
40+
- name: Deploy to GitHub Pages
41+
id: deployment
42+
uses: actions/deploy-pages@v1

.github/workflows/smartdns.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Smartdns Rules
2+
on:
3+
schedule:
4+
- cron: 0 20 * * *
5+
#push:
6+
# branches:
7+
# - master
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set Variables
16+
run: |
17+
mkdir publish
18+
echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV
19+
echo "anti_ad_domains=https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt" >> $GITHUB_ENV
20+
echo "anti_ad_domains_whitelist=https://raw.githubusercontent.com/privacy-protection-tools/dead-horse/master/anti-ad-white-list.txt" >> $GITHUB_ENV
21+
echo "CHINA_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf" >> $GITHUB_ENV
22+
echo "GOOGLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf" >> $GITHUB_ENV
23+
echo "APPLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf" >> $GITHUB_ENV
24+
echo "GFW_DOMAINS_URL=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt" >> $GITHUB_ENV
25+
echo "GREATFIRE_DOMAINS_URL=https://raw.githubusercontent.com/Johnshall/cn-blocked-domain/release/domains.txt" >> $GITHUB_ENV
26+
echo "CUSTOM_DIRECT=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/cn.txt" >> $GITHUB_ENV
27+
echo "CUSTOM_PROXY=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/geolocation-!cn.txt" >> $GITHUB_ENV
28+
29+
- name: Checkout the "hidden" branch of Loyalsoldier/v2ray-rules-dat
30+
uses: actions/checkout@v3
31+
with:
32+
repository: Loyalsoldier/v2ray-rules-dat
33+
ref: hidden
34+
path: extra
35+
36+
- name: Generate anti_ad files
37+
run: |
38+
curl -sSL $anti_ad_domains |sed '/^#/d' > publish/anti_ad_domains.txt
39+
curl -sSL $anti_ad_domains_whitelist |sed '/^#/d' > publish/anti_ad_domains_whitelist.txt
40+
41+
- name: Get and add direct domains into temp-direct.txt file
42+
run: |
43+
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > temp-direct.txt
44+
curl -sSL ${CUSTOM_DIRECT} -o CUSTOM_DIRECT.txt
45+
cat CUSTOM_DIRECT.txt | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
46+
cat extra/direct.txt >> temp-direct.txt
47+
#cat temp-direct.txt |sed '/\./!d' | sort --ignore-case -u > direct-list-with-redundant
48+
cat temp-direct.txt | sort --ignore-case -u > direct-list-with-redundant
49+
50+
- name: Get and add proxy domains into temp-proxy.txt file
51+
run: |
52+
curl -sSL $GFW_DOMAINS_URL | sed '$a\\n' > temp-proxy.txt
53+
curl -sSL $GREATFIRE_DOMAINS_URL | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> temp-proxy.txt
54+
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
55+
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
56+
curl -sSL ${CUSTOM_PROXY} -o CUSTOM_PROXY.txt
57+
cat CUSTOM_PROXY.txt | grep -Ev ":@cn" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
58+
cat CUSTOM_PROXY.txt | grep -Ev ":@cn" | perl -ne '/^(full:[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > proxy-reserve.txt
59+
cat extra/proxy.txt >> temp-proxy.txt
60+
#cat temp-proxy.txt |sed '/\./!d' | sort --ignore-case -u > proxy-list-with-redundant
61+
cat temp-proxy.txt | sort --ignore-case -u > proxy-list-with-redundant
62+
63+
- name: Remove redundant domains
64+
run: |
65+
chmod +x extra/findRedundantDomain.py
66+
./extra/findRedundantDomain.py ./direct-list-with-redundant ./direct-list-deleted-unsort
67+
./extra/findRedundantDomain.py ./proxy-list-with-redundant ./proxy-list-deleted-unsort
68+
[ ! -f "direct-list-deleted-unsort" ] && touch direct-list-deleted-unsort
69+
[ ! -f "proxy-list-deleted-unsort" ] && touch proxy-list-deleted-unsort
70+
sort ./direct-list-deleted-unsort > ./direct-list-deleted-sort
71+
sort ./proxy-list-deleted-unsort > ./proxy-list-deleted-sort
72+
diff ./direct-list-deleted-sort ./direct-list-with-redundant | awk '/^>/{print $2}' > ./direct-list-without-redundant
73+
diff ./proxy-list-deleted-sort ./proxy-list-with-redundant | awk '/^>/{print $2}' > ./proxy-list-without-redundant
74+
75+
- name: Remove domains from "need-to-remove" lists in "hidden" branch
76+
run: |
77+
diff ./extra/direct-need-to-remove.txt ./direct-list-without-redundant | awk '/^>/{print $2}' > temp-cn.txt
78+
diff ./extra/proxy-need-to-remove.txt ./proxy-list-without-redundant | awk '/^>/{print $2}' > temp-geolocation-\!cn.txt
79+
80+
- name: Remove domains end with ".cn" in "temp-geolocation-!cn.txt" and write lists to data directory
81+
run: |
82+
cat temp-cn.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' > cn.txt
83+
cat temp-geolocation-\!cn.txt | sort --ignore-case -u | perl -ne '/^((?=^.{1,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})*)/ && print "$1\n"' | perl -ne 'print if not /\.cn$/' > geolocation-\!cn.txt
84+
85+
- name: Add `full`, `regexp` and `keyword` type of rules back into "cn", "geolocation-!cn" and "category-ads-all" list
86+
run: |
87+
cat CUSTOM_DIRECT.txt | perl -ne '/^(full:[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > direct-reserve.txt
88+
[ -f "direct-reserve.txt" ] && cat direct-reserve.txt >> cn.txt
89+
[ -f "proxy-reserve.txt" ] && cat proxy-reserve.txt >> geolocation-\!cn.txt
90+
#if [ -f "proxy-reserve.txt" ]; then
91+
# for i in `cat proxy-reserve.txt`; do
92+
# if ! grep -q "^${i##full:}$" proxy-list-deleted-unsort; then
93+
# echo -e "$i"
94+
# fi
95+
# done >> temp-proxy.txt
96+
#fi
97+
98+
- name: Transform "full:" suit for Smartdns
99+
run: |
100+
sed 's#^full:#-.#' cn.txt > ./publish/direct_list.txt
101+
sed 's#^full:#-.#' geolocation-\!cn.txt > ./publish/proxy_list.txt
102+
103+
- name: Upload To Artifact
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: list
107+
path: |
108+
*
109+
110+
- name: Generate sha256sum
111+
working-directory: publish
112+
run: |
113+
for i in $(ls *.txt); do
114+
sha256sum $i > $i.sha256sum
115+
done
116+
117+
- name: Release and Upload Assets
118+
uses: ncipollo/release-action@v1
119+
with:
120+
name: SmartDNS
121+
body: ${{ env.RELEASE_NAME }}
122+
tag: smartdns
123+
makeLatest: false
124+
allowUpdates: true
125+
removeArtifacts: true
126+
artifacts: |
127+
publish/*.txt
128+
publish/*.txt.sha256sum

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## ABP/ublock订阅规则
2+
1. ad-pc.txt:[推荐桌面端]合并自乘风视频广告过滤规则、Easylist、EasylistChina、EasyPrivacy、CJX'sAnnoyance,以及补充的一些规则;
3+
1. ad-mo.txt:合并自Easylist、EasylistChina、EasyPrivacy、CJX'sAnnoyance;
4+
3. ad.txt:[推荐移动端]合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance,以及补充的一些规则;
5+
4. ad2.txt:合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance;
6+
5. ad3.txt:合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance、EasyPrivacy;
7+
6. ad-edentw.txt:合并自Adblock Warning Removal List、ABP filters、anti-adblock-killer-filters。

0 commit comments

Comments
 (0)