feat: add Google Drive backend module - #243
Merged
Merged
Conversation
Owner
|
Wow this is amazing. It could take me a while to review. |
Adds a gdrive module implementing the RootFs contract against the Google Drive API v3 with the drive.file scope. Authentication uses Google's OAuth device flow against the user's own OAuth client, with tokens in Obsidian secret storage and a bearer-token request middleware that refreshes and retries once on 401. Listing fetches all visible files in one paginated query and assembles the tree client-side; uploads use multipart for small files and sequential resumable sessions for large ones; deletes go to the Drive trash by default. Includes an in-memory Drive API mock and contract tests, a module spec page, and registry plus docs sidebar entries.
Owner
|
The auth can work but is nearly wrong, Fable conflated a lot of stuff. And the code is unnecessarily verbose. |
hesprs
approved these changes
Aug 23, 2026
Owner
|
Thanks for contribution. Now the Google Drive backend works like a charm. I have registered a Google App in Google Developer console, so that users don't need to register themselves (which is very complicated). The registration is being reviewed by Google, after that, the module will be publicly installable in the module catalog. If you want to test in advance, please provide your Google Account email so that I can grant you tester role and send you the compiled module binary. Unexpectedly, the review passes instantly. So you can try it now. |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new
gdrivemodule adding Google Drive as a sync backend, following the module contribution guide (package underpackages/,modules.jsonentry, spec page indeep-dive/modules/, sidebar + i18n entries).Design
drive.file+email— the module can only see files it created. The client secret and refresh token live in Obsidian secret storage; a remote request middleware injects the bearer token, refreshes it before expiry (deduped across concurrent callers), and retries once on 401 — same pattern as the S3 module's SigV4 middleware.GdriveFsimplementsRootFswith a per-instance path→id cache. Folders are real Drive folders;move()uses native re-parenting; deletes go to the Drive trash by default (setting to disable);md5Checksumis the uid; the local mtime is written to Drive'smodifiedTimeso timestamps round-trip.drive.fileonly exposes module-created files,list()fetches all visible files in one paginated query and assembles the tree client-side, honoring reporter verdicts (advance/include/exclude) without visiting excluded subtrees.Tests
An in-memory Drive API v3 mock (
test/mock-drive.ts) covers lookup/list queries, ranged media downloads, multipart + resumable uploads, patches, and deletes. 23 tests exercise the fullRootFscontract plus the device flow, token manager, and bearer middleware.bun checkandbun testspass across the workspace.Notes for review
modules.jsonentry points athttps://sync.consensia.cc/modules/gdrive.jsfollowing the existing convention — hosting is yours to wire up at release time.lint:instead oflink:,smart-marge) — left untouched to keep this PR scoped, happy to fix in a follow-up.Fixes
Resolves #245