🎨 改进云端数据同步

This commit is contained in:
Liang Ding 2022-07-17 00:47:45 +08:00
parent 412f6d0303
commit 3d514b6d31
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
9 changed files with 18 additions and 14 deletions

View file

@ -39,7 +39,7 @@ require (
github.com/panjf2000/ants/v2 v2.5.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/radovskyb/watcher v1.0.7
github.com/siyuan-note/dejavu v0.0.0-20220716091807-656dabf873a2
github.com/siyuan-note/dejavu v0.0.0-20220716164152-fe0371110dcb
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f
github.com/siyuan-note/filelock v0.0.0-20220704090116-54dfb035283f

View file

@ -514,8 +514,8 @@ github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYED
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/siyuan-note/dejavu v0.0.0-20220716091807-656dabf873a2 h1:cTMm2dWIs5Er68NWWY+IyK2UA4gG6+GeLEiA6R97F6Q=
github.com/siyuan-note/dejavu v0.0.0-20220716091807-656dabf873a2/go.mod h1:cri+XyZAqmK5fJ98En9aOHB+YkuU8+XQcJdQ31EUhis=
github.com/siyuan-note/dejavu v0.0.0-20220716164152-fe0371110dcb h1:2E/kpgD8QXdu9vaN/1clMatxOcmqd6al6oQ7QRW6ORI=
github.com/siyuan-note/dejavu v0.0.0-20220716164152-fe0371110dcb/go.mod h1:cri+XyZAqmK5fJ98En9aOHB+YkuU8+XQcJdQ31EUhis=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU=

View file

@ -253,8 +253,10 @@ func UploadCloudSnapshot(tag, id string) (err error) {
uploadFileCount, uploadChunkCount, uploadBytes, err := repo.UploadTagIndex(tag, id, cloudInfo, map[string]interface{}{dejavu.CtxPushMsg: dejavu.CtxPushMsgToStatusBarAndProgress})
if nil != err {
if errors.Is(err, dejavu.ErrCloudBackupCountExceeded) {
err = errors.New(Conf.Language(154))
err = fmt.Errorf(Conf.Language(84), Conf.Language(154))
return
}
err = errors.New(fmt.Sprintf(Conf.Language(84), formatErrorMsg(err)))
return
}
msg := fmt.Sprintf(Conf.Language(152), uploadFileCount, uploadChunkCount, humanize.Bytes(uint64(uploadBytes)))

View file

@ -296,6 +296,8 @@ func formatErrorMsg(err error) string {
msg = Conf.Language(85) + " " + err.Error()
} else if strings.Contains(msg, "cipher: message authentication failed") {
msg = Conf.Language(172) + " " + err.Error()
} else if strings.Contains(msg, "repo fatal error") {
msg = Conf.Language(23) + " " + err.Error()
}
msg = msg + " v" + util.Ver
return msg