♻️ 书源 id 去掉 ext. 前缀,沿用旧内置源数据
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
85dd9c6c6b
commit
90461c8c06
11 files changed
+16
-16
No files matched your search
@@ -3,7 +3,7 @@
|
||||
--]]
|
||||
|
||||
-- 本源的段评可借给本地书(reader.paragraph_lender)
|
||||
require("utils.extension").add("reader.paragraph_lender", { id = "ext.jjwxc", label = require("moonsource_jjwxc._meta").name })
|
||||
require("utils.extension").add("reader.paragraph_lender", { id = "jjwxc", label = require("moonsource_jjwxc._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_jjwxc")
|
||||
|
||||
return {
|
||||
id = "ext.jjwxc",
|
||||
id = "jjwxc",
|
||||
name = _("晋江文学城"),
|
||||
type = "chapter",
|
||||
description = _("晋江文学城书架与在线阅读"),
|
||||
|
||||
@@ -9,7 +9,7 @@ local Vip = require("moonsource_jjwxc.vip")
|
||||
|
||||
local Mapper = {}
|
||||
|
||||
local SOURCE_ID = "ext.jjwxc"
|
||||
local SOURCE_ID = "jjwxc"
|
||||
|
||||
--- 带 ver 参数的封面链接服务端强制 gzip(Content-Encoding 与图片下载器不兼容,落盘变成无法识别的文件);
|
||||
--- 去掉 ver 就是同一张图的原始 PNG。
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
local Protocols = {}
|
||||
|
||||
local SOURCE_ID = "ext.jjwxc"
|
||||
local SOURCE_ID = "jjwxc"
|
||||
|
||||
---@type table[]
|
||||
Protocols.list = { require("moonsource_jjwxc.protocols.web"), require("moonsource_jjwxc.protocols.app") }
|
||||
|
||||
@@ -20,7 +20,7 @@ local Token = {}
|
||||
|
||||
Token.id = "app"
|
||||
|
||||
local SOURCE_ID = "ext.jjwxc"
|
||||
local SOURCE_ID = "jjwxc"
|
||||
local APP = "https://app-cdn.jjwxc.net/androidapi"
|
||||
-- 接口回包 code:1004 = 要登录(token 无效),1025 = 登录态有效但这章没买。
|
||||
local LOGIN_CODE = 1004
|
||||
|
||||
@@ -21,7 +21,7 @@ local Web = {}
|
||||
|
||||
Web.id = "web"
|
||||
|
||||
local SOURCE_ID = "ext.jjwxc"
|
||||
local SOURCE_ID = "jjwxc"
|
||||
local HOST = "https://m.jjwxc.com"
|
||||
local FONT_URL = "https://static.jjwxc.net/tmp/fonts/%s.ttf"
|
||||
local UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) "
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
local _ = require("l10n").get("moonsource_jjwxc")
|
||||
local CookieLogin = require("source.cookie_login")
|
||||
|
||||
local SOURCE_ID = "ext.jjwxc"
|
||||
local SOURCE_ID = "jjwxc"
|
||||
local Setting = {}
|
||||
|
||||
---@return boolean
|
||||
|
||||
@@ -41,12 +41,12 @@ package.loaded["moonsource_jjwxc.client"] = {
|
||||
if #requests == 1 then cb(Mapper.category(html))
|
||||
elseif mode == "oversized" then
|
||||
cb({ page = params.page, pages = 3, books = {
|
||||
{ source_id = "ext.jjwxc", stable_id = "201" },
|
||||
{ source_id = "ext.jjwxc", stable_id = "202" },
|
||||
{ source_id = "ext.jjwxc", stable_id = "203" },
|
||||
{ source_id = "jjwxc", stable_id = "201" },
|
||||
{ source_id = "jjwxc", stable_id = "202" },
|
||||
{ source_id = "jjwxc", stable_id = "203" },
|
||||
} })
|
||||
elseif mode == "sync" then
|
||||
cb({ page = params.page, pages = 3, books = { { source_id = "ext.jjwxc", stable_id = tostring(params.page) } } })
|
||||
cb({ page = params.page, pages = 3, books = { { source_id = "jjwxc", stable_id = tostring(params.page) } } })
|
||||
end
|
||||
return request
|
||||
end,
|
||||
|
||||
@@ -71,7 +71,7 @@ local function vipToc()
|
||||
{ uid = "2", idx = 2, title = "二", vip = true, toc_version = 7 },
|
||||
}
|
||||
end
|
||||
local identity = { source_id = "ext.jjwxc", stable_id = "9" }
|
||||
local identity = { source_id = "jjwxc", stable_id = "9" }
|
||||
|
||||
-- 缓存命中:开探测;同一本书再问不重开;问完一次性写回
|
||||
do
|
||||
@@ -126,7 +126,7 @@ do
|
||||
local src = Jjwxc.new()
|
||||
src:loadTocAsync(identity, function() end)
|
||||
Stubs.flush()
|
||||
src:loadTocAsync({ source_id = "ext.jjwxc", stable_id = "10" }, function() end)
|
||||
src:loadTocAsync({ source_id = "jjwxc", stable_id = "10" }, function() end)
|
||||
Stubs.flush()
|
||||
Assert.is_true(pending[1].cancelled)
|
||||
Assert.eq(src.probe.stable_id, "10")
|
||||
|
||||
@@ -275,7 +275,7 @@ end
|
||||
do
|
||||
local Settings = require("utils.settings")
|
||||
local Protocols = require("moonsource_jjwxc.protocols")
|
||||
local cfg = Settings.getSource("ext.jjwxc")
|
||||
local cfg = Settings.getSource("jjwxc")
|
||||
cfg.cookie, cfg.token, cfg.protocol = nil, nil, nil
|
||||
Assert.is_nil(Protocols.current())
|
||||
cfg.token = "t"
|
||||
@@ -294,7 +294,7 @@ end
|
||||
do
|
||||
local Settings = require("utils.settings")
|
||||
local Protocols = require("moonsource_jjwxc.protocols")
|
||||
local cfg = Settings.getSource("ext.jjwxc")
|
||||
local cfg = Settings.getSource("jjwxc")
|
||||
cfg.cookie, cfg.token, cfg.protocol = nil, nil, nil
|
||||
Assert.eq(select(1, Protocols.list[1].commentAuth()), "")
|
||||
Assert.is_nil(select(2, Protocols.list[1].commentAuth()).Cookie)
|
||||
|
||||
@@ -78,7 +78,7 @@ source.loadTocAsync = function(_self, _identity, cb)
|
||||
cb({ { uid = "23" } })
|
||||
return { cancel = function() error("不应取消已完成目录请求") end }
|
||||
end
|
||||
local identity = { source_id = "ext.jjwxc", stable_id = "9", chapter_idx = 1 }
|
||||
local identity = { source_id = "jjwxc", stable_id = "9", chapter_idx = 1 }
|
||||
source:paragraphHotspotsAsync(identity, function(value) called = value end)
|
||||
Assert.len(called, 1)
|
||||
Assert.eq(called[1].range, "6")
|
||||
|
||||
Reference in new issue
Block a user