mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 01:05:34 +03:00
Investigate SW cache keys
This commit is contained in:
parent
f59058efa1
commit
efb42ca911
2 changed files with 77 additions and 19 deletions
38
src/locales/en.po
generated
38
src/locales/en.po
generated
|
@ -194,7 +194,7 @@ msgstr ""
|
||||||
#: src/pages/catchup.jsx:72
|
#: src/pages/catchup.jsx:72
|
||||||
#: src/pages/catchup.jsx:1447
|
#: src/pages/catchup.jsx:1447
|
||||||
#: src/pages/catchup.jsx:2068
|
#: src/pages/catchup.jsx:2068
|
||||||
#: src/pages/settings.jsx:1045
|
#: src/pages/settings.jsx:1103
|
||||||
msgid "Boosts"
|
msgid "Boosts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1251,7 +1251,7 @@ msgstr ""
|
||||||
#: src/pages/home.jsx:224
|
#: src/pages/home.jsx:224
|
||||||
#: src/pages/mentions.jsx:20
|
#: src/pages/mentions.jsx:20
|
||||||
#: src/pages/mentions.jsx:167
|
#: src/pages/mentions.jsx:167
|
||||||
#: src/pages/settings.jsx:1037
|
#: src/pages/settings.jsx:1095
|
||||||
#: src/pages/trending.jsx:381
|
#: src/pages/trending.jsx:381
|
||||||
msgid "Mentions"
|
msgid "Mentions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1306,7 +1306,7 @@ msgstr ""
|
||||||
#: src/pages/catchup.jsx:2062
|
#: src/pages/catchup.jsx:2062
|
||||||
#: src/pages/favourites.jsx:11
|
#: src/pages/favourites.jsx:11
|
||||||
#: src/pages/favourites.jsx:23
|
#: src/pages/favourites.jsx:23
|
||||||
#: src/pages/settings.jsx:1041
|
#: src/pages/settings.jsx:1099
|
||||||
msgid "Likes"
|
msgid "Likes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2298,7 +2298,7 @@ msgid "<0/> <1/> boosted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/components/timeline.jsx:453
|
#: src/components/timeline.jsx:453
|
||||||
#: src/pages/settings.jsx:1065
|
#: src/pages/settings.jsx:1123
|
||||||
msgid "New posts"
|
msgid "New posts"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -3137,7 +3137,7 @@ msgid "{0, plural, one {Announcement} other {Announcements}}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/notifications.jsx:599
|
#: src/pages/notifications.jsx:599
|
||||||
#: src/pages/settings.jsx:1053
|
#: src/pages/settings.jsx:1111
|
||||||
msgid "Follow requests"
|
msgid "Follow requests"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -3492,56 +3492,56 @@ msgstr ""
|
||||||
msgid "Unable to copy version string"
|
msgid "Unable to copy version string"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:950
|
#: src/pages/settings.jsx:1008
|
||||||
#: src/pages/settings.jsx:955
|
#: src/pages/settings.jsx:1013
|
||||||
msgid "Failed to update subscription. Please try again."
|
msgid "Failed to update subscription. Please try again."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:961
|
#: src/pages/settings.jsx:1019
|
||||||
msgid "Failed to remove subscription. Please try again."
|
msgid "Failed to remove subscription. Please try again."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:968
|
#: src/pages/settings.jsx:1026
|
||||||
msgid "Push Notifications (beta)"
|
msgid "Push Notifications (beta)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:990
|
#: src/pages/settings.jsx:1048
|
||||||
msgid "Push notifications are blocked. Please enable them in your browser settings."
|
msgid "Push notifications are blocked. Please enable them in your browser settings."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:999
|
#: src/pages/settings.jsx:1057
|
||||||
msgid "Allow from <0>{0}</0>"
|
msgid "Allow from <0>{0}</0>"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1008
|
#: src/pages/settings.jsx:1066
|
||||||
msgid "anyone"
|
msgid "anyone"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1012
|
#: src/pages/settings.jsx:1070
|
||||||
msgid "people I follow"
|
msgid "people I follow"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1016
|
#: src/pages/settings.jsx:1074
|
||||||
msgid "followers"
|
msgid "followers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1049
|
#: src/pages/settings.jsx:1107
|
||||||
msgid "Follows"
|
msgid "Follows"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1057
|
#: src/pages/settings.jsx:1115
|
||||||
msgid "Polls"
|
msgid "Polls"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1061
|
#: src/pages/settings.jsx:1119
|
||||||
msgid "Post edits"
|
msgid "Post edits"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1082
|
#: src/pages/settings.jsx:1140
|
||||||
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>."
|
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 ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/settings.jsx:1098
|
#: src/pages/settings.jsx:1156
|
||||||
msgid "NOTE: Push notifications only work for <0>one account</0>."
|
msgid "NOTE: Push notifications only work for <0>one account</0>."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -841,6 +841,42 @@ function Settings({ onClose }) {
|
||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
<p>Service Worker Cache</p>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="plain2 small"
|
||||||
|
onClick={async () => alert(await getCachesKeys())}
|
||||||
|
>
|
||||||
|
Show keys count
|
||||||
|
</button>{' '}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="plain2 small"
|
||||||
|
onClick={() => {
|
||||||
|
const key = prompt('Enter cache key');
|
||||||
|
if (!key) return;
|
||||||
|
try {
|
||||||
|
clearCacheKey(key);
|
||||||
|
} catch (e) {
|
||||||
|
alert(e);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear cache key
|
||||||
|
</button>{' '}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="plain2 small"
|
||||||
|
onClick={() => {
|
||||||
|
try {
|
||||||
|
clearCaches();
|
||||||
|
} catch (e) {
|
||||||
|
alert(e);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clear all caches
|
||||||
|
</button>
|
||||||
</details>
|
</details>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
@ -848,6 +884,28 @@ function Settings({ onClose }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getCachesKeys() {
|
||||||
|
const keys = await caches.keys();
|
||||||
|
const total = {};
|
||||||
|
for (const key of keys) {
|
||||||
|
const cache = await caches.open(key);
|
||||||
|
const k = await cache.keys();
|
||||||
|
total[key] = k.length;
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearCacheKey(key) {
|
||||||
|
return caches.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function clearCaches() {
|
||||||
|
const keys = await caches.keys();
|
||||||
|
for (const key of keys) {
|
||||||
|
await caches.delete(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function PushNotificationsSection({ onClose }) {
|
function PushNotificationsSection({ onClose }) {
|
||||||
if (!isPushSupported()) return null;
|
if (!isPushSupported()) return null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue