mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 01:21:14 +08:00
🔥 移除冗余代码
This commit is contained in:
parent
8f8f2b6100
commit
5b9f2c3cb1
@ -1,34 +0,0 @@
|
|||||||
// 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 Backup struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewBackup() *Backup {
|
|
||||||
return &Backup{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *Backup) GetSaveDir() string {
|
|
||||||
return filepath.Join(util.WorkspaceDir, "backup")
|
|
||||||
}
|
|
@ -16,12 +16,6 @@
|
|||||||
|
|
||||||
package conf
|
package conf
|
||||||
|
|
||||||
import (
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Sync struct {
|
type Sync struct {
|
||||||
CloudName string `json:"cloudName"` // 云端同步目录名称
|
CloudName string `json:"cloudName"` // 云端同步目录名称
|
||||||
Enabled bool `json:"enabled"` // 是否开启同步
|
Enabled bool `json:"enabled"` // 是否开启同步
|
||||||
@ -37,7 +31,3 @@ func NewSync() *Sync {
|
|||||||
Mode: 1,
|
Mode: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sync) GetSaveDir() string {
|
|
||||||
return filepath.Join(util.WorkspaceDir, "sync")
|
|
||||||
}
|
|
||||||
|
@ -64,7 +64,6 @@ type AppConf struct {
|
|||||||
AccessAuthCode string `json:"accessAuthCode"` // 访问授权码
|
AccessAuthCode string `json:"accessAuthCode"` // 访问授权码
|
||||||
System *conf.System `json:"system"` // 系统
|
System *conf.System `json:"system"` // 系统
|
||||||
Keymap *conf.Keymap `json:"keymap"` // 快捷键
|
Keymap *conf.Keymap `json:"keymap"` // 快捷键
|
||||||
Backup *conf.Backup `json:"backup"` // 备份配置
|
|
||||||
Sync *conf.Sync `json:"sync"` // 同步配置
|
Sync *conf.Sync `json:"sync"` // 同步配置
|
||||||
Search *conf.Search `json:"search"` // 搜索配置
|
Search *conf.Search `json:"search"` // 搜索配置
|
||||||
Stat *conf.Stat `json:"stat"` // 统计
|
Stat *conf.Stat `json:"stat"` // 统计
|
||||||
@ -231,23 +230,9 @@ func InitConf() {
|
|||||||
Conf.Account = conf.NewAccount()
|
Conf.Account = conf.NewAccount()
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil == Conf.Backup {
|
|
||||||
Conf.Backup = conf.NewBackup()
|
|
||||||
}
|
|
||||||
if !gulu.File.IsExist(Conf.Backup.GetSaveDir()) {
|
|
||||||
if err := os.MkdirAll(Conf.Backup.GetSaveDir(), 0755); nil != err {
|
|
||||||
logging.LogErrorf("create backup dir [%s] failed: %s", Conf.Backup.GetSaveDir(), err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if nil == Conf.Sync {
|
if nil == Conf.Sync {
|
||||||
Conf.Sync = conf.NewSync()
|
Conf.Sync = conf.NewSync()
|
||||||
}
|
}
|
||||||
if !gulu.File.IsExist(Conf.Sync.GetSaveDir()) {
|
|
||||||
if err := os.MkdirAll(Conf.Sync.GetSaveDir(), 0755); nil != err {
|
|
||||||
logging.LogErrorf("create sync dir [%s] failed: %s", Conf.Sync.GetSaveDir(), err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if 0 == Conf.Sync.Mode {
|
if 0 == Conf.Sync.Mode {
|
||||||
Conf.Sync.Mode = 1
|
Conf.Sync.Mode = 1
|
||||||
}
|
}
|
||||||
@ -505,10 +490,10 @@ func InitBoxes() {
|
|||||||
blockCount := 0
|
blockCount := 0
|
||||||
if 1 > len(treenode.GetBlockTrees()) {
|
if 1 > len(treenode.GetBlockTrees()) {
|
||||||
if gulu.File.IsExist(util.BlockTreePath) {
|
if gulu.File.IsExist(util.BlockTreePath) {
|
||||||
util.IncBootProgress(30, "Reading block trees...")
|
util.IncBootProgress(20, "Reading block trees...")
|
||||||
go func() {
|
go func() {
|
||||||
for i := 0; i < 40; i++ {
|
for i := 0; i < 40; i++ {
|
||||||
util.RandomSleep(100, 200)
|
util.RandomSleep(50, 100)
|
||||||
util.IncBootProgress(1, "Reading block trees...")
|
util.IncBootProgress(1, "Reading block trees...")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user