File tree Expand file tree Collapse file tree 8 files changed +36
-9
lines changed
Expand file tree Collapse file tree 8 files changed +36
-9
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ 5.5.2] - 2025-04-16
4+
5+ ### Fixed
6+
7+ * fix(IndexedDB): Delete up to the last hour of logs
8+ * fix(storage): Add checkStorage method to freeStorage regularly
9+ * fix(IndexedDB): Don't store more than 50MB of logs
10+
311## [ 5.5.1] - 2025-04-09
412
513### Fixed
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ android {
77 applicationId " org.handmadeideas.floccus"
88 minSdkVersion rootProject. ext. minSdkVersion
99 targetSdkVersion rootProject. ext. targetSdkVersion
10- versionCode 5005001
11- versionName " 5.5.1 "
10+ versionCode 5005002
11+ versionName " 5.5.2 "
1212 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
1313 aaptOptions {
1414 // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Original file line number Diff line number Diff line change 22 "manifest_version" : 3 ,
33 "name" : " floccus bookmarks sync" ,
44 "short_name" : " floccus" ,
5- "version" : " 5.5.1 " ,
5+ "version" : " 5.5.2 " ,
66 "description" : " __MSG_DescriptionExtension__" ,
77 "icons" : {
88 "48" : " icons/logo.png" ,
Original file line number Diff line number Diff line change 22 "manifest_version" : 2 ,
33 "name" : " floccus bookmarks sync" ,
44 "short_name" : " floccus" ,
5- "version" : " 5.5.1 " ,
5+ "version" : " 5.5.2 " ,
66 "description" : " __MSG_DescriptionExtension__" ,
77 "icons" : {
88 "48" : " icons/logo.png" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " floccus" ,
3- "version" : " 5.5.1 " ,
3+ "version" : " 5.5.2 " ,
44 "description" : " Sync your bookmarks privately across browsers and devices" ,
55 "scripts" : {
66 "build" : " NODE_OPTIONS=--max-old-space-size=5000 gulp" ,
Original file line number Diff line number Diff line change @@ -20,10 +20,12 @@ db.version(1).stores({
2020export { db }
2121export { LogMessage }
2222
23+ const MAX_STORAGE_SIZE = 50 * 1024 * 1024 // 50MB
24+
2325export async function freeStorageIfNecessary ( ) {
2426 if ( navigator . storage && navigator . storage . estimate ) {
2527 let { usage, quota} = await navigator . storage . estimate ( )
26- if ( usage / quota > 0.9 ) {
28+ if ( usage / quota > 0.9 || usage > MAX_STORAGE_SIZE ) {
2729 const oneWeekAgo = Date . now ( ) - 60 * 60 * 1000 * 24 * 7
2830
2931 await db . logs
@@ -32,12 +34,21 @@ export async function freeStorageIfNecessary() {
3234 }
3335
3436 ( { usage, quota} = await navigator . storage . estimate ( ) )
35- if ( usage / quota > 0.6 ) {
37+ if ( usage / quota > 0.6 || usage > MAX_STORAGE_SIZE ) {
3638 const oneDayAgo = Date . now ( ) - 60 * 60 * 1000 * 24
3739
3840 await db . logs
3941 . where ( 'dateTime' ) . below ( oneDayAgo )
4042 . delete ( )
4143 }
44+
45+ ( { usage, quota} = await navigator . storage . estimate ( ) )
46+ if ( usage / quota > 0.6 || usage > MAX_STORAGE_SIZE ) {
47+ const lastHour = Date . now ( ) - 60 * 60 * 1000
48+
49+ await db . logs
50+ . where ( 'dateTime' ) . below ( lastHour )
51+ . delete ( )
52+ }
4253 }
4354}
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ class AlarmManager {
2222 this . ctl = ctl
2323 }
2424
25+ async checkStorage ( ) {
26+ await freeStorageIfNecessary ( )
27+ }
28+
2529 async checkSync ( ) {
2630 const accounts = await BrowserAccountStorage . getAllAccounts ( )
2731 for ( let accountId of accounts ) {
@@ -105,6 +109,7 @@ export default class BrowserController {
105109
106110 // Set up the alarms
107111
112+ browser . alarms . create ( 'checkStorage' , { periodInMinutes : 15 } )
108113 browser . alarms . create ( 'checkSync' , { periodInMinutes : 1 } )
109114 browser . alarms . onAlarm . addListener ( async alarm => {
110115 await this . alarms [ alarm . name ] ( )
@@ -129,7 +134,6 @@ export default class BrowserController {
129134 } ,
130135 [ ]
131136 )
132- freeStorageIfNecessary ( )
133137
134138 // do some cleaning if this is a new version
135139
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class AlarmManager {
1515 this . ctl = ctl
1616 this . backgroundSyncEnabled = true
1717 setInterval ( ( ) => this . checkSync ( ) , 25 * 1000 )
18+ setInterval ( ( ) => this . checkStorage ( ) , 30 * 1000 )
1819
1920 Network . addListener ( 'networkStatusChange' , status => {
2021 if ( status . connected ) {
@@ -25,6 +26,10 @@ class AlarmManager {
2526 } )
2627 }
2728
29+ async checkStorage ( ) {
30+ await freeStorageIfNecessary ( )
31+ }
32+
2833 async checkSync ( ) {
2934 if ( ! this . backgroundSyncEnabled ) {
3035 return
@@ -93,7 +98,6 @@ export default class NativeController {
9398 } ,
9499 [ ]
95100 )
96- freeStorageIfNecessary ( )
97101
98102 // lock accounts when locking is enabled
99103
You can’t perform that action at this time.
0 commit comments