mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-18 21:18:07 +01:00
🎨 改进多设备同时同步数据的可靠性 https://github.com/siyuan-note/siyuan/issues/7245
This commit is contained in:
parent
6e8a4bbf71
commit
85771e1a45
10 changed files with 48 additions and 13 deletions
|
|
@ -215,7 +215,7 @@ func InitConf() {
|
|||
if "" == Conf.System.ID {
|
||||
Conf.System.ID = util.GetDeviceID()
|
||||
}
|
||||
if "std" == util.Container {
|
||||
if util.ContainerStd == util.Container {
|
||||
Conf.System.ID = util.GetDeviceID()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -927,6 +927,7 @@ func syncRepo(exit, byHand bool) (err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))
|
||||
Conf.Sync.Synced = util.CurrentTimeMillis()
|
||||
msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))
|
||||
|
|
@ -1185,7 +1186,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
|
|||
|
||||
ignoreLines := getIgnoreLines()
|
||||
ignoreLines = append(ignoreLines, "/.siyuan/conf.json") // 忽略旧版同步配置
|
||||
ret, err = dejavu.NewRepo(util.DataDir, util.RepoDir, util.HistoryDir, util.TempDir, Conf.Repo.Key, ignoreLines, cloudRepo)
|
||||
ret, err = dejavu.NewRepo(util.DataDir, util.RepoDir, util.HistoryDir, util.TempDir, Conf.System.ID, Conf.Repo.Key, ignoreLines, cloudRepo)
|
||||
if nil != err {
|
||||
logging.LogErrorf("init data repo failed: %s", err)
|
||||
return
|
||||
|
|
@ -1363,6 +1364,16 @@ func subscribeEvents() {
|
|||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudLock, func(context map[string]interface{}) {
|
||||
msg := fmt.Sprintf(Conf.Language(186))
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
eventbus.Subscribe(eventbus.EvtCloudUnlock, func(context map[string]interface{}) {
|
||||
msg := fmt.Sprintf(Conf.Language(187))
|
||||
util.SetBootDetails(msg)
|
||||
util.ContextPushMsg(context, msg)
|
||||
})
|
||||
}
|
||||
|
||||
func buildCloudConf() (ret *cloud.Conf, err error) {
|
||||
|
|
|
|||
|
|
@ -437,6 +437,10 @@ func formatErrorMsg(err error) string {
|
|||
msg = Conf.Language(28)
|
||||
} else if strings.Contains(msgLowerCase, "cloud object not found") {
|
||||
msg = Conf.Language(129)
|
||||
} else if strings.Contains(msgLowerCase, "lock cloud repo failed") {
|
||||
msg = Conf.Language(188)
|
||||
} else if strings.Contains(msgLowerCase, "cloud repo is locked") {
|
||||
msg = Conf.Language(189)
|
||||
}
|
||||
msg = msg + " v" + util.Ver
|
||||
return msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue