🎨 集市支持已安装的包单独显示 https://github.com/siyuan-note/siyuan/issues/5678

This commit is contained in:
Liang Ding 2022-09-01 20:10:36 +08:00
parent 29021c8d02
commit 74b73d02bc
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 59 additions and 68 deletions

View file

@ -59,27 +59,13 @@ type Template struct {
func Templates() (templates []*Template) {
templates = []*Template{}
result, err := util.GetRhyResult(false)
pkgIndex, err := getPkgIndex("templates")
if nil != err {
return
}
bazaarIndex := getBazaarIndex()
bazaarHash := result["bazaar"].(string)
result = map[string]interface{}{}
request := httpclient.NewBrowserRequest()
u := util.BazaarOSSServer + "/bazaar@" + bazaarHash + "/stage/templates.json"
resp, reqErr := request.SetResult(&result).Get(u)
if nil != reqErr {
logging.LogErrorf("get community stage index [%s] failed: %s", u, reqErr)
return
}
if 200 != resp.StatusCode {
logging.LogErrorf("get community stage index [%s] failed: %d", u, resp.StatusCode)
return
}
repos := result["repos"].([]interface{})
repos := pkgIndex["repos"].([]interface{})
waitGroup := &sync.WaitGroup{}
lock := &sync.Mutex{}
p, _ := ants.NewPoolWithFunc(2, func(arg interface{}) {