An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Enable or disable all CSS and JS code snippets https://github.com/siyuan-note/siyuan/issues/9860
Daniel81780c81c877
diff --git a/kernel/api/snippet.go b/kernel/api/snippet.goindex 60d82edc60..899f9d48a6 100644--- a/kernel/api/snippet.go+++ b/kernel/api/snippet.go@@ -37,7 +37,7 @@ func serveSnippets(c *gin.Context) {name := strings.TrimSuffix(filePath, ext)confSnippets, err := model.LoadSnippets()if nil != err {- logging.LogErrorf("load snippets failed: %s", name, err)+ logging.LogErrorf("load snippets failed: %s", err)c.Status(404)return}diff --git a/kernel/conf/snippet.go b/kernel/conf/snippet.goindex ff43528e84..71d987e229 100644--- a/kernel/conf/snippet.go+++ b/kernel/conf/snippet.go@@ -16,6 +16,18 @@package conf+type Snpt struct {+ EnabledCSS bool `json:"enabledCSS"`+ EnabledJS bool `json:"enabledJS"`+}++func NewSnpt() *Snpt {+ return &Snpt{+ EnabledCSS: true,+ EnabledJS: true,+ }+}+type Snippet struct {ID string `json:"id"`Name string `json:"name"`diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex 8962dc17a8..c26a7c0fc8 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -80,6 +80,7 @@ type AppConf struct {OpenHelp bool `json:"openHelp"` // 启动后是否需要打开用户指南ShowChangelog bool `json:"showChangelog"` // 是否显示版本更新日志CloudRegion int `json:"cloudRegion"` // 云端区域,0:中国大陆,1:北美+ Snippet *conf.Snpt `json:"snippet"` // 代码片段m *sync.Mutex}@@ -300,6 +301,10 @@ func InitConf() {Conf.System.Name = util.GetDeviceName()}+ if nil == Conf.Snippet {+ Conf.Snippet = conf.NewSnpt()+ }+Conf.System.AppDir = util.WorkingDirConf.System.ConfDir = util.ConfDirConf.System.HomeDir = util.HomeDir