siyuan/kernel/conf/sync.go

48 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// SiYuan - Build Your Eternal Digital Garden
// Copyright (c) 2020-present, b3log.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package conf
import (
"path/filepath"
"github.com/siyuan-note/siyuan/kernel/util"
)
type Sync struct {
CloudName string `json:"cloudName"` // 云端同步目录名称
Enabled bool `json:"enabled"` // 是否开启同步
Mode int `json:"mode"` // 同步模式0未设置为兼容已有配置initConf 函数中会转换为 11自动2手动 https://github.com/siyuan-note/siyuan/issues/5089
Uploaded int64 `json:"uploaded"` // 最近上传时间
Downloaded int64 `json:"downloaded"` // 最近下载时间
Synced int64 `json:"synced"` // 最近同步时间
Stat string `json:"stat"` // 最近同步统计信息
UseDataRepo bool `json:"useDataRepo"` // 是否使用数据仓库同步
}
func NewSync() *Sync {
return &Sync{
CloudName: "main",
Enabled: true,
Mode: 1,
UseDataRepo: false,
}
}
func (s *Sync) GetSaveDir() string {
return filepath.Join(util.WorkspaceDir, "sync")
}