Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 改进集市已下载包的显示和更新 https://github.com/siyuan-note/siyuan/issues/5807

Liang Ding99fdfd796608
diff --git a/kernel/api/bazaar.go b/kernel/api/bazaar.go
index 1ee5011aec..1bfc36e250 100644
--- a/kernel/api/bazaar.go
+++ b/kernel/api/bazaar.go
@@ -21,7 +21,6 @@ import (
"github.com/88250/gulu"
"github.com/gin-gonic/gin"
- "github.com/siyuan-note/siyuan/kernel/bazaar"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
)
@@ -56,7 +55,7 @@ func getInstalledWidget(c *gin.Context) {
defer c.JSON(http.StatusOK, ret)
ret.Data = map[string]interface{}{
- "packages": bazaar.InstalledWidgets(),
+ "packages": model.InstalledWidgets(),
}
}
@@ -121,7 +120,7 @@ func getInstalledIcon(c *gin.Context) {
defer c.JSON(http.StatusOK, ret)
ret.Data = map[string]interface{}{
- "packages": bazaar.InstalledIcons(),
+ "packages": model.InstalledIcons(),
}
}
@@ -188,7 +187,7 @@ func getInstalledTemplate(c *gin.Context) {
defer c.JSON(http.StatusOK, ret)
ret.Data = map[string]interface{}{
- "packages": bazaar.InstalledTemplates(),
+ "packages": model.InstalledTemplates(),
}
}
@@ -254,7 +253,7 @@ func getInstalledTheme(c *gin.Context) {
defer c.JSON(http.StatusOK, ret)
ret.Data = map[string]interface{}{
- "packages": bazaar.InstalledThemes(),
+ "packages": model.InstalledThemes(),
}
}
diff --git a/kernel/model/bazzar.go b/kernel/model/bazzar.go
index 0cd39280d4..c379c4dc70 100644
--- a/kernel/model/bazzar.go
+++ b/kernel/model/bazzar.go
@@ -49,6 +49,11 @@ func BazaarWidgets() (widgets []*bazaar.Widget) {
return
}
+func InstalledWidgets() (widgets []*bazaar.Widget) {
+ widgets = bazaar.InstalledWidgets()
+ return
+}
+
func InstallBazaarWidget(repoURL, repoHash, widgetName string) error {
writingDataLock.Lock()
defer writingDataLock.Unlock()
@@ -91,6 +96,14 @@ func BazaarIcons() (icons []*bazaar.Icon) {
return
}
+func InstalledIcons() (icons []*bazaar.Icon) {
+ icons = bazaar.InstalledIcons()
+ for _, icon := range icons {
+ icon.Current = icon.Name == Conf.Appearance.Icon
+ }
+ return
+}
+
func InstallBazaarIcon(repoURL, repoHash, iconName string) error {
writingDataLock.Lock()
defer writingDataLock.Unlock()
@@ -138,6 +151,14 @@ func BazaarThemes() (ret []*bazaar.Theme) {
return
}
+func InstalledThemes() (ret []*bazaar.Theme) {
+ ret = bazaar.InstalledThemes()
+ for _, theme := range ret {
+ theme.Current = theme.Name == Conf.Appearance.ThemeDark || theme.Name == Conf.Appearance.ThemeLight
+ }
+ return
+}
+
func InstallBazaarTheme(repoURL, repoHash, themeName string, mode int, update bool) error {
writingDataLock.Lock()
defer writingDataLock.Unlock()
@@ -197,6 +218,11 @@ func BazaarTemplates() (templates []*bazaar.Template) {
return
}
+func InstalledTemplates() (templates []*bazaar.Template) {
+ templates = bazaar.InstalledTemplates()
+ return
+}
+
func InstallBazaarTemplate(repoURL, repoHash, templateName string) error {
writingDataLock.Lock()
defer writingDataLock.Unlock()