mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Delete items if exceeding storage
This commit is contained in:
parent
d7ff6aa6a2
commit
67c63a09fe
1 changed files with 13 additions and 1 deletions
|
@ -370,8 +370,20 @@ function configProxy(): { sync: SBConfig, local: SBStorage } {
|
|||
}
|
||||
|
||||
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({
|
||||
[prop]: Config.cachedSyncConfig[prop]
|
||||
[prop]: value
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue