Add a setting to clear cache
This commit is contained in:
1 parent
0bbb876a84
commit
55c811adb7
14 files changed
+192
No files matched your search
@@ -265,6 +265,15 @@ export class InvidiousApi {
|
||||
}
|
||||
}
|
||||
|
||||
public static clearCache() {
|
||||
for (let i = localStorage.length - 1; i >= 0; i--) {
|
||||
const key = localStorage.key(i);
|
||||
if (key && key.startsWith("v1:")) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO:P2 use more appropriate cache storage
|
||||
private getCache(url: string, cacheSeconds: number) {
|
||||
const cacheKey = this.getCacheKey(url);
|
||||
|
||||
@@ -132,6 +132,10 @@ export class PlayletApi {
|
||||
return await fetch(`${PlayletApi.host()}/api/search-history`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
static async clearCache() {
|
||||
return await fetch(`${PlayletApi.host()}/api/cache`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
static async getBookmarkFeeds() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/bookmarks/feeds`);
|
||||
return await response.json();
|
||||
|
||||
Reference in new issue
Block a user