darkreader 4.9.117 → 4.9.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/darkreader.js +62 -14
- package/darkreader.mjs +62 -14
- package/package.json +1 -1
package/darkreader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.118
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -189,7 +189,10 @@
|
|
|
189
189
|
}
|
|
190
190
|
if (
|
|
191
191
|
mimeType &&
|
|
192
|
-
!
|
|
192
|
+
!(
|
|
193
|
+
response.headers.get("Content-Type") === mimeType ||
|
|
194
|
+
response.headers.get("Content-Type").startsWith(`${mimeType};`)
|
|
195
|
+
)
|
|
193
196
|
) {
|
|
194
197
|
throw new Error(`Mime type mismatch when loading ${url}`);
|
|
195
198
|
}
|
|
@@ -2691,22 +2694,64 @@
|
|
|
2691
2694
|
}
|
|
2692
2695
|
});
|
|
2693
2696
|
const ipV4RegExp = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
|
|
2694
|
-
const
|
|
2695
|
-
const
|
|
2697
|
+
const MAX_CORS_HOSTS = 16;
|
|
2698
|
+
const corsHosts = new Set();
|
|
2699
|
+
const checkedHosts = new Set();
|
|
2700
|
+
const localAliases = [
|
|
2701
|
+
"127-0-0-1.org.uk",
|
|
2702
|
+
"42foo.com",
|
|
2703
|
+
"domaincontrol.com",
|
|
2704
|
+
"fbi.com",
|
|
2705
|
+
"fuf.me",
|
|
2706
|
+
"lacolhost.com",
|
|
2707
|
+
"local.sisteminha.com",
|
|
2708
|
+
"localfabriek.nl",
|
|
2709
|
+
"localhost",
|
|
2710
|
+
"localhst.co.uk",
|
|
2711
|
+
"localmachine.info",
|
|
2712
|
+
"localmachine.name",
|
|
2713
|
+
"localtest.me",
|
|
2714
|
+
"lvh.me",
|
|
2715
|
+
"mouse-potato.com",
|
|
2716
|
+
"nip.io",
|
|
2717
|
+
"sslip.io",
|
|
2718
|
+
"vcap.me",
|
|
2719
|
+
"xip.io",
|
|
2720
|
+
"yoogle.com"
|
|
2721
|
+
];
|
|
2722
|
+
const localSubDomains = [
|
|
2723
|
+
".corp",
|
|
2724
|
+
".direct",
|
|
2725
|
+
".home",
|
|
2726
|
+
".internal",
|
|
2727
|
+
".intranet",
|
|
2728
|
+
".lan",
|
|
2729
|
+
".local",
|
|
2730
|
+
".localdomain",
|
|
2731
|
+
".test",
|
|
2732
|
+
".zz",
|
|
2733
|
+
...localAliases.map((alias) => `.${alias}`)
|
|
2734
|
+
];
|
|
2696
2735
|
function shouldIgnoreCors(url) {
|
|
2697
|
-
const host = url
|
|
2698
|
-
if (!
|
|
2699
|
-
|
|
2736
|
+
const {host, hostname, port, protocol} = url;
|
|
2737
|
+
if (!corsHosts.has(host)) {
|
|
2738
|
+
corsHosts.add(host);
|
|
2739
|
+
}
|
|
2740
|
+
if (checkedHosts.has(host)) {
|
|
2741
|
+
return false;
|
|
2700
2742
|
}
|
|
2701
2743
|
if (
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2744
|
+
corsHosts.size >= MAX_CORS_HOSTS ||
|
|
2745
|
+
protocol !== "https:" ||
|
|
2746
|
+
port !== "" ||
|
|
2747
|
+
localAliases.includes(hostname) ||
|
|
2748
|
+
localSubDomains.some((sub) => hostname.endsWith(sub)) ||
|
|
2749
|
+
hostname.startsWith("[") ||
|
|
2750
|
+
hostname.match(ipV4RegExp)
|
|
2707
2751
|
) {
|
|
2708
2752
|
return true;
|
|
2709
2753
|
}
|
|
2754
|
+
checkedHosts.add(host);
|
|
2710
2755
|
return false;
|
|
2711
2756
|
}
|
|
2712
2757
|
|
|
@@ -4530,13 +4575,16 @@
|
|
|
4530
4575
|
function isTextColorProperty(property) {
|
|
4531
4576
|
return textColorProps.includes(property);
|
|
4532
4577
|
}
|
|
4533
|
-
const rawRGBSpaceRegex =
|
|
4578
|
+
const rawRGBSpaceRegex =
|
|
4579
|
+
/^(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s*(\/\s*\d+\.?\d*)?$/;
|
|
4534
4580
|
const rawRGBCommaRegex = /^(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})$/;
|
|
4535
4581
|
function parseRawColorValue(input) {
|
|
4536
4582
|
const match =
|
|
4537
4583
|
input.match(rawRGBSpaceRegex) ?? input.match(rawRGBCommaRegex);
|
|
4538
4584
|
if (match) {
|
|
4539
|
-
const color =
|
|
4585
|
+
const color = match[4]
|
|
4586
|
+
? `rgb(${match[1]} ${match[2]} ${match[3]} / ${match[4]})`
|
|
4587
|
+
: `rgb(${match[1]}, ${match[2]}, ${match[3]})`;
|
|
4540
4588
|
return {isRaw: true, color};
|
|
4541
4589
|
}
|
|
4542
4590
|
return {isRaw: false, color: input};
|
package/darkreader.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.118
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -172,7 +172,10 @@ async function getOKResponse(url, mimeType, origin) {
|
|
|
172
172
|
}
|
|
173
173
|
if (
|
|
174
174
|
mimeType &&
|
|
175
|
-
!
|
|
175
|
+
!(
|
|
176
|
+
response.headers.get("Content-Type") === mimeType ||
|
|
177
|
+
response.headers.get("Content-Type").startsWith(`${mimeType};`)
|
|
178
|
+
)
|
|
176
179
|
) {
|
|
177
180
|
throw new Error(`Mime type mismatch when loading ${url}`);
|
|
178
181
|
}
|
|
@@ -2603,22 +2606,64 @@ chrome.runtime.onMessage.addListener(({type, data, error, id}) => {
|
|
|
2603
2606
|
}
|
|
2604
2607
|
});
|
|
2605
2608
|
const ipV4RegExp = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
|
|
2606
|
-
const
|
|
2607
|
-
const
|
|
2609
|
+
const MAX_CORS_HOSTS = 16;
|
|
2610
|
+
const corsHosts = new Set();
|
|
2611
|
+
const checkedHosts = new Set();
|
|
2612
|
+
const localAliases = [
|
|
2613
|
+
"127-0-0-1.org.uk",
|
|
2614
|
+
"42foo.com",
|
|
2615
|
+
"domaincontrol.com",
|
|
2616
|
+
"fbi.com",
|
|
2617
|
+
"fuf.me",
|
|
2618
|
+
"lacolhost.com",
|
|
2619
|
+
"local.sisteminha.com",
|
|
2620
|
+
"localfabriek.nl",
|
|
2621
|
+
"localhost",
|
|
2622
|
+
"localhst.co.uk",
|
|
2623
|
+
"localmachine.info",
|
|
2624
|
+
"localmachine.name",
|
|
2625
|
+
"localtest.me",
|
|
2626
|
+
"lvh.me",
|
|
2627
|
+
"mouse-potato.com",
|
|
2628
|
+
"nip.io",
|
|
2629
|
+
"sslip.io",
|
|
2630
|
+
"vcap.me",
|
|
2631
|
+
"xip.io",
|
|
2632
|
+
"yoogle.com"
|
|
2633
|
+
];
|
|
2634
|
+
const localSubDomains = [
|
|
2635
|
+
".corp",
|
|
2636
|
+
".direct",
|
|
2637
|
+
".home",
|
|
2638
|
+
".internal",
|
|
2639
|
+
".intranet",
|
|
2640
|
+
".lan",
|
|
2641
|
+
".local",
|
|
2642
|
+
".localdomain",
|
|
2643
|
+
".test",
|
|
2644
|
+
".zz",
|
|
2645
|
+
...localAliases.map((alias) => `.${alias}`)
|
|
2646
|
+
];
|
|
2608
2647
|
function shouldIgnoreCors(url) {
|
|
2609
|
-
const host = url
|
|
2610
|
-
if (!
|
|
2611
|
-
|
|
2648
|
+
const {host, hostname, port, protocol} = url;
|
|
2649
|
+
if (!corsHosts.has(host)) {
|
|
2650
|
+
corsHosts.add(host);
|
|
2651
|
+
}
|
|
2652
|
+
if (checkedHosts.has(host)) {
|
|
2653
|
+
return false;
|
|
2612
2654
|
}
|
|
2613
2655
|
if (
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2656
|
+
corsHosts.size >= MAX_CORS_HOSTS ||
|
|
2657
|
+
protocol !== "https:" ||
|
|
2658
|
+
port !== "" ||
|
|
2659
|
+
localAliases.includes(hostname) ||
|
|
2660
|
+
localSubDomains.some((sub) => hostname.endsWith(sub)) ||
|
|
2661
|
+
hostname.startsWith("[") ||
|
|
2662
|
+
hostname.match(ipV4RegExp)
|
|
2619
2663
|
) {
|
|
2620
2664
|
return true;
|
|
2621
2665
|
}
|
|
2666
|
+
checkedHosts.add(host);
|
|
2622
2667
|
return false;
|
|
2623
2668
|
}
|
|
2624
2669
|
|
|
@@ -4381,13 +4426,16 @@ const textColorProps = [
|
|
|
4381
4426
|
function isTextColorProperty(property) {
|
|
4382
4427
|
return textColorProps.includes(property);
|
|
4383
4428
|
}
|
|
4384
|
-
const rawRGBSpaceRegex =
|
|
4429
|
+
const rawRGBSpaceRegex =
|
|
4430
|
+
/^(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})\s*(\/\s*\d+\.?\d*)?$/;
|
|
4385
4431
|
const rawRGBCommaRegex = /^(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})$/;
|
|
4386
4432
|
function parseRawColorValue(input) {
|
|
4387
4433
|
const match =
|
|
4388
4434
|
input.match(rawRGBSpaceRegex) ?? input.match(rawRGBCommaRegex);
|
|
4389
4435
|
if (match) {
|
|
4390
|
-
const color =
|
|
4436
|
+
const color = match[4]
|
|
4437
|
+
? `rgb(${match[1]} ${match[2]} ${match[3]} / ${match[4]})`
|
|
4438
|
+
: `rgb(${match[1]}, ${match[2]}, ${match[3]})`;
|
|
4391
4439
|
return {isRaw: true, color};
|
|
4392
4440
|
}
|
|
4393
4441
|
return {isRaw: false, color: input};
|