🎨 Marketplace introduction page https://github.com/siyuan-note/siyuan/issues/8324
This commit is contained in:
parent
b50dd5dca5
commit
1d5365294f
4 changed files with 62 additions and 0 deletions
|
@ -282,6 +282,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/setting/setEmoji", model.CheckAuth, model.CheckReadonly, setEmoji)
|
||||
ginServer.Handle("POST", "/api/setting/setFlashcard", model.CheckAuth, model.CheckReadonly, setFlashcard)
|
||||
ginServer.Handle("POST", "/api/setting/setAI", model.CheckAuth, model.CheckReadonly, setAI)
|
||||
ginServer.Handle("POST", "/api/setting/setBazaar", model.CheckAuth, model.CheckReadonly, setBazaar)
|
||||
|
||||
ginServer.Handle("POST", "/api/graph/resetGraph", model.CheckAuth, model.CheckReadonly, resetGraph)
|
||||
ginServer.Handle("POST", "/api/graph/resetLocalGraph", model.CheckAuth, model.CheckReadonly, resetLocalGraph)
|
||||
|
|
|
@ -29,6 +29,35 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func setBazaar(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
param, err := gulu.JSON.MarshalJSON(arg)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
bazaar := &conf.Bazaar{}
|
||||
if err = gulu.JSON.UnmarshalJSON(param, bazaar); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
model.Conf.Bazaar = bazaar
|
||||
model.Conf.Save()
|
||||
|
||||
ret.Data = bazaar
|
||||
}
|
||||
|
||||
func setAI(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
27
kernel/conf/bazaar.go
Normal file
27
kernel/conf/bazaar.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
// SiYuan - Build Your Eternal Digital Garden
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package conf
|
||||
|
||||
type Bazaar struct {
|
||||
Trust bool `json:"bool"`
|
||||
}
|
||||
|
||||
func NewBazaar() *Bazaar {
|
||||
return &Bazaar{
|
||||
Trust: false,
|
||||
}
|
||||
}
|
|
@ -72,6 +72,7 @@ type AppConf struct {
|
|||
Search *conf.Search `json:"search"` // 搜索配置
|
||||
Flashcard *conf.Flashcard `json:"flashcard"` // 闪卡配置
|
||||
AI *conf.AI `json:"ai"` // 人工智能配置
|
||||
Bazaar *conf.Bazaar `json:"bazaar"` // 集市配置
|
||||
Stat *conf.Stat `json:"stat"` // 统计
|
||||
Api *conf.API `json:"api"` // API
|
||||
Repo *conf.Repo `json:"repo"` // 数据仓库
|
||||
|
@ -288,6 +289,10 @@ func InitConf() {
|
|||
Conf.Api = conf.NewAPI()
|
||||
}
|
||||
|
||||
if nil == Conf.Bazaar {
|
||||
Conf.Bazaar = conf.NewBazaar()
|
||||
}
|
||||
|
||||
if nil == Conf.Repo {
|
||||
Conf.Repo = conf.NewRepo()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue