From 73e57dba1ee21fe07b79e662a7d0f6c52b30cabb Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 27 Sep 2022 00:14:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:bug:=20=E8=AE=BE=E7=BD=AE=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=8E=88=E6=9D=83=E7=A0=81=E5=90=8E=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=20PDF=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/5959?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/export.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/api/export.go b/kernel/api/export.go index e369c26eb..379c6949b 100644 --- a/kernel/api/export.go +++ b/kernel/api/export.go @@ -193,14 +193,14 @@ func exportTempContent(c *gin.Context) { } content := arg["content"].(string) - tmpExport := filepath.Join(util.TempDir, "export") + tmpExport := filepath.Join(util.TempDir, "export", "temp") if err := os.MkdirAll(tmpExport, 0755); nil != err { ret.Code = 1 ret.Msg = err.Error() ret.Data = map[string]interface{}{"closeTimeout": 7000} return } - p := filepath.Join(tmpExport, "temp", gulu.Rand.String(7)) + p := filepath.Join(tmpExport, gulu.Rand.String(7)) if err := os.WriteFile(p, []byte(content), 0644); nil != err { ret.Code = 1 ret.Msg = err.Error() From 51990554d1cfa8514d1441dc560d2c2f34b96168 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 27 Sep 2022 00:17:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?:bug:=20=E8=AE=BE=E7=BD=AE=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=8E=88=E6=9D=83=E7=A0=81=E5=90=8E=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=20PDF=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/5959?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/export.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/api/export.go b/kernel/api/export.go index 379c6949b..35e343b56 100644 --- a/kernel/api/export.go +++ b/kernel/api/export.go @@ -209,7 +209,7 @@ func exportTempContent(c *gin.Context) { } url := path.Join("/export/temp/", filepath.Base(p)) ret.Data = map[string]interface{}{ - "url": url, + "url": "http://127.0.0.1:" + util.ServerPort + url, } } From 5550ed78c1b1e473033f833e27ab0e3e1732cfa9 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 27 Sep 2022 00:19:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:bug:=20=E8=AE=BE=E7=BD=AE=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=8E=88=E6=9D=83=E7=A0=81=E5=90=8E=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=20PDF=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/5959?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/export/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index d3a9b1542..2c8053e4b 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -2,7 +2,7 @@ import {hideMessage, showMessage} from "../../dialog/message"; import {Constants} from "../../constants"; /// #if !BROWSER import {OpenDialogReturnValue} from "electron"; -import {BrowserWindow, dialog} from "@electron/remote"; +import {BrowserWindow, dialog, app} from "@electron/remote"; import * as fs from "fs"; import * as path from "path"; import {afterExport} from "./util"; @@ -381,6 +381,7 @@ const renderPDF = (id: string) => { webSecurity: false, }, }); + window.siyuan.printWin.webContents.userAgent = `SiYuan/${app.getVersion()} https://b3log.org/siyuan Electron` fetchPost("/api/export/exportTempContent", {content: html}, (response) => { window.siyuan.printWin.loadURL(response.data.url); });