Skip to content

feat: 允许把 S3 / R2 设为当前图片存储 - #4

Open
Ethan2258 wants to merge 1 commit into
cshaizhihao:mainfrom
Ethan2258:claude/upstream-s3-r2-active-storage
Open

Ethan2258 wants to merge 1 commit into
cshaizhihao:mainfrom
Ethan2258:claude/upstream-s3-r2-active-storage

Conversation

@Ethan2258

Copy link
Copy Markdown

动机

目前 S3 / R2 可以配置、探测和作为迁移目标,但上传、读取和删除始终走本地卷。对磁盘小的 VPS 来说,能直接把图片写进对象存储会实用很多。这个功能已经在我的 fork 上线运行。

改动

  • Owner 可在存储中心把已验证的 S3 或 R2 设为当前存储(新增“设为当前存储”按钮),保存提供商配置不再强制改回本地。
  • 当前存储为 S3 / R2 时,新上传的原图、缩略图、编辑版本和 Live Photo 片段写入存储桶;永久删除同时删除远端对象。
  • 读取时优先本地文件,缺失再回退到已配置的存储桶,所以切换前上传的图片不用迁移也能访问。
  • 侧边栏、概览、上传工作台、存储中心、引导页和系统状态都跟随当前存储显示;系统检查会直接探测当前存储桶。
  • 元数据和备份仍在本地;部署、备份、安全模型和排障文档已更新说明。
  • 默认仍是本地存储,不设置就没有任何行为变化。

验证

  • 新增测试覆盖 S3 和 R2 的上传、读取、切回本地、彻底删除。
  • pnpm check 全部通过(70 个测试 + 构建)。

Until now S3 and R2 could be configured, probed and used as a migration
target, but uploads, reads and deletes always went to the local volume.
An Owner can now set a verified S3 or R2 provider as the active storage:

- New originals, thumbnails, edited versions and Live Photo clips are
  written to the bucket; permanent deletion removes the remote objects.
- Reads prefer a local copy and fall back to the configured buckets, so
  images uploaded before a switch keep working without migration.
- The storage console gets a "设为当前存储" action, and saving provider
  settings no longer resets the active storage to local.
- The sidebar, overview, upload workbench, storage console, onboarding
  and system status follow the active storage, and system checks probe
  the active bucket.
- Metadata and backups stay local; the docs describe the new behaviour.

Tests cover upload, serve, switch-back and purge for both S3 and R2.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01URmSTaHbqzQS9fEoXkvAZL
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