♻️ 书源 id 去掉 ext. 前缀,沿用旧内置源数据
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
73a4f219c8
commit
0a69fe7728
8 files changed
+15
-15
No files matched your search
@@ -26,7 +26,7 @@ package.preload["source.chapter"] = function()
|
||||
}
|
||||
end
|
||||
local opened
|
||||
source:openBookAsync({ source_id = "ext.qidian", stable_id = "fixture" }, { chapter_idx = 1 },
|
||||
source:openBookAsync({ source_id = "qidian", stable_id = "fixture" }, { chapter_idx = 1 },
|
||||
function(value) opened = value end)
|
||||
Assert.eq(opened, path)
|
||||
file = assert(io.open(path, "rb"))
|
||||
|
||||
@@ -36,7 +36,7 @@ package.preload["source.registry"] = function()
|
||||
end
|
||||
package.preload["book.books_db"] = function()
|
||||
return { prepareAccountSync = function(id, shelf_add)
|
||||
Assert.eq(id, "ext.qidian", "只准备当前源")
|
||||
Assert.eq(id, "qidian", "只准备当前源")
|
||||
Assert.is_true(shelf_add)
|
||||
Assert.not_nil(cfg.cookie, "成功准备同步之后才替换凭据")
|
||||
cleared = cleared + 1
|
||||
@@ -45,7 +45,7 @@ package.preload["book.books_db"] = function()
|
||||
end
|
||||
package.preload["reader.session"] = function()
|
||||
return { current = function() return {
|
||||
identity = { source_id = "ext.qidian" }, ui = { onClose = function() closed = closed + 1 end },
|
||||
identity = { source_id = "qidian" }, ui = { onClose = function() closed = closed + 1 end },
|
||||
} end }
|
||||
end
|
||||
local CookieLogin = require("source.cookie_login")
|
||||
|
||||
@@ -43,7 +43,7 @@ for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
||||
end
|
||||
end
|
||||
for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
||||
local id = "ext." .. name
|
||||
local id = name
|
||||
package.preload["moonsource_" .. name .. ".client"] = function()
|
||||
return {
|
||||
cookie = function() return configs[id] and configs[id].cookie end,
|
||||
@@ -60,11 +60,11 @@ for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
||||
end
|
||||
|
||||
for _idx, source in ipairs({
|
||||
{ id = "ext.qqreader", app_id = "1450000220", area_id = "1" },
|
||||
{ id = "ext.qidian", app_id = "13", area_id = "31" },
|
||||
{ id = "ext.xiaoxiang", app_id = "57", area_id = "5" },
|
||||
{ id = "qqreader", app_id = "1450000220", area_id = "1" },
|
||||
{ id = "qidian", app_id = "13", area_id = "31" },
|
||||
{ id = "xiaoxiang", app_id = "57", area_id = "5" },
|
||||
}) do
|
||||
local Setting = require("moonsource_" .. source.id:sub(5) .. ".setting")
|
||||
local Setting = require("moonsource_" .. source.id .. ".setting")
|
||||
started, checked, saved_id, authorized = nil, nil, nil, nil
|
||||
local rows = Setting.rows()
|
||||
rows[1](400).callback()
|
||||
@@ -88,7 +88,7 @@ for _idx, source in ipairs({
|
||||
started = nil
|
||||
Setting.login()
|
||||
Assert.is_true(started, "登录失效的直达入口也走设备扫码")
|
||||
if source.id ~= "ext.qqreader" then
|
||||
if source.id ~= "qqreader" then
|
||||
local paste
|
||||
for _idx, factory in ipairs(Setting.rows()) do
|
||||
local row = factory(400)
|
||||
@@ -96,7 +96,7 @@ for _idx, source in ipairs({
|
||||
end
|
||||
Assert.not_nil(paste)
|
||||
paste.callback()
|
||||
Assert.eq(Themed.last("input").title, source.id == "ext.qidian" and "起点登录 Cookie" or "潇湘登录 Cookie")
|
||||
Assert.eq(Themed.last("input").title, source.id == "qidian" and "起点登录 Cookie" or "潇湘登录 Cookie")
|
||||
end
|
||||
end
|
||||
Assert.eq(reloads, 3)
|
||||
Reference in new issue
Block a user