mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
⚡ 改进非订阅用户集市包下载速度 Fix https://github.com/siyuan-note/siyuan/issues/5779
This commit is contained in:
parent
b0de05da78
commit
00e0f6b7de
7 changed files with 21 additions and 25 deletions
|
|
@ -37,9 +37,9 @@ import (
|
|||
"golang.org/x/text/transform"
|
||||
)
|
||||
|
||||
func GetPackageREADME(repoURL, repoHash string, chinaCDN bool, systemID string) (ret string) {
|
||||
func GetPackageREADME(repoURL, repoHash string, systemID string) (ret string) {
|
||||
repoURLHash := repoURL + "@" + repoHash
|
||||
data, err := downloadPackage(repoURLHash+"/README.md", chinaCDN, false, systemID)
|
||||
data, err := downloadPackage(repoURLHash+"/README.md", false, systemID)
|
||||
if nil != err {
|
||||
ret = "Load bazaar package's README.md failed: " + err.Error()
|
||||
return
|
||||
|
|
@ -75,14 +75,11 @@ func GetPackageREADME(repoURL, repoHash string, chinaCDN bool, systemID string)
|
|||
return
|
||||
}
|
||||
|
||||
func downloadPackage(repoURLHash string, chinaCDN, pushProgress bool, systemID string) (data []byte, err error) {
|
||||
func downloadPackage(repoURLHash string, pushProgress bool, systemID string) (data []byte, err error) {
|
||||
// repoURLHash: https://github.com/88250/Comfortably-Numb@6286912c381ef3f83e455d06ba4d369c498238dc
|
||||
pushID := repoURLHash[:strings.LastIndex(repoURLHash, "@")]
|
||||
repoURLHash = strings.TrimPrefix(repoURLHash, "https://github.com/")
|
||||
u := util.BazaarOSSFileServer + "/package/" + repoURLHash
|
||||
if chinaCDN {
|
||||
u = util.BazaarOSSServer + "/package/" + repoURLHash
|
||||
}
|
||||
u := util.BazaarOSSServer + "/package/" + repoURLHash
|
||||
buf := &bytes.Buffer{}
|
||||
resp, err := httpclient.NewBrowserDownloadRequest().SetOutput(buf).SetDownloadCallback(func(info req.DownloadInfo) {
|
||||
if pushProgress {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue