mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-16 17:10:53 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
374ea19152
@ -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);
|
||||
});
|
||||
|
@ -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()
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user