This commit is contained in:
Liang Ding 2023-05-10 23:07:17 +08:00
parent 14f8d8e426
commit af938cc41d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 30 additions and 1 deletions

View file

@ -667,6 +667,17 @@ export const exportMd = (id: string) => {
openByMobile(response.data.zip); openByMobile(response.data.zip);
}); });
} }
}, {
label: "OPML",
click: () => {
const msgId = showMessage(window.siyuan.languages.exporting, -1);
fetchPost("/api/export/exportOPML", {
id,
}, response => {
hideMessage(msgId);
openByMobile(response.data.zip);
});
}
}, },
] ]
} }

View file

@ -31,6 +31,23 @@ import (
"github.com/siyuan-note/siyuan/kernel/util" "github.com/siyuan-note/siyuan/kernel/util"
) )
func exportOPML(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, zipPath := model.ExportPandocConvertZip(id, "opml", ".opml")
ret.Data = map[string]interface{}{
"name": name,
"zip": zipPath,
}
}
func exportTextile(c *gin.Context) { func exportTextile(c *gin.Context) {
ret := gulu.Ret.NewResult() ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret) defer c.JSON(http.StatusOK, ret)

View file

@ -248,6 +248,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/export/exportReStructuredText", model.CheckAuth, exportReStructuredText) ginServer.Handle("POST", "/api/export/exportReStructuredText", model.CheckAuth, exportReStructuredText)
ginServer.Handle("POST", "/api/export/exportAsciiDoc", model.CheckAuth, exportAsciiDoc) ginServer.Handle("POST", "/api/export/exportAsciiDoc", model.CheckAuth, exportAsciiDoc)
ginServer.Handle("POST", "/api/export/exportTextile", model.CheckAuth, exportTextile) ginServer.Handle("POST", "/api/export/exportTextile", model.CheckAuth, exportTextile)
ginServer.Handle("POST", "/api/export/exportOPML", model.CheckAuth, exportOPML)
ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd) ginServer.Handle("POST", "/api/import/importStdMd", model.CheckAuth, model.CheckReadonly, importStdMd)
ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData) ginServer.Handle("POST", "/api/import/importData", model.CheckAuth, model.CheckReadonly, importData)