Skip to content

refactor(drivers/wps): remove resolveCache#2411

Merged
xrgzs merged 3 commits intoOpenListTeam:mainfrom
xrgzs:refactor/wps
Apr 27, 2026
Merged

refactor(drivers/wps): remove resolveCache#2411
xrgzs merged 3 commits intoOpenListTeam:mainfrom
xrgzs:refactor/wps

Conversation

@xrgzs
Copy link
Copy Markdown
Member

@xrgzs xrgzs commented Apr 27, 2026

Description / 描述

  • 移除 resolveNode 驱动自带缓存,改为类型断言实现
  • 更改代码布局
  • 避免用户错误输入多行字符串
  • 增加启动时创建 resty client,避免使用默认 client 出现“串号”问题
  • 增加自定义UA功能,并默认使用OpenList UA,避免登录出现 go 默认 UA
  • 重构账号类型检测,经过测试,一个 Session 只能同时对应一个账号

Motivation and Context / 背景

How Has This Been Tested? / 测试

实测WPS365商业版,WPS个人版可正常上传、复制、新建文件夹,说明类型断言实现没问题。

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the WPS driver to remove the old path-resolution cache and instead rely on driver-specific object metadata (IDs/kinds), while also improving HTTP client isolation and request headers (UA).

Changes:

  • Removed resolveCache/resolvePath-based workflow and moved to object-type assertions with richer Obj metadata.
  • Added per-driver resty.Client initialization on startup and login-state detection via islogin.
  • Extracted upload logic into a dedicated put.go and added configurable/custom User-Agent support.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
drivers/wps/util.go Reworked endpoints, UA handling, request creation, and group fetching to rely on login state + per-driver client.
drivers/wps/types.go Introduced loginState, moved API response types, and redesigned Obj to embed model.Obj plus driver metadata.
drivers/wps/put.go New file containing upload implementation (hashing, create/commit, multipart/stream handling).
drivers/wps/meta.go Updated driver addition fields (default mode, custom UA, tag metadata changes).
drivers/wps/driver.go Rebuilt core driver methods (List/Link/CRUD/GetDetails) to use the new object model and initialized resty client + login state in Init.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread drivers/wps/util.go Outdated
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/meta.go
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/driver.go Outdated
Comment thread drivers/wps/put.go Outdated
xrgzs and others added 2 commits April 27, 2026 13:51
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
@xrgzs xrgzs merged commit 29ec90e into OpenListTeam:main Apr 27, 2026
12 checks passed
@xrgzs xrgzs deleted the refactor/wps branch April 27, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Module: Driver Driver-Related Issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants