Support read-only publish service

* 🎨 kernel supports read-only publishing services

* 🐛 Fix authentication vulnerabilities

* 🎨 Protect secret information

* 🎨 Adjust the permission control

* 🎨 Adjust the permission control

* 🎨 Fixed the vulnerability that `getFile` gets file `conf.json`

* 🎨 Add API `/api/setting/setPublish`

* 🎨 Add API `/api/setting/getPublish`

* 🐛 Fixed the issue that PWA-related files could not pass BasicAuth

* 🎨 Add a settings panel for publishing features

* 📝 Add guide for `Publish Service`

* 📝 Update Japanese user guide

* 🎨 Merge fixed static file services
This commit is contained in:
Yingyi / 颖逸 2024-06-12 21:03:51 +08:00 committed by GitHub
parent 536879cb84
commit ba2193403d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 3690 additions and 375 deletions

View file

@ -76,6 +76,7 @@ type AppConf struct {
Stat *conf.Stat `json:"stat"` // 统计
Api *conf.API `json:"api"` // API
Repo *conf.Repo `json:"repo"` // 数据仓库
Publish *conf.Publish `json:"publish"` // 发布服务
OpenHelp bool `json:"openHelp"` // 启动后是否需要打开用户指南
ShowChangelog bool `json:"showChangelog"` // 是否显示版本更新日志
CloudRegion int `json:"cloudRegion"` // 云端区域0中国大陆1北美
@ -357,6 +358,10 @@ func InitConf() {
Conf.Bazaar = conf.NewBazaar()
}
if nil == Conf.Publish {
Conf.Publish = conf.NewPublish()
}
if nil == Conf.Repo {
Conf.Repo = conf.NewRepo()
}
@ -894,6 +899,24 @@ func GetMaskedConf() (ret *AppConf, err error) {
return
}
// REF: https://github.com/siyuan-note/siyuan/issues/11364
// HideConfSecret 隐藏设置中的秘密信息
func HideConfSecret(c *AppConf) {
c.AI = &conf.AI{}
c.Api = &conf.API{}
c.Flashcard = &conf.Flashcard{}
c.LocalIPs = []string{}
c.Publish = &conf.Publish{}
c.Repo = &conf.Repo{}
c.Sync = &conf.Sync{}
c.System.AppDir = ""
c.System.ConfDir = ""
c.System.DataDir = ""
c.System.HomeDir = ""
c.System.Name = ""
c.System.NetworkProxy = &conf.NetworkProxy{}
}
func clearPortJSON() {
pid := fmt.Sprintf("%d", os.Getpid())
portJSON := filepath.Join(util.HomeDir, ".config", "siyuan", "port.json")