Skip to content

Conversation

@UcnacDx2
Copy link

@UcnacDx2 UcnacDx2 commented Oct 24, 2025

  • Added Username and Password fields to the Addition struct for user authentication.
  • Implemented loginWithPassword method to handle user login via password and cookies.
  • Introduced new request types for batch operations and document modifications.
  • Enhanced error handling in request methods to provide better debugging information.
  • Added AES encryption and decryption utilities for secure communication.
  • Implemented methods for handling album requests and group copying operations.
  • Updated logging for better traceability of requests and responses.

Description / 描述

增加了账户密码登录的功能。
增加了家庭云和共享群的复制,移动功能。
更换了更快速的上传端点。

Motivation and Context / 背景

authorization有效期太短。
家庭云和共享群功能缺失,上传速度慢。

How Has This Been Tested? / 测试

使用本地 debug 进行密码登录流程验证(创建临时用户 -> 调用 loginWithPassword -> 检查 Cookie/Session)。

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).
    我已相应更新了相关仓库(若适用)。

- Added support for password-based login in the 139 driver.
- Introduced RootPath field to store the root directory path.
- Updated Init method to handle family and group types more effectively.
- Implemented new methods for handling file operations in family and group contexts.
- Enhanced error handling and logging for better debugging.
- Added new request and response structures for batch operations and document modifications.
- Improved encryption and decryption methods for secure communication.
@ILoveScratch2
Copy link
Member

勾选框请删掉空格直接写x

Copy link
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

This PR implements password-based authentication for the 139 cloud driver to address short authorization token validity periods. The implementation adds a multi-step login flow involving password hashing, session token exchange, and third-party authentication with AES encryption for secure communication.

Key Changes:

  • Added username/password fields to the Addition struct for authentication
  • Implemented a three-step password login flow with AES encryption/decryption utilities
  • Enhanced error handling and logging throughout request methods
  • Added support for batch operations (move, copy, rename) in family and group cloud types

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
drivers/139/meta.go Added Username, Password, and MailCookies fields to Addition struct for authentication
drivers/139/driver.go Integrated password login fallback in Init, added Move/Copy/Rename support for family/group clouds
drivers/139/util.go Implemented password login flow (3 steps), AES encryption utilities, and new request handlers
drivers/139/types.go Added new request/response types for batch operations and document modifications
Comments suppressed due to low confidence (1)

drivers/139/util.go:1

  • Magic string value for x-deviceinfo header lacks explanation. Add a comment explaining the format and purpose of this device information string.
package _139

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

if createBatchOprTaskResp, ok := resp.(*CreateBatchOprTaskResp); ok {
log.Debugf("[139] CreateBatchOprTaskResp.Result.ResultCode: %s", createBatchOprTaskResp.Result.ResultCode)
if createBatchOprTaskResp.Result.ResultCode == "0" {
goto SUCCESS_PROCESS
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Use of goto statement reduces code readability and maintainability. Consider refactoring to use explicit return statements or conditional logic instead.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

能跑就行

Copy link
Member

Choose a reason for hiding this comment

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

这个函数if嵌套的有点太深了,我觉得如果能改成下面这种形式最好,不行就算了

if condition1 {
    return nil, err
}
xxx, err := xxx
if err != nil {
    return nil, err
}
yyy, ok := yyy
if !ok {
    return nil, fmt.Errorf("xxx")
}
return res.Body(), nil

Copy link
Author

Choose a reason for hiding this comment

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

这个函数if嵌套的有点太深了,我觉得如果能改成下面这种形式最好,不行就算了

if condition1 {
    return nil, err
}
xxx, err := xxx
if err != nil {
    return nil, err
}
yyy, ok := yyy
if !ok {
    return nil, fmt.Errorf("xxx")
}
return res.Body(), nil

主要是本地环境删了,懒得测试了(

Copy link
Author

Choose a reason for hiding this comment

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

如果能帮忙测试下改掉应该没问题

@UcnacDx2 UcnacDx2 changed the title feat(139): Enhance 139 driver with user authentication and new reques… feat(139): Enhance 139 driver with user authentication and file batch operations Oct 25, 2025
UcnacDx2 and others added 5 commits October 25, 2025 11:20
Co-authored-by: Copilot <[email protected]>
Signed-off-by: UcnacDx2 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: UcnacDx2 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: UcnacDx2 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: UcnacDx2 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Signed-off-by: UcnacDx2 <[email protected]>
@xrgzs
Copy link
Member

xrgzs commented Oct 25, 2025

换成 139 邮箱了?

Account string
ref *Yun139
PersonalCloudHost string
RootPath string
Copy link
Member

Choose a reason for hiding this comment

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

这个RootPath是在哪用到的,没找到

Copy link
Author

@UcnacDx2 UcnacDx2 Oct 25, 2025

Choose a reason for hiding this comment

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

没记错的话,是家庭云和共享群的复制和移动的接口用到的参数,如果没用到应该是写到一起了

Copy link
Member

Choose a reason for hiding this comment

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

应该只是我没找到,我再看看

@UcnacDx2
Copy link
Author

换成 139 邮箱了?

云盘本身的登录接口要短信验证,这是取巧的办法。
需要139邮箱网页操作,在邮箱那边登记成可信设备提取header string格式cookie,
然后在这边填入邮箱cookie和填写账号密码。
理论上云盘和邮箱两者账号密码通用的

@jyxjjj
Copy link
Member

jyxjjj commented Nov 21, 2025

May a fix of #1680

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.

5 participants