An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Fix locating the built-in Pandoc executable https://github.com/siyuan-note/siyuan/issues/18437
Danielafdf8c7082aa
diff --git a/app/src/config/tabs/exportTab.ts b/app/src/config/tabs/exportTab.tsindex dd87464313..94b9b1ff79 100644--- a/app/src/config/tabs/exportTab.ts+++ b/app/src/config/tabs/exportTab.ts@@ -5,6 +5,7 @@ import {useShell} from "../../util/pathName";import type {SettingTabBuilder} from "../setting/builder";import {Constants} from "../../constants";import {exportConfigApi} from "./exportRuntime";+import {fetchPost} from "../../util/fetch";const registerExportReferencesGroup = (tab: SettingTabBuilder) => {const group = tab.group("references", window.siyuan.languages.configGroupReferences);@@ -175,7 +176,13 @@ const mountExportPandocStack = (root: HTMLElement) => {root.querySelector("#pandocBinPathDisplay")?.addEventListener("click", () => {if (window.siyuan.config.export.pandocBin) {useShell("showItemInFolder", window.siyuan.config.export.pandocBin);+ return;}+ fetchPost("/api/setting/getPandocBin", {}, (response) => {+ if (response.data) {+ useShell("showItemInFolder", response.data);+ }+ });});root.querySelector("#pandocBinChooser")?.addEventListener("click", async () => {const localPath = await ipcRenderer.invoke(Constants.SIYUAN_GET, {diff --git a/kernel/api/router.go b/kernel/api/router.goindex 51a6fce383..f43bf332be 100644--- a/kernel/api/router.go+++ b/kernel/api/router.go@@ -430,6 +430,7 @@ func ServeAPI(ginServer *gin.Engine) {ginServer.Handle("POST", "/api/setting/setAccount", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setAccount)ginServer.Handle("POST", "/api/setting/setEditor", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setEditor)ginServer.Handle("POST", "/api/setting/setExport", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setExport)+ ginServer.Handle("POST", "/api/setting/getPandocBin", model.CheckAuth, model.CheckAdminRole, getPandocBin)ginServer.Handle("POST", "/api/setting/setFiletree", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setFiletree)ginServer.Handle("POST", "/api/setting/setSearch", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setSearch)ginServer.Handle("POST", "/api/setting/setKeymap", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, setKeymap)diff --git a/kernel/api/setting.go b/kernel/api/setting.goindex 80c6ce001c..002c63cc73 100644--- a/kernel/api/setting.go+++ b/kernel/api/setting.go@@ -499,6 +499,23 @@ func setExport(c *gin.Context) {ret.Data = model.Conf.Export}+func getPandocBin(c *gin.Context) {+ ret := gulu.Ret.NewResult()+ defer c.JSON(http.StatusOK, ret)++ pandocRuntime := util.GetPandocRuntime()+ if !util.IsValidPandocBin(pandocRuntime.BinPath) {+ util.InitPandoc(model.Conf.Export.PandocBin)+ pandocRuntime = util.GetPandocRuntime()+ }+ if !util.IsValidPandocBin(pandocRuntime.BinPath) {+ ret.Code = -1+ ret.Msg = model.Conf.Language(115)+ return+ }+ ret.Data = pandocRuntime.BinPath+}+func setFiletree(c *gin.Context) {ret := gulu.Ret.NewResult()defer c.JSON(http.StatusOK, ret)