mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
fix(reader): harden KOReader sync and credential refresh
Sanitize match-check batches before strict server validation and classify HTTP failures accurately. Rebind the active catalog client whenever authentication settings change so retries use current credentials. Fixes #1150
This commit is contained in:
@@ -199,7 +199,7 @@ local function finish(ctx, err)
|
||||
end
|
||||
|
||||
if ctx.plugin and ctx.plugin.recordSyncError then
|
||||
if err == "auth" or err == "network" then
|
||||
if err == "auth" or err == "network" or err == "server" then
|
||||
ctx.plugin:recordSyncError("sweep", err)
|
||||
elseif not err and ctx.had_errors then
|
||||
ctx.plugin:recordSyncError("sweep", "partial_failure")
|
||||
@@ -243,6 +243,17 @@ local function finish(ctx, err)
|
||||
return
|
||||
end
|
||||
|
||||
if err == "server" then
|
||||
if ctx.interactive then
|
||||
UIManager:show(InfoMessage:new{ text = _("BookOrbit sync: server request failed."), timeout = 4 })
|
||||
end
|
||||
logger.warn("BookOrbit: sweep aborted, server request failed")
|
||||
if ctx.on_finish then
|
||||
pcall(ctx.on_finish, err)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if ctx.interactive then
|
||||
local text = T(_("BookOrbit sync done: %1 books matched, %2 reading events, %3 highlights."),
|
||||
ctx.counts.books_matched, ctx.counts.page_stats, ctx.counts.annotations)
|
||||
@@ -606,6 +617,7 @@ local function stepMatchNext(ctx)
|
||||
if aborted(ctx) then return end
|
||||
if not body then
|
||||
if isAuthError(err) then return finish(ctx, "auth") end
|
||||
if type(err) == "number" then return finish(ctx, "server") end
|
||||
return finish(ctx, "network")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user