Skip to content

Commit 48013fe

Browse files
author
hoang.tran12
committed
fix font gstatic
1 parent 2816446 commit 48013fe

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

scripts/auto_redirectLargestImageSrc_rules.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
name: unique name for this rule
66
url: regex for url that this rule support
77
src: regex for img src that this rule support
8+
exclude: regex for img src that this rule should not support
89
r: regex(s) for string that will be replaced
9-
s: regex(s) for string that will be added
10+
s: regex(s) / function(s) to calculate string that will be added
1011
}
1112
*/
1213

@@ -76,11 +77,8 @@ export default [
7677
{
7778
name: "font gstatic",
7879
src: /^https?:\/\/fonts\.gstatic\.com\/(.*)\/notoemoji/i,
79-
r: [
80-
/(https?:\/\/.*)\/\d+.(png|jpg)/,
81-
/(https?:\/\/.*)\/\d+.(png|jpg)(.*?)(=s\d+)/,
82-
],
83-
s: ["$1/512.$2"],
80+
r: /(https?:\/\/.*)\/\d+.(png|jpg)(.*?)(=s\d+)?/,
81+
s: "$1/512.$2",
8482
},
8583
{
8684
name: "artstation",

scripts/content-scripts/ufs_global.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ async function isImageSrc(src) {
15371537
const res = await fetchByPassOrigin(src, {
15381538
method: "HEAD",
15391539
});
1540-
if (res.ok) {
1540+
if (res?.ok) {
15411541
// const type = res.headers.get("content-type");
15421542
const type = res.headers?.["content-type"];
15431543
if (type && type.startsWith("image/")) {

0 commit comments

Comments
 (0)