Skip to content

Commit

Permalink
Merge pull request #270 from brave/mirror
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
thypon authored Oct 11, 2024
2 parents ac5eb36 + 44bcb5f commit 7191027
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- [Add `-uricomponent` to `urlskip=` option](https://github.com/gorhill/uBlock/commit/01eebffc1f)
- [Add `forbidden`/`forever` as safe cookie values](https://github.com/gorhill/uBlock/commit/4d982d9972) (by @ryanbr)
- [Add regex extraction transformation step to `urlskip=` option](https://github.com/gorhill/uBlock/commit/c86ed5287b)
- [Improve `prevent-window-open` scriptlet](https://github.com/gorhill/uBlock/commit/85877b12ed)
- [Add support to parse Adguard's `[$domain=/.../]` regex-based modifier](https://github.com/gorhill/uBlock/commit/58bfe4c846)
Expand Down
1 change: 1 addition & 0 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ function getSafeCookieValuesFn() {
'enable', 'disable',
'enabled', 'disabled',
'essential', 'nonessential',
'forbidden', 'forever',
'hide', 'hidden',
'necessary', 'required',
'ok',
Expand Down
4 changes: 2 additions & 2 deletions dist/firefox/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"[email protected]": {
"updates": [
{
"version": "1.60.1.11",
"version": "1.60.1.12",
"browser_specific_settings": { "gecko": { "strict_min_version": "78.0" } },
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.60.1b11/uBlock0_1.60.1b11.firefox.signed.xpi"
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.60.1b12/uBlock0_1.60.1b12.firefox.signed.xpi"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion dist/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.60.1.11
1.60.1.12
37 changes: 19 additions & 18 deletions platform/npm/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ import { StaticNetFilteringEngine } from '@gorhill/ubo-core';

/******************************************************************************/

async function fetchList(name, url) {
return fetch(url).then(r => {
return r.text();
}).then(raw => {
console.log(`${name} fetched`);
return { name, raw };
}).catch(reason => {
console.error(reason);
});
}

async function main() {
const pathToSelfie = 'cache/selfie.txt';

Expand All @@ -62,24 +73,14 @@ async function main() {
if ( !selfie ) {
console.log(`Fetching lists...`);
await snfe.useLists([
fetch('https://easylist.to/easylist/easylist.txt')
.then(r => {
return r.text();
}).then(raw => {
console.log(`easylist fetched`);
return { name: 'easylist', raw };
}).catch(reason => {
console.error(reason);
}),
fetch('https://easylist.to/easylist/easyprivacy.txt')
.then(r => {
return r.text();
}).then(raw => {
console.log(`easyprivacy fetched`);
return { name: 'easyprivacy', raw };
}).catch(reason => {
console.error(reason);
}),
fetchList('ubo-ads', 'https://ublockorigin.github.io/uAssetsCDN/filters/filters.min.txt'),
fetchList('ubo-badware', 'https://ublockorigin.github.io/uAssetsCDN/filters/badware.min.txt'),
fetchList('ubo-privacy', 'https://ublockorigin.github.io/uAssetsCDN/filters/privacy.min.txt'),
fetchList('ubo-unbreak', 'https://ublockorigin.github.io/uAssetsCDN/filters/unbreak.min.txt'),
fetchList('ubo-quick', 'https://ublockorigin.github.io/uAssetsCDN/filters/quick-fixes.min.txt'),
fetchList('easylist', 'https://easylist.to/easylist/easylist.txt'),
fetchList('easyprivacy', 'https://easylist.to/easylist/easyprivacy.txt'),
fetchList('plowe', 'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext'),
]);
const selfie = await snfe.serialize();
await fs.mkdir('cache', { recursive: true });
Expand Down
18 changes: 14 additions & 4 deletions src/js/static-net-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -5406,6 +5406,8 @@ StaticNetFilteringEngine.prototype.transformRequest = function(fctxt, out = [])
*
* `-base64`: decode the current string as a base64-encoded string.
*
* `-uricomponent`: decode the current string as a URI encoded string.
*
* At any given step, the currently extracted string may not necessarily be
* a valid URL, and more transformation steps may be needed to obtain a valid
* URL once all the steps are applied.
Expand Down Expand Up @@ -5470,10 +5472,18 @@ function urlSkip(directive, urlin, steps) {
urlout = `https://${s}`;
continue;
}
// Decode base64
if ( c0 === 0x2D && step === '-base64' ) {
urlout = self.atob(urlin);
continue;
// Decode
if ( c0 === 0x2D ) {
// Base64
if ( step === '-base64' ) {
urlout = self.atob(urlin);
continue;
}
// URI component
if ( step === '-uricomponent' ) {
urlout = self.decodeURIComponent(urlin);
continue;
}
}
// Regex extraction from first capture group
if ( c0 === 0x2F ) { // /
Expand Down

0 comments on commit 7191027

Please sign in to comment.