mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Delete items if exceeding storage
This commit is contained in:
@@ -370,8 +370,20 @@ function configProxy(): { sync: SBConfig, local: SBStorage } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function forceSyncUpdate(prop: string): void {
|
function forceSyncUpdate(prop: string): void {
|
||||||
|
const value = Config.cachedSyncConfig[prop];
|
||||||
|
if (prop === "unsubmittedSegments") {
|
||||||
|
// Early to be safe
|
||||||
|
if (JSON.stringify(value).length + prop.length > 8000) {
|
||||||
|
for (const key in value) {
|
||||||
|
if (!value[key] || value[key].length <= 0) {
|
||||||
|
delete value[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
[prop]: Config.cachedSyncConfig[prop]
|
[prop]: value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user