mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-24 17:26:10 +01:00
🎨 分屏
This commit is contained in:
parent
310c5f7042
commit
e12c004036
9 changed files with 31 additions and 14 deletions
|
|
@ -40,7 +40,7 @@ require (
|
|||
github.com/qiniu/go-sdk/v7 v7.13.0
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220704005630-2c6fc0ab7992
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220704031858-e4eee44034c8
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
|
||||
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f
|
||||
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/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220704005630-2c6fc0ab7992 h1:cVr7UqNcz1kq3Z435SIg8pqj/2xq62qHo1gxk4faw48=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220704005630-2c6fc0ab7992/go.mod h1:0t+TpAdsrrv+6LkhDlJY2Gl92CQexgp8KWOBp5Ah9kU=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220704031858-e4eee44034c8 h1:nPbcb+ZAbsqgE2q69wMmWQ/oNDOqPRaH5e2POrcSG6E=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220704031858-e4eee44034c8/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/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU=
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ const (
|
|||
CtxPushMsgToStatusBarAndProgress
|
||||
)
|
||||
|
||||
func syncRepo(byHand bool) {
|
||||
func syncRepo(boot, exit, byHand bool) {
|
||||
if 1 > len(Conf.Repo.Key) {
|
||||
msg := Conf.Language(26)
|
||||
util.PushStatusBar(msg)
|
||||
|
|
@ -284,21 +284,33 @@ func syncRepo(byHand bool) {
|
|||
Server: util.AliyunServer,
|
||||
}
|
||||
syncContext := map[string]interface{}{CtxPushMsg: CtxPushMsgToStatusBar}
|
||||
latest, mergeUpserts, mergeRemoves, _, err := repo.Sync(cloudInfo, syncContext)
|
||||
|
||||
_, mergeUpserts, mergeRemoves, _,
|
||||
uploadFileCount, uploadChunkCount, downloadFileCount, downloadChunkCount,
|
||||
uploadBytes, downloadBytes, err := repo.Sync(cloudInfo, syncContext)
|
||||
|
||||
elapsed := time.Since(start)
|
||||
util.LogInfof("sync data repo elapsed [%.2fs], latest [%s]", elapsed.Seconds(), latest.ID)
|
||||
if nil != err {
|
||||
util.LogErrorf("sync data repo failed: %s", err)
|
||||
msg := "Sync data repo failed: " + err.Error()
|
||||
msg := fmt.Sprintf(Conf.Language(80), formatErrorMsg(err))
|
||||
if errors.Is(err, dejavu.ErrSyncCloudStorageSizeExceeded) {
|
||||
msg = fmt.Sprintf(Conf.Language(43), byteCountSI(int64(Conf.User.UserSiYuanRepoSize)))
|
||||
}
|
||||
Conf.Sync.Stat = msg
|
||||
util.PushStatusBar(msg)
|
||||
util.PushErrMsg(msg, 0)
|
||||
if boot {
|
||||
BootSyncSucc = 1
|
||||
}
|
||||
if exit {
|
||||
ExitSyncSucc = 1
|
||||
}
|
||||
return
|
||||
}
|
||||
util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))
|
||||
Conf.Sync.Synced = util.CurrentTimeMillis()
|
||||
msg := fmt.Sprintf(Conf.Language(150), uploadFileCount, uploadChunkCount, downloadFileCount, downloadChunkCount, byteCountSI(uploadBytes), byteCountSI(downloadBytes))
|
||||
Conf.Sync.Stat = msg
|
||||
|
||||
if 1 > len(mergeUpserts) && 1 > len(mergeRemoves) { // 没有数据变更
|
||||
syncSameCount++
|
||||
|
|
@ -343,7 +355,7 @@ func indexRepoBeforeCloudSync(repo *dejavu.Repo) (err error) {
|
|||
CtxPushMsg: CtxPushMsgToStatusBar,
|
||||
})
|
||||
if nil != err {
|
||||
util.PushStatusBar(Conf.Language(140))
|
||||
util.PushStatusBar(fmt.Sprintf(Conf.Language(140), err))
|
||||
util.LogErrorf("index data repo before cloud sync failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ func SyncData(boot, exit, byHand bool) {
|
|||
defer syncLock.Unlock()
|
||||
|
||||
if Conf.Sync.UseDataRepo {
|
||||
syncRepo(byHand)
|
||||
syncRepo(boot, exit, byHand)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue