1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-17 07:52:42 +01:00
Commit Graph

3034 Commits

Author SHA1 Message Date
Raymond Hill
b8193ea5f9
Fix detection of unfilled filter list fields
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/781#discussioncomment-7503866
2023-11-07 17:27:37 -05:00
Raymond Hill
3ff456a63d
Prefer CDNs when subscribing to a new list
Also, purging the cache of a list should not remove the
compiled version of that list so that it keep being seen
as cached, but obsolete.
2023-11-07 08:21:22 -05:00
Raymond Hill
ae24032607
Add more replace-able types
Reference:
https://en.wikipedia.org/wiki/M3U#Internet_media_types
2023-11-07 07:53:37 -05:00
Raymond Hill
2360bc02f3
Lower maximum Expires value to 4h
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2899
2023-11-06 19:45:16 -05:00
Raymond Hill
8ed1ad9c9d
Properly reset needle length in unserialized buffer
Possible related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2925
2023-11-06 19:22:47 -05:00
Imre Kristoffer Eilertsen
a2ab313ae2
Attempted to set flag codes for Chromium Windows users (#3906)
* Attempted to set flag codes for Chromium users

* Not sure how I missed MD.
2023-11-06 16:46:56 -05:00
Raymond Hill
5d1618e1be
Reset potential g regex before use in replace= option
Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/5184#issuecomment-1794058253
2023-11-06 07:16:41 -05:00
Raymond Hill
6417f54299
Apply response filtering according to mime type
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2833
2023-11-05 19:13:38 -05:00
Raymond Hill
1055203542
Avoid creating a session if there are no jobs 2023-11-05 14:54:59 -05:00
Raymond Hill
ce835bb300
Remove extraneous increment in charset sniffing code
Related commit:
7c3e060c01

Related feedback:
7c3e060c01 (commitcomment-131759551)
2023-11-05 14:19:06 -05:00
Raymond Hill
b69b0b5fb9
Add more mimes as valid target for response filtering
Related feedback:
7c3e060c01 (commitcomment-131754750)

application/vnd.apple.mpegurl
Reference:
https://www.iana.org/assignments/media-types/application/vnd.apple.mpegurl

application/vnd.api+json
Reference:
https://www.iana.org/assignments/media-types/application/vnd.api+json
2023-11-05 12:50:03 -05:00
Raymond Hill
d7c99b46e6
Have urltransform= use the same syntax as replace=
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2924
2023-11-05 11:19:03 -05:00
Raymond Hill
5f78d83fea
Fix various code paths in bodyFilterer
Related to extracting charset of response body.
2023-11-05 10:32:23 -05:00
Raymond Hill
1cf634cce0
Leave out hash part when extracting patch file name
Related commit:
aeff955667
2023-11-05 08:03:43 -05:00
Raymond Hill
c38267bb2b
Fix charset sniffing in reworked response body filtering code
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/830

Related commit:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2537#discussioncomment-5277574
2023-11-04 09:50:10 -04:00
Raymond Hill
4de6bd6f07
Fix potential exceptions in new response body filtering code
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2929

Related commit:
7c3e060c01
2023-11-04 09:43:38 -04:00
Raymond Hill
4774a39b17
[mv3] Fix converter to DNR rules 2023-11-03 21:32:44 -04:00
Raymond Hill
4c48148eb2
Support auto-complete for from= same as domain= 2023-11-03 20:19:19 -04:00
Raymond Hill
7c3e060c01
Implement network filter option replace=
Reference documentation:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#replace-modifier

This is a network filter option which can only be loaded from a
trusted source.

Since this filter is about modifying the response body, it currently
only works in Firefox.

As discussed with filter list maintainers.
2023-11-03 19:01:01 -04:00
Raymond Hill
aeff955667
Extract list name from hash portion of ! Diff-Path: 2023-11-03 18:39:14 -04:00
Raymond Hill
89b272775a
Prevent evaluating the SNFE until fully loaded
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2925
2023-11-03 10:01:40 -04:00
Raymond Hill
605ad238b4
Report modifier stats in built-in benchmark of SNFE 2023-11-02 19:23:06 -04:00
Raymond Hill
4032ac9149
Minor re-wording in log output 2023-11-02 11:49:15 -04:00
Raymond Hill
69fce3aa6e
Fine-tune details about when differential update should kick in
Manual update of one or more lists will cause the most recent version
of these lists to be fetched from the "origin" server, and since the
lists from "origin" servers cannot be updated through differential
update, the lists will be subsequently updated according to their
`Expires` directive.

When the lists are auto-updated, the "CDN" servers will be used,
and as a result the lists will start to be updated trhough
differential updates every 6-hour (currently).

Thus it is recommended and optimal to let the lists auto-update,
since you will benefit from a much shorter delay to get up-to-date
lists (i.e. every 6-hour instead of every 6-day).

You can force the auto-updater to fetch all the lists by clicking
"Purge all caches", then restart uBO without clicking "Update".
This will cause uBO to perform an emergency auto-update at restart
time, after which you will have all the lists which are candidates
for differential update.

The "Update now" button in the "Support" pane will also cause lists
to be fetched from their "origin" server.
2023-11-01 10:45:31 -04:00
Raymond Hill
9058fce037
Fire notification when no update but writeTime change 2023-10-31 16:33:03 -04:00
Raymond Hill
abd8577096
Distinguish diff patch not-available from not-yet-available
A not-yet-available won't cause a list to become candidate for
full update.

A not-available will cause the list to be candidate for full
update.
2023-10-31 10:52:03 -04:00
Raymond Hill
153783cfaa
Forgot to lower update period limit to 6-hour 2023-10-30 20:42:38 -04:00
Raymond Hill
3dca115eb6
Add more dev console tracing to asset updater 2023-10-30 19:49:17 -04:00
Raymond Hill
19d6d7ff5c
Minor code review: remove pointless argument 2023-10-30 14:02:47 -04:00
Raymond Hill
2344cbdeca
Harden diff-updater against unexpected errors
The diff-updater worker will terminate upon unexpected
error, in order to avoid a stalled updater.
2023-10-30 13:47:24 -04:00
Raymond Hill
d05ff8ffeb
Add support for diff-patching filter lists
Related discussion:
https://github.com/ameshkov/diffupdates

The benefits of diff-patching filter lists is much shorter update
schedule and significantly less bandwidth consumed.

At the moment, only default filter lists are subject to be
diff-patched.

External filter lists can make their lists diff-patchable by
following the specification link above.

Only filter lists fetched by the auto-updater are candidate for
diff-patching.

Forcing a manual update of the filter lists will prevent the
diff-patcher from kicking in until one or more lists are
auto-updated.

Some back-of-the-envelop calculations regarding the load on free
CDN solutions used by uBO to distribute its own filter lists:

Currently, for each CDN (with lists updating after days):
~560 M req/month, ~78 TB/month

With diff-patching lists on a 6-hour schedule:
~390 M req/month, 1 TB/month

Those estimates were done according to statistics shown by
jsDelivr, which is one of 4 CDNs picked randomly when a list
updates:
https://www.jsdelivr.com/package/gh/uBlockOrigin/uAssetsCDN?tab=stats
2023-10-30 12:30:46 -04:00
Raymond Hill
032f170dba
Make update-through-link equivalent to auto-update cycle 2023-10-30 12:09:16 -04:00
Raymond Hill
4fa92f930e
Support soft-updating through update links
Where "soft-updating" means updating from CDNs, and "hard-updating"
means updating from `ublockorigin.github.io/uAssets`.
2023-10-30 10:47:38 -04:00
Raymond Hill
b061db229e
Prevent contentScripts.register from throwing
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2915
2023-10-30 10:44:04 -04:00
Raymond Hill
07ac27e07b
Give precedence to Last modified: field when evaluating "age" if lists
Available network information is not very reliable and should be
used only when `Last modified:` is not available.
2023-10-27 21:09:49 -04:00
Raymond Hill
9bd483bec3
Enable "not permissions" filtering expression in logger
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714#discussioncomment-6959861
2023-10-22 17:50:45 -04:00
Raymond Hill
0b9b5a4802
Enable dev console by default in dev build 2023-10-22 12:33:10 -04:00
Raymond Hill
8c283d4d38
Flush the registered scriptlet cache as needed only
Related commit:
e5b438257f
2023-10-22 12:31:33 -04:00
Raymond Hill
e33c0f9d9c
Minor refactoring plus other minor changes
Added more evocative error messages to linter.

Made the content of _My filters_ trusted by default in
dev build.
2023-10-22 08:53:01 -04:00
Raymond Hill
64c1f8767c
Add ability to control trusted status of filter lists
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895

Changes:

The _content of the My filters_ pane is now considered untrusted by
default, and only uBO's own lists are now trusted by default.

It has been observed that too many people will readily copy-paste
filters from random sources. Copy-pasting filters which require trust
represents a security risk to users with no understanding of how the
filters work and their potential abuse.

Using a filter which requires trust in a filter list from an untrusted
source will cause the filter to be invalid, i.e. shown as an error.

A new advanced setting has been added to control which lists are
considered trustworthy: `trustedListPrefixes`, which is a space-
separated list of tokens. Examples of possible values:

- `ublock-`: trust only uBO lists, exclude everything else including
  content of _My filters_ (default value)

- `ublock- user-`: trust uBO lists and content of _My filters_

- `-`: trust no list, essentially disabling all filters requiring
  trust (admins or people who don't trust us may want to use this)

One can also decide to trust lists maintained elsewhere. For example,
for stock AdGuard lists add ` adguard-`. To trust stock EasyList lists,
add ` easylist-`.

To trust a specific regional stock list, look-up its token in
assets.json and add to `trustedListPrefixes`.

The matching is made with String.startsWith(), hence why `ublock-`
matches all uBO's own filter lists.

This also allows to trust imported lists, for example add
` https://filters.adtidy.org/extension/ublock/filters/` to trust all
non-stock AdGuard lists.

Add the complete URL of a given imported list to trust only that one
list.

URLs not starting with `https://` or `file:///` will be rejected,
i.e. `http://example.org` will be ignored.

Invalid URLs are rejected.
2023-10-21 19:29:10 -04:00
Raymond Hill
e5b438257f
Ensure scriptlet cache is reset when filtering profile changes
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2896

TODO: Eventually, distinguish between filtering profile increasing
or decreasing so as to avoid flushing caches when increasing
filtering, which should not affect the scriptlets cache.
2023-10-21 14:25:26 -04:00
Raymond Hill
9d3acd91b8
Support AdGuard's [trusted-]set-cookie-reload scriptlets
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2881
2023-10-18 09:48:08 -04:00
Raymond Hill
5bd40b34cd
Support pairing doc with urltransform
Related feedback:
2e4525fe3c (commitcomment-130203742)
2023-10-18 09:06:28 -04:00
Raymond Hill
74a4772e41
Fix comment 2023-10-18 08:55:09 -04:00
Raymond Hill
b98ee0f442
Minor code review 2023-10-17 23:11:06 -04:00
Raymond Hill
f34855b859
Do not consider same-creation time to be a stale status
Related commit:
7daf31336a
2023-10-17 12:30:06 -04:00
Raymond Hill
7daf31336a
Ignore assets older than cached version when fetching from CDNs
As discussed with filter list volunteers.

https://github.com/uBlockOrigin/uBlock-discussions/discussions/781#discussioncomment-7283981
2023-10-17 12:08:10 -04:00
Raymond Hill
05ae51beb2
Minor code review of last commit
Related commit:
027c7a4fb5
2023-10-16 18:05:41 -04:00
Raymond Hill
027c7a4fb5
Support quoting scriptlet parameters with backticks
(In addition to in already supported single- and double-quote).

The parsing of (optionally) quoted arguments from an argument
list has been spinned off into a standalone helper in order to
be reused in other parts of the parser eventually.
2023-10-16 17:38:57 -04:00
Raymond Hill
c06f5e014f
Prevent redirecting when URL is not transformed
Related commit:
https://github.com/gorhill/uBlock/commit/2e4525fe3c
2023-10-16 11:14:12 -04:00