From cffb3117d4680e7b1bd600435c806f5bc2814f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Wed, 4 Sep 2024 22:32:03 +0200 Subject: [PATCH 1/4] Remove lines containing ABP JavaScript rules from adlists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- gravity.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gravity.sh b/gravity.sh index 1ac0e282..e7cd47cf 100755 --- a/gravity.sh +++ b/gravity.sh @@ -699,15 +699,17 @@ gravity_ParseFileIntoDomains() { # 3) Remove lines starting with ! (ABP Comments) # 4) Remove lines starting with [ (ABP Header) # 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#") preceded by a letter - # 6) Remove comments (text starting with "#", include possible spaces before the hash sign) - # 7) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) - # 8) Remove empty lines + # 6) Remove lines containing ABP JavaScript rules ("#%#") preceded by a letter + # 7) Remove comments (text starting with "#", include possible spaces before the hash sign) + # 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) + # 9) Remove empty lines sed -i -r \ -e 's/\r$//' \ -e 's/\s*!.*//g' \ -e 's/\s*\[.*//g' \ -e '/[a-z]\#[$?@]{0,1}\#/d' \ + -e '/[a-z]\#%\#/d' \ -e 's/\s*#.*//g' \ -e 's/^.*\s+//g' \ -e '/^$/d' "${destination}" From e291a9f7e044c0bb317c7f886c72648e8d43a163 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Thu, 5 Sep 2024 13:42:10 +0200 Subject: [PATCH 2/4] It's Adguard not ABP Co-authored-by: Adam Warner Signed-off-by: yubiuser --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index e7cd47cf..7d1358f2 100755 --- a/gravity.sh +++ b/gravity.sh @@ -699,7 +699,7 @@ gravity_ParseFileIntoDomains() { # 3) Remove lines starting with ! (ABP Comments) # 4) Remove lines starting with [ (ABP Header) # 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#") preceded by a letter - # 6) Remove lines containing ABP JavaScript rules ("#%#") preceded by a letter + # 6) Remove lines containing Adguard JavaScript rules ("#%#") preceded by a letter # 7) Remove comments (text starting with "#", include possible spaces before the hash sign) # 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) # 9) Remove empty lines From 0ad2a79624a3f2365acabf9fe234e4325aa8e2fe Mon Sep 17 00:00:00 2001 From: yubiuser Date: Fri, 6 Sep 2024 21:20:36 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Adam Warner Signed-off-by: yubiuser --- gravity.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gravity.sh b/gravity.sh index 7d1358f2..dce387f5 100755 --- a/gravity.sh +++ b/gravity.sh @@ -699,7 +699,6 @@ gravity_ParseFileIntoDomains() { # 3) Remove lines starting with ! (ABP Comments) # 4) Remove lines starting with [ (ABP Header) # 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#") preceded by a letter - # 6) Remove lines containing Adguard JavaScript rules ("#%#") preceded by a letter # 7) Remove comments (text starting with "#", include possible spaces before the hash sign) # 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) # 9) Remove empty lines @@ -708,8 +707,7 @@ gravity_ParseFileIntoDomains() { -e 's/\r$//' \ -e 's/\s*!.*//g' \ -e 's/\s*\[.*//g' \ - -e '/[a-z]\#[$?@]{0,1}\#/d' \ - -e '/[a-z]\#%\#/d' \ + -e '/[a-z]\#[$?@%]{0,3}\#/d' \ -e 's/\s*#.*//g' \ -e 's/^.*\s+//g' \ -e '/^$/d' "${destination}" From f02162b0212ed1bb9e6cdaf0ae0dd9ae11e0a456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 6 Sep 2024 21:22:22 +0200 Subject: [PATCH 4/4] Update comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- gravity.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index dce387f5..4f345960 100755 --- a/gravity.sh +++ b/gravity.sh @@ -698,10 +698,10 @@ gravity_ParseFileIntoDomains() { # 2) Remove carriage returns # 3) Remove lines starting with ! (ABP Comments) # 4) Remove lines starting with [ (ABP Header) - # 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#") preceded by a letter - # 7) Remove comments (text starting with "#", include possible spaces before the hash sign) - # 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) - # 9) Remove empty lines + # 5) Remove lines containing ABP extended CSS selectors ("##", "#$#", "#@#", "#?#") and Adguard JavaScript (#%#) preceded by a letter + # 6) Remove comments (text starting with "#", include possible spaces before the hash sign) + # 7) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) + # 8) Remove empty lines sed -i -r \ -e 's/\r$//' \