Skip to content

Conversation

@KirCute
Copy link
Member

@KirCute KirCute commented Jan 3, 2026

Description / 描述

实现了mopanwopanwpsdegoo驱动显示剩余空间的功能。

DiskUsage结构体改为储存TotalSpaceUsedSpace,并且将类型均改为int64,解决因网盘欠费导致已用空间比总空间大所带来的各种奇怪问题。

Motivation and Context / 背景

Closes #1918

How Has This Been Tested? / 测试

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

@KirCute KirCute added enhancement Module: Driver Driver-Related Issue/PR labels Jan 3, 2026
@KirCute
Copy link
Member Author

KirCute commented Jan 3, 2026

@x-spy

@hhsw2015
Copy link

hhsw2015 commented Jan 5, 2026

也许可以一起改了
#1918

Copy link
Member

@xrgzs xrgzs left a comment

Choose a reason for hiding this comment

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

构建报错

# github.com/OpenListTeam/OpenList/v4/drivers/mega
Error: drivers/mega/driver.go:204:21: undefined: driver.DiskUsageFromUsedAndTotal
Error: Process completed with exit code 1.

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 refactors the DiskUsage struct to store UsedSpace instead of FreeSpace, changing the underlying type from uint64 to int64 across all drivers. This addresses issues where used space exceeds total space due to overdue account payments. Additionally, the PR implements disk usage reporting for four new drivers: mopan, wopan, wps, and degoo.

  • Refactored DiskUsage struct to use TotalSpace and UsedSpace (both int64) with a computed FreeSpace() method
  • Added GetDetails() implementation for mopan, wopan, wps, and degoo drivers
  • Updated all existing drivers to use the new DiskUsage structure and removed the DiskUsageFromUsedAndTotal helper function

Reviewed changes

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

Show a summary per file
File Description
internal/model/storage.go Refactored DiskUsage struct to store UsedSpace instead of FreeSpace, added FreeSpace() method and custom JSON marshaling
internal/driver/utils.go Removed DiskUsageFromUsedAndTotal helper function
drivers/wps/util.go Added spaces() method to query WPS disk usage
drivers/wps/types.go Added spacesResp struct for WPS API response
drivers/wps/driver.go Implemented GetDetails() to report WPS disk usage
drivers/wopan/driver.go Implemented GetDetails() to report Wopan disk usage
drivers/mopan/driver.go Implemented GetDetails() to report MoPan disk usage
drivers/degoo/util.go Added getUserInfo() method to query Degoo quota
drivers/degoo/types.go Added DegooGetUserInfo3Data struct for user quota information
drivers/degoo/driver.go Implemented GetDetails() to report Degoo disk usage
drivers/weiyun/driver.go Updated to use new DiskUsage structure
drivers/smb/driver.go Updated to calculate UsedSpace from total and free values
drivers/sftp/driver.go Updated to calculate UsedSpace with explicit int64 conversions
drivers/quark_uc/types.go Changed capacity fields from uint64 to int64
drivers/quark_uc/driver.go Updated to use new DiskUsage structure
drivers/proton_drive/driver.go Simplified to directly use int64 values without intermediate conversions
drivers/pikpak/driver.go Changed ParseUint to ParseInt and updated to new DiskUsage structure
drivers/onedrive_app/types.go Changed quota fields from uint64 to int64
drivers/onedrive_app/driver.go Updated to use UsedSpace instead of Remaining
drivers/onedrive/types.go Changed quota fields from uint64 to int64
drivers/onedrive/driver.go Updated to use UsedSpace instead of Remaining
drivers/mediafire/driver.go Changed ParseUint to ParseInt and updated to new DiskUsage structure
drivers/local/util_windows.go Added int64 conversions for Windows disk usage calculation
drivers/local/util_unix.go Updated Unix disk usage calculation with int64 conversions
drivers/ilanzou/driver.go Changed to use ToInt64() instead of ToUint64() and updated to new DiskUsage structure
drivers/halalcloud_open/driver_curd_impl.go Updated to use BytesUsed instead of calculating from BytesFree
drivers/google_drive/driver.go Changed ParseUint to ParseInt and updated to new DiskUsage structure
drivers/cloudreve_v4/types.go Changed capacity fields from uint64 to int64
drivers/cloudreve_v4/driver.go Updated to use new DiskUsage structure
drivers/baidu_netdisk/util.go Updated to use new DiskUsage structure directly
drivers/baidu_netdisk/types.go Changed quota fields from uint64 to int64
drivers/aliyundrive_open/driver.go Changed to use ToInt64() instead of ToUint64() and updated to new DiskUsage structure
drivers/aliyundrive/driver.go Changed to use ToInt64() instead of ToUint64() and updated to new DiskUsage structure
drivers/alias/util.go Updated parameter type from uint64 to int64 and added FreeSpace() method calls
drivers/alias/driver.go Added GetDetails() implementation with pass-through support
drivers/189pc/types.go Changed capacity fields from uint64 to int64
drivers/189pc/driver.go Updated to use new DiskUsage structure
drivers/189_tv/types.go Changed capacity fields from uint64 to int64
drivers/189_tv/driver.go Updated to use new DiskUsage structure
drivers/189/types.go Changed capacity fields from uint64 to int64
drivers/189/driver.go Updated to use new DiskUsage structure
drivers/139/driver.go Changed ParseUint to ParseInt and updated to new DiskUsage structure
drivers/123_open/types.go Changed space fields from uint64 to int64
drivers/123_open/driver.go Updated to use new DiskUsage structure with inline calculation
drivers/123/types.go Changed space fields from uint64 to int64
drivers/123/driver.go Updated to use new DiskUsage structure with inline calculation
drivers/115_open/driver.go Changed to query AllUse instead of AllRemain and removed uint64 conversions
drivers/115/driver.go Changed to use AllUse instead of AllRemain and removed uint64 conversions

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

@KirCute
Copy link
Member Author

KirCute commented Jan 7, 2026

构建报错

我的,忘了拉最新的主分支

@KirCute KirCute requested a review from xrgzs January 7, 2026 10:33
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

Copilot reviewed 49 out of 49 changed files in this pull request and generated 1 comment.


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

@xrgzs xrgzs merged commit 744dbd5 into OpenListTeam:main Jan 8, 2026
18 checks passed
@KirCute KirCute deleted the feat/quota branch January 8, 2026 07:10
TwoOnefour pushed a commit to TwoOnefour/OpenList that referenced this pull request Jan 8, 2026
…am#1905)

* feat(drivers): support getting disk usage of some drivers

* feat(drivers/degoo): implement GetDetails

* fix(fs/storage-details): fill used space rather than free space

* fix mega

* fix bsize type
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.

[Feature] 增加Degoo容量显示

3 participants