Try debug cache sizing on Safari

This commit is contained in:
Lim Chee Aun 2024-11-08 12:58:28 +08:00
parent a1a4b01ace
commit efc3fe5de4
2 changed files with 29 additions and 24 deletions

36
src/locales/en.po generated
View file

@ -193,7 +193,7 @@ msgstr ""
#: src/pages/catchup.jsx:72
#: src/pages/catchup.jsx:1447
#: src/pages/catchup.jsx:2068
#: src/pages/settings.jsx:1140
#: src/pages/settings.jsx:1145
msgid "Boosts"
msgstr ""
@ -1270,7 +1270,7 @@ msgstr ""
#: src/pages/home.jsx:224
#: src/pages/mentions.jsx:20
#: src/pages/mentions.jsx:167
#: src/pages/settings.jsx:1132
#: src/pages/settings.jsx:1137
#: src/pages/trending.jsx:381
msgid "Mentions"
msgstr ""
@ -1325,7 +1325,7 @@ msgstr ""
#: src/pages/catchup.jsx:2062
#: src/pages/favourites.jsx:11
#: src/pages/favourites.jsx:23
#: src/pages/settings.jsx:1136
#: src/pages/settings.jsx:1141
msgid "Likes"
msgstr ""
@ -2317,7 +2317,7 @@ msgid "<0/> <1/> boosted"
msgstr ""
#: src/components/timeline.jsx:453
#: src/pages/settings.jsx:1160
#: src/pages/settings.jsx:1165
msgid "New posts"
msgstr ""
@ -3169,7 +3169,7 @@ msgid "{0, plural, one {Announcement} other {Announcements}}"
msgstr ""
#: src/pages/notifications.jsx:614
#: src/pages/settings.jsx:1148
#: src/pages/settings.jsx:1153
msgid "Follow requests"
msgstr ""
@ -3524,56 +3524,56 @@ msgstr ""
msgid "Unable to copy version string"
msgstr ""
#: src/pages/settings.jsx:1045
#: src/pages/settings.jsx:1050
#: src/pages/settings.jsx:1055
msgid "Failed to update subscription. Please try again."
msgstr ""
#: src/pages/settings.jsx:1056
#: src/pages/settings.jsx:1061
msgid "Failed to remove subscription. Please try again."
msgstr ""
#: src/pages/settings.jsx:1063
#: src/pages/settings.jsx:1068
msgid "Push Notifications (beta)"
msgstr ""
#: src/pages/settings.jsx:1085
#: src/pages/settings.jsx:1090
msgid "Push notifications are blocked. Please enable them in your browser settings."
msgstr ""
#: src/pages/settings.jsx:1094
#: src/pages/settings.jsx:1099
msgid "Allow from <0>{0}</0>"
msgstr ""
#: src/pages/settings.jsx:1103
#: src/pages/settings.jsx:1108
msgid "anyone"
msgstr ""
#: src/pages/settings.jsx:1107
#: src/pages/settings.jsx:1112
msgid "people I follow"
msgstr ""
#: src/pages/settings.jsx:1111
#: src/pages/settings.jsx:1116
msgid "followers"
msgstr ""
#: src/pages/settings.jsx:1144
#: src/pages/settings.jsx:1149
msgid "Follows"
msgstr ""
#: src/pages/settings.jsx:1152
#: src/pages/settings.jsx:1157
msgid "Polls"
msgstr ""
#: src/pages/settings.jsx:1156
#: src/pages/settings.jsx:1161
msgid "Post edits"
msgstr ""
#: src/pages/settings.jsx:1177
#: src/pages/settings.jsx:1182
msgid "Push permission was not granted since your last login. You'll need to <0><1>log in</1> again to grant push permission</0>."
msgstr ""
#: src/pages/settings.jsx:1193
#: src/pages/settings.jsx:1198
msgid "NOTE: Push notifications only work for <0>one account</0>."
msgstr ""

View file

@ -913,22 +913,27 @@ async function getCachesKeys() {
async function getCachesSize() {
const keys = await caches.keys();
let total = {};
let totalSize = 0;
let TOTAL = 0;
for (const key of keys) {
const cache = await caches.open(key);
const k = await cache.keys();
for (const item of k) {
try {
const response = await cache.match(item);
const blob = await response.blob();
total[key] = (total[key] || 0) + blob.size;
totalSize += blob.size;
TOTAL += blob.size;
} catch (e) {
alert('Failed to get cache size for ' + item);
alert(e);
}
}
}
return {
...Object.fromEntries(
Object.entries(total).map(([k, v]) => [k, prettyBytes(v)]),
),
totalSize: prettyBytes(totalSize),
TOTAL: prettyBytes(TOTAL),
};
}