Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-05-05 20:42:22 +08:00
commit a6ca9bdd09
6 changed files with 15 additions and 0 deletions

View file

@ -133,6 +133,7 @@ func InstalledIcons() (ret []*Icon) {
icon.PreviewURL = "/appearance/icons/" + dirName + "/preview.png"
icon.PreviewURLThumb = "/appearance/icons/" + dirName + "/preview.png"
icon.IconURL = "/appearance/icons/" + dirName + "/icon.png"
icon.Funding = parseFunding(iconConf)
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
if nil != statErr {
logging.LogWarnf("stat install theme README.md failed: %s", statErr)

View file

@ -75,6 +75,16 @@ type Package struct {
Downloads int `json:"downloads"`
}
func parseFunding(conf map[string]interface{}) (ret *Funding) {
ret = &Funding{}
funding := conf["funding"].(map[string]interface{})
ret.OpenCollective = funding["openCollective"].(string)
ret.Patreon = funding["patreon"].(string)
ret.GitHub = funding["github"].(string)
ret.Custom = funding["custom"].([]string)
return
}
func PluginJSON(pluginDirName string) (ret map[string]interface{}, err error) {
p := filepath.Join(util.DataDir, "plugins", pluginDirName, "plugin.json")
if !gulu.File.IsExist(p) {

View file

@ -138,6 +138,7 @@ func InstalledPlugins() (ret []*Plugin) {
plugin.PreviewURL = "/plugins/" + dirName + "/preview.png"
plugin.PreviewURLThumb = "/plugins/" + dirName + "/preview.png"
plugin.IconURL = "/plugins/" + dirName + "/icon.png"
plugin.Funding = parseFunding(pluginConf)
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
if nil != statErr {
logging.LogWarnf("stat install theme README.md failed: %s", statErr)

View file

@ -140,6 +140,7 @@ func InstalledTemplates() (ret []*Template) {
template.PreviewURL = "/templates/" + dirName + "/preview.png"
template.PreviewURLThumb = "/templates/" + dirName + "/preview.png"
template.IconURL = "/templates/" + dirName + "/icon.png"
template.Funding = parseFunding(templateConf)
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
if nil != statErr {
logging.LogWarnf("stat install theme README.md failed: %s", statErr)

View file

@ -144,6 +144,7 @@ func InstalledThemes() (ret []*Theme) {
theme.PreviewURL = "/appearance/themes/" + dirName + "/preview.png"
theme.PreviewURLThumb = "/appearance/themes/" + dirName + "/preview.png"
theme.IconURL = "/appearance/themes/" + dirName + "/icon.png"
theme.Funding = parseFunding(themeConf)
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
if nil != statErr {
logging.LogWarnf("stat install theme README.md failed: %s", statErr)

View file

@ -138,6 +138,7 @@ func InstalledWidgets() (ret []*Widget) {
widget.PreviewURL = "/widgets/" + dirName + "/preview.png"
widget.PreviewURLThumb = "/widgets/" + dirName + "/preview.png"
widget.IconURL = "/widgets/" + dirName + "/icon.png"
widget.Funding = parseFunding(widgetConf)
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
if nil != statErr {
logging.LogWarnf("stat install theme README.md failed: %s", statErr)