mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-02 10:50:15 +01:00
🎨 改进集市已下载包更新 https://github.com/siyuan-note/siyuan/issues/5807
This commit is contained in:
parent
9bc71a9f2c
commit
3bb1427492
12 changed files with 32 additions and 9 deletions
|
|
@ -135,8 +135,12 @@ func InstalledIcons() (ret []*Icon) {
|
|||
icon.RepoURL = icon.URL
|
||||
icon.PreviewURL = "/appearance/icons/" + dirName + "/preview.png"
|
||||
icon.PreviewURLThumb = "/appearance/icons/" + dirName + "/preview.png"
|
||||
icon.Updated = iconDir.ModTime().Format("2006-01-02 15:04:05")
|
||||
icon.HUpdated = formatUpdated(icon.Updated)
|
||||
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
|
||||
if nil != statErr {
|
||||
logging.LogWarnf("stat install theme README.md failed: %s", statErr)
|
||||
continue
|
||||
}
|
||||
icon.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
icon.InstallSize = installSize
|
||||
icon.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ type Package struct {
|
|||
HSize string `json:"hSize"`
|
||||
InstallSize int64 `json:"installSize"`
|
||||
HInstallSize string `json:"hInstallSize"`
|
||||
HInstallDate string `json:"hInstallDate"`
|
||||
HUpdated string `json:"hUpdated"`
|
||||
Downloads int `json:"downloads"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,8 +135,12 @@ func InstalledTemplates() (ret []*Template) {
|
|||
template.RepoURL = template.URL
|
||||
template.PreviewURL = "/templates/" + dirName + "/preview.png"
|
||||
template.PreviewURLThumb = "/templates/" + dirName + "/preview.png"
|
||||
template.Updated = templateDir.ModTime().Format("2006-01-02 15:04:05")
|
||||
template.HUpdated = formatUpdated(template.Updated)
|
||||
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
|
||||
if nil != statErr {
|
||||
logging.LogWarnf("stat install theme README.md failed: %s", statErr)
|
||||
continue
|
||||
}
|
||||
template.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
template.InstallSize = installSize
|
||||
template.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
|
|
|
|||
|
|
@ -138,8 +138,12 @@ func InstalledThemes() (ret []*Theme) {
|
|||
theme.RepoURL = theme.URL
|
||||
theme.PreviewURL = "/appearance/themes/" + dirName + "/preview.png"
|
||||
theme.PreviewURLThumb = "/appearance/themes/" + dirName + "/preview.png"
|
||||
theme.Updated = themeDir.ModTime().Format("2006-01-02 15:04:05")
|
||||
theme.HUpdated = formatUpdated(theme.Updated)
|
||||
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
|
||||
if nil != statErr {
|
||||
logging.LogWarnf("stat install theme README.md failed: %s", statErr)
|
||||
continue
|
||||
}
|
||||
theme.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
theme.InstallSize = installSize
|
||||
theme.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
|
|
|
|||
|
|
@ -133,8 +133,12 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
widget.RepoURL = widget.URL
|
||||
widget.PreviewURL = "/widgets/" + dirName + "/preview.png"
|
||||
widget.PreviewURLThumb = "/widgets/" + dirName + "/preview.png"
|
||||
widget.Updated = widgetDir.ModTime().Format("2006-01-02 15:04:05")
|
||||
widget.HUpdated = formatUpdated(widget.Updated)
|
||||
info, statErr := os.Stat(filepath.Join(installPath, "README.md"))
|
||||
if nil != statErr {
|
||||
logging.LogWarnf("stat install theme README.md failed: %s", statErr)
|
||||
continue
|
||||
}
|
||||
widget.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
widget.InstallSize = installSize
|
||||
widget.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue