mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 10:30:13 +01:00
🎨 Improve marketplace loading https://github.com/siyuan-note/siyuan/issues/11179
This commit is contained in:
parent
479370b9f5
commit
bc22aa0c35
7 changed files with 66 additions and 21 deletions
|
|
@ -90,6 +90,9 @@ func Widgets() (widgets []*Widget) {
|
|||
widget.OpenIssues = repo.OpenIssues
|
||||
widget.Size = repo.Size
|
||||
widget.HSize = humanize.BytesCustomCeil(uint64(widget.Size), 2)
|
||||
widget.InstallSize = repo.InstallSize
|
||||
widget.HInstallSize = humanize.BytesCustomCeil(uint64(widget.InstallSize), 2)
|
||||
packageInstallSizeCache.SetDefault(widget.RepoURL, widget.InstallSize)
|
||||
widget.HUpdated = formatUpdated(widget.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -155,9 +158,14 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
continue
|
||||
}
|
||||
widget.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
widget.InstallSize = installSize
|
||||
widget.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
if installSize, ok := packageInstallSizeCache.Get(widget.RepoURL); ok {
|
||||
widget.InstallSize = installSize.(int64)
|
||||
} else {
|
||||
is, _ := util.SizeOfDirectory(installPath)
|
||||
widget.InstallSize = is
|
||||
packageInstallSizeCache.SetDefault(widget.RepoURL, is)
|
||||
}
|
||||
widget.HInstallSize = humanize.BytesCustomCeil(uint64(widget.InstallSize), 2)
|
||||
readmeFilename := getPreferredReadme(widget.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue