Improvement to the built-in github.com rule #117
Answered
by
tophf
necaran
asked this question in
MPIV host rules
-
The current rule looks like this. dotDomain.endsWith('.github.com') && {
r: new RegExp([
/(avatars.+?&s=)\d+/,
/(raw\.github)(\.com\/.+?\/img\/.+)$/,
/\/(github)(\.com\/.+?\/)blob\/([^/]+\/.+?\.(?:png|jpe?g|bmp|gif|cur|ico))$/,
].map(rx => rx.source).join('|')),
s: m => `https://${
m[1] ? `${m[1]}460` :
m[2] ? `${m[2]}usercontent${m[3]}` :
`raw.${m[4]}usercontent${m[5]}${m[6]}`
}`,
}, But there are some problems.
My proposed improvement is like this. dotDomain.endsWith('.github.com') && {
r: new RegExp([
/(avatars.+?&s=)\d+/,
/(raw\.github)(\.com\/.+?\/img\/.+)$/,
/\/(github\.com\/.+?\/blob\/[^/]+\/.+?\.(?:avif|webp|png|jpe?g|bmp|gif|cur|ico))$/,
].map(rx => rx.source).join('|')),
s: m => `https://${
m[1] ? `${m[1]}460` :
m[2] ? `${m[2]}usercontent${m[3]}` :
`${m[4]}?raw=1`
}`,
}, You can make life easier by appending
Another option is to replace
|
Beta Was this translation helpful? Give feedback.
Answered by
tophf
May 12, 2024
Replies: 1 comment 1 reply
-
Seems fine, go ahead. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make a PR, I mean. Or do you want me to just apply the changes?