Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Keep PDF preview requests on the temporary page origin https://github.com/siyuan-note/siyuan/issues/19205

Danielbd3e2bc5c7c6
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index 5cb24ce47c..ab5eaa163b 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -200,8 +200,9 @@ const renderPDF = async (id: string) => {
if (typeof localData.paged === "undefined") {
localData.paged = true;
}
- const servePathWithoutTrailingSlash = window.location.protocol + "//" + window.location.host;
- const servePath = servePathWithoutTrailingSlash + "/";
+ // 导出预览临时页可能由不同于主窗口的内核端口提供,使用相对路径可确保资源和接口保持同源。
+ const servePathWithoutTrailingSlash = "";
+ const servePath = "/";
const isDefault = (window.siyuan.config.appearance.mode === 1 && window.siyuan.config.appearance.themeDark === "midnight") || (window.siyuan.config.appearance.mode === 0 && window.siyuan.config.appearance.themeLight === "daylight");
let themeStyle = "";
if (!isDefault) {