Skip to content

Commit 9de36df

Browse files
authored
Merge pull request #2185 from floccusaddon/dropbox
Dropbox integration
2 parents 3fc29ef + d180b9b commit 9de36df

20 files changed

Lines changed: 1568 additions & 45 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ body:
3636
- Linkwarden
3737
- WebDAV
3838
- Google Drive
39+
- Dropbox
3940
- Git
4041
validations:
4142
required: true

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ jobs:
100100
- git-html
101101
- google-drive
102102
- google-drive-encrypted
103+
- dropbox
104+
- dropbox-encrypted
103105
- linkwarden
104106
- karakeep
105107
test-name:
@@ -284,6 +286,7 @@ jobs:
284286
FLOCCUS_TEST_SEED: ${{ github.sha }}
285287
GIST_TOKEN: ${{ secrets.GIST_TOKEN }}
286288
GOOGLE_API_REFRESH_TOKEN: ${{ secrets.GOOGLE_API_REFRESH_TOKEN }}
289+
DROPBOX_API_REFRESH_TOKEN: ${{ secrets.DROPBOX_API_REFRESH_TOKEN }}
287290
LINKWARDEN_TOKEN: ${{ secrets.LINKWARDEN_TOKEN }}
288291
APP_VERSION: ${{ matrix.app-version }}
289292
KARAKEEP_TEST_HOST: 172.17.0.1:3000

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Tests](https://github.com/marcelklehr/floccus/workflows/Tests/badge.svg)](https://github.com/marcelklehr/floccus/actions?query=workflow%3ATests) <img src="https://img.shields.io/chrome-web-store/users/fnaicdffflnofjppbagibeoednhnbjhg.svg"> <img src="https://img.shields.io/amo/users/floccus.svg">
77

88
- 🔖 Syncs your real, native browser bookmarks directly
9-
- ☸ Sync via [Nextcloud Bookmarks](https://github.com/nextcloud/bookmarks), [Linkwarden](https://linkwarden.app/), [KaraKeep](https://karakeep.app/), Google Drive, any Git server (like GitHub, Gitlab, Gitea, etc.) or [any WebDAV-compatible service](https://community.cryptomator.org/t/webdav-urls-of-common-cloud-storage-services/75)
9+
- ☸ Sync via [Nextcloud Bookmarks](https://github.com/nextcloud/bookmarks), [Linkwarden](https://linkwarden.app/), [KaraKeep](https://karakeep.app/), Google Drive, Dropbox, any Git server (like GitHub, Gitlab, Gitea, etc.) or [any WebDAV-compatible service](https://community.cryptomator.org/t/webdav-urls-of-common-cloud-storage-services/75)
1010
- ⚛ Use any browser that supports Web extensions (e.g. Firefox, Chrome, Edge, Opera, Brave, Vivaldi, ...; Safari [not yet](https://github.com/floccusaddon/floccus/issues/23))
1111
- 📲 Install the floccus Android/iOS app to access your bookmarks on your phone (Most mobile browsers do not support floccus, sadly)
1212
- 💼 Create as many sync profiles as you need

_locales/en/messages.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@
146146
"Error050": {
147147
"message": "E050: Failsafe: The current sync run would delete {0}% of your local links in this profile. Refusing to execute. Disable this failsafe in the profile settings if you want to proceed anyway. If you didn't cause this, you can use the manual sync buttons to override the server state with the local state on this device. If you believe this is a bug, please reach out to the developers with the debug log of this run."
148148
},
149+
"Error051": {
150+
"message": "E051: Could not authenticate with Dropbox. Please connect floccus with your Dropbox account again."
151+
},
152+
"Error052": {
153+
"message": "E052: OAuth error. Token validation error. Please reconnect your Dropbox Account."
154+
},
155+
"Error053": {
156+
"message": "E053: Could not search for your file name in your Dropbox"
157+
},
158+
"Error054": {
159+
"message": "E054: Could not get template for Dropbox"
160+
},
149161
"LabelWebdavurl": {
150162
"message": "WebDAV URL"
151163
},
@@ -169,6 +181,9 @@
169181
},
170182
"DescriptionBookmarksfilegoogle": {
171183
"message": "the file name of the bookmarks file that will reside in your Google Drive. Do not enter the full file path, only the file name. Make sure this name is unique in your Drive. e.g. mybookmarks.xbel"
184+
},
185+
"DescriptionBookmarksfiledropbox": {
186+
"message": "the file name of the bookmarks file that will reside in your Dropbox. Do not enter the full file path, only the file name. Make sure this name is unique in your Dropbox. e.g. mybookmarks.xbel"
172187
},
173188
"DescriptionBookmarksfilegit": {
174189
"message": "a path to the bookmarks file relative to your Git repository root (all folders in the path must already exist). e.g. personal_stuff/bookmarks.xbel"
@@ -567,6 +582,21 @@
567582
"DescriptionLoggedingoogle": {
568583
"message": "You have connected your Google account to store the bookmark sync file in your Google Drive."
569584
},
585+
"LabelAdapterdropbox": {
586+
"message": "Dropbox"
587+
},
588+
"DescriptionAdapterdropbox": {
589+
"message": "Sync bookmarks via an (optionally encrypted) file that is stored in your Dropbox. It can sync http, ftp, data, file and javascript bookmarks. You can choose to use end-to-end encryption when using this option."
590+
},
591+
"LabelLogindropbox": {
592+
"message": "Login with Dropbox"
593+
},
594+
"DescriptionLogindropbox": {
595+
"message": "Connect your Dropbox account to store the bookmark sync file in your Dropbox."
596+
},
597+
"DescriptionLoggedindropbox": {
598+
"message": "You have connected your Dropbox account to store the bookmark sync file in your Dropbox."
599+
},
570600
"LabelPassphrase": {
571601
"message": "Passphrase"
572602
},
@@ -699,6 +729,9 @@
699729
"LabelGoogledrivesetup": {
700730
"message": "Login to Google Drive"
701731
},
732+
"LabelDropboxsetup": {
733+
"message": "Login to Dropbox"
734+
},
702735
"LabelSyncfoldersetup": {
703736
"message": "Which Folders do you want to sync?"
704737
},

dropbox-api.credentials.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"web": {
3+
"client_id": "apzybhhq0x0o0gk",
4+
"project_id": "apzybhhq0x0o0gk",
5+
"auth_uri": "https://www.dropbox.com/oauth2/authorize",
6+
"token_uri": "https://www.dropbox.com/oauth2/token",
7+
"client_secret": "5p9q884v8vd69sw",
8+
"redirect_uris": [
9+
"https://mbepccofdnoepgicagpchfmafecckdam.chromiumapp.org/",
10+
"https://76a380c4950986998208e7bb9dbd8fea94c91504.extensions.allizom.org/",
11+
"https://fnaicdffflnofjppbagibeoednhnbjhg.chromiumapp.org/",
12+
"https://gjkddcofhiifldbllobcamllmanombji.chromiumapp.org/",
13+
"https://djejpebekaoommcjfeaiipdikmdjkblg.chromiumapp.org/"
14+
]
15+
},
16+
"android": {
17+
"client_id": "apzybhhq0x0o0gk",
18+
"project_id": "apzybhhq0x0o0gk",
19+
"auth_uri": "https://www.dropbox.com/oauth2/authorize",
20+
"token_uri": "https://www.dropbox.com/oauth2/token",
21+
"redirect_uri": "org.handmadeideas.floccus://auth"
22+
},
23+
"ios": {
24+
"client_id": "apzybhhq0x0o0gk",
25+
"redirect_uri": "org.handmadeideas.floccus://auth"
26+
}
27+
}

fastlane/metadata/android/en-US/full_description.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Manage and synchronize your bookmarks via Nextcloud, or any WebDAV service, or any Git service, or Google Drive, end-to-end encrypted, if you want.
1+
Manage and synchronize your bookmarks via Nextcloud, or any WebDAV service, or any Git service, or Google Drive, or Dropbox, end-to-end encrypted, if you want.
22

33
This is the standalone bookmarks manager android app variant of floccus. You can also install floccus on your Desktop browsers to sync bookmarks with them. This App, due to technical reasons, cannot access bookmarks in your mobile browser apps directly, which is why you can only view them in the app or import and export them as a html file.
44

gulpfile.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,13 @@ var path = require('path')
1313
try {
1414
fs.accessSync('./google-api.credentials.json')
1515
} catch (e) {
16-
fs.writeFileSync('./google-api.credentials.json', JSON.stringify({
17-
'web': {
18-
'client_id': 'yourappidhere.apps.googleusercontent.com',
19-
'project_id': 'YOUR PROJECT ID HERE',
20-
'auth_uri': 'https://accounts.google.com/o/oauth2/auth',
21-
'token_uri': 'https://oauth2.googleapis.com/token',
22-
'auth_provider_x509_cert_url': 'https://www.googleapis.com/oauth2/v1/certs',
23-
'client_secret': 'YOUR CLIENT SECRET HERE',
24-
'redirect_uris': [
25-
'https://yourappidhere.chromiumapp.org/',
26-
'https://yourappidhere.extensions.allizom.org/'
27-
]
28-
}
29-
}))
16+
console.log(`error loading google api credentials: ${e.message}`)
17+
}
18+
19+
try {
20+
fs.accessSync('./dropbox-api.credentials.json')
21+
} catch (e) {
22+
console.log(`error loading dropbox api credentials: ${e.message}`)
3023
}
3124

3225
// eslint-disable-next-line @typescript-eslint/no-var-requires

manifest.firefox.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@
2525

2626
"options_ui": {
2727
"page": "dist/html/options.html",
28-
"browser_style": false,
29-
"chrome_style": false
28+
"browser_style": false
3029
},
3130

3231
"browser_action": {
3332
"browser_style": false,
34-
"chrome_style": false,
3533
"default_icon": {
3634
"48": "icons/logo.png"
3735
},

src/errors/Error.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,11 @@ export class GoogleDriveAuthenticationError extends FloccusError {
287287
}
288288
}
289289

290-
export class OAuthTokenError extends FloccusError {
290+
export class GoogleOAuthTokenError extends FloccusError {
291291
public readonly code = 32
292292
constructor() {
293293
super('E032: OAuth error. Token validation error. Please reconnect your Google Account.')
294-
Object.setPrototypeOf(this, OAuthTokenError.prototype)
294+
Object.setPrototypeOf(this, GoogleOAuthTokenError.prototype)
295295
}
296296
}
297297

@@ -466,4 +466,36 @@ export class ClientsideDeletionFailsafeError extends FloccusError {
466466
this.percent = percent
467467
Object.setPrototypeOf(this, ClientsideDeletionFailsafeError.prototype)
468468
}
469+
}
470+
471+
export class DropboxAuthenticationError extends FloccusError {
472+
public readonly code = 51
473+
constructor() {
474+
super('E051: Could not authenticate with Dropbox. Please connect floccus with your Dropbox account again.')
475+
Object.setPrototypeOf(this, DropboxAuthenticationError.prototype)
476+
}
477+
}
478+
479+
export class DropboxOAuthTokenError extends FloccusError {
480+
public readonly code = 52
481+
constructor() {
482+
super('E052: OAuth error. Token validation error. Please reconnect your Dropbox Account.')
483+
Object.setPrototypeOf(this, DropboxOAuthTokenError.prototype)
484+
}
485+
}
486+
487+
export class DropboxSearchError extends FloccusError {
488+
public readonly code = 53
489+
constructor() {
490+
super('E053: Could not search for your file name in your Dropbox')
491+
Object.setPrototypeOf(this, DropboxSearchError.prototype)
492+
}
493+
}
494+
495+
export class DropboxTemplateError extends FloccusError {
496+
public readonly code = 54
497+
constructor() {
498+
super('E054: Could not get template for Dropbox')
499+
Object.setPrototypeOf(this, DropboxTemplateError.prototype)
500+
}
469501
}

src/lib/Account.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ AdapterFactory.register('nextcloud-bookmarks', async() => (await import('./adapt
3131
AdapterFactory.register('webdav', async() => (await import('./adapters/WebDav')).default)
3232
AdapterFactory.register('git', async() => (await import('./adapters/Git')).default)
3333
AdapterFactory.register('google-drive', async() => (await import('./adapters/GoogleDrive')).default)
34+
AdapterFactory.register('dropbox', async() => (await import('./adapters/Dropbox')).default)
3435
AdapterFactory.register('fake', async() => (await import('./adapters/Fake')).default)
3536

3637
// 2h

0 commit comments

Comments
 (0)