Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelklehr committed May 21, 2024
2 parents f84f263 + 441560f commit 1446134
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 74 deletions.
23 changes: 16 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# Changelog

## [5.1.4] - 2024-05-21

### Fixed

* [native] fix(Drawer): Add icon for git profiles
* fix: Improve locking logic
* fix(BrowserController): Don't spam setIcon warnings
* fix(Account): call onSyncFail if onSyncStart fails

## [5.1.3] - 2024-05-18

### Fixed

[native] fix: set largeHeap to true on android + fix git settings
fix: Improve locking logic
fix(NextcloudBookmarks#getExistingBookmarks): Don't use search-by-url for javascript links
fix: Make Diff#inspect() output more readable
fix: Limit concurrency for reorderings
fix: Improve bulkImport performance by chunking
fix: Unhandled error "Receiving end does not exist"
* [native] fix: set largeHeap to true on android + fix git settings
* fix: Improve locking logic
* fix(NextcloudBookmarks#getExistingBookmarks): Don't use search-by-url for javascript links
* fix: Make Diff#inspect() output more readable
* fix: Limit concurrency for reorderings
* fix: Improve bulkImport performance by chunking
* fix: Unhandled error "Receiving end does not exist"

## [5.1.2] - 2024-05-14

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "org.handmadeideas.floccus"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 5001003
versionName "5.1.3"
versionCode 5001004
versionName "5.1.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"launchAutoHide": false,
"androidScaleType": "CENTER_INSIDE",
"backgroundColor": "#ffffff"
},
"CapacitorHttp": {
"enabled": true
}
},
"cordova": {}
Expand Down
3 changes: 3 additions & 0 deletions capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"launchAutoHide": false,
"androidScaleType": "CENTER_INSIDE",
"backgroundColor": "#ffffff"
},
"CapacitorHttp": {
"enabled": true
}
},
"cordova": {}
Expand Down
3 changes: 3 additions & 0 deletions ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"launchAutoHide": false,
"androidScaleType": "CENTER_INSIDE",
"backgroundColor": "#ffffff"
},
"CapacitorHttp": {
"enabled": true
}
},
"cordova": {}
Expand Down
2 changes: 1 addition & 1 deletion manifest.chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "floccus bookmarks sync",
"short_name": "floccus",
"version": "5.1.3.1",
"version": "5.1.4.2",
"description": "__MSG_DescriptionExtension__",
"icons": {
"48": "icons/logo.png",
Expand Down
2 changes: 1 addition & 1 deletion manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "floccus bookmarks sync",
"short_name": "floccus",
"version": "5.1.3.1",
"version": "5.1.4.2",
"description": "__MSG_DescriptionExtension__",
"icons": {
"48": "icons/logo.png",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "floccus bookmarks sync",
"short_name": "floccus",
"version": "5.1.3.1",
"version": "5.1.4.2",
"description": "__MSG_DescriptionExtension__",
"icons": {
"48": "icons/logo.png",
Expand Down
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "floccus",
"version": "5.1.3",
"version": "5.1.4",
"description": "Sync your bookmarks privately across browsers and devices",
"scripts": {
"build": "gulp",
Expand Down
9 changes: 8 additions & 1 deletion src/lib/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,21 @@ export default class Account {
try {
status = await this.server.onSyncStart(needLock)
} catch (e) {
await this.server.onSyncFail()
// Resource locked
if (e.code === 37) {
Sentry.setContext('accountData', {
...this.getData(),
username: 'SENSITIVEVALUEHIDDEN',
password: 'SENSITIVEVALUVALUEHIDDEN',
passphrase: 'SENSITIVEVALUVALUEHIDDEN'
})
Sentry.captureException(e)
// We got a resource locked error
if (this.getData().lastSync < Date.now() - LOCK_TIMEOUT) {
// but if we've been waiting for the lock for more than 2h
// start again without locking the resource
status = await this.server.onSyncStart(false)
status = await this.server.onSyncStart(false, true)
} else {
await this.setData({
...this.getData(),
Expand Down
8 changes: 6 additions & 2 deletions src/lib/adapters/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class GitAdapter extends CachingAdapter {
this.cancelCallback && this.cancelCallback()
}

async onSyncStart(needLock = true) {
async onSyncStart(needLock = true, forceLock = false) {
Logger.log('onSyncStart: begin')

const hash = await Crypto.sha256(JSON.stringify(this.server)) + Date.now()
Expand Down Expand Up @@ -152,8 +152,12 @@ export default class GitAdapter extends CachingAdapter {
if (this.lockingInterval) {
clearInterval(this.lockingInterval)
}
if (needLock) {
if (forceLock) {
await this.setLock()
} else if (needLock) {
await this.obtainLock()
}
if (needLock || forceLock) {
this.lockingInterval = setInterval(() => this.setLock(), LOCK_INTERVAL) // Set lock every minute
}

Expand Down
14 changes: 5 additions & 9 deletions src/lib/adapters/GoogleDrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class GoogleDriveAdapter extends CachingAdapter {
})
}

async onSyncStart(needLock = true) {
async onSyncStart(needLock = true, forceLock = false) {
Logger.log('onSyncStart: begin')

if (Capacitor.getPlatform() === 'web') {
Expand All @@ -214,7 +214,9 @@ export default class GoogleDriveAdapter extends CachingAdapter {
const file = fileList.files.filter(file => !file.trashed)[0]
if (file) {
this.fileId = file.id
if (needLock) {
if (forceLock) {
await this.setLock(this.fileId)
} else if (needLock) {
const data = await this.getFileMetadata(file.id, 'appProperties')
if (data.appProperties && data.appProperties.locked && (data.appProperties.locked === true || JSON.parse(data.appProperties.locked))) {
const lockedDate = JSON.parse(data.appProperties.locked)
Expand All @@ -225,12 +227,6 @@ export default class GoogleDriveAdapter extends CachingAdapter {
throw new ResourceLockedError()
}
}
}
}

if (file) {
this.fileId = file.id
if (needLock) {
await this.setLock(this.fileId)
}

Expand Down Expand Up @@ -266,7 +262,7 @@ export default class GoogleDriveAdapter extends CachingAdapter {
if (this.lockingInterval) {
clearInterval(this.lockingInterval)
}
if (needLock) {
if (needLock || forceLock) {
this.lockingInterval = setInterval(() => this.setLock(this.fileId), LOCK_INTERVAL) // Set lock every minute
}
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/adapters/NextcloudBookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes
return output + (output[output.length - 1] !== '/' ? '/' : '')
}

async onSyncStart(needLock = true): Promise<void> {
async onSyncStart(needLock = true, forceLock = false): Promise<void> {
if (Capacitor.getPlatform() === 'web') {
const browser = (await import('../browser-api')).default
let hasPermissions
Expand All @@ -143,7 +143,8 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes
}

// if needLock -- we always need it
if (!(await this.acquireLock())) {
const couldAcquireLock = await this.acquireLock()
if (!forceLock && !couldAcquireLock) {
throw new ResourceLockedError()
}
this.lockingInterval = setInterval(() => !this.ended && this.acquireLock(), LOCK_INTERVAL)
Expand Down
Loading

0 comments on commit 1446134

Please sign in to comment.