-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b9ab46
Showing
19 changed files
with
390,598 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
name: Build adblock rules files | ||
on: | ||
schedule: | ||
- cron: 0 */6 * * * | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go 1.x | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "^1.14" | ||
|
||
- name: Set $GOPATH and more variables | ||
run: | | ||
echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV | ||
echo "TAG_NAME=$(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV | ||
echo "MODIFIED_TIME=$(date -d "8 hour" -u "+%Y年%m月%d日 %H:%M")" >> $GITHUB_ENV | ||
echo "EASYLIST_URL=https://easylist-downloads.adblockplus.org/easylist.txt" >> $GITHUB_ENV | ||
echo "EASYLISTCHINA_URL=https://easylist-downloads.adblockplus.org/easylistchina.txt" >> $GITHUB_ENV | ||
echo "EASYPRIVACY_URL=https://easylist-downloads.adblockplus.org/easyprivacy.txt" >> $GITHUB_ENV | ||
echo "CJXLIST_URL=https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjxlist.txt" >> $GITHUB_ENV | ||
echo "CJX_ANNOYANCE_URL=https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt" >> $GITHUB_ENV | ||
echo "ANTI_ADBLOCK_KILLER_FILTERS_URL=https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt" >> $GITHUB_ENV | ||
echo "ANTIADBLOCKFILTERS_URL=https://easylist-downloads.adblockplus.org/antiadblockfilters.txt" >> $GITHUB_ENV | ||
echo "ABP_FILTERS_ANTI_CV_URL=https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt" >> $GITHUB_ENV | ||
echo "XINGGSF_MV_URL=https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/mv.txt" >> $GITHUB_ENV | ||
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV | ||
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH | ||
shell: bash | ||
|
||
- name: Initialize Git | ||
run: | | ||
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
git config --global user.name github-actions[bot] | ||
- name: Checkout the "master" branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: master | ||
|
||
- name: Get every files | ||
id: download | ||
run: | | ||
mkdir -p ./download/ | ||
cd ./download | ||
curl -sSL $EASYLIST_URL | sed -e '/^! /d' -e '1c ! EasyList' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./easylist.txt | ||
curl -sSL $EASYLISTCHINA_URL | sed -e '/^! /d' -e '1c ! EasyList China' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./easylistchina.txt | ||
curl -sSL $EASYPRIVACY_URL | sed -e '/^! /d' -e '1c ! EasyPrivacy' -e '/^!$/d' > ./easyprivacy.txt | ||
curl -sSL $CJXLIST_URL | sed -e '/^! /d' -e '1c ! EasyList Lite' -e '/^!$/d' -e '/The End/d' -e '/^$/d' > ./cjxlist.txt | ||
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 | ||
sed -i '/!#include cjx-ublock.txt/c !#include https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-ublock.txt' ./cjx-annoyance.txt | ||
curl -sSL $XINGGSF_MV_URL | sed '/禁止站内新开窗/,+2d' | sed -e '/^! /d' -e '1c ! 乘风 视频广告过滤规则' -e '/^!$/d' -e '/^$/d' > ./xinggsf-mv.txt | ||
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 | ||
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 | ||
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 | ||
for i in $(ls *.txt); do | ||
if [[ `cat $i |wc -l` -eq 0 ]]; then | ||
echo "status=failed">> $GITHUB_OUTPUT | ||
break | ||
else | ||
echo "status=success">> $GITHUB_OUTPUT | ||
echo "" >> $i | ||
fi | ||
done | ||
- name: Generate adblock files | ||
if: steps.download.outputs.status == 'success' | ||
run: | | ||
mkdir -p ./new/ | ||
cd ./download | ||
cat ../mod/GeneralBlock.txt ../mod/TiebaBlock.txt easylist.txt easylistchina.txt easyprivacy.txt cjx-annoyance.txt xinggsf-mv.txt > ../new/ad-pc.txt | ||
cat ../mod/GeneralBlock.txt easylist.txt easylistchina.txt easyprivacy.txt cjx-annoyance.txt > ../new/ad-mo.txt | ||
cat ../mod/GeneralBlock.txt ../mod/TiebaBlock.txt xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt > ../new/ad.txt | ||
cat xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt > ../new/ad2.txt | ||
cat xinggsf-mv.txt easylistchina.txt cjxlist.txt cjx-annoyance.txt easyprivacy.txt > ../new/ad3.txt | ||
cat antiadblockfilters.txt abp-filters-anti-cv.txt anti-adblock-killer-filters.txt > ../new/ad-edentw.txt | ||
for i in $(ls ../new/*.txt); do | ||
sed -i '/^$/d' $i | ||
done | ||
- name: Diff and addChecksum | ||
id: diffResult | ||
if: steps.download.outputs.status == 'success' | ||
run: | | ||
mkdir -p ./old_no_title/ | ||
chmod +x ./mod/addChecksum.pl | ||
for i in $(ls ad*.txt); do | ||
sed '1,/^!$/d' $i > ./old_no_title/$i | ||
done | ||
diffFile="$(diff -q new/ old_no_title/ |grep -o '[a-zA-Z0-9-]\+.txt' |sort -u)" | ||
if [ -n "$diffFile" ]; then | ||
for i in $diffFile ; do | ||
titleName=$(echo "$i" |sed 's#.txt#-title.txt#') | ||
cat ./mod/$titleName ./new/$i > ./$i | ||
sed -i -e "s#201412030951#$TAG_NAME#" -e "s#201412030952#$MODIFIED_TIME#" ./$i | ||
perl ./mod/addChecksum.pl ./$i | ||
echo "status=success">> $GITHUB_OUTPUT | ||
done | ||
else | ||
echo "status=failed">> $GITHUB_OUTPUT | ||
fi | ||
- name: Deliver download Dir | ||
uses: actions/upload-artifact@v3 | ||
if: steps.download.outputs.status == 'failed' | ||
with: | ||
name: AllFiles | ||
path: | | ||
./download/ | ||
- name: Deliver new and old_no_title Di | ||
uses: actions/upload-artifact@v3 | ||
if: steps.diffResult.outputs.status == 'failed' | ||
with: | ||
name: AllFiles | ||
path: | | ||
* | ||
!./.git/ | ||
- name: Git push assets to github & coding | ||
if: steps.diffResult.outputs.status == 'success' | ||
run: | | ||
rm -rf .git/ download/ new/ old_no_title/ | ||
git init | ||
git checkout -b master | ||
git add --all | ||
git commit -m "${{ env.RELEASE_NAME }}" | ||
git remote add origin "https://${{ github.actor }}:${{ secrets.WORKFLOW_TOKEN }}@github.com/${{ github.repository }}" | ||
#git remote set-url --add origin "https://${{ secrets.CODING_ACCOUNT }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/${{ secrets.CODING_NAME }}/list.git" | ||
git push -u -f origin master | ||
- name: Release and Upload Assets | ||
if: steps.diffResult.outputs.status == 'success' | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: adblock | ||
body: ${{ env.RELEASE_NAME }} | ||
tag: adblock | ||
makeLatest: true | ||
allowUpdates: true | ||
removeArtifacts: true | ||
artifacts: | | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["master"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v2 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
# Upload entire repository | ||
path: '.' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: Smartdns Rules | ||
on: | ||
schedule: | ||
- cron: 0 20 * * * | ||
#push: | ||
# branches: | ||
# - master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Variables | ||
run: | | ||
mkdir publish | ||
echo "RELEASE_NAME=Released on $(date -d "8 hour" -u +%Y%m%d%H%M)" >> $GITHUB_ENV | ||
echo "anti_ad_domains=https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt" >> $GITHUB_ENV | ||
echo "anti_ad_domains_whitelist=https://raw.githubusercontent.com/privacy-protection-tools/dead-horse/master/anti-ad-white-list.txt" >> $GITHUB_ENV | ||
echo "CHINA_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf" >> $GITHUB_ENV | ||
echo "GOOGLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf" >> $GITHUB_ENV | ||
echo "APPLE_DOMAINS_URL=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf" >> $GITHUB_ENV | ||
echo "GFW_DOMAINS_URL=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt" >> $GITHUB_ENV | ||
echo "GREATFIRE_DOMAINS_URL=https://raw.githubusercontent.com/Johnshall/cn-blocked-domain/release/domains.txt" >> $GITHUB_ENV | ||
echo "CUSTOM_DIRECT=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/cn.txt" >> $GITHUB_ENV | ||
echo "CUSTOM_PROXY=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/geolocation-!cn.txt" >> $GITHUB_ENV | ||
- name: Checkout the "hidden" branch of Loyalsoldier/v2ray-rules-dat | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: Loyalsoldier/v2ray-rules-dat | ||
ref: hidden | ||
path: extra | ||
|
||
- name: Generate anti_ad files | ||
run: | | ||
curl -sSL $anti_ad_domains |sed '/^#/d' > publish/anti_ad_domains.txt | ||
curl -sSL $anti_ad_domains_whitelist |sed '/^#/d' > publish/anti_ad_domains_whitelist.txt | ||
- name: Get and add direct domains into temp-direct.txt file | ||
run: | | ||
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > temp-direct.txt | ||
curl -sSL ${CUSTOM_DIRECT} -o CUSTOM_DIRECT.txt | ||
cat CUSTOM_DIRECT.txt | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt | ||
cat extra/direct.txt >> temp-direct.txt | ||
#cat temp-direct.txt |sed '/\./!d' | sort --ignore-case -u > direct-list-with-redundant | ||
cat temp-direct.txt | sort --ignore-case -u > direct-list-with-redundant | ||
- name: Get and add proxy domains into temp-proxy.txt file | ||
run: | | ||
curl -sSL $GFW_DOMAINS_URL | sed '$a\\n' > temp-proxy.txt | ||
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 | ||
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt | ||
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt | ||
curl -sSL ${CUSTOM_PROXY} -o CUSTOM_PROXY.txt | ||
cat CUSTOM_PROXY.txt | grep -Ev ":@cn" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt | ||
cat CUSTOM_PROXY.txt | grep -Ev ":@cn" | perl -ne '/^(full:[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > proxy-reserve.txt | ||
cat extra/proxy.txt >> temp-proxy.txt | ||
#cat temp-proxy.txt |sed '/\./!d' | sort --ignore-case -u > proxy-list-with-redundant | ||
cat temp-proxy.txt | sort --ignore-case -u > proxy-list-with-redundant | ||
- name: Remove redundant domains | ||
run: | | ||
chmod +x extra/findRedundantDomain.py | ||
./extra/findRedundantDomain.py ./direct-list-with-redundant ./direct-list-deleted-unsort | ||
./extra/findRedundantDomain.py ./proxy-list-with-redundant ./proxy-list-deleted-unsort | ||
[ ! -f "direct-list-deleted-unsort" ] && touch direct-list-deleted-unsort | ||
[ ! -f "proxy-list-deleted-unsort" ] && touch proxy-list-deleted-unsort | ||
sort ./direct-list-deleted-unsort > ./direct-list-deleted-sort | ||
sort ./proxy-list-deleted-unsort > ./proxy-list-deleted-sort | ||
diff ./direct-list-deleted-sort ./direct-list-with-redundant | awk '/^>/{print $2}' > ./direct-list-without-redundant | ||
diff ./proxy-list-deleted-sort ./proxy-list-with-redundant | awk '/^>/{print $2}' > ./proxy-list-without-redundant | ||
- name: Remove domains from "need-to-remove" lists in "hidden" branch | ||
run: | | ||
diff ./extra/direct-need-to-remove.txt ./direct-list-without-redundant | awk '/^>/{print $2}' > temp-cn.txt | ||
diff ./extra/proxy-need-to-remove.txt ./proxy-list-without-redundant | awk '/^>/{print $2}' > temp-geolocation-\!cn.txt | ||
- name: Remove domains end with ".cn" in "temp-geolocation-!cn.txt" and write lists to data directory | ||
run: | | ||
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 | ||
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 | ||
- name: Add `full`, `regexp` and `keyword` type of rules back into "cn", "geolocation-!cn" and "category-ads-all" list | ||
run: | | ||
cat CUSTOM_DIRECT.txt | perl -ne '/^(full:[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > direct-reserve.txt | ||
[ -f "direct-reserve.txt" ] && cat direct-reserve.txt >> cn.txt | ||
[ -f "proxy-reserve.txt" ] && cat proxy-reserve.txt >> geolocation-\!cn.txt | ||
#if [ -f "proxy-reserve.txt" ]; then | ||
# for i in `cat proxy-reserve.txt`; do | ||
# if ! grep -q "^${i##full:}$" proxy-list-deleted-unsort; then | ||
# echo -e "$i" | ||
# fi | ||
# done >> temp-proxy.txt | ||
#fi | ||
- name: Transform "full:" suit for Smartdns | ||
run: | | ||
sed 's#^full:#-.#' cn.txt > ./publish/direct_list.txt | ||
sed 's#^full:#-.#' geolocation-\!cn.txt > ./publish/proxy_list.txt | ||
- name: Upload To Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: list | ||
path: | | ||
* | ||
- name: Generate sha256sum | ||
working-directory: publish | ||
run: | | ||
for i in $(ls *.txt); do | ||
sha256sum $i > $i.sha256sum | ||
done | ||
- name: Release and Upload Assets | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: SmartDNS | ||
body: ${{ env.RELEASE_NAME }} | ||
tag: smartdns | ||
makeLatest: false | ||
allowUpdates: true | ||
removeArtifacts: true | ||
artifacts: | | ||
publish/*.txt | ||
publish/*.txt.sha256sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## ABP/ublock订阅规则 | ||
1. ad-pc.txt:[推荐桌面端]合并自乘风视频广告过滤规则、Easylist、EasylistChina、EasyPrivacy、CJX'sAnnoyance,以及补充的一些规则; | ||
1. ad-mo.txt:合并自Easylist、EasylistChina、EasyPrivacy、CJX'sAnnoyance; | ||
3. ad.txt:[推荐移动端]合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance,以及补充的一些规则; | ||
4. ad2.txt:合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance; | ||
5. ad3.txt:合并自乘风视频广告过滤规则、EasylistChina、EasylistLite、CJX'sAnnoyance、EasyPrivacy; | ||
6. ad-edentw.txt:合并自Adblock Warning Removal List、ABP filters、anti-adblock-killer-filters。 |
Oops, something went wrong.