feat(pds): add direct upload frontend#564
Open
zymooll wants to merge 3 commits into
Open
Conversation
xrgzs
requested changes
Jul 1, 2026
xrgzs
left a comment
Member
There was a problem hiding this comment.
如果需要增加前端直传功能,建议浏览其他驱动,看看有没有能用这种回调方法直传的,统一这种上传方法。如果不能复用,那建议移除这种独立的功能,因为PDS并非主要驱动,用户量不大,不好测试,避免增加维护成本。
Author
fixed,已经整合到 src/pages/uploads/direct.ts 和 src/pages/uploads/upload.ts 用户规模方面其实我估计不会小,因为这个有羊毛可以薅。 |
- Move PDS direct upload into the existing direct upload module. - Reuse shared direct upload helpers for headers, progress, and completion. - Keep the PDS direct upload tool name and request flow unchanged.
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.
Summary / 摘要
修改概览
本次修改为 OpenList 新增原生 PDS 驱动,并在驱动注册表中启用
PDS存储类型。驱动使用 PDS 官方接口完成文件列表、下载链接、上传、目录创建、重命名、移动、复制、回收站删除、容量信息读取和 OAuth Token 刷新。主要变更
drivers/pds驱动目录,按 OpenList 现有驱动结构拆分为元信息、API 客户端、数据类型和驱动实现。drivers/all.go中注册 PDS 驱动,确保程序启动时可在存储类型列表中发现PDS。domain_id、drive_id、access_token、refresh_token等配置连接 PDS 空间。op.MustSaveDriverStorage写回存储配置。/v2/file/create、预签名PUT和/v2/file/complete的单分片流程。/v2/recyclebin/trash,行为是移入 PDS 回收站,不做永久删除。/v2/file/get获取,并设置两小时链接缓存过期时间。drivers/pds/README.md,说明驱动能力、配置项和实现注意事项。文件说明
drivers/pds/meta.go:定义驱动配置项和注册逻辑。drivers/pds/api.go:封装 PDS API 请求、Token 刷新和预签名上传请求。drivers/pds/types.go:定义 PDS 响应结构,并转换为 OpenListmodel.Obj。drivers/pds/driver.go:实现 OpenList 驱动接口,包括读写、移动、复制、删除和容量详情。drivers/pds/README.md:驱动使用说明。drivers/all.go:增加 PDS 驱动 blank import。行为与兼容性
本次新增的是独立驱动,不修改既有驱动行为。
删除动作进入 PDS 回收站,与永久删除不同。
expires_at可填0;只要配置了refresh_token,驱动会在首次请求时刷新 Token。当前上传为单分片上传,适合作为最小可用实现;大文件分片并发上传可后续增强。
新增了公开接口 /api/fs/complete_direct_upload
This PR has breaking changes.
/ 此 PR 包含破坏性变更。
This PR changes public API, config, storage format, or migration behavior.
/ 此 PR 修改了公开 API、配置、存储格式或迁移行为。
This PR requires corresponding changes in related repositories.
/ 此 PR 需要关联仓库同步修改。
Related repository PRs / 关联仓库 PR:
Testing / 测试
go test ./...gofmt -w drivers/pds drivers/all.gogo test ./drivers/pdsgo build -o build/openlist-demo.exe -tags=jsoniter ./pds存储。/pds。Checklist / 检查清单
/ 我已阅读 CONTRIBUTING。
/ 我确认此贡献符合仓库许可证、贡献规范和行为准则。
gofmt,go fmt, orprettierwhere applicable./ 我已按适用情况使用
gofmt、go fmt或prettier格式化变更代码。/ 我已在适用情况下请求相关维护者或代码所有者审查。
AI Disclosure / AI 使用声明
/ 此 PR 包含 AI 辅助内容。
Tools used / 使用工具:
Usage scope / 使用范围:
Code generation / 代码生成
Refactoring / 重构
Documentation / 文档
Tests / 测试
Translation / 翻译
Review assistance / 审查辅助
I have reviewed and validated all AI-assisted content included in this PR.
/ 我已审核并验证此 PR 中的所有 AI 辅助内容。
I have ensured that all AI-assisted commits include
Co-Authored-Byattribution./ 我已确保所有 AI 辅助提交都包含
Co-Authored-By归属信息。I can reproduce all AI-assisted content included in this PR without any AI tools.
/ 我可以在没有任何 AI 工具的情况下重现此 PR 中包含的所有 AI 辅助内容。
其他说明
PDS 服务文档:https://help.aliyun.com/zh/pds/drive-and-photo-service-ent/what-is-cde