mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20: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
|
|
@ -94,6 +94,9 @@ func Plugins(frontend string) (plugins []*Plugin) {
|
|||
plugin.OpenIssues = repo.OpenIssues
|
||||
plugin.Size = repo.Size
|
||||
plugin.HSize = humanize.BytesCustomCeil(uint64(plugin.Size), 2)
|
||||
plugin.InstallSize = repo.InstallSize
|
||||
plugin.HInstallSize = humanize.BytesCustomCeil(uint64(plugin.InstallSize), 2)
|
||||
packageInstallSizeCache.SetDefault(plugin.RepoURL, plugin.InstallSize)
|
||||
plugin.HUpdated = formatUpdated(plugin.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -194,9 +197,14 @@ func InstalledPlugins(frontend string, checkUpdate bool) (ret []*Plugin) {
|
|||
continue
|
||||
}
|
||||
plugin.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
plugin.InstallSize = installSize
|
||||
plugin.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
if installSize, ok := packageInstallSizeCache.Get(plugin.RepoURL); ok {
|
||||
plugin.InstallSize = installSize.(int64)
|
||||
} else {
|
||||
is, _ := util.SizeOfDirectory(installPath)
|
||||
plugin.InstallSize = is
|
||||
packageInstallSizeCache.SetDefault(plugin.RepoURL, is)
|
||||
}
|
||||
plugin.HInstallSize = humanize.BytesCustomCeil(uint64(plugin.InstallSize), 2)
|
||||
readmeFilename := getPreferredReadme(plugin.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue