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

This commit is contained in:
Liang Ding 2023-05-05 15:46:09 +08:00
parent 93dad2bfb2
commit 897e98bd0d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 11 additions and 0 deletions

View file

@ -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)

View file

@ -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"`

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)