♻️ 书源 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 6379a117c2
commit 0174664163
15 files changed
+47 -47

No files matched your search

+4 -4
View File
@@ -8,7 +8,7 @@
local Assert = require("support.assert")
local JSON = require("support.json_stub")
package.loaded["json"] = JSON
local cfg = require("utils.settings").getSource("ext.zhihu")
local cfg = require("utils.settings").getSource("zhihu")
cfg.cookie = "z_c0=comment-fixture"
local pending = {}
package.loaded["http.request"] = {
@@ -91,7 +91,7 @@ local Auth = require("source.auth")
Auth.reset()
Client.reviewsAsync("22", 0, false, done)
pending[#pending].cb(nil, "HTTP 401", { code = 401 })
Assert.is_true(Auth.expired("ext.zhihu"))
Assert.is_true(Auth.expired("zhihu"))
Auth.reset()
local cache_keys = {}
@@ -103,7 +103,7 @@ package.loaded["book.review_cache"] = {
end,
}
local source = require("moonsource_zhihu.source").new()
local short = { source_id = "ext.zhihu", stable_id = "11/22", book = { title = "短篇" } }
local short = { source_id = "zhihu", stable_id = "11/22", book = { title = "短篇" } }
source:chapterReviewHotspotsAsync(short, done)
pending[#pending].cb(JSON.encode(wire()))
Assert.len(result, 1)
@@ -112,7 +112,7 @@ Assert.eq(result[1].text, "短篇")
Assert.eq(result[1].badge, "380")
Assert.eq(result[1].heading, "章节评论")
Assert.eq(cache_keys[#cache_keys][1], short, "整篇 EPUB 不需要伪造 chapter_idx")
local long = { source_id = "ext.zhihu", stable_id = "11", chapter_idx = 2 }
local long = { source_id = "zhihu", stable_id = "11", chapter_idx = 2 }
function source:loadTocAsync(_identity, cb)
cb({ { uid = "22", title = "第一章" }, { uid = "33", title = "第二章" } })
return { cancel = function() error("已完成目录请求不能覆盖当前评论请求") end }