🐛 修复目录倒序导致开书落到未购买章
ep_list 最新话在前,startIndex 默认取第一项于是开书总落在锁定章弹「本章未购买」。改为按 ord 升序排、加 toc_version 强制旧缓存重拉;首话 title 为空时回落 short_title。
This commit is contained in:
1 parent
5efe13834e
commit
93c0413424
2 files changed
+28
-9
No files matched your search
@@ -51,11 +51,19 @@ function BiliManga:getDetailAsync(identity, cb)
|
||||
end)
|
||||
end
|
||||
|
||||
--- 当前格式的缓存目录;旧格式(倒序)当作没有。
|
||||
---@param identity BookIdentity
|
||||
---@return table[]|nil
|
||||
local function cachedToc(identity)
|
||||
local toc = Toc.read(identity.source_id or SOURCE_ID, identity.stable_id)
|
||||
if toc and toc[1] and toc[1].toc_version == Mapper.TOC_VERSION then return toc end
|
||||
return nil
|
||||
end
|
||||
|
||||
function BiliManga:loadTocAsync(identity, cb, force)
|
||||
local tid = identity.source_id or SOURCE_ID
|
||||
if not force then
|
||||
local cached = Toc.read(tid, identity.stable_id)
|
||||
if cached and #cached > 0 then
|
||||
local cached = cachedToc(identity)
|
||||
if cached then
|
||||
return SourceBase.defer(cb, cached)
|
||||
end
|
||||
end
|
||||
@@ -101,8 +109,8 @@ function BiliManga:openBookAsync(identity, opts, cb)
|
||||
})
|
||||
cb(ok and path or nil, err)
|
||||
end
|
||||
local toc = Toc.read(identity.source_id, identity.stable_id)
|
||||
if toc and #toc > 0 then
|
||||
local toc = cachedToc(identity)
|
||||
if toc then
|
||||
local idx = startIndex(identity, opts, toc)
|
||||
local path = Chapter.existing(identity, toc[idx])
|
||||
if path then return SourceBase.defer(finish, path, idx) end
|
||||
@@ -211,8 +219,8 @@ function BiliManga:getProgressAsync(identity, cb)
|
||||
cb(nil, nil, { empty = true })
|
||||
end
|
||||
|
||||
local existing = Toc.read(identity.source_id or SOURCE_ID, identity.stable_id)
|
||||
if existing and #existing > 0 then
|
||||
local existing = cachedToc(identity)
|
||||
if existing then
|
||||
afterToc(existing)
|
||||
else
|
||||
self:refreshTocAsync(identity, afterToc)
|
||||
|
||||
Reference in new issue
Block a user