mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
🎨 Cloud sync storage size check
This commit is contained in:
parent
d013fd1229
commit
e17aa59597
5 changed files with 10 additions and 6 deletions
|
|
@ -30,6 +30,7 @@ type User struct {
|
||||||
UserToken string `json:"userToken"`
|
UserToken string `json:"userToken"`
|
||||||
UserTokenExpireTime string `json:"userTokenExpireTime"`
|
UserTokenExpireTime string `json:"userTokenExpireTime"`
|
||||||
UserSiYuanRepoSize float64 `json:"userSiYuanRepoSize"`
|
UserSiYuanRepoSize float64 `json:"userSiYuanRepoSize"`
|
||||||
|
UserSiYuanAssetSize float64 `json:"userSiYuanAssetSize"`
|
||||||
UserTrafficUpload float64 `json:"userTrafficUpload"`
|
UserTrafficUpload float64 `json:"userTrafficUpload"`
|
||||||
UserTrafficDownload float64 `json:"userTrafficDownload"`
|
UserTrafficDownload float64 `json:"userTrafficDownload"`
|
||||||
UserTrafficTime float64 `json:"userTrafficTime"`
|
UserTrafficTime float64 `json:"userTrafficTime"`
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ require (
|
||||||
github.com/qiniu/go-sdk/v7 v7.13.0
|
github.com/qiniu/go-sdk/v7 v7.13.0
|
||||||
github.com/radovskyb/watcher v1.0.7
|
github.com/radovskyb/watcher v1.0.7
|
||||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
||||||
github.com/siyuan-note/dejavu v0.0.0-20220702123733-b829773aeffe
|
github.com/siyuan-note/dejavu v0.0.0-20220703013235-b4ad745e0bd5
|
||||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
|
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
|
||||||
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f
|
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f
|
||||||
github.com/siyuan-note/filelock v0.0.0-20220616063212-74cfba0754ee
|
github.com/siyuan-note/filelock v0.0.0-20220616063212-74cfba0754ee
|
||||||
|
|
|
||||||
|
|
@ -421,8 +421,8 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/siyuan-note/dejavu v0.0.0-20220702123733-b829773aeffe h1:/awuEhSKXTQXxBB1+0YYUtqVya6RHSO6DBVRf9uTlr4=
|
github.com/siyuan-note/dejavu v0.0.0-20220703013235-b4ad745e0bd5 h1:k1Tx3CR/FWxzyMDaIV/nyLwe1E4DPy3ZZvFuj+wdSRM=
|
||||||
github.com/siyuan-note/dejavu v0.0.0-20220702123733-b829773aeffe/go.mod h1:0t+TpAdsrrv+6LkhDlJY2Gl92CQexgp8KWOBp5Ah9kU=
|
github.com/siyuan-note/dejavu v0.0.0-20220703013235-b4ad745e0bd5/go.mod h1:0t+TpAdsrrv+6LkhDlJY2Gl92CQexgp8KWOBp5Ah9kU=
|
||||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
|
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
|
||||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||||
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU=
|
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU=
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ func syncRepo(byHand bool) {
|
||||||
Dir: Conf.Sync.CloudName,
|
Dir: Conf.Sync.CloudName,
|
||||||
UserID: Conf.User.UserId,
|
UserID: Conf.User.UserId,
|
||||||
Token: Conf.User.UserToken,
|
Token: Conf.User.UserToken,
|
||||||
LimitSize: int64(Conf.User.UserSiYuanRepoSize),
|
LimitSize: int64(Conf.User.UserSiYuanRepoSize - Conf.User.UserSiYuanAssetSize),
|
||||||
ProxyURL: Conf.System.NetworkProxy.String(),
|
ProxyURL: Conf.System.NetworkProxy.String(),
|
||||||
Server: util.AliyunServer,
|
Server: util.AliyunServer,
|
||||||
}
|
}
|
||||||
|
|
@ -322,6 +322,9 @@ func syncRepo(byHand bool) {
|
||||||
if nil != err {
|
if nil != err {
|
||||||
util.LogErrorf("sync data repo failed: %s", err)
|
util.LogErrorf("sync data repo failed: %s", err)
|
||||||
msg := "Sync data repo failed: " + err.Error()
|
msg := "Sync data repo failed: " + err.Error()
|
||||||
|
if errors.Is(err, dejavu.ErrSyncCloudStorageSizeExceeded) {
|
||||||
|
msg = fmt.Sprintf(Conf.Language(43), byteCountSI(int64(Conf.User.UserSiYuanRepoSize)))
|
||||||
|
}
|
||||||
util.PushStatusBar(msg)
|
util.PushStatusBar(msg)
|
||||||
util.PushErrMsg(msg, 0)
|
util.PushErrMsg(msg, 0)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,8 @@ func SyncData(boot, exit, byHand bool) {
|
||||||
indexRepoBeforeCloudSync()
|
indexRepoBeforeCloudSync()
|
||||||
|
|
||||||
//同步数据仓库 https://github.com/siyuan-note/siyuan/issues/5142
|
//同步数据仓库 https://github.com/siyuan-note/siyuan/issues/5142
|
||||||
//syncRepo(byHand)
|
syncRepo(byHand)
|
||||||
//return // TODO: 测试
|
return // TODO: 测试
|
||||||
|
|
||||||
WaitForWritingFiles()
|
WaitForWritingFiles()
|
||||||
writingDataLock.Lock()
|
writingDataLock.Lock()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue