mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
🎨 集市支持已安装的包单独显示 https://github.com/siyuan-note/siyuan/issues/5678
This commit is contained in:
parent
29021c8d02
commit
74b73d02bc
5 changed files with 59 additions and 68 deletions
|
|
@ -81,6 +81,46 @@ func ThemeJSON(themeDirName string) (ret map[string]interface{}, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func getPkgIndex(pkgType string) (ret map[string]interface{}, err error) {
|
||||
ret, err = util.GetRhyResult(false)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
bazaarHash := ret["bazaar"].(string)
|
||||
ret = map[string]interface{}{}
|
||||
request := httpclient.NewBrowserRequest()
|
||||
u := util.BazaarOSSServer + "/bazaar@" + bazaarHash + "/stage/" + pkgType + ".json"
|
||||
resp, reqErr := request.SetResult(&ret).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
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func isOutdatedPkg(fullURL, version string, pkgIndex map[string]interface{}) bool {
|
||||
if !strings.HasPrefix(fullURL, "https://github.com/") {
|
||||
return false
|
||||
}
|
||||
|
||||
url := strings.TrimPrefix(fullURL, "https://github.com/")
|
||||
repos := pkgIndex["repos"].([]interface{})
|
||||
for _, repo := range repos {
|
||||
r := repo.(map[string]interface{})
|
||||
repoURL := r["url"].(string)
|
||||
repoVer := r["version"].(string)
|
||||
if url == repoURL && version != repoVer {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func GetPackageREADME(repoURL, repoHash string, systemID string) (ret string) {
|
||||
repoURLHash := repoURL + "@" + repoHash
|
||||
data, err := downloadPackage(repoURLHash+"/README.md", false, systemID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue