Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
实现 S3 同步核心功能,支持阿里云 OSS、AWS S3、MinIO 等 S3 兼容服务: - testS3Connection: 测试 S3 连接 - s3Upload: 上传文件到 S3 - s3Download: 从 S3 下载文件 - s3Delete: 删除 S3 文件 - s3ListObjects: 列出 S3 文件 - s3HeadObject: 获取文件信息 复用 imageHosting/s3.ts 中的 AWS V4 签名实现和 URL 构建逻辑 Co-Authored-By: Claude Opus 4.6 <[email protected]>
添加 S3 运行时状态管理: - s3Connected: 连接状态 - s3FileEtags: 云端文件 ETag 记录 - setS3Connected: 设置连接状态 - setS3FileEtags: 批量设置 ETag - updateS3FileEtag: 更新单个文件 ETag - removeS3FileEtag: 删除单个文件 ETag Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- 导入 S3 函数和类型 - 添加 getS3Config 辅助函数获取 S3 配置 - 修改 pushFile 方法添加 s3 case,支持上传文件并更新 ETag - 修改 pullFile 方法添加 s3 case,支持下载文件并更新 ETag - 修改 deleteRemoteFile 方法添加 s3 case,支持删除文件并移除 ETag Co-Authored-By: Claude Opus 4.6 <[email protected]>
使用 ETag 比较代替 SHA 比较,以支持 S3 平台的文件版本检测 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
在 isSyncConfigured 函数中添加 S3 case,检查 s3SyncConfig 是否包含必要的配置项(accessKeyId、secretAccessKey、region、bucket) Co-Authored-By: Claude Opus 4.6 <[email protected]>
- 添加 S3 到 primaryBackupMethod 类型 - 添加 S3 到 platformStatus 初始状态 - 修复 getSyncRepoName 对 S3 平台的调用 Co-Authored-By: Claude Opus 4.6 <[email protected]>
- 修复 Cloudflare R2 的 URL 路径风格和查询参数编码问题 - 添加根目录和文件夹展开时的远程文件列表加载 - 添加点击远程文件自动拉取功能 - 添加国际化翻译支持 Co-Authored-By: Claude Opus 4.6 <[email protected]>
无论是否有远程更新,用户都可以随时手动点击拉取按钮 Co-Authored-By: Claude Opus 4.6 <[email protected]>
在 sync-toggle.tsx 中添加 S3 上传和下载支持: - 导入 s3Delete 函数用于上传时删除旧文件 - 添加 uploadAll 函数的 S3 上传 case - 添加 downloadAll 函数的 S3 下载 case Co-Authored-By: Claude Opus 4.6 <[email protected]>
问题原因:useUsername hook 只检查 Git 平台的用户名,未考虑 S3 解决方案: - 在 SyncToggle 组件中添加 S3 配置检测 - 当 primaryBackupMethod 为 s3 时,检测 s3SyncConfig 是否配置 - 修改显示条件:Git 平台需要用户名,S3 需要配置 Co-Authored-By: Claude Opus 4.6 <[email protected]>
将 useEffect 移到 primaryBackupMethod 声明之后 Co-Authored-By: Claude Opus 4.6 <[email protected]>
在 tag.ts、mark.ts、chat.ts 的上传和下载函数中添加 S3 支持: - 添加 s3Upload、s3Delete、s3HeadObject、s3Download 导入 - 在 uploadTags、downloadTags 中添加 S3 case - 在 uploadMarks、downloadMarks 中添加 S3 case - 在 uploadChats、downloadChats 中添加 S3 case Co-Authored-By: Claude Opus 4.6 <[email protected]>
问题:S3 下载返回的 content 已经是字符串,不需要 base64 编码 解决方案: - S3 下载时直接解析 content 为 JSON - Git 平台仍使用 decodeBase64ToString 解码 - 修复 tag.ts、mark.ts、chat.ts 的下载函数 Co-Authored-By: Claude Opus 4.6 <[email protected]>
问题:S3 下载的 content 是字符串,不需要 base64 解码 解决方案:根据 primaryBackupMethod 判断,S3 直接解析,Git 平台使用 base64 解码 Co-Authored-By: Claude Opus 4.6 <[email protected]>
s3Download 返回 { content: string; etag: string; lastModified: string }
需要通过 remoteFile.content.content 访问实际的字符串内容
Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.
No description provided.