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: Add field `disabledInPublish` to the code snippet to indicate whether it is disabled in the publish service https://github.com/siyuan-note/siyuan/issues/15806
Daniel93422c134dd3
diff --git a/app/changelogs/v3.3.2/v3.3.2.md b/app/changelogs/v3.3.2/v3.3.2.mdindex e1c6dff48e..43c0665a1d 100644--- a/app/changelogs/v3.3.2/v3.3.2.md+++ b/app/changelogs/v3.3.2/v3.3.2.md@@ -25,6 +25,7 @@ Below are the detailed changes in this version.* [Dragging multiple files into the editor will cause them to be opened by the default program](https://github.com/siyuan-note/siyuan/pull/15773)* [Improve HTML table clipping](https://github.com/siyuan-note/siyuan/issues/15781)* [Automatically create a new document when clicking on a notebook without documents](https://github.com/siyuan-note/siyuan/issues/15782)+* [Add field `disabledInPublish` to the code snippet to indicate whether it is disabled in the publish service](https://github.com/siyuan-note/siyuan/issues/15806)### Bugfixdiff --git a/app/changelogs/v3.3.2/v3.3.2_zh_CHT.md b/app/changelogs/v3.3.2/v3.3.2_zh_CHT.mdindex a64ea0b76c..f55c490c4d 100644--- a/app/changelogs/v3.3.2/v3.3.2_zh_CHT.md+++ b/app/changelogs/v3.3.2/v3.3.2_zh_CHT.md@@ -25,6 +25,7 @@* [拖入多個檔案到編輯器不再被預設程式開啟](https://github.com/siyuan-note/siyuan/pull/15773)* [改進 HTML 表格剪藏](https://github.com/siyuan-note/siyuan/issues/15781)* [點選無文件的筆記本時自動新建文件](https://github.com/siyuan-note/siyuan/issues/15782)+* [程式碼片段新增欄位 `disabledInPublish`,用於識別發佈服務中是否已停用](https://github.com/siyuan-note/siyuan/issues/15806)### 修復缺陷diff --git a/app/changelogs/v3.3.2/v3.3.2_zh_CN.md b/app/changelogs/v3.3.2/v3.3.2_zh_CN.mdindex d6c2304bd5..1d7e8c51f5 100644--- a/app/changelogs/v3.3.2/v3.3.2_zh_CN.md+++ b/app/changelogs/v3.3.2/v3.3.2_zh_CN.md@@ -25,6 +25,7 @@* [拖入多个文件到编辑器不再被默认程序打开](https://github.com/siyuan-note/siyuan/pull/15773)* [改进 HTML 表格剪藏](https://github.com/siyuan-note/siyuan/issues/15781)* [点击无文档的笔记本时自动新建文档](https://github.com/siyuan-note/siyuan/issues/15782)+* [代码片段新增字段 `disabledInPublish`,用于标识发布服务中是否禁用](https://github.com/siyuan-note/siyuan/issues/15806)### 修复缺陷diff --git a/kernel/api/snippet.go b/kernel/api/snippet.goindex 460dffb410..3f6bb0880a 100644--- a/kernel/api/snippet.go+++ b/kernel/api/snippet.go@@ -55,11 +55,20 @@ func getSnippet(c *gin.Context) {return}+ isPublish := model.IsReadOnlyRole(model.GetGinContextRole(c))var snippets []*conf.Snippetfor _, s := range confSnippets {- if ("all" == typ || s.Type == typ) && (2 == enabledArg || s.Enabled == enabled) {- snippets = append(snippets, s)+ if isPublish && s.DisabledInPublish {+ continue}+ if "all" != typ && s.Type != typ {+ continue+ }+ if 2 != enabledArg && s.Enabled != enabled {+ continue+ }++ snippets = append(snippets, s)}if "" != keyword {@@ -101,6 +110,9 @@ func setSnippet(c *gin.Context) {Content: m["content"].(string),Enabled: m["enabled"].(bool),}+ if nil != m["disabledInPublish"] {+ snippet.DisabledInPublish = m["disabledInPublish"].(bool)+ }if "" == snippet.ID {snippet.ID = ast.NewNodeID()}diff --git a/kernel/conf/snippet.go b/kernel/conf/snippet.goindex 71d987e229..8bedc3769b 100644--- a/kernel/conf/snippet.go+++ b/kernel/conf/snippet.go@@ -29,9 +29,10 @@ func NewSnpt() *Snpt {}type Snippet struct {- ID string `json:"id"`- Name string `json:"name"`- Type string `json:"type"` // js/css- Enabled bool `json:"enabled"`- Content string `json:"content"`+ ID string `json:"id"`+ Name string `json:"name"`+ Type string `json:"type"` // js/css+ Enabled bool `json:"enabled"`+ DisabledInPublish bool `json:"disabledInPublish"`+ Content string `json:"content"`}