♻️ 书源 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
@@ -3,7 +3,7 @@
|
|||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- 本源的段评可借给本地书(reader.paragraph_lender)
|
-- 本源的段评可借给本地书(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)
|
local function lazy(module)
|
||||||
return setmetatable({}, { __index = function(_, key) return require(module)[key] end })
|
return setmetatable({}, { __index = function(_, key) return require(module)[key] end })
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
local _ = require("l10n").get("moonsource_qidian")
|
local _ = require("l10n").get("moonsource_qidian")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id = "ext.qidian",
|
id = "qidian",
|
||||||
name = _("起点中文网"),
|
name = _("起点中文网"),
|
||||||
type = "chapter",
|
type = "chapter",
|
||||||
description = _("起点中文网书架与在线阅读"),
|
description = _("起点中文网书架与在线阅读"),
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ local _ = require("l10n").get("moonsource_qidian")
|
|||||||
|
|
||||||
local Client = {}
|
local Client = {}
|
||||||
|
|
||||||
local SOURCE_ID = "ext.qidian"
|
local SOURCE_ID = "qidian"
|
||||||
local WEB = "https://m.qidian.com"
|
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) "
|
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"
|
.. "Version/16.0 Mobile/15E148 Safari/604.1"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ local Text = require("utils.text")
|
|||||||
|
|
||||||
local Mapper = {}
|
local Mapper = {}
|
||||||
|
|
||||||
local SOURCE_ID = "ext.qidian"
|
local SOURCE_ID = "qidian"
|
||||||
local COVER = "https://bookcover.yuewen.com/qdbimg/349573/%s/180"
|
local COVER = "https://bookcover.yuewen.com/qdbimg/349573/%s/180"
|
||||||
|
|
||||||
--- 封面走阅文 CDN,书号即路径。实测是 JPEG,不强制 gzip。
|
--- 封面走阅文 CDN,书号即路径。实测是 JPEG,不强制 gzip。
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
local _ = require("l10n").get("moonsource_qidian")
|
local _ = require("l10n").get("moonsource_qidian")
|
||||||
local CookieLogin = require("source.cookie_login")
|
local CookieLogin = require("source.cookie_login")
|
||||||
|
|
||||||
local SOURCE_ID = "ext.qidian"
|
local SOURCE_ID = "qidian"
|
||||||
local Setting = {}
|
local Setting = {}
|
||||||
|
|
||||||
---@return boolean
|
---@return boolean
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ package.preload["source.chapter"] = function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
local opened
|
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)
|
function(value) opened = value end)
|
||||||
Assert.eq(opened, path)
|
Assert.eq(opened, path)
|
||||||
file = assert(io.open(path, "rb"))
|
file = assert(io.open(path, "rb"))
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ package.preload["source.registry"] = function()
|
|||||||
end
|
end
|
||||||
package.preload["book.books_db"] = function()
|
package.preload["book.books_db"] = function()
|
||||||
return { prepareAccountSync = function(id, shelf_add)
|
return { prepareAccountSync = function(id, shelf_add)
|
||||||
Assert.eq(id, "ext.qidian", "只准备当前源")
|
Assert.eq(id, "qidian", "只准备当前源")
|
||||||
Assert.is_true(shelf_add)
|
Assert.is_true(shelf_add)
|
||||||
Assert.not_nil(cfg.cookie, "成功准备同步之后才替换凭据")
|
Assert.not_nil(cfg.cookie, "成功准备同步之后才替换凭据")
|
||||||
cleared = cleared + 1
|
cleared = cleared + 1
|
||||||
@@ -45,7 +45,7 @@ package.preload["book.books_db"] = function()
|
|||||||
end
|
end
|
||||||
package.preload["reader.session"] = function()
|
package.preload["reader.session"] = function()
|
||||||
return { current = function() return {
|
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 }
|
||||||
end
|
end
|
||||||
local CookieLogin = require("source.cookie_login")
|
local CookieLogin = require("source.cookie_login")
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
||||||
local id = "ext." .. name
|
local id = name
|
||||||
package.preload["moonsource_" .. name .. ".client"] = function()
|
package.preload["moonsource_" .. name .. ".client"] = function()
|
||||||
return {
|
return {
|
||||||
cookie = function() return configs[id] and configs[id].cookie end,
|
cookie = function() return configs[id] and configs[id].cookie end,
|
||||||
@@ -60,11 +60,11 @@ for _idx, name in ipairs({ "qqreader", "qidian", "xiaoxiang" }) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
for _idx, source in ipairs({
|
for _idx, source in ipairs({
|
||||||
{ id = "ext.qqreader", app_id = "1450000220", area_id = "1" },
|
{ id = "qqreader", app_id = "1450000220", area_id = "1" },
|
||||||
{ id = "ext.qidian", app_id = "13", area_id = "31" },
|
{ id = "qidian", app_id = "13", area_id = "31" },
|
||||||
{ id = "ext.xiaoxiang", app_id = "57", area_id = "5" },
|
{ id = "xiaoxiang", app_id = "57", area_id = "5" },
|
||||||
}) do
|
}) 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
|
started, checked, saved_id, authorized = nil, nil, nil, nil
|
||||||
local rows = Setting.rows()
|
local rows = Setting.rows()
|
||||||
rows[1](400).callback()
|
rows[1](400).callback()
|
||||||
@@ -88,7 +88,7 @@ for _idx, source in ipairs({
|
|||||||
started = nil
|
started = nil
|
||||||
Setting.login()
|
Setting.login()
|
||||||
Assert.is_true(started, "登录失效的直达入口也走设备扫码")
|
Assert.is_true(started, "登录失效的直达入口也走设备扫码")
|
||||||
if source.id ~= "ext.qqreader" then
|
if source.id ~= "qqreader" then
|
||||||
local paste
|
local paste
|
||||||
for _idx, factory in ipairs(Setting.rows()) do
|
for _idx, factory in ipairs(Setting.rows()) do
|
||||||
local row = factory(400)
|
local row = factory(400)
|
||||||
@@ -96,7 +96,7 @@ for _idx, source in ipairs({
|
|||||||
end
|
end
|
||||||
Assert.not_nil(paste)
|
Assert.not_nil(paste)
|
||||||
paste.callback()
|
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
|
||||||
end
|
end
|
||||||
Assert.eq(reloads, 3)
|
Assert.eq(reloads, 3)
|
||||||
Reference in new issue
Block a user