-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(drivers): support getting disk usage of some drivers #1905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
也许可以一起改了 |
xrgzs
left a comment
There was a problem hiding this 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.
There was a problem hiding this 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
DiskUsagestruct to useTotalSpaceandUsedSpace(bothint64) with a computedFreeSpace()method - Added
GetDetails()implementation for mopan, wopan, wps, and degoo drivers - Updated all existing drivers to use the new
DiskUsagestructure and removed theDiskUsageFromUsedAndTotalhelper 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.
我的,忘了拉最新的主分支 |
There was a problem hiding this 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.
…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
Description / 描述
实现了
mopan,wopan,wps,degoo驱动显示剩余空间的功能。将
DiskUsage结构体改为储存TotalSpace和UsedSpace,并且将类型均改为int64,解决因网盘欠费导致已用空间比总空间大所带来的各种奇怪问题。Motivation and Context / 背景
Closes #1918
How Has This Been Tested? / 测试
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。