mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 集市支持已安装的包单独显示 https://github.com/siyuan-note/siyuan/issues/5678
This commit is contained in:
parent
3750ca12cc
commit
a563861ab8
5 changed files with 106 additions and 25 deletions
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/88250/gulu"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/bazaar"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
|
|
@ -115,8 +116,8 @@ func loadThemes() {
|
|||
continue
|
||||
}
|
||||
name := themeDir.Name()
|
||||
themeConf, err := themeJSON(name)
|
||||
if nil != err || nil == themeConf {
|
||||
themeConf, parseErr := bazaar.ThemeJSON(name)
|
||||
if nil != parseErr || nil == themeConf {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -145,28 +146,6 @@ func loadThemes() {
|
|||
}
|
||||
}
|
||||
|
||||
func themeJSON(themeName string) (ret map[string]interface{}, err error) {
|
||||
p := filepath.Join(util.ThemesPath, themeName, "theme.json")
|
||||
if !gulu.File.IsExist(p) {
|
||||
err = os.ErrNotExist
|
||||
return
|
||||
}
|
||||
data, err := os.ReadFile(p)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read theme.json [%s] failed: %s", p, err)
|
||||
return
|
||||
}
|
||||
if err = gulu.JSON.UnmarshalJSON(data, &ret); nil != err {
|
||||
logging.LogErrorf("parse theme.json [%s] failed: %s", p, err)
|
||||
return
|
||||
}
|
||||
if 5 > len(ret) {
|
||||
logging.LogWarnf("invalid theme.json [%s]", p)
|
||||
return nil, errors.New("invalid theme.json")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func iconJSON(iconName string) (ret map[string]interface{}, err error) {
|
||||
p := filepath.Join(util.IconsPath, iconName, "icon.json")
|
||||
if !gulu.File.IsExist(p) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue