An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: 改进非订阅用户集市包下载速度 Fix https://github.com/siyuan-note/siyuan/issues/5779
Liang Ding00e0f6b7decb
diff --git a/kernel/bazaar/icon.go b/kernel/bazaar/icon.goindex 8a9768c1e3..80a156071b 100644--- a/kernel/bazaar/icon.go+++ b/kernel/bazaar/icon.go@@ -127,9 +127,9 @@ func Icons() (icons []*Icon) {return}-func InstallIcon(repoURL, repoHash, installPath string, chinaCDN bool, systemID string) error {+func InstallIcon(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHash- data, err := downloadPackage(repoURLHash, chinaCDN, true, systemID)+ data, err := downloadPackage(repoURLHash, true, systemID)if nil != err {return err}diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.goindex dd355a891d..12f8b7462d 100644--- a/kernel/bazaar/package.go+++ b/kernel/bazaar/package.go@@ -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@6286912c381ef3f83e455d06ba4d369c498238dcpushID := 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/" + repoURLHashbuf := &bytes.Buffer{}resp, err := httpclient.NewBrowserDownloadRequest().SetOutput(buf).SetDownloadCallback(func(info req.DownloadInfo) {if pushProgress {diff --git a/kernel/bazaar/template.go b/kernel/bazaar/template.goindex fc402897e2..c08083264f 100644--- a/kernel/bazaar/template.go+++ b/kernel/bazaar/template.go@@ -130,9 +130,9 @@ func Templates() (templates []*Template) {return}-func InstallTemplate(repoURL, repoHash, installPath string, chinaCDN bool, systemID string) error {+func InstallTemplate(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHash- data, err := downloadPackage(repoURLHash, chinaCDN, true, systemID)+ data, err := downloadPackage(repoURLHash, true, systemID)if nil != err {return err}diff --git a/kernel/bazaar/theme.go b/kernel/bazaar/theme.goindex 25842e7cc9..23a2a2ebf1 100644--- a/kernel/bazaar/theme.go+++ b/kernel/bazaar/theme.go@@ -129,9 +129,9 @@ func Themes() (ret []*Theme) {return}-func InstallTheme(repoURL, repoHash, installPath string, chinaCDN bool, systemID string) error {+func InstallTheme(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHash- data, err := downloadPackage(repoURLHash, chinaCDN, true, systemID)+ data, err := downloadPackage(repoURLHash, true, systemID)if nil != err {return err}diff --git a/kernel/bazaar/widget.go b/kernel/bazaar/widget.goindex 93e8d8ab57..db5742e340 100644--- a/kernel/bazaar/widget.go+++ b/kernel/bazaar/widget.go@@ -128,9 +128,9 @@ func Widgets() (widgets []*Widget) {return}-func InstallWidget(repoURL, repoHash, installPath string, chinaCDN bool, systemID string) error {+func InstallWidget(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHash- data, err := downloadPackage(repoURLHash, chinaCDN, true, systemID)+ data, err := downloadPackage(repoURLHash, true, systemID)if nil != err {return err}diff --git a/kernel/model/bazzar.go b/kernel/model/bazzar.goindex ca19b4bf1f..5dded0c908 100644--- a/kernel/model/bazzar.go+++ b/kernel/model/bazzar.go@@ -28,7 +28,7 @@ import ()func GetPackageREADME(repoURL, repoHash string) (ret string) {- ret = bazaar.GetPackageREADME(repoURL, repoHash, IsSubscriber(), Conf.System.ID)+ ret = bazaar.GetPackageREADME(repoURL, repoHash, Conf.System.ID)return}@@ -54,7 +54,7 @@ func InstallBazaarWidget(repoURL, repoHash, widgetName string) error {defer writingDataLock.Unlock()installPath := filepath.Join(util.DataDir, "widgets", widgetName)- err := bazaar.InstallWidget(repoURL, repoHash, installPath, IsSubscriber(), Conf.System.ID)+ err := bazaar.InstallWidget(repoURL, repoHash, installPath, Conf.System.ID)if nil != err {return errors.New(fmt.Sprintf(Conf.Language(46), widgetName))}@@ -96,7 +96,7 @@ func InstallBazaarIcon(repoURL, repoHash, iconName string) error {defer writingDataLock.Unlock()installPath := filepath.Join(util.IconsPath, iconName)- err := bazaar.InstallIcon(repoURL, repoHash, installPath, IsSubscriber(), Conf.System.ID)+ err := bazaar.InstallIcon(repoURL, repoHash, installPath, Conf.System.ID)if nil != err {return errors.New(fmt.Sprintf(Conf.Language(46), iconName))}@@ -145,7 +145,7 @@ func InstallBazaarTheme(repoURL, repoHash, themeName string, mode int, update bocloseThemeWatchers()installPath := filepath.Join(util.ThemesPath, themeName)- err := bazaar.InstallTheme(repoURL, repoHash, installPath, IsSubscriber(), Conf.System.ID)+ err := bazaar.InstallTheme(repoURL, repoHash, installPath, Conf.System.ID)if nil != err {return errors.New(fmt.Sprintf(Conf.Language(46), themeName))}@@ -202,7 +202,7 @@ func InstallBazaarTemplate(repoURL, repoHash, templateName string) error {defer writingDataLock.Unlock()installPath := filepath.Join(util.DataDir, "templates", templateName)- err := bazaar.InstallTemplate(repoURL, repoHash, installPath, IsSubscriber(), Conf.System.ID)+ err := bazaar.InstallTemplate(repoURL, repoHash, installPath, Conf.System.ID)if nil != err {return errors.New(fmt.Sprintf(Conf.Language(46), templateName))}diff --git a/kernel/util/path.go b/kernel/util/path.goindex b065c8890d..bfdcd09fbe 100644--- a/kernel/util/path.go+++ b/kernel/util/path.go@@ -34,11 +34,10 @@ var ()const (- ServerPort = "6806" // HTTP/WebSocket 端口- AliyunServer = "https://siyuan-sync.b3logfile.com" // 云端服务地址,阿里云负载均衡,用于接口,数据同步文件上传、下载会走七牛云 OSS http://siyuan-data.b3logfile.com- BazaarStatServer = "http://bazaar.b3logfile.com" // 集市包统计服务地址,直接对接 Bucket 没有 CDN 缓存- BazaarOSSServer = "https://oss.b3logfile.com" // 云端对象存储地址,七牛云,仅用于读取小文件(比如配置 json),不用于读取包内容(如果是订阅会员则用于读取包内容)- BazaarOSSFileServer = "https://oss0.b3logfile.com" // 云端对象存储文件服务地址,Cloudflare,用于读取包内容+ ServerPort = "6806" // HTTP/WebSocket 端口+ AliyunServer = "https://siyuan-sync.b3logfile.com" // 云端服务地址,阿里云负载均衡,用于接口,数据同步文件上传、下载会走七牛云 OSS http://siyuan-data.b3logfile.com+ BazaarStatServer = "http://bazaar.b3logfile.com" // 集市包统计服务地址,直接对接 Bucket 没有 CDN 缓存+ BazaarOSSServer = "https://oss.b3logfile.com" // 云端对象存储地址,七牛云,仅用于读取集市包)func ShortPathForBootingDisplay(p string) string {