mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-04 20:00:17 +01:00
🔒 Perform authentication on paths such as widgets, plugins, and templates https://github.com/siyuan-note/siyuan/issues/17118#issuecomment-3984053596
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
3becde4d87
commit
d1170e7b71
1 changed files with 7 additions and 0 deletions
|
|
@ -369,6 +369,13 @@ func servePublic(ginServer *gin.Engine) {
|
|||
func serveSnippets(ginServer *gin.Engine) {
|
||||
ginServer.Handle("GET", "/snippets/*filepath", model.CheckAuth, func(c *gin.Context) {
|
||||
filePath := strings.TrimPrefix(c.Request.URL.Path, "/snippets/")
|
||||
if !model.IsAdminRoleContext(c) {
|
||||
if "conf.json" == filePath {
|
||||
c.Status(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ext := filepath.Ext(filePath)
|
||||
name := strings.TrimSuffix(filePath, ext)
|
||||
confSnippets, err := model.LoadSnippets()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue