8000 feat(storage): keep Lens's own files on this machine or any rclone connection by adeelahmad · Pull Request #148 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(storage): keep Lens's own files on this machine or any rclone connection - #148

Merged
adeelahmad merged 1 commit into
mainfrom
claude/notes-module-j9j30y
Oct 5, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/notes-module-j9j30y

Conversation

@adeelahmad
Copy link
8000 Copy Markdown
Owner

Before: every file Lens kept went into data_dir on the machine's disk.

After: the files Lens makes its own, starting with notes' attachments in the next PR, go where a new files settings section says. That is either this machine (data_dir/objects, still the default) or any storage connection from Settings → Sources:

  • S3 or S3-compatible
  • Google Drive, Dropbox, OneDrive
  • SFTP, SMB, WebDAV
  • a folder on this machine

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 new file_storage tool 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.py builds a private rclone config for each operation from the existing connection (sources._config), adding a crypt section when crypt is on.
  • put, open_file, delete and test cover both the local and connection paths.
  • Settings are validated in settings._check/save, which rejects a missing connection or one that isn't storage (an email account or calendar). A local folder must sit inside sources.local_roots.
  • change_settings files always waits for approval.
  • Tests in tests/api/test_file_store.py use a real rclone against a local folder, the same folder through crypt, and S3 through rclone 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

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0