1
0
Fork 0

First run of flrender

This commit is contained in:
Spirillen 2022-10-07 19:36:14 +02:00
parent 316256e135
commit 8e483333fd
No known key found for this signature in database
GPG Key ID: 88CC3F27732845AD
9 changed files with 171 additions and 52 deletions

View File

@ -1,4 +1,4 @@
name: uBlockOrigin
name: AdBlocker
dependencies:
- python=3.10
- pip

View File

@ -2,28 +2,28 @@ name: Deploy new rules
on:
push:
branches:
- "master"
- 'master'
pull_request:
branches:
- "master"
- 'master'
schedule:
- cron: '01 * * * *'
env:
GIT_NAME: "${{ secrets.GIT_NAME }}"
GIT_EMAIL: "${{ secrets.GIT_EMAIL }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GIT_NAME: '${{ secrets.GIT_NAME }}'
GIT_EMAIL: '${{ secrets.GIT_EMAIL }}'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
jobs:
buildrules:
name: Trigger action
runs-on: "${{ matrix.os }}"
runs-on: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
python_version:
- "3.10"
- '3.10'
os:
- ubuntu-22.04
@ -31,15 +31,15 @@ jobs:
- uses: actions/checkout@v2
name: Clone repository
with:
token: "${{ secrets.GITHUB_TOKEN }}"
token: '${{ secrets.GITHUB_TOKEN }}'
fetch-depth: 5
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Get latest FOP
- name: Get latest FOP
run: wget -O FOP.py "https://raw.githubusercontent.com/easylist/easylist/master/FOP.py"
- name: Install dependencies
@ -49,7 +49,7 @@ jobs:
- name: Render the rules
run: |
flrender -v -i ublockorigin-rules=. ublockorigin-rules.template _public/blockrules.txt
flrender -v -i ublockorigin-rules=. adblocker-rules.template _public/blockrules.txt
- name: Deploy
run: |

3
.gitignore vendored
View File

@ -113,3 +113,6 @@ dmypy.json
# Pyre type checker
.pyre/
miniconda/**
miniconda.sh

View File

@ -25,7 +25,7 @@ after_script:
run:
stage: build
script:
flrender -v -i ublockorigin-rules=. ublockorigin-rules.template _public/blockrules.txt
flrender -v -i ublockorigin-rules=. adblocker-rules.template _public/blockrules.txt
# pages:
# stage: deploy

View File

@ -1,4 +1,5 @@
{
"python.pythonPath": "/usr/bin/python3.9",
"python.pythonPath": "/usr/bin/python3.10",
"python.formatting.provider": "black"
]
}

View File

@ -169,7 +169,7 @@ all the rules)
@migueldemoura [ublock-umatrix-rulesets](https://github.com/migueldemoura/ublock-umatrix-rulesets/)
And everyone else I've forgot to mention here.
Have a look in the [source list](/ublockorigin-rules.template)
Have a look in the [source list](/adblocker-rules.template)
## Tanks

View File

@ -1,50 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="https://mypdns.org/spirillen">
<title>Spirillen's blocking rules for uBlock Origin</title>
<link rel="stylesheet" href="style.css">
<link rel="license" href="https://mypdns.org/my-privacy-dns/adblocker-rules-/blob/master/LICENSE">
<link rel="prefetch" href="https://mypdns.org/">
<link rel="prefetch" href="https://archive.mypdns.org/">
<head prefix="og: http://ogp.me/ns#">
<meta charset="utf-8">
<meta name="generator" content="https://mypdns.org/spirillen">
<title>My Privacy DNS's blocking rules for Ad-blockers</title>
<link rel="preload" href="style.css">
<link rel="preload"
href="/assets/application_utilities_dark-9aab2a3cee6460c807a07e08fd90f1b437bd024468f30154c162755f26705d70.css"
as="style" type="text/css">
<link rel="preload"
href="/assets/application_dark-fb47def5c7bac4103062f03d10bd5448526f50d9b4d162f950808fe25e6a6496.css"
as="style" type="text/css">
<link rel="preload"
href="/assets/highlight/themes/dark-0537c09f077245d346ebbe73ea39b18833487d026751b5d0dd67c2ee82bdf3f9.css"
as="style" type="text/css">
<link rel="stylesheet" href="style.css">
<link rel="license" href="https://mypdns.org/my-privacy-dns/adblocker-rules-/blob/master/LICENSE">
<link rel="prefetch" href="https://mypdns.org/">
<link rel="shortcut icon" type="image/png" href="/uploads/-/system/appearance/favicon/1/Icon___Wordmark.png"
id="favicon" data-original-href="/uploads/-/system/appearance/favicon/1/Icon___Wordmark.png" />
</head>
</head>
<body>
<div class="navbar">
<a href="https://spirillen.atlassian.net/browse/UBOR" target="_top">Repository</a>
<a href="https://mypdns.org" target="_blank">My Privacy DNS</a>
<body
class="gl-dark tab-width-4 gl-browser-firefox gl-platform-windows diff-custom-addition-color diff-custom-deletion-color">
<div class="navbar">
</div>
<a href="https://mypdns.org/my-privacy-dns/adblocker-rules" target="_top">Repository</a>
<a href="https://mypdns.org" target="_blank">My Privacy DNS</a>
</div>
<h1>Spirillen's Adblock Rules</h1>
<h1>My Privacy DNS's Adblock Rules</h1>
<p>
The one and only rule set applied by @spirillen is this on
blockrules.txt in complementary to <a href="https://easylist.to/" title="EasyList">easylist</a>
</p>
<p>
Project aim's to provide a number of rules to your adblocker like
uBlock Origin, Adguard or any other that support the format in
complementary to <a href="https://easylist.to/" title="EasyList">easylist</a>
</p>
<p>
Click here to <a
href="abp:subscribe?location=https://mypdns.github.io/adblocker-rules/blockrules.txt&title=My%20Privacy%20DNS%20%20Adblock%20Rules"
target="_top" title="Subscibe this list to uBlockOrigin">activate</a>
in uBloc Origin
</p>
<p>
We support the uBlock Origin rule-sets when writing rules.
In case of twists, the uBlockOrigin ruleset wins for fixing a issue.
</p>
<p></p>
<p>
You find the builded list <a href="./blockrules.txt">here</a>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p>If you would like to contribute to the list, please do it at this <a
href="https://spirillen.atlassian.net/browse/UBOR">repo</a></p>
<p>Cheers</p>
<p>
Click here to <a
href="abp:subscribe?location=https://mypdns.github.io/adblocker-rules/blockrules.txt&title=My%20Privacy%20DNS%20%20Adblock%20Rules"
target="_top" title="Subscibe this list to uBlockOrigin">activate</a>
in uBloc Origin or You can find the builded list
<a href="./blockrules.txt">here</a>
</p>
</body>
<p>
If you would like to contribute to the list, please do it at this <a
href="https://mypdns.org/my-privacy-dns/adblocker-rules">repo</a></p>
<p>Cheers</p>
</body>
</html>

103
flrender.sh Normal file
View File

@ -0,0 +1,103 @@
#!/usr/bin/env sh
# This script is to run the flrender tool to generate new adblocker lists
# from AdBlocker-rules.template.
# Since Github have choosen to disable the Actions (GHA) we will be running
# this code directly on My Privacy DNS's server by using conda
# First check if conda is installed
# We use git dir to make it CI independent
GIT_DIR="$(git rev-parse --show-toplevel)"
# Goto repo root
cd "${GIT_DIR}"
echo "..."
echo "Let's install conda to prevent uncontrolled things to happens"
echo ""
echo "Any surprises that Ubuntu brakes everything??"
echo "..."
echo ""
# Conda installer
if [ -d "${HOME}/miniconda" ]; then
# Update Conda
echo "Update Conda"
echo ""
export PATH="${HOME}/miniconda/bin:${PATH}"
source "${HOME}/miniconda/etc/profile.d/conda.sh"
conda update conda -c conda-canary
conda update -yq conda
conda config --set channel_priority false
else
# install Conda
echo "Update Conda"
echo ""
curl 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh' -o "${GIT_DIR}/miniconda.sh"
bash miniconda.sh -b -p "${HOME}/miniconda"
hash -r
export PATH="${HOME}/miniconda/bin:${PATH}"
source "${HOME}/miniconda/etc/profile.d/conda.sh"
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
conda update conda -c conda-canary
conda update -yq conda
conda config --set channel_priority false
fi
# Env installer
if [ -n "$(conda info --envs | cut -d ' ' -f 1 | grep -i 'AdBlocker')" ]; then
echo "Update conda ENV"
conda create -q -n AdBlocker \
-f "${GIT_DIR}/.environment.yaml" \
--prefix "${HOME}/miniconda" --all
else
echo "Install fresh conda ENV"
conda env update -n AdBlocker \
-f "${GIT_DIR}/.environment.yaml" --prune
fi
# Activate Conda
conda activate AdBlocker
# Render the rules
flrender -v -i ublockorigin-rules=. adblocker-rules.template public/blockrules.txt
if [ -f "public/blockrules.txt"]; then
rsync -avP --chown "$USER" "public/" "/var/www/mypdns.org/public/adblocker-rules/"
if [ -d "public/" ]; then
rm -fr "public/"
fi
else
echo "Script failed to generate output"
conda deactivate
exit 99
fi
conda deactivate
#
#
#
#
#
#
#
#
#
#
#
#
# Copyright: https://mypdns.org/
# Content: https://mypdns.org/spirillen/
# Source: https://mypdns.org/my-privacy-dns/adblocker-rules
# License: https://mypdns.org/my-privacy-dns/adblocker-rules/-/blob/master/LICENSE
# License: MCRAE GENERAL PUBLIC LICENSE (version 4.r53m2)
#
# You should have received a copy of the license along with this work.