Efficient embeddable adblocker library
MPL-2.0 License
Bot releases are hidden (Show)
Published by remusao over 5 years ago
Published by remusao over 5 years ago
isAnchoredByHostname
to be more readableslice
instead of subarray
Published by remusao over 5 years ago
Published by remusao over 5 years ago
Published by remusao over 5 years ago
serialize
method as well as a static method deserialize
.update
which expects a diff of filters, updateList
andupdateResources
. This API should be a cleared and allows using theparse
and match
method (with the same expectedtoString
method of filters should now be more accurate.getCosmeticsFilters
will now return CSS as a single stringPublished by remusao almost 6 years ago
This release contains many fixes as well as a few (small) breaking changes.
Request
as argumentRequest
as argumentRequest
as argumentdomain
argumentRequest
's constructor does not apply default valuemakeRequest
to reproduce the previous behavior of new Request
.bug
filter attributebug
optionPublished by remusao almost 6 years ago
Published by remusao almost 6 years ago
tldts
to version 3.1.1
Published by remusao almost 6 years ago
Published by remusao almost 6 years ago
Published by remusao almost 6 years ago
This release contains massive optimizations as well as a few bug fixes and building improvements:
Distribute both un-bundled cjs and es6 source #54
Produce a commonjs build artifact #53
Update build instructions in README.md #52
Remove dist folder from source tree #50
Cosmetics: fix rule matching when hostname is empty #49
Optimizations #46
type
as a string or number (e.g.: script
or 2
).// Both are equivalent
new Request({ type: 2, url, sourceUrl })
new Request({ type: 'script', url, sourceUrl })
id
attribute from filters has been remove, use getId()
instead (please note that the id
is not stored internally anymore, but generated every time getId()
is called).// Bad
filter.id
// Good
filter.getId()
getId()
will differ from values stored inid
attribute for identical filters (the algorithm is now different$domains=
option are now stored hasheddebug
flag is used in FiltersEngine
fastTokenizer
will now only consider tokens longer than 1fastTokenizer
will now only tokenize up to 2048 characters from URLsfastHash
and fastHashBetween
will notCosmeticFilter
and NetworkFilter
) will have value undefined
null
or empty string like before. It is recommendedfilter.getHostname()
instead offilter.hostname
) to access internal attributes, as they will// Bad
filter.redirect
filter.filter
filter.hostname
// Good
filter.getRedirect()
filter.getFilter()
filter.getHostname()
Request
abstraction supersedes IRequest
andIRawRequest
. This new class offers a more consistent experience to worknew Request({ url })
new Request({ url, sourceUrl })
new Request({ url, sourceUrl, type: 'string' })
new Request({ url, hostname, domain, type: 'string' })
hosts
format (e.g.: 127.0.0.1 domain
),||domain^$third-party
). This simplifies the parsing logic.fromFetch
fromDTD
fromXLST
fromBeacon
fromCSP
cpt
(Content Policy Type of requests) is now called type
,// Bad
request.cpt
new Request({ cpt })
// Good
request.type
new Request({ type })
parseJSResource
(~4 times faster)slice
, substr
and substring
)|https://$script,domain=downloadpirate.com
|https://$script,domain=dwindly.io
|https://$script,domain=intoupload.net
|https://$script,domain=linkshrink.net
|https://$script,domain=movpod.in
|https://$script,domain=povw1deo.com|povwideo.net|powvideo.net
|https://$script,domain=sendit.cloud
|https://$script,domain=sfiles.org|suprafiles.me|suprafiles.net|suprafiles.org
|https://$script,domain=streamplay.to
|https://$script,domain=userscloud.com
|https://$script,domain=yourporn.sexy
|https://$script,domain=dwindly.io|movpod.in|...|yourporn.sexy
tokenize
will now allow %
as part of tokens for filtersCosmeticFilter
now support the new +js()
syntax to inject scriptsNetworkFilter
's getTokens()
method will now return more tokens in some$domain=
NetworkFilter
has no token available (e.g.:$image,domain=ads.com
), then it can be indexed using the domains$domain=
option, if any.*pattern
(regex) are now optimized into pattern
(plain)|http://
or |https://
or |http*://
are nowhttp
and https
options. TheRequest
instances will now say if they are http
or https
, and thisengine
has been optimizedserialize
method on FiltersEngine
classMap
instead of twoSet
and a binary search is used for lookups.magic
field)