mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-29 12:58:48 +01:00
🎨 改进集市已下载包更新 https://github.com/siyuan-note/siyuan/issues/5807
This commit is contained in:
parent
fcfbab3652
commit
9bc71a9f2c
15 changed files with 49 additions and 38 deletions
|
|
@ -122,6 +122,8 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
continue
|
||||
}
|
||||
|
||||
installPath := filepath.Join(util.DataDir, "widgets", dirName)
|
||||
|
||||
widget := &Widget{}
|
||||
widget.Installed = true
|
||||
widget.Name = widgetConf["name"].(string)
|
||||
|
|
@ -132,10 +134,11 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
widget.PreviewURL = "/widgets/" + dirName + "/preview.png"
|
||||
widget.PreviewURLThumb = "/widgets/" + dirName + "/preview.png"
|
||||
widget.Updated = widgetDir.ModTime().Format("2006-01-02 15:04:05")
|
||||
widget.Size = widgetDir.Size()
|
||||
widget.HSize = humanize.Bytes(uint64(widget.Size))
|
||||
widget.HUpdated = formatUpdated(widget.Updated)
|
||||
readme, readErr := os.ReadFile(filepath.Join(util.DataDir, "widgets", dirName, "README.md"))
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
widget.InstallSize = installSize
|
||||
widget.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, "README.md"))
|
||||
if nil != readErr {
|
||||
logging.LogWarnf("read install widget README.md failed: %s", readErr)
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue