Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adguard preprocessor directive to load sublist only when using Adguard iOS App [2020-09-08: Adguard Android App Exclusion List Added] #241

Closed
yourduskquibbles opened this issue Aug 12, 2020 · 7 comments

Comments

@yourduskquibbles
Copy link
Owner

yourduskquibbles commented Aug 12, 2020

Describe the issue

I would like to use exclusion filters in a sublist that will only get loaded when the client is detected to be adguard on iOS to workaround cosmetic display issues caused by CSS style modification "companion" filters that end up incorrectly removing extra spacing/content that doesn't work because iOS can't use CSS style modification filters so the companion filters for the CSS Style modification filters are not necessary and should be excluded.

In ultralist.txt I tried using the pre-processor directive as I follow the logic but it doesn't appear to work and get loaded properly into Adguard for iOS.

! Start Web Annoyances Ultralist Exclusion Sublists
!#if adguard
!#if env_mobile
!#include filters/adguard_app_ios_exclusion_filters.txt
!#endif
!#endif
! End Web Annoyances Ultralist Exclusion Sublists

Related to AdguardTeam/AdguardBrowserExtension#917

I need to investigate further to find out why the sublist is not being loaded on Adguard iOS compiled list when subscribed to Web Annoyances Ultralist in the 'Annoyances' section of Adguard.

yourduskquibbles added a commit that referenced this issue Aug 12, 2020
Unknown if this will cause error in uBO (hopefully the sublist will just get ignored) as `adguard_app_ios` is not a [supported directive](https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#if-condition) in uBO.

[adguard Directive list](https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#what-constants-we-declare)

Relates to #241
yourduskquibbles added a commit that referenced this issue Aug 12, 2020
Unknown if this will cause error in uBO as `adguard_app_ios` is not a [supported directive](https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#if-condition) in uBO. (The sublist should be ignored entirely but based on testing, it still loads the filters/adguard_mobile_exclusion_filters.txt so adding the pre-processor directive within the sublist as well

[adguard Directive list](https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#what-constants-we-declare)

Relates to #241
@yourduskquibbles
Copy link
Owner Author

yourduskquibbles commented Aug 12, 2020

!#include sublist wrapped in invalid uBO directive adguard_app_ios in Ultralist.txt still fetches and loads the sublist that should be ignored because it is wrapped in invalid uBO directive adguard_app_ios

!#if adguard_app_ios
!#include filters/adguard_app_ios_exclusion_filters.txt
!#endif

In uBO the sublist should be ignored entirely but based on testing, logger shows the filters/adguard_app_ios_exclusion_filters.txt being fetched so additionally adding the !#if adguard_app_ios pre-processor directive within the adguard_mobile_exclusion_filters.txt sublist as well.

!#if adguard_app_ios
apnews.com#@#.header-placeholder, .optional-header-title
mobile.twitter.com#@#header[role="banner"] > div[style*="height"]
!#endif

@yourduskquibbles
Copy link
Owner Author

The uBO fix to recognize the directive adguard_app_ios (as well as additional special case directives) is now published with gorhill/uBlock@00b790c and is implemented with uBO 1.29.1b

yourduskquibbles added a commit that referenced this issue Aug 13, 2020
…ion_filters.txt

Change in list name to mirror the pre-parser directive nomenclature for the AdGuard iOS app

Related: #241
Related: #67
@krystian3w
Copy link
Contributor

krystian3w commented Aug 14, 2020

How this works with something like:

!#if (!adguard_ext_android_cb && !adguard_app_ios)
!#include filters_uBO_AG.txt
!#endif

in file filters_uBO_AG.txt we found:

  • :has()
  • :has-text()
  • :upward()
  • many scriptlets, css filters
  • html filtering
  • many other embeded pre-procesor directives e.g.:
    • disable use css filters, if html filtering kill problem faster and still safe.
    • filters specified for disabled userCSS in Nano Adblocker for Chromium.

@yourduskquibbles
Copy link
Owner Author

!#if (!adguard_ext_android_cb && !adguard_app_ios)
!#include filters_uBO_AG.txt
!#endif

uBO only allows ONE preprocessor directive, no match for two cases with &&

@yourduskquibbles
Copy link
Owner Author

in file filters_uBO_AG.txt we found:

* `:has()`

* `:has-text()`

* `:upward()`

* many scriptlets, css filters

* html filtering

* many other embeded pre-procesor directives e.g.:
  
  * disable use css filters, if html filtering kill problem faster and still safe.
  * filters specified for disabled userCSS in Nano Adblocker for Chromium.

AdGuard has its own internal system that converts uBO syntax to AdGuard syntax, I don't think these filters get thrown out, just rewritten internally.

@krystian3w
Copy link
Contributor

krystian3w commented Aug 19, 2020

I mean, if I don't have to reprogramme this preprocessor, so that some 5 thousand filters won't suddenly disappear from the list of active filters in uBO, under AdGuard such exclusion works well for now.

AdGuard has a strange policy - filters do not for iOS / Content Blocker convert in CSS (instead use preprocessors):

example.com#$#.pop-up { display: none !important; }
example.com#$#body { overflow: visibile !important; }

So instead of adding thousands :style(display: none !important;) (when works simple example.com##.popup) I use one "big" preprocessor #if (!adguard_ext_android_cb && !adguard_app_ios)

@yourduskquibbles
Copy link
Owner Author

I've Added an Adguard App for Android exclusion list now

Discussion: AdguardTeam/AdguardFilters#63209 (comment)

Related: #67

@yourduskquibbles yourduskquibbles changed the title Adguard preprocessor directive to load sublist only when using Adguard iOS client Adguard preprocessor directive to load sublist only when using Adguard iOS App [2020-09-08: Adguard Android App Exclusion List Added] Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants