Skip to content

Commit

Permalink
v3.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
qjfoidnh committed Sep 4, 2023
1 parent 9956dc0 commit dca487e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ iikira/BaiduPCS-Go was largely inspired by [GangZhuo/BaiduPCS](https://github.co
[离线下载](#离线下载), 支持http/https/ftp/电驴/磁力链协议.

# 版本更新
**2023.09.05** v3.9.4
- fix #244, 修复断点上传时偶发崩溃
- 优化本地上传秒传失败时的处理逻辑

**2023.08.26** v3.9.3
- 因官方接口从原理层面封禁秒传, 取消秒传转存功能
- 更新部分使用说明
Expand Down
9 changes: 8 additions & 1 deletion internal/pcsfunctions/pcsupload/upload_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"path/filepath"
"strings"
"sync"
"time"
)

Expand All @@ -22,6 +23,7 @@ type (

// UploadingDatabase 未完成上传的数据库
UploadingDatabase struct {
lock sync.RWMutex
UploadingList []*Uploading `json:"upload_state"`
Timestamp int64 `json:"timestamp"`

Expand Down Expand Up @@ -94,7 +96,8 @@ func (ud *UploadingDatabase) UpdateUploading(meta *checksum.LocalFileMeta, state
if meta == nil {
return
}

ud.lock.RLock()
defer ud.lock.RUnlock()
meta.CompleteAbsPath()
for k, uploading := range ud.UploadingList {
if uploading.LocalFileMeta == nil {
Expand Down Expand Up @@ -123,6 +126,8 @@ func (ud *UploadingDatabase) Delete(meta *checksum.LocalFileMeta) bool {
}

meta.CompleteAbsPath()
ud.lock.Lock()
defer ud.lock.Unlock()
for k, uploading := range ud.UploadingList {
if uploading.LocalFileMeta == nil {
continue
Expand Down Expand Up @@ -168,6 +173,8 @@ func (ud *UploadingDatabase) Search(meta *checksum.LocalFileMeta) *uploader.Inst
}

func (ud *UploadingDatabase) clearModTimeChange() {
ud.lock.Lock()
defer ud.lock.Unlock()
for i := 0; i < len(ud.UploadingList); i++ {
uploading := ud.UploadingList[i]
if uploading.LocalFileMeta == nil {
Expand Down
5 changes: 3 additions & 2 deletions internal/pcsfunctions/pcsupload/upload_task_unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ func (utu *UploadTaskUnit) rapidUpload() (isContinue bool, result *taskframework

uk, err := utu.PCS.UK()
if err != nil {
result.ResultMessage = "获取用户uk错误"
result.ResultMessage = "获取用户uk错误, 请确保登录信息包含了STOKEN"
result.Err = err
fmt.Printf("[%s] 秒传失败, 开始上传文件...\n\n", utu.taskInfo.Id())
isContinue = true
return
}
currentTime := time.Now().Unix()
Expand Down Expand Up @@ -196,7 +198,6 @@ func (utu *UploadTaskUnit) rapidUpload() (isContinue bool, result *taskframework
return
}
}

fmt.Printf("[%s] 秒传失败, 开始上传文件...\n\n", utu.taskInfo.Id())

// 保存秒传信息
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const (

var (
// Version 版本号
Version = "v3.9.3-devel"
Version = "v3.9.4-devel"

historyFilePath = filepath.Join(pcsconfig.GetConfigDir(), "pcs_command_history.txt")
reloadFn = func(c *cli.Context) error {
Expand Down
8 changes: 4 additions & 4 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"FileVersion": {
"Major": 3,
"Minor": 9,
"Patch": 3,
"Patch": 4,
"Build": 0
},
"ProductVersion": {
"Major": 3,
"Minor": 9,
"Patch": 3,
"Patch": 4,
"Build": 0
},
"FileFlagsMask": "3f",
Expand All @@ -22,14 +22,14 @@
"Comments": "",
"CompanyName": "qjfoidnh",
"FileDescription": "百度网盘客户端(加强版)",
"FileVersion": "v3.9.3",
"FileVersion": "v3.9.4",
"InternalName": "",
"LegalCopyright": "© 2016-2020 iikira.",
"LegalTrademarks": "",
"OriginalFilename": "",
"PrivateBuild": "",
"ProductName": "BaiduPCS-Go",
"ProductVersion": "v3.9.3",
"ProductVersion": "v3.9.4",
"SpecialBuild": ""
},
"VarFileInfo": {
Expand Down

0 comments on commit dca487e

Please sign in to comment.