mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 集市支持已安装的包单独显示 https://github.com/siyuan-note/siyuan/issues/5678
This commit is contained in:
parent
f9fdabf665
commit
6072f8a3a1
7 changed files with 158 additions and 100 deletions
|
|
@ -34,27 +34,7 @@ import (
|
|||
)
|
||||
|
||||
type Template struct {
|
||||
Author string `json:"author"`
|
||||
URL string `json:"url"`
|
||||
Version string `json:"version"`
|
||||
|
||||
Name string `json:"name"`
|
||||
RepoURL string `json:"repoURL"`
|
||||
RepoHash string `json:"repoHash"`
|
||||
PreviewURL string `json:"previewURL"`
|
||||
PreviewURLThumb string `json:"previewURLThumb"`
|
||||
|
||||
README string `json:"readme"`
|
||||
|
||||
Installed bool `json:"installed"`
|
||||
Outdated bool `json:"outdated"`
|
||||
Updated string `json:"updated"`
|
||||
Stars int `json:"stars"`
|
||||
OpenIssues int `json:"openIssues"`
|
||||
Size int64 `json:"size"`
|
||||
HSize string `json:"hSize"`
|
||||
HUpdated string `json:"hUpdated"`
|
||||
Downloads int `json:"downloads"`
|
||||
Package
|
||||
}
|
||||
|
||||
func Templates() (templates []*Template) {
|
||||
|
|
@ -131,11 +111,14 @@ func InstalledTemplates() (ret []*Template) {
|
|||
}
|
||||
dir.Close()
|
||||
|
||||
bazaarTemplates := Templates()
|
||||
|
||||
for _, templateDir := range templateDirs {
|
||||
if !templateDir.IsDir() {
|
||||
continue
|
||||
}
|
||||
dirName := templateDir.Name()
|
||||
|
||||
templateConf, parseErr := TemplateJSON(dirName)
|
||||
if nil != parseErr || nil == templateConf {
|
||||
continue
|
||||
|
|
@ -159,7 +142,7 @@ func InstalledTemplates() (ret []*Template) {
|
|||
continue
|
||||
}
|
||||
template.README = gulu.Str.FromBytes(readme)
|
||||
|
||||
template.Outdated = isOutdatedTemplate(template.URL, template.Version, bazaarTemplates)
|
||||
ret = append(ret, template)
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue