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.
This commit is contained in:
Ben Bell
2023-11-20 17:53:19 +08:00
committed by GitHub
parent dea94026f1
commit f92c0eae3b

View File

@@ -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