Commit Graph

326 Commits

Author SHA1 Message Date
Raymond Hill 923452b788
Use raw string for regex patterns in python scripts
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3229
2024-05-05 11:47:31 -04:00
Raymond Hill 65b6753c69
Simpler to use an extra property than to use a new assets.json 2024-03-14 10:20:25 -04:00
Raymond Hill 258a26283d
assets.json is not meant to be updated until 1.57 is widespread 2024-03-11 22:24:15 -04:00
Raymond Hill 2c9ab8ee04
Fix the salvaging of rule ids 2024-03-11 22:22:57 -04:00
Raymond Hill 633135745f
Need new `assets.son` file for next release
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3154
2024-03-11 18:41:18 -04:00
Raymond Hill e1e861704b
[mv3] Fix build script 2024-03-07 09:19:16 -05:00
Raymond Hill 02966afb8c
[mv3] Do not pollute browser console in stable release versions 2024-03-06 12:46:12 -05:00
Raymond Hill 185ff3fd96
Empty target directory instead of re-creating it
For better web-ext compatibility.
2024-03-05 07:59:11 -05:00
Raymond Hill f7e00e4223
[mv3] Fix rule id-salvaging task 2024-02-25 20:49:25 -05:00
Raymond Hill f2d7413a42
[mv3] Reuse rule ids across release where possible
This is to reduce the diff size of rulesets in new
releases. Beside smaller diff size, this also makes it
easier to investigate rule changes across releases.
2024-02-14 14:27:36 -05:00
Raymond Hill cc726c06cd
Remove untranslated language 2023-12-05 13:15:00 -05:00
Raymond Hill d110c21db7
Ship minified version of lists in package 2023-10-29 23:39:40 -04:00
Raymond Hill ed4b31931a
Prepare to ship minified lists in package 2023-10-26 13:38:24 -04:00
Raymond Hill 74d04f1945
[mv3] Fix overiting of version in manifest 2023-09-10 14:24:29 -04:00
Raymond Hill 1db17ac4bf
[mv3] Support the tagname being set externally 2023-09-09 09:47:38 -04:00
Raymond Hill eeafae12b0
Let uBOL-home pick the uBO version 2023-08-25 11:17:15 -04:00
Raymond Hill 179e0fe9fa
re-oops 2023-08-19 09:15:15 -04:00
Raymond Hill faa4b7b69a
oops 2023-08-19 08:56:57 -04:00
Raymond Hill bcc0803bb5
[mv3] Use specific commit URL to pick uBO repo version 2023-08-19 08:50:20 -04:00
Raymond Hill f049aea65e
Provide instructions on how to build uBO Lite
Required by AMO when submitting an extension to be hosted on AMO.
2023-08-12 08:02:42 -04:00
Raymond Hill bb41d9594f
[mv3] Use workaround to inject scriptlets in Firefox
Additionally:

Use `export UBO_VERSION=local` at the console to build MV3 extension using
current version of uBO code base. By default, the version is taken from
`./platform/mv3/ubo-version' and usually set to last stable release.
2023-08-11 13:22:25 -04:00
Raymond Hill 2d32505045
Build uBO Lite on top of stable release of uBO 2023-08-10 13:16:35 -04:00
Raymond Hill e295822f93
Build uBO Lite on top of stable release of uBO 2023-08-10 13:08:15 -04:00
Raymond Hill d19e62a595
[mv3] Add support for admin configurations
See `managed_storage.json` for available settings. Currently
only `noFiltering` setting is availale.

`noFiltering` is an array of strings, each being a domain for
which no filtering should occur.

Related discussion:
- https://github.com/uBlockOrigin/uBOL-issues/discussions/35
2023-06-13 11:40:41 -04:00
Raymond Hill 4ddfb3f278
[mv3] Add more specific purposed annoyances-related lists
Import country flag-related code from uBO.

Switch to AdGuard annoyance-related lists, as this solves
https://github.com/uBlockOrigin/uBOL-issues/issues/5#issuecomment-1583192594
2023-06-11 09:20:10 -04:00
Raymond Hill f282b43550
[mv3] Move hostname label to top of popup panel
Related commit in uBO:
- b8cfa382e8

Additionally, render internationalized domain names in pretty Unicode
instead of ugly punycode.
2023-06-06 09:04:21 -04:00
Raymond Hill b163097399
[mv3] Extend scriplet filtering support to all scriptlets
Source code of scriplets is now fetched directly from uBO
project, so there is no longer the need to keep duplicate
versions of scriplet code.

All scriplet filters are now supported.
2023-06-02 17:04:15 -04:00
Raymond Hill 223815342e
Make dev build use its own assets.json: assets.dev.json
This will make it easier to safely test new versions of
assets.json.
2023-05-04 19:20:18 -04:00
Raymond Hill e7f6b43659
Update as per filter list changes 2023-04-28 17:02:51 -04:00
Raymond Hill bc35110180
Pick only the packaged lists 2023-04-27 13:22:15 -04:00
Raymond Hill ae474aae40
Remove languages with no translations, no activity 2023-04-25 14:21:46 -04:00
Raymond Hill ba1d686795
Fix github-actions re uBO Lite 2023-04-07 13:34:27 -04:00
Raymond Hill 16b50852c3
Make a firefox package of uBO Lite on release 2023-04-07 13:24:57 -04:00
Raymond Hill cbfd2ad942
Create a MVP version of uBOLite for Firefox
What does not work at the time of commit:

Cosmetic filtering does not work:

The content scripts responsible for cosmetic filtering fail when
trying to inject the stylesheets through document.adoptedStyleSheets,
with the following error message:

  XrayWrapper denied access to property Symbol.iterator
  (reason: object is not safely Xrayable).
  See https://developer.mozilla.org/en-US/docs/Xray_vision for more
  information. ... css-declarative.js:106:8

A possible solution is to inject those content scripts in the
MAIN world. However Firefox scripting API does not support MAIN
world injection at the moment.

Scriptlet-filtering does not work:

Because scriptlet code needs to be injected in the MAIN world,
and this is currently not supported by Firefox's scripting API,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1736575

There is no count badge on the toolbar icon in Firefox, as it
currently does not support the `DNR.setExtensionActionOptions`
method.

Other than the above issues, it does appear uBO is blocking
properly with no error reported in the dev console.

The adoptedStyleSheets issue though is worrisome, as the
cosmetic filtering content scripts were designed with ISOLATED
world injection in mind. Being forced to inject in MAIN world
(when available) make things a bit more complicated as uBO
has to ensure it's global variables do not leak into the page.
2023-04-07 10:19:43 -04:00
Raymond Hill 64909c671f
Fix crowdin import script 2022-11-29 11:05:21 -05:00
Raymond Hill 65cde3b75a
Remove locales without a translated description 2022-11-18 13:09:27 -05:00
Raymond Hill f716fe3960
Remove now obsolete shell script re. uAssets 2022-11-14 10:01:56 -05:00
Raymond Hill 17590c5a0c
Use `git clone` instead of submodule to pull uAssets dependencies
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2358

We need two different branches of uAssets to properly add the
default filter lists into the packages. I couldn't figure out
how to do this with submodules, using simple `git clone` as a
dependency just work.
2022-11-14 09:50:53 -05:00
Raymond Hill feaa338678
Code maintenance: replace uDom.js with dom.js
`uDom` is old and crusty and `dom` is meant as replacement. The
goal of `dom` is to be simpler and mainly just convenience
methods for handling the DOM with vanilla JS -- this is not a
framework.

Additionally, removed keyboard shortcuts pane which was useful
only on very old versions of Firefox.
2022-11-12 09:51:22 -05:00
Raymond Hill 985ea24e82
[mv3] Add support for redirect= filters
This adds support for `redirect=` filters. As with `removeparam=`
filters, `redirect=` filters can only be enforced when the
default filtering mode is set to Optimal or Complete, since these
filters require broad host permissions to be enforced by the DNR
engine.

`redirect-rule=` filters are not supported since there is no
corresponding DNR syntax.

Additionally, fixed the dropping of whole network filters even though
those filters are still useful despite not being completely
enforceable -- for example a filter with a single (unsupported) domain
using entity syntax in its `domain=` option should not be wholly
dropped when there are other valid domains in the list.
2022-10-16 12:05:24 -04:00
Raymond Hill 1db3748ab1
[mv3] General code review
Re-arranged resources in a more tidy way. General code review of
various code paths.
2022-10-15 13:05:20 -04:00
Raymond Hill 1a9a19a91f
[mv3] Open options page at first install
To be sure first time users are properly informed about the
possibility to enable broad permissions for better filtering.
2022-09-30 09:18:52 -04:00
Raymond Hill a71b71e4c8
New cosmetic filter parser using CSSTree library
The new parser no longer uses the browser DOM to validate
that a cosmetic filter is valid or not, this is now done
through a JS library, CSSTree.

This means filter list authors will have to be more careful
to ensure that a cosmetic filter is really valid, as there is
no more guarantee that a cosmetic filter which works for a
given browser/version will still work properly on another
browser, or different version of the same browser.

This change has become necessary because of many reasons,
one of them being the flakiness of the previous parser as
exposed by many issues lately:

- https://github.com/uBlockOrigin/uBlock-issues/issues/2262
- https://github.com/uBlockOrigin/uBlock-issues/issues/2228

The new parser introduces breaking changes, there was no way
to do otherwise. Some current procedural cosmetic filters will
be shown as invalid with this change. This occurs because the
CSSTree library gets confused with some syntax which was
previously allowed by the previous parser because it was more
permissive.

Mainly the issue is with the arguments passed to some procedural
cosmetic filters, and these issues can be solved as follow:

Use quotes around the argument. You can use either single or
double-quotes, whichever is most convenient. If your argument
contains a single quote, use double-quotes, and vice versa.

Additionally, try to escape a quote inside an argument using
backslash. THis may work, but if not, use quotes around the
argument.

When the parser encounter quotes around an argument, it will
discard them before trying to process the argument, same with
escaped quotes inside the argument. Examples:

Breakage:

    ...##^script:has-text(toscr')

Fix:

    ...##^script:has-text(toscr\')

Breakage:

    ...##:xpath(//*[contains(text(),"VPN")]):upward(2)

Fix:

    ...##:xpath('//*[contains(text(),"VPN")]'):upward(2)

There are not many filters which break in the default set of
filter lists, so this should be workable for default lists.

Unfortunately those fixes will break the filter for previous
versions of uBO since these to not deal with quoted argument.
In such case, it may be necessary to keep the previous filter,
which will be discarded as broken on newer version of uBO.

THis was a necessary change as the old parser was becoming
more and more flaky after being constantly patched for new
cases arising, The new parser should be far more robust and
stay robist through expanding procedural cosmetic filter
syntax.

Additionally, in the MV3 version, filters are pre-compiled
using a Nodejs script, i.e. outside the browser, so validating
cosmetic filters using a live DOM no longer made sense.

This new parser will have to be tested throughly before stable
release.
2022-09-23 16:03:13 -04:00
Raymond Hill 70a0de9d00
[mv3] Mind trusted-site directives when registering content scripts 2022-09-20 08:24:01 -04:00
Raymond Hill adb5d503d9
[mv3] Add GitHub action to build mv3 separately form uBO 2022-09-19 11:08:34 -04:00
Raymond Hill 232c44eeb2
[mv3] Add scriptlet support; improve reliability of cosmetic filtering
First iteration of adding scriptlet support. As with cosmetic
filtering, scriptlet niijection occurs only on sites for which
uBO Lite was granted extended permissions.

At the moment, only three scriptlets are supported:
- abort-current-script
- json-prune
- set-constant

More will be added in the future.
2022-09-16 15:56:35 -04:00
Raymond Hill 99e4fa1d4d
Set zip to quiet mode 2022-09-15 13:37:39 -04:00
Raymond Hill 34aab95107
[mv3] Add support for specific cosmetic filtering
Specific plain CSS cosmetic filters are now supported.

Cosmetic filtering will occur only after the user explicitly
grant uBO extended permissions for a given site, so that it
can inject CSS on the site.

A new button in the popup panel allows a user to grant/revoke
extended permissions to/from uBO Lite for the current site.

More capabilities will be carefully added for when extended
permissions are granted on a site, so specific cosmetic
filtering through plain CSS is the first implemented capability.

Generic and procedural cosmetic filtering is not implemented.

The current implementation for plain CSS cosmetic filters is
through declarative content injection, which does not require
the service worker to be alive, the browser takes care to
inject the cosmetic filters.

However declarative CSS injection does not support user
styles, so the injected cosmetic filters are "weak". I consider
this is a browser issue, since user styles are supported by
Chromium, there is just no way in the API to specify user
styles for the injected content.

Also:
- Fixed dark theme issues
- Added Steven Black's hosts file

Keep in mind all this is very experimental and implementation
details in this release may (will) greatly change in the future.
2022-09-15 13:14:08 -04:00
Raymond Hill 3435e9886e
Import translation work from https://crowdin.com/project/ublock 2022-09-13 17:58:12 -04:00
Raymond Hill e31637af78
[mv3] Add ability to enable/disable filter lists 2022-09-13 17:44:24 -04:00