From f92c0eae3bb2f215d7f7ecc6c5543a0083aaf163 Mon Sep 17 00:00:00 2001 From: Ben Bell Date: Mon, 20 Nov 2023 17:53:19 +0800 Subject: [PATCH] Exporter: fix XMNote export, add author field (#11134) Optimize #11087 : 1. In `isReadyToExport`, check if the ip is set. If not, then the user cannot enable xmnote export. 2. Add author field in highlights. --- plugins/exporter.koplugin/target/xmnote.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/exporter.koplugin/target/xmnote.lua b/plugins/exporter.koplugin/target/xmnote.lua index 1e80a72ff..442519b00 100644 --- a/plugins/exporter.koplugin/target/xmnote.lua +++ b/plugins/exporter.koplugin/target/xmnote.lua @@ -79,6 +79,7 @@ end function XMNoteExporter:createRequestBody(booknotes) local book = { title = booknotes.title or "", + author = booknotes.author or "", type = 1, locationUnit = 1, } @@ -151,10 +152,13 @@ end function XMNoteExporter:isReadyToExport() - return true + if self.settings.ip then return true end + return false end function XMNoteExporter:export(t) + if not self:isReadyToExport() then return false end + for _, booknotes in ipairs(t) do local ok = self:createHighlights(booknotes) if not ok then return false end