This commit is contained in:
Daniel 2023-10-22 11:03:49 +08:00
parent 5f0567f134
commit 9f9494a4e7
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 185 additions and 20 deletions

View file

@ -52,9 +52,13 @@ func getBazaarPlugin(c *gin.Context) {
}
frontend := arg["frontend"].(string)
var keyword string
if keywordArg := arg["keyword"]; nil != keywordArg {
keyword = keywordArg.(string)
}
ret.Data = map[string]interface{}{
"packages": model.BazaarPlugins(frontend),
"packages": model.BazaarPlugins(frontend, keyword),
}
}
@ -97,7 +101,7 @@ func installBazaarPlugin(c *gin.Context) {
util.PushMsg(model.Conf.Language(69), 3000)
ret.Data = map[string]interface{}{
"packages": model.BazaarPlugins(frontend),
"packages": model.BazaarPlugins(frontend, ""),
}
}
@ -120,7 +124,7 @@ func uninstallBazaarPlugin(c *gin.Context) {
}
ret.Data = map[string]interface{}{
"packages": model.BazaarPlugins(frontend),
"packages": model.BazaarPlugins(frontend, ""),
}
}
@ -128,8 +132,18 @@ func getBazaarWidget(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
var keyword string
if keywordArg := arg["keyword"]; nil != keywordArg {
keyword = keywordArg.(string)
}
ret.Data = map[string]interface{}{
"packages": model.BazaarWidgets(),
"packages": model.BazaarWidgets(keyword),
}
}
@ -163,7 +177,7 @@ func installBazaarWidget(c *gin.Context) {
util.PushMsg(model.Conf.Language(69), 3000)
ret.Data = map[string]interface{}{
"packages": model.BazaarWidgets(),
"packages": model.BazaarWidgets(""),
}
}
@ -185,7 +199,7 @@ func uninstallBazaarWidget(c *gin.Context) {
}
ret.Data = map[string]interface{}{
"packages": model.BazaarWidgets(),
"packages": model.BazaarWidgets(""),
}
}
@ -193,8 +207,18 @@ func getBazaarIcon(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
var keyword string
if keywordArg := arg["keyword"]; nil != keywordArg {
keyword = keywordArg.(string)
}
ret.Data = map[string]interface{}{
"packages": model.BazaarIcons(),
"packages": model.BazaarIcons(keyword),
}
}
@ -228,7 +252,7 @@ func installBazaarIcon(c *gin.Context) {
util.PushMsg(model.Conf.Language(69), 3000)
ret.Data = map[string]interface{}{
"packages": model.BazaarIcons(),
"packages": model.BazaarIcons(""),
"appearance": model.Conf.Appearance,
}
}
@ -251,7 +275,7 @@ func uninstallBazaarIcon(c *gin.Context) {
}
ret.Data = map[string]interface{}{
"packages": model.BazaarIcons(),
"packages": model.BazaarIcons(""),
"appearance": model.Conf.Appearance,
}
}
@ -260,8 +284,18 @@ func getBazaarTemplate(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
var keyword string
if keywordArg := arg["keyword"]; nil != keywordArg {
keyword = keywordArg.(string)
}
ret.Data = map[string]interface{}{
"packages": model.BazaarTemplates(),
"packages": model.BazaarTemplates(keyword),
}
}
@ -294,7 +328,7 @@ func installBazaarTemplate(c *gin.Context) {
}
ret.Data = map[string]interface{}{
"packages": model.BazaarTemplates(),
"packages": model.BazaarTemplates(""),
}
util.PushMsg(model.Conf.Language(69), 3000)
@ -318,7 +352,7 @@ func uninstallBazaarTemplate(c *gin.Context) {
}
ret.Data = map[string]interface{}{
"packages": model.BazaarTemplates(),
"packages": model.BazaarTemplates(""),
}
}
@ -326,8 +360,18 @@ func getBazaarTheme(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
var keyword string
if keywordArg := arg["keyword"]; nil != keywordArg {
keyword = keywordArg.(string)
}
ret.Data = map[string]interface{}{
"packages": model.BazaarThemes(),
"packages": model.BazaarThemes(keyword),
}
}
@ -370,7 +414,7 @@ func installBazaarTheme(c *gin.Context) {
util.PushMsg(model.Conf.Language(69), 3000)
ret.Data = map[string]interface{}{
"packages": model.BazaarThemes(),
"packages": model.BazaarThemes(""),
"appearance": model.Conf.Appearance,
}
}
@ -393,7 +437,7 @@ func uninstallBazaarTheme(c *gin.Context) {
}
ret.Data = map[string]interface{}{
"packages": model.BazaarThemes(),
"packages": model.BazaarThemes(""),
"appearance": model.Conf.Appearance,
}
}