mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Fix fake websites redirect in uBO
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
Some checks failed
Build / Build (push) Has been cancelled
Build / Diff output (push) Has been cancelled
Build / Deploy to Cloudflare Pages (3.114.12) (push) Has been cancelled
Build / Deploy to GitHub and GitLab (push) Has been cancelled
Build / Remove Artifacts after Deployment (push) Has been cancelled
This commit is contained in:
@@ -269,7 +269,15 @@ function uBOUriTransformGeneratorForFakeWebsites(acc: string[], [from, to]: [fro
|
|||||||
'||'
|
'||'
|
||||||
+ from
|
+ from
|
||||||
+ '$all,uritransform=/'
|
+ '$all,uritransform=/'
|
||||||
+ String.raw`.*` + escapeRegexp(from).replaceAll('/', String.raw`\/`) + String.raw`\/(.*)`
|
// \/.*formysql\.com\/.*
|
||||||
|
//
|
||||||
|
// By adding \/.* at the beginning and the end, we can avoid replace the protocol (https:// or http://),
|
||||||
|
// which will bork uBlock Origin's filter matching (requires final URL to be a valid URL):
|
||||||
|
//
|
||||||
|
// https://www.formysql.com/en/products/navicat-for-mysql
|
||||||
|
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
// https://www.navicat.com.cn
|
||||||
|
+ String.raw`\/.*` + escapeRegexp(from).replaceAll('/', String.raw`\/`) + String.raw`.*`
|
||||||
+ '/'
|
+ '/'
|
||||||
+ to.replace('https://', '').replaceAll('/', String.raw`\/`)
|
+ to.replace('https://', '').replaceAll('/', String.raw`\/`)
|
||||||
+ '/'
|
+ '/'
|
||||||
|
|||||||
Reference in New Issue
Block a user