Fetch diff patches from "reliable" servers only · gorhill/uBlock@8b964a8 · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

Commit 8b964a8

Browse files
committed
Fetch diff patches from "reliable" servers only
Some CDN servers take too long to mirror updated resources, potentially preventing diff-updating to work reliably as intended.
1 parent b5642ba commit 8b964a8

File tree

4 files changed

+69
-2
lines changed

4 files changed

+69
-2
lines changed

assets/assets.dev.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/filters.min.txt",
5353
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/filters.min.txt"
5454
],
55+
"patchURLs": [
56+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
57+
"https://ublockorigin.pages.dev/filters/"
58+
],
5559
"supportURL": "https://github.com/uBlockOrigin/uAssets"
5660
},
5761
"ublock-badware": {
@@ -71,6 +75,10 @@
7175
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/badware.min.txt",
7276
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/badware.min.txt"
7377
],
78+
"patchURLs": [
79+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
80+
"https://ublockorigin.pages.dev/filters/"
81+
],
7482
"supportURL": "https://github.com/uBlockOrigin/uAssets",
7583
"instructionURL": "https://github.com/gorhill/uBlock/wiki/Badware-risks"
7684
},
@@ -91,6 +99,10 @@
9199
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/privacy.min.txt",
92100
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/privacy.min.txt"
93101
],
102+
"patchURLs": [
103+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
104+
"https://ublockorigin.pages.dev/filters/"
105+
],
94106
"supportURL": "https://github.com/uBlockOrigin/uAssets"
95107
},
96108
"ublock-unbreak": {
@@ -109,6 +121,10 @@
109121
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/unbreak.min.txt",
110122
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/unbreak.min.txt"
111123
],
124+
"patchURLs": [
125+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
126+
"https://ublockorigin.pages.dev/filters/"
127+
],
112128
"supportURL": "https://github.com/uBlockOrigin/uAssets"
113129
},
114130
"ublock-quick-fixes": {
@@ -127,6 +143,10 @@
127143
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/quick-fixes.min.txt",
128144
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/quick-fixes.min.txt"
129145
],
146+
"patchURLs": [
147+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
148+
"https://ublockorigin.pages.dev/filters/"
149+
],
130150
"supportURL": "https://github.com/uBlockOrigin/uAssets"
131151
},
132152
"adguard-generic": {
@@ -163,6 +183,10 @@
163183
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easylist.txt",
164184
"https://ublockorigin.pages.dev/thirdparties/easylist.txt"
165185
],
186+
"patchURLs": [
187+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
188+
"https://ublockorigin.pages.dev/filters/"
189+
],
166190
"supportURL": "https://easylist.to/"
167191
},
168192
"adguard-spyware-url": {
@@ -212,6 +236,10 @@
212236
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easyprivacy.txt",
213237
"https://ublockorigin.pages.dev/thirdparties/easyprivacy.txt"
214238
],
239+
"patchURLs": [
240+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
241+
"https://ublockorigin.pages.dev/filters/"
242+
],
215243
"supportURL": "https://easylist.to/"
216244
},
217245
"urlhaus-1": {
@@ -478,6 +506,10 @@
478506
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances.min.txt",
479507
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances.min.txt"
480508
],
509+
"patchURLs": [
510+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
511+
"https://ublockorigin.pages.dev/filters/"
512+
],
481513
"supportURL": "https://github.com/uBlockOrigin/uAssets"
482514
},
483515
"dpollock-0": {

assets/assets.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/filters.min.txt",
5353
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/filters.min.txt"
5454
],
55+
"patchURLs": [
56+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
57+
"https://ublockorigin.pages.dev/filters/"
58+
],
5559
"supportURL": "https://github.com/uBlockOrigin/uAssets"
5660
},
5761
"ublock-badware": {
@@ -71,6 +75,10 @@
7175
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/badware.min.txt",
7276
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/badware.min.txt"
7377
],
78+
"patchURLs": [
79+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
80+
"https://ublockorigin.pages.dev/filters/"
81+
],
7482
"supportURL": "https://github.com/uBlockOrigin/uAssets",
7583
"instructionURL": "https://github.com/gorhill/uBlock/wiki/Badware-risks"
7684
},
@@ -91,6 +99,10 @@
9199
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/privacy.min.txt",
92100
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/privacy.min.txt"
93101
],
102+
"patchURLs": [
103+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
104+
"https://ublockorigin.pages.dev/filters/"
105+
],
94106
"supportURL": "https://github.com/uBlockOrigin/uAssets"
95107
},
96108
"ublock-unbreak": {
@@ -109,6 +121,10 @@
109121
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/unbreak.min.txt",
110122
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/unbreak.min.txt"
111123
],
124+
"patchURLs": [
125+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
126+
"https://ublockorigin.pages.dev/filters/"
127+
],
112128
"supportURL": "https://github.com/uBlockOrigin/uAssets"
113129
},
114130
"ublock-quick-fixes": {
@@ -127,6 +143,10 @@
127143
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/quick-fixes.min.txt",
128144
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/quick-fixes.min.txt"
129145
],
146+
"patchURLs": [
147+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
148+
"https://ublockorigin.pages.dev/filters/"
149+
],
130150
"supportURL": "https://github.com/uBlockOrigin/uAssets"
131151
},
132152
"adguard-generic": {
@@ -163,6 +183,10 @@
163183
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easylist.txt",
164184
"https://ublockorigin.pages.dev/thirdparties/easylist.txt"
165185
],
186+
"patchURLs": [
187+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
188+
"https://ublockorigin.pages.dev/filters/"
189+
],
166190
"supportURL": "https://easylist.to/"
167191
},
168192
"adguard-spyware-url": {
@@ -212,6 +236,10 @@
212236
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/thirdparties/easyprivacy.txt",
213237
"https://ublockorigin.pages.dev/thirdparties/easyprivacy.txt"
214238
],
239+
"patchURLs": [
240+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
241+
"https://ublockorigin.pages.dev/filters/"
242+
],
215243
"supportURL": "https://easylist.to/"
216244
},
217245
"urlhaus-1": {
@@ -478,6 +506,10 @@
478506
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances.min.txt",
479507
"https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances.min.txt"
480508
],
509+
"patchURLs": [
510+
"https://ublockorigin.github.io/uAssetsCDN/filters/",
511+
"https://ublockorigin.pages.dev/filters/"
512+
],
481513
"supportURL": "https://github.com/uBlockOrigin/uAssets"
482514
},
483515
"dpollock-0": {

src/js/assets.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,9 @@ const getAssetDiffDetails = assetKey => {
12141214
}
12151215
if ( Array.isArray(out.cdnURLs) === false ) { return; }
12161216
if ( out.cdnURLs.length === 0 ) { return; }
1217+
if ( Array.isArray(assetEntry.patchURLs) ) {
1218+
out.patchURLs = assetEntry.patchURLs.slice();
1219+
}
12171220
return out;
12181221
};
12191222

src/js/diff-updater.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ async function applyPatchAndValidate(assetDetails, diffDetails) {
181181
}
182182

183183
async function fetchPatchDetailsFromCDNs(assetDetails) {
184-
const { patchPath, cdnURLs } = assetDetails;
184+
const { patchPath, cdnURLs, patchURLs } = assetDetails;
185185
if ( Array.isArray(cdnURLs) === false ) { return null; }
186186
if ( cdnURLs.length === 0 ) { return null; }
187-
for ( const cdnURL of suffleArray(cdnURLs) ) {
187+
for ( const cdnURL of suffleArray(patchURLs || cdnURLs) ) {
188188
const patchURL = resolveURL(patchPath, cdnURL);
189189
if ( patchURL === undefined ) { continue; }
190190
const response = await fetch(patchURL).catch(reason => {

0 commit comments

Comments
 (0)

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.