mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Support export and import settings https://github.com/siyuan-note/siyuan/issues/10617
This commit is contained in:
parent
1f47be1a11
commit
2deb986c87
3 changed files with 106 additions and 7 deletions
|
|
@ -51,7 +51,7 @@ var Conf *AppConf
|
|||
|
||||
// AppConf 维护应用元数据,保存在 ~/.siyuan/conf.json。
|
||||
type AppConf struct {
|
||||
LogLevel string `json:"logLevel"` // 日志级别:Off, Trace, Debug, Info, Warn, Error, Fatal
|
||||
LogLevel string `json:"logLevel"` // 日志级别:off, trace, debug, info, warn, error, fatal
|
||||
Appearance *conf.Appearance `json:"appearance"` // 外观
|
||||
Langs []*conf.Lang `json:"langs"` // 界面语言列表
|
||||
Lang string `json:"lang"` // 选择的界面语言,同 Appearance.Lang
|
||||
|
|
@ -87,6 +87,10 @@ type AppConf struct {
|
|||
m *sync.Mutex
|
||||
}
|
||||
|
||||
func NewAppConf() *AppConf {
|
||||
return &AppConf{LogLevel: "debug", m: &sync.Mutex{}}
|
||||
}
|
||||
|
||||
func (conf *AppConf) GetUILayout() *conf.UILayout {
|
||||
conf.m.Lock()
|
||||
defer conf.m.Unlock()
|
||||
|
|
@ -114,7 +118,7 @@ func (conf *AppConf) SetUser(user *conf.User) {
|
|||
func InitConf() {
|
||||
initLang()
|
||||
|
||||
Conf = &AppConf{LogLevel: "debug", m: &sync.Mutex{}}
|
||||
Conf = NewAppConf()
|
||||
confPath := filepath.Join(util.ConfDir, "conf.json")
|
||||
if gulu.File.IsExist(confPath) {
|
||||
if data, err := os.ReadFile(confPath); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue