♻️ 书源 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 ff11bb481a
commit 35383a2451
11 files changed
+18 -18

No files matched your search

+5 -5
View File
@@ -64,16 +64,16 @@ Client.get("/old-response", nil, done)
pending = requests[#requests]
cfg.zysid = "renewed"
pending.cb(JSON.encode({ code = 600001 }))
Assert.is_true(not Auth.expired("ext.ireader"))
Assert.is_true(not Auth.expired("ireader"))
Assert.is_nil(result)
Client.get("/expired", nil, done)
requests[#requests].cb(JSON.encode({ code = 600001 }))
Assert.is_true(Auth.expired("ext.ireader"))
Assert.is_true(Auth.expired("ireader"))
Client.get("/stale-success", nil, done)
pending = requests[#requests]
cfg.zysid = "latest"
pending.cb(JSON.encode({ code = 0, body = {} }))
Assert.is_true(Auth.expired("ext.ireader"), "旧会话成功不能清新会话的失效标记")
Assert.is_true(Auth.expired("ireader"), "旧会话成功不能清新会话的失效标记")
mode = "sync-toc"
handle = Client.chaptersAsync("42", done)
@@ -101,12 +101,12 @@ Client.shelfAsync(done)
requests[#requests].cb(JSON.encode({ code = 0, body = {} }))
Assert.is_nil(result)
Assert.eq(reason, "响应无效")
Auth.expire("ext.ireader", "测试失效状态")
Auth.expire("ireader", "测试失效状态")
Client.checkSessionAsync({ usr = "candidate", zysid = "candidate-session" }, done)
Assert.is_true(requests[#requests].url:find("usr=candidate", 1, true) ~= nil)
requests[#requests].cb(JSON.encode({ code = 0, body = { data = {} } }))
Assert.is_true(result)
Assert.is_true(Auth.expired("ext.ireader"), "候选登录校验不改变现有账号的认证状态")
Assert.is_true(Auth.expired("ireader"), "候选登录校验不改变现有账号的认证状态")
local catalog_opts = { parent = "10", category = "11", order = "score", status = "0" }
Client.catalogAsync(catalog_opts, 2, done)
+2 -2
View File
@@ -58,8 +58,8 @@ package.loaded["moonsource_ireader.client"] = {
end
if mode == "failed" and index == 2 then cb(nil, "network failed"); return end
cb({
{ source_id = "ext.ireader", stable_id = tostring(index), title = "书" },
{ source_id = "ext.ireader", stable_id = "duplicate", title = "重复" },
{ source_id = "ireader", stable_id = tostring(index), title = "书" },
{ source_id = "ireader", stable_id = "duplicate", title = "重复" },
}, nil, index < 3)
return { cancel = function() request.cancelled = true end }
end,
+1 -1
View File
@@ -35,7 +35,7 @@ local shelf = Mapper.shelf({
})
Assert.eq(#shelf, 1)
Assert.eq(shelf[1].stable_id, "1")
Assert.eq(shelf[1].source_id, "ext.ireader")
Assert.eq(shelf[1].source_id, "ireader")
local found = Mapper.search([[
<div data-id="42" data-src="https://img/a.jpg"><span class="name">三体</span>
+2 -2
View File
@@ -44,7 +44,7 @@ package.loaded["http.request"] = {
}
local captured_ops, captured_reuse
local identity = { source_id = "ext.ireader", stable_id = "content-fixture" }
local identity = { source_id = "ireader", stable_id = "content-fixture" }
local chapter = { idx = 1, uid = "1", title = "正文" }
package.loaded["source.chapter"] = {
openAsync = function(_source, ref, _book, _opts, ops, cb)
@@ -93,7 +93,7 @@ Assert.is_false(Text.hasRemoteImageSrc(payload.html))
Assert.eq(#requests, 2, "同一图片只下载一次")
local href = payload.html:match('src="([^"]+)"')
Assert.matches(href, "^images/[a-f0-9]+%.png$")
Assert.eq(Fs.read(require("utils.paths").bookWorkDir(identity.stable_id, "ext.ireader") .. "/" .. href), png)
Assert.eq(Fs.read(require("utils.paths").bookWorkDir(identity.stable_id, "ireader") .. "/" .. href), png)
reset()
local handle = open()
+1 -1
View File
@@ -33,7 +33,7 @@ package.loaded["moonsource_ireader.client"] = {
local source = require("moonsource_ireader.source").new()
local result, reason, calls = nil, nil, 0
local function done(value, err) result, reason, calls = value, err, calls + 1 end
local identity = { source_id = "ext.ireader", stable_id = "test", chapter_idx = 2 }
local identity = { source_id = "ireader", stable_id = "test", chapter_idx = 2 }
source:loadTocAsync(identity, done)
require("support.stubs").flush()
Assert.eq(result, toc, "离线不强制刷新旧目录")
+1 -1
View File
@@ -40,7 +40,7 @@ local source = require("moonsource_ireader.source").new()
---@type IReaderReviewPage|nil
local result
local reason, calls = nil, 0
local identity = { source_id = "ext.ireader", stable_id = "42" }
local identity = { source_id = "ireader", stable_id = "42" }
local function done(page, err) result, reason, calls = page, err, calls + 1 end
source:bookReviewsAsync(identity, done)
local request = requests[#requests]