瀏覽代碼

:art: Add icon settings in marketplace package https://github.com/siyuan-note/siyuan/issues/8174

Liang Ding 2 年之前
父節點
當前提交
897e98bd0d
共有 6 個文件被更改,包括 11 次插入0 次删除
  1. 2 0
      kernel/bazaar/icon.go
  2. 1 0
      kernel/bazaar/package.go
  3. 2 0
      kernel/bazaar/plugin.go
  4. 2 0
      kernel/bazaar/template.go
  5. 2 0
      kernel/bazaar/theme.go
  6. 2 0
      kernel/bazaar/widget.go

+ 2 - 0
kernel/bazaar/icon.go

@@ -70,6 +70,7 @@ func Icons() (icons []*Icon) {
 		icon.RepoHash = repoURLHash[1]
 		icon.PreviewURL = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageslim"
 		icon.PreviewURLThumb = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageView2/2/w/436/h/232"
+		icon.IconURL = util.BazaarOSSServer + "/package/" + repoURL + "/icon.png"
 		icon.Updated = repo["updated"].(string)
 		icon.Stars = int(repo["stars"].(float64))
 		icon.OpenIssues = int(repo["openIssues"].(float64))
@@ -131,6 +132,7 @@ func InstalledIcons() (ret []*Icon) {
 		icon.RepoURL = icon.URL
 		icon.PreviewURL = "/appearance/icons/" + dirName + "/preview.png"
 		icon.PreviewURLThumb = "/appearance/icons/" + dirName + "/preview.png"
+		icon.IconURL = "/appearance/icons/" + dirName + "/icon.png"
 		info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
 		if nil != statErr {
 			logging.LogWarnf("stat install theme README.md failed: %s", statErr)

+ 1 - 0
kernel/bazaar/package.go

@@ -56,6 +56,7 @@ type Package struct {
 	RepoHash        string `json:"repoHash"`
 	PreviewURL      string `json:"previewURL"`
 	PreviewURLThumb string `json:"previewURLThumb"`
+	IconURL         string `json:"iconURL"`
 
 	README string `json:"readme"`
 

+ 2 - 0
kernel/bazaar/plugin.go

@@ -72,6 +72,7 @@ func Plugins() (plugins []*Plugin) {
 		plugin.RepoHash = repoURLHash[1]
 		plugin.PreviewURL = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageslim"
 		plugin.PreviewURLThumb = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageView2/2/w/436/h/232"
+		plugin.IconURL = util.BazaarOSSServer + "/package/" + repoURL + "/icon.png"
 		plugin.Updated = repo["updated"].(string)
 		plugin.Stars = int(repo["stars"].(float64))
 		plugin.OpenIssues = int(repo["openIssues"].(float64))
@@ -136,6 +137,7 @@ func InstalledPlugins() (ret []*Plugin) {
 		plugin.RepoURL = plugin.URL
 		plugin.PreviewURL = "/plugins/" + dirName + "/preview.png"
 		plugin.PreviewURLThumb = "/plugins/" + dirName + "/preview.png"
+		plugin.IconURL = "/plugins/" + dirName + "/icon.png"
 		info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
 		if nil != statErr {
 			logging.LogWarnf("stat install theme README.md failed: %s", statErr)

+ 2 - 0
kernel/bazaar/template.go

@@ -72,6 +72,7 @@ func Templates() (templates []*Template) {
 		template.RepoHash = repoURLHash[1]
 		template.PreviewURL = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageslim"
 		template.PreviewURLThumb = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageView2/2/w/436/h/232"
+		template.IconURL = util.BazaarOSSServer + "/package/" + repoURL + "/icon.png"
 		template.Updated = repo["updated"].(string)
 		template.Stars = int(repo["stars"].(float64))
 		template.OpenIssues = int(repo["openIssues"].(float64))
@@ -138,6 +139,7 @@ func InstalledTemplates() (ret []*Template) {
 		template.RepoURL = template.URL
 		template.PreviewURL = "/templates/" + dirName + "/preview.png"
 		template.PreviewURLThumb = "/templates/" + dirName + "/preview.png"
+		template.IconURL = "/templates/" + dirName + "/icon.png"
 		info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
 		if nil != statErr {
 			logging.LogWarnf("stat install theme README.md failed: %s", statErr)

+ 2 - 0
kernel/bazaar/theme.go

@@ -73,6 +73,7 @@ func Themes() (ret []*Theme) {
 		theme.RepoHash = repoURLHash[1]
 		theme.PreviewURL = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageslim"
 		theme.PreviewURLThumb = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageView2/2/w/436/h/232"
+		theme.IconURL = util.BazaarOSSServer + "/package/" + repoURL + "/icon.png"
 		theme.Updated = repo["updated"].(string)
 		theme.Stars = int(repo["stars"].(float64))
 		theme.OpenIssues = int(repo["openIssues"].(float64))
@@ -142,6 +143,7 @@ func InstalledThemes() (ret []*Theme) {
 		theme.RepoURL = theme.URL
 		theme.PreviewURL = "/appearance/themes/" + dirName + "/preview.png"
 		theme.PreviewURLThumb = "/appearance/themes/" + dirName + "/preview.png"
+		theme.IconURL = "/appearance/themes/" + dirName + "/icon.png"
 		info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
 		if nil != statErr {
 			logging.LogWarnf("stat install theme README.md failed: %s", statErr)

+ 2 - 0
kernel/bazaar/widget.go

@@ -72,6 +72,7 @@ func Widgets() (widgets []*Widget) {
 		widget.RepoHash = repoURLHash[1]
 		widget.PreviewURL = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageslim"
 		widget.PreviewURLThumb = util.BazaarOSSServer + "/package/" + repoURL + "/preview.png?imageView2/2/w/436/h/232"
+		widget.IconURL = util.BazaarOSSServer + "/package/" + repoURL + "/icon.png"
 		widget.Updated = repo["updated"].(string)
 		widget.Stars = int(repo["stars"].(float64))
 		widget.OpenIssues = int(repo["openIssues"].(float64))
@@ -136,6 +137,7 @@ func InstalledWidgets() (ret []*Widget) {
 		widget.RepoURL = widget.URL
 		widget.PreviewURL = "/widgets/" + dirName + "/preview.png"
 		widget.PreviewURLThumb = "/widgets/" + dirName + "/preview.png"
+		widget.IconURL = "/widgets/" + dirName + "/icon.png"
 		info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
 		if nil != statErr {
 			logging.LogWarnf("stat install theme README.md failed: %s", statErr)