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

This commit is contained in:
Vanessa 2024-04-28 23:02:50 +08:00
commit e1f1a5b3c8
10 changed files with 237 additions and 78 deletions

View file

@ -7,7 +7,7 @@
"id": "20200924100950-9op5xi1",
"title": "Shortcuts",
"type": "doc",
"updated": "20240426233832"
"updated": "20240428230146"
},
"Children": [
{
@ -10745,7 +10745,7 @@
"Properties": {
"colgroup": "||",
"id": "20221105230832-4q1qwpt",
"updated": "20221105231226"
"updated": "20240428230146"
},
"Children": [
{
@ -11109,7 +11109,7 @@
"Children": [
{
"Type": "NodeText",
"Data": "Collapse/expand all subsets"
"Data": "Collapse/expand all sub-levels"
}
]
},
@ -11152,6 +11152,60 @@
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "Expand and insert last child"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Alt+Enter"
},
{
"Type": "NodeText",
"Data": " / "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⌥Enter"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "Cursor in folded item"
}
]
}
]
}
]
},

View file

@ -7,7 +7,7 @@
"id": "20200813004551-gm0pbn1",
"title": "快捷键",
"type": "doc",
"updated": "20240426233401"
"updated": "20240428230058"
},
"Children": [
{
@ -10728,7 +10728,7 @@
"Properties": {
"colgroup": "||",
"id": "20221105225614-a4zp7mm",
"updated": "20221105230438"
"updated": "20240428230058"
},
"Children": [
{
@ -11084,7 +11084,7 @@
"Children": [
{
"Type": "NodeText",
"Data": "折叠/展开所有子"
"Data": "折叠/展开所有子"
}
]
},
@ -11127,6 +11127,60 @@
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "展开并插入末尾子项"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Alt+Enter"
},
{
"Type": "NodeText",
"Data": " / "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⌥Enter"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "光标在折叠项中"
}
]
}
]
}
]
},

View file

@ -7,7 +7,7 @@
"id": "20211226122549-jktxego",
"title": "快捷鍵",
"type": "doc",
"updated": "20240426233618"
"updated": "20240428230152"
},
"Children": [
{
@ -11147,7 +11147,7 @@
"Properties": {
"colgroup": "||",
"id": "20221105230755-x4ktugr",
"updated": "20221105231222"
"updated": "20240428230152"
},
"Children": [
{
@ -11161,8 +11161,6 @@
{
"Type": "NodeTableCell",
"Data": "th",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11173,8 +11171,6 @@
{
"Type": "NodeTableCell",
"Data": "th",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11185,8 +11181,6 @@
{
"Type": "NodeTableCell",
"Data": "th",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11205,8 +11199,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11217,8 +11209,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11238,8 +11228,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 14,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11256,8 +11244,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 10,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11268,8 +11254,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11289,8 +11273,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 14,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11307,8 +11289,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 10,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11319,8 +11299,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 11,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11349,8 +11327,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 14,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11367,8 +11343,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 21,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11383,8 +11357,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 11,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11413,8 +11385,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 14,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11431,8 +11401,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 8,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11447,8 +11415,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 11,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11477,8 +11443,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 14,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11495,8 +11459,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 19,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
@ -11507,8 +11469,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 6,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11528,8 +11488,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 12,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11546,20 +11504,16 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 19,
"TableCellContentMaxWidth": 21,
"Children": [
{
"Type": "NodeText",
"Data": "折疊/展開所有子"
"Data": "折疊/展開所有子"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 11,
"TableCellContentMaxWidth": 11,
"Children": [
{
"Type": "NodeText",
@ -11588,8 +11542,6 @@
{
"Type": "NodeTableCell",
"Data": "td",
"TableCellContentWidth": 12,
"TableCellContentMaxWidth": 14,
"Children": [
{
"Type": "NodeText",
@ -11598,6 +11550,60 @@
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "展開並插入末尾子項"
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Alt+Enter"
},
{
"Type": "NodeText",
"Data": " / "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⌥Enter"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "遊標在折疊項中"
}
]
}
]
}
]
},

View file

@ -530,8 +530,10 @@ export const bazaar = {
<div class="ft__on-surface ft__smaller" style="line-height: 20px;">${window.siyuan.languages.currentVer}<br>v${data.version}</div>
<div class="fn__hr"></div>
<div class="ft__on-surface ft__smaller" style="line-height: 20px;">${dataObj.downloaded ? window.siyuan.languages.installDate : window.siyuan.languages.releaseDate}<br>${dataObj.downloaded ? data.hInstallDate : data.hUpdated}</div>
<div class="fn__hr${dataObj.downloaded?"fn__none":""}"></div>
<div class="ft__on-surface ft__smaller${dataObj.downloaded?"fn__none":""}" style="line-height: 20px;">${window.siyuan.languages.pkgSize}<br>${data.hSize}</div>
<div class="fn__hr"></div>
<div class="ft__on-surface ft__smaller" style="line-height: 20px;">${dataObj.downloaded ? window.siyuan.languages.installSize : window.siyuan.languages.pkgSize}<br>${dataObj.downloaded ? data.hInstallSize : data.hSize}</div>
<div class="ft__on-surface ft__smaller" style="line-height: 20px;">${window.siyuan.languages.installSize}<br>${data.hInstallSize}</div>
<div class="fn__hr--b"></div>
<div class="fn__hr--b"></div>
<div${(data.installed || dataObj.downloaded) ? ' class="fn__none"' : ""}>

View file

@ -89,6 +89,9 @@ func Icons() (icons []*Icon) {
icon.OpenIssues = repo.OpenIssues
icon.Size = repo.Size
icon.HSize = humanize.BytesCustomCeil(uint64(icon.Size), 2)
icon.InstallSize = repo.InstallSize
icon.HInstallSize = humanize.BytesCustomCeil(uint64(icon.InstallSize), 2)
packageInstallSizeCache.SetDefault(icon.RepoURL, icon.InstallSize)
icon.HUpdated = formatUpdated(icon.Updated)
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
if nil != pkg {
@ -156,9 +159,14 @@ func InstalledIcons() (ret []*Icon) {
continue
}
icon.HInstallDate = info.ModTime().Format("2006-01-02")
installSize, _ := util.SizeOfDirectory(installPath)
icon.InstallSize = installSize
icon.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
if installSize, ok := packageInstallSizeCache.Get(icon.RepoURL); ok {
icon.InstallSize = installSize.(int64)
} else {
is, _ := util.SizeOfDirectory(installPath)
icon.InstallSize = is
packageInstallSizeCache.SetDefault(icon.RepoURL, is)
}
icon.HInstallSize = humanize.BytesCustomCeil(uint64(icon.InstallSize), 2)
readmeFilename := getPreferredReadme(icon.Readme)
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
if nil != readErr {

View file

@ -121,11 +121,12 @@ type StagePackage struct {
}
type StageRepo struct {
URL string `json:"url"`
Updated string `json:"updated"`
Stars int `json:"stars"`
OpenIssues int `json:"openIssues"`
Size int64 `json:"size"`
URL string `json:"url"`
Updated string `json:"updated"`
Stars int `json:"stars"`
OpenIssues int `json:"openIssues"`
Size int64 `json:"size"`
InstallSize int64 `json:"installSize"`
Package *StagePackage `json:"package"`
}
@ -703,3 +704,5 @@ func disallowDisplayBazaarPackage(pkg *Package) bool {
}
var packageCache = gcache.New(6*time.Hour, 30*time.Minute) // [repoURL]*Package
var packageInstallSizeCache = gcache.New(48*time.Hour, 6*time.Hour) // [repoURL]*int64

View file

@ -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 {

View file

@ -90,6 +90,9 @@ func Templates() (templates []*Template) {
template.OpenIssues = repo.OpenIssues
template.Size = repo.Size
template.HSize = humanize.BytesCustomCeil(uint64(template.Size), 2)
template.InstallSize = repo.InstallSize
template.HInstallSize = humanize.BytesCustomCeil(uint64(template.InstallSize), 2)
packageInstallSizeCache.SetDefault(template.RepoURL, template.InstallSize)
template.HUpdated = formatUpdated(template.Updated)
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
if nil != pkg {
@ -157,9 +160,14 @@ func InstalledTemplates() (ret []*Template) {
continue
}
template.HInstallDate = info.ModTime().Format("2006-01-02")
installSize, _ := util.SizeOfDirectory(installPath)
template.InstallSize = installSize
template.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
if installSize, ok := packageInstallSizeCache.Get(template.RepoURL); ok {
template.InstallSize = installSize.(int64)
} else {
is, _ := util.SizeOfDirectory(installPath)
template.InstallSize = is
packageInstallSizeCache.SetDefault(template.RepoURL, is)
}
template.HInstallSize = humanize.BytesCustomCeil(uint64(template.InstallSize), 2)
readmeFilename := getPreferredReadme(template.Readme)
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
if nil != readErr {

View file

@ -91,6 +91,9 @@ func Themes() (ret []*Theme) {
theme.OpenIssues = repo.OpenIssues
theme.Size = repo.Size
theme.HSize = humanize.BytesCustomCeil(uint64(theme.Size), 2)
theme.InstallSize = repo.InstallSize
theme.HInstallSize = humanize.BytesCustomCeil(uint64(theme.InstallSize), 2)
packageInstallSizeCache.SetDefault(theme.RepoURL, theme.InstallSize)
theme.HUpdated = formatUpdated(theme.Updated)
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
if nil != pkg {
@ -158,9 +161,14 @@ func InstalledThemes() (ret []*Theme) {
continue
}
theme.HInstallDate = info.ModTime().Format("2006-01-02")
installSize, _ := util.SizeOfDirectory(installPath)
theme.InstallSize = installSize
theme.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
if installSize, ok := packageInstallSizeCache.Get(theme.RepoURL); ok {
theme.InstallSize = installSize.(int64)
} else {
is, _ := util.SizeOfDirectory(installPath)
theme.InstallSize = is
packageInstallSizeCache.SetDefault(theme.RepoURL, is)
}
theme.HInstallSize = humanize.BytesCustomCeil(uint64(theme.InstallSize), 2)
readmeFilename := getPreferredReadme(theme.Readme)
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
if nil != readErr {

View file

@ -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 {