Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0bca6687b0
7 changed files with 21 additions and 25 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 bo
|
|||
closeThemeWatchers()
|
||||
|
||||
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))
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue