mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 桌面端自动下载更新安装包 https://github.com/siyuan-note/siyuan/issues/5837
This commit is contained in:
parent
175fee5804
commit
684e430fe1
4 changed files with 37 additions and 15 deletions
|
@ -180,6 +180,24 @@ func exportMdHTML(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func exportPreviewHTML(c *gin.Context) {
|
||||||
|
ret := gulu.Ret.NewResult()
|
||||||
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := arg["id"].(string)
|
||||||
|
name, content := model.ExportHTML(id, "", true)
|
||||||
|
ret.Data = map[string]interface{}{
|
||||||
|
"id": id,
|
||||||
|
"name": name,
|
||||||
|
"content": content,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func exportHTML(c *gin.Context) {
|
func exportHTML(c *gin.Context) {
|
||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
|
@ -198,6 +198,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||||
ginServer.Handle("POST", "/api/export/exportNotebookSY", model.CheckAuth, exportNotebookSY)
|
ginServer.Handle("POST", "/api/export/exportNotebookSY", model.CheckAuth, exportNotebookSY)
|
||||||
ginServer.Handle("POST", "/api/export/exportMdContent", model.CheckAuth, exportMdContent)
|
ginServer.Handle("POST", "/api/export/exportMdContent", model.CheckAuth, exportMdContent)
|
||||||
ginServer.Handle("POST", "/api/export/exportHTML", model.CheckAuth, exportHTML)
|
ginServer.Handle("POST", "/api/export/exportHTML", model.CheckAuth, exportHTML)
|
||||||
|
ginServer.Handle("POST", "/api/export/exportPreviewHTML", model.CheckAuth, exportPreviewHTML)
|
||||||
ginServer.Handle("POST", "/api/export/exportMdHTML", model.CheckAuth, exportMdHTML)
|
ginServer.Handle("POST", "/api/export/exportMdHTML", model.CheckAuth, exportMdHTML)
|
||||||
ginServer.Handle("POST", "/api/export/exportDocx", model.CheckAuth, exportDocx)
|
ginServer.Handle("POST", "/api/export/exportDocx", model.CheckAuth, exportDocx)
|
||||||
ginServer.Handle("POST", "/api/export/addPDFOutline", model.CheckAuth, addPDFOutline)
|
ginServer.Handle("POST", "/api/export/addPDFOutline", model.CheckAuth, addPDFOutline)
|
||||||
|
|
|
@ -386,6 +386,7 @@ func ExportHTML(id, savePath string, pdf bool) (name, dom string) {
|
||||||
name = path.Base(tree.Path)
|
name = path.Base(tree.Path)
|
||||||
name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614
|
name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614
|
||||||
|
|
||||||
|
if "" != savePath {
|
||||||
if err := os.MkdirAll(savePath, 0755); nil != err {
|
if err := os.MkdirAll(savePath, 0755); nil != err {
|
||||||
logging.LogErrorf("mkdir [%s] failed: %s", savePath, err)
|
logging.LogErrorf("mkdir [%s] failed: %s", savePath, err)
|
||||||
return
|
return
|
||||||
|
@ -403,9 +404,10 @@ func ExportHTML(id, savePath string, pdf bool) (name, dom string) {
|
||||||
logging.LogWarnf("copy asset from [%s] to [%s] failed: %s", srcAbsPath, targetAbsPath, err)
|
logging.LogWarnf("copy asset from [%s] to [%s] failed: %s", srcAbsPath, targetAbsPath, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
luteEngine := NewLute()
|
luteEngine := NewLute()
|
||||||
if !pdf { // 导出 HTML 需要复制静态资源
|
if !pdf && "" != savePath { // 导出 HTML 需要复制静态资源
|
||||||
srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}
|
srcs := []string{"stage/build/export", "stage/build/fonts", "stage/protyle"}
|
||||||
for _, src := range srcs {
|
for _, src := range srcs {
|
||||||
from := filepath.Join(util.WorkingDir, src)
|
from := filepath.Join(util.WorkingDir, src)
|
||||||
|
|
|
@ -35,4 +35,5 @@ call pnpm run dist-win32
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
echo 'Building Appx'
|
echo 'Building Appx'
|
||||||
|
echo . > app\build\win-unpacked\resources\ms-store
|
||||||
electron-windows-store --input-directory app\build\win-unpacked --output-directory app\build\ --package-version 1.0.0.0 --package-name SiYuan --manifest app\appx\AppxManifest.xml --assets app\appx\assets\ --make-pri true
|
electron-windows-store --input-directory app\build\win-unpacked --output-directory app\build\ --package-version 1.0.0.0 --package-name SiYuan --manifest app\appx\AppxManifest.xml --assets app\appx\assets\ --make-pri true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue