♻️ 书源 id 去掉 ext. 前缀,沿用旧内置源数据

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
GarfieldandCopilot committed 2026-11-16 14:07:45 +08:00
1 parent 818a3d9067
commit a8ce4da366
13 files changed
+42 -42

No files matched your search

+13 -13
View File
@@ -86,7 +86,7 @@ do
}
local BookDB = require("book.books_db")
BookDB.get = function(source_id, stable_id)
Assert.eq(source_id, "ext.jdread")
Assert.eq(source_id, "jdread")
return stored[stable_id]
end
Assert.eq(source:coverRequest({ stable_id = "42" }).url, "https://img.jd.com/42.jpg")
@@ -176,7 +176,7 @@ do
Assert.is_nil(err)
Assert.eq(result.pushed, 0)
Assert.eq(#finalized, 0)
Assert.eq(warnings[1][1], "ext.jdread shelf delete push failed")
Assert.eq(warnings[1][1], "jdread shelf delete push failed")
Assert.eq(warnings[1][2], "gone")
pending_deletes = {}
end
@@ -228,7 +228,7 @@ do
require("support.stubs").flush()
Assert.eq(result.pushed, 0)
Assert.eq(#synced, 0)
Assert.eq(warnings[1][1], "ext.jdread shelf push failed")
Assert.eq(warnings[1][1], "jdread shelf push failed")
Assert.eq(warnings[1][2], "99")
pending_adds = {}
end
@@ -248,7 +248,7 @@ do
src:syncBooksAsync({ dirty_only = true }, function(r) result = r end)
require("support.stubs").flush()
Assert.eq(result.pushed, 0)
Assert.eq(warnings[1][1], "ext.jdread shelf mark synced failed")
Assert.eq(warnings[1][1], "jdread shelf mark synced failed")
package.loaded["book.books_db"].markSynced = function() return true end
pending_adds = {}
end
@@ -285,7 +285,7 @@ do
end
local progressed, ok, cached, total, failed
source:cacheAllChaptersAsync(
{ source_id = "ext.jdread", stable_id = "10", book = { stable_id = "10" } },
{ source_id = "jdread", stable_id = "10", book = { stable_id = "10" } },
function(done, count) progressed = { done, count } end,
function(success, count, _, all, failures)
ok, cached, total, failed = success, count, all, failures
@@ -321,7 +321,7 @@ do
end
local src = Jdread.new()
src:prefetchChaptersAsync(
{ source_id = "ext.jdread", stable_id = "34028897", book = { stable_id = "34028897" } },
{ source_id = "jdread", stable_id = "34028897", book = { stable_id = "34028897" } },
{ { idx = 1, uid = "15001647875062768", title = "第一章" } },
1, 1, function() end
)
@@ -369,7 +369,7 @@ do
Assert.is_false(src:isTocCurrent({ { idx = 1, uid = "0", title = "无版本" } }))
Assert.is_false(src:isTocCurrent({}))
src:prefetchChaptersAsync(
{ source_id = "ext.jdread", stable_id = "30451107", book = { stable_id = "30451107" } },
{ source_id = "jdread", stable_id = "30451107", book = { stable_id = "30451107" } },
old, 1, 1, function() end
)
Assert.eq(cleared[1], "30451107")
@@ -392,7 +392,7 @@ do
return { cancel = function() end }
end
src:prefetchChaptersAsync(
{ source_id = "ext.jdread", stable_id = "30451107", book = { stable_id = "30451107" } },
{ source_id = "jdread", stable_id = "30451107", book = { stable_id = "30451107" } },
stored, 1, 1, function() end
)
Assert.eq(denied, "京东读书网页协议读不到本章,请在京东读书 App 内阅读")
@@ -422,7 +422,7 @@ do
return { cancel = function() end }
end
local pos
Jdread.new():getProgressAsync({ source_id = "ext.jdread", stable_id = "30451107" }, function(v) pos = v end)
Jdread.new():getProgressAsync({ source_id = "jdread", stable_id = "30451107" }, function(v) pos = v end)
require("support.stubs").flush()
Assert.eq(pos.chapter_idx, 2)
Assert.eq(pos.extra.chapter_idx, 2)
@@ -436,7 +436,7 @@ do
return { cancel = function() end }
end
pos = nil
Jdread.new():getProgressAsync({ source_id = "ext.jdread", stable_id = "30451107" }, function(v) pos = v end)
Jdread.new():getProgressAsync({ source_id = "jdread", stable_id = "30451107" }, function(v) pos = v end)
require("support.stubs").flush()
Assert.eq(catalog_calls, 0)
Assert.eq(pos.fraction, 0.4)
@@ -461,7 +461,7 @@ do
return { cancel = function() end }
end
local src = Jdread.new()
local identity = { source_id = "ext.jdread", stable_id = "30451107" }
local identity = { source_id = "jdread", stable_id = "30451107" }
local ok, err
src:putProgressAsync(identity, { fraction = 0.5, chapter_idx = 2 }, function(v, e) ok, err = v, e end)
Assert.is_true(ok)
@@ -502,7 +502,7 @@ do
end
require("source.assets").localizeAsync = function(raw, _, _, done) done(raw) end
Jdread.new():prefetchChaptersAsync(
{ source_id = "ext.jdread", stable_id = "30982479", book = { stable_id = "30982479" } },
{ source_id = "jdread", stable_id = "30982479", book = { stable_id = "30982479" } },
{ { idx = 1, uid = "0", title = "封面" } }, 1, 1, function() end
)
Assert.eq(html, '<p><img src="https://img.test/c.jpg"/></p>')
@@ -538,7 +538,7 @@ do
opened = opened + 1
return { cancel = function() end }
end
local identity = { source_id = "ext.jdread", stable_id = "30982479" }
local identity = { source_id = "jdread", stable_id = "30982479" }
local src = Jdread.new()
old = {