Repository navigation
feat(storage): keep Lens's own files on this machine or any rclone connection - #148
Merged
Merged
Conversation
…nnection blobs.py keeps files where Settings → Storage (the files section) says: data_dir/objects, or a storage connection (S3, Drive, Dropbox, OneDrive, SFTP, SMB, WebDAV, a folder) under a folder, optionally wrapped in rclone crypt. Files are encrypted with their namespace's key before they leave the machine. Each file records where it went, so changing the setting strands nothing. A check route and the assistant's file_storage tool test it; change_settings files always waits for approval. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZQXJtCvJgbG1Z2H312KcS
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.
Before: every file Lens kept went into
data_diron the machine's disk.After: the files Lens makes its own, starting with notes' attachments in the next PR, go where a new
filessettings section says. That is either this machine (data_dir/objects, still the default) or any storage connection from Settings → Sources:A file can go under a folder on the connection, and can optionally be wrapped in rclone crypt as well. Admins can check the store with
POST /api/v1/settings/files/test, and the assistant's newfile_storagetool reports where files go and can run the same check.Files bound for a connection are encrypted with their namespace's key before they leave the machine, so the remote only ever holds ciphertext. rclone crypt also hides file names and sizes; its password is generated on first use and kept sealed. Each file records where it went, so changing the setting never strands files that are already stored.
How:
app/domain/blobs.pybuilds a private rclone config for each operation from the existing connection (sources._config), adding a crypt section when crypt is on.put,open_file,deleteandtestcover both the local and connection paths.settings._check/save, which rejects a missing connection or one that isn't storage (an email account or calendar). A local folder must sit insidesources.local_roots.change_settings filesalways waits for approval.tests/api/test_file_store.pyuse a real rclone against a local folder, the same folder through crypt, and S3 throughrclone serve s3. They cover the round trip, ciphertext at rest, hidden names, reading after the setting changes, the check route and the assistant tool.Settings → Storage, the setup wizard step and attachments follow as separate PRs. See
docs/storage.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01XZQXJtCvJgbG1Z2H312KcS
Generated by Claude Code