Commit e4ec830
committed
feat(avatar-cache): cache author avatar bytes to bypass Brave Shields
Brave's Shields bypasses HTTP caching for cross-origin requests from
extension pages, so <img> tags pointing at avatars.githubusercontent.com
re-download on every popup open. Cache the decoded bytes as base64 data
URLs in chrome.storage.local so popups render with no network and no
flicker.
Design:
- Single writer (background), popup is read-only via loadSnapshot()
- Freshness: URL match + 7d TTL + If-Modified-Since revalidation
- LRU eviction bounded by both entry count (100) and total bytes (5 MB)
- Generation counter gates cross-account logout/re-login races
- Concurrency capped at 5 in-flight fetches
Bumps minimum_chrome_version to 114 so the 5 MB avatar cap fits within
storage.local's 10 MB quota (Chrome <114 was 5 MB total).1 parent 615b810 commit e4ec830
19 files changed
Lines changed: 813 additions & 13 deletions
File tree
- src
- background
- lib
- popup
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
212 | 226 | | |
213 | 227 | | |
214 | 228 | | |
| |||
461 | 475 | | |
462 | 476 | | |
463 | 477 | | |
| 478 | + | |
464 | 479 | | |
465 | 480 | | |
466 | 481 | | |
| |||
502 | 517 | | |
503 | 518 | | |
504 | 519 | | |
| 520 | + | |
505 | 521 | | |
506 | 522 | | |
507 | 523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
134 | 156 | | |
135 | 157 | | |
136 | 158 | | |
| 159 | + | |
137 | 160 | | |
138 | 161 | | |
139 | 162 | | |
| |||
413 | 436 | | |
414 | 437 | | |
415 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
416 | 449 | | |
417 | 450 | | |
418 | 451 | | |
| |||
426 | 459 | | |
427 | 460 | | |
428 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
429 | 467 | | |
430 | 468 | | |
431 | 469 | | |
| |||
0 commit comments