♻️ 书源 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 73a4f219c8
commit 0a69fe7728
8 files changed
+15 -15

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
--]]
-- 本源的段评可借给本地书(reader.paragraph_lender)
require("utils.extension").add("reader.paragraph_lender", { id = "ext.qidian", label = require("moonsource_qidian._meta").name })
require("utils.extension").add("reader.paragraph_lender", { id = "qidian", label = require("moonsource_qidian._meta").name })
local function lazy(module)
return setmetatable({}, { __index = function(_, key) return require(module)[key] end })
@@ -7,7 +7,7 @@
local _ = require("l10n").get("moonsource_qidian")
return {
id = "ext.qidian",
id = "qidian",
name = _("起点中文网"),
type = "chapter",
description = _("起点中文网书架与在线阅读"),
@@ -22,7 +22,7 @@ local _ = require("l10n").get("moonsource_qidian")
local Client = {}
local SOURCE_ID = "ext.qidian"
local SOURCE_ID = "qidian"
local WEB = "https://m.qidian.com"
local UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) "
.. "Version/16.0 Mobile/15E148 Safari/604.1"
@@ -9,7 +9,7 @@ local Text = require("utils.text")
local Mapper = {}
local SOURCE_ID = "ext.qidian"
local SOURCE_ID = "qidian"
local COVER = "https://bookcover.yuewen.com/qdbimg/349573/%s/180"
--- 封面走阅文 CDN,书号即路径。实测是 JPEG,不强制 gzip。
@@ -10,7 +10,7 @@
local _ = require("l10n").get("moonsource_qidian")
local CookieLogin = require("source.cookie_login")
local SOURCE_ID = "ext.qidian"
local SOURCE_ID = "qidian"
local Setting = {}
---@return boolean
+1 -1
View File
@@ -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"))
+2 -2
View File
@@ -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")
+7 -7
View File
@@ -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)