♻️ 书源 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 088a1a2d94
commit 241cea9599
12 files changed
+21 -21

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.fanqie", label = require("moonsource_fanqie._meta").name })
require("utils.extension").add("reader.paragraph_lender", { id = "fanqie", label = require("moonsource_fanqie._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_fanqie")
return {
id = "ext.fanqie",
id = "fanqie",
name = _("番茄小说"),
type = "chapter",
description = _("番茄小说书架与在线阅读"),
@@ -218,7 +218,7 @@ local function jsonAsync(self, method, url, extra_headers, body, cb)
if isAuthError(code, res.body, res) then
-- 技术细节只打日志;弹窗给人看的中文由 Auth → Sync.promptLogin。
logger.warn("fanqie auth expired", httpError(method, url, code, res.body, res))
cb(nil, Auth.expire("ext.fanqie", _("点这个提示上的「重新登录」。二维码出来以后,打开手机上的番茄小说 App 或抖音,用扫一扫对准屏幕上的二维码,在手机上点确认。")))
cb(nil, Auth.expire("fanqie", _("点这个提示上的「重新登录」。二维码出来以后,打开手机上的番茄小说 App 或抖音,用扫一扫对准屏幕上的二维码,在手机上点确认。")))
return
end
if not Request.ok(code) then
@@ -226,7 +226,7 @@ local function jsonAsync(self, method, url, extra_headers, body, cb)
cb(nil, userHttpError(code, res.body))
return
end
Auth.ok("ext.fanqie")
Auth.ok("fanqie")
cb(decodeJson(res.body))
end)
end
@@ -379,7 +379,7 @@ function QRLogin:_finish_login_success(gen)
for k in pairs(jar) do keys[#keys + 1] = k end
table.sort(keys)
logger.info("[FanQieQR] 登录成功,扫码获取到 " .. #keys .. " 个 cookie: " .. table.concat(keys, ", "))
if not require("source.logout").replaceLibrary("ext.fanqie", function()
if not require("source.logout").replaceLibrary("fanqie", function()
self.settings:set("cookies", jar)
self.settings:flush()
end) then
@@ -6,7 +6,7 @@
local _ = require("l10n").get("moonsource_fanqie")
local SOURCE_ID = "ext.fanqie"
local SOURCE_ID = "fanqie"
local M = {}
function M.rowTitle()
@@ -64,11 +64,11 @@ function M.rows(plugin)
if plugin and plugin.desktop then plugin.desktop:updateView() end
end })
end,
require("source.category_setting").row("ext.fanqie", plugin),
require("source.category_setting").row("fanqie", plugin),
}
local _status, logged_in = M.rowStatus()
if logged_in then
rows[#rows + 1] = require("source.logout").row("ext.fanqie", _("确定退出番茄账号?"), function()
rows[#rows + 1] = require("source.logout").row("fanqie", _("确定退出番茄账号?"), function()
local settings = require("moonsource_fanqie.settings"):new()
settings:set("cookies", nil)
settings:flush()
@@ -1,10 +1,10 @@
--[[--
番茄源配置:落在 utils.settings.getSource("ext.fanqie")。
番茄源配置:落在 utils.settings.getSource("fanqie")。
@module koplugin.book.moonsource_fanqie.settings
--]]
local SOURCE_ID = "ext.fanqie"
local SOURCE_ID = "fanqie"
---@class FanqieSettings
---@field cfg table
@@ -91,7 +91,7 @@ end
--- 书架行带最后打开时间(last_operate_time)和加入时间(add_shelf_time)。
local function shelfBook(row)
local book = {
source_id = "ext.fanqie",
source_id = "fanqie",
stable_id = tostring(row.book_id),
title = row.book_name,
authors = row.author_name,
@@ -100,7 +100,7 @@ local function shelfBook(row)
read_at = shelfTime(row.last_operate_time),
inserted_at = shelfTime(row.add_shelf_time),
}
book.category = require("source.category_setting").apply("ext.fanqie", nil, row._group_name)
book.category = require("source.category_setting").apply("fanqie", nil, row._group_name)
return book
end
@@ -129,7 +129,7 @@ local function shelfRemote(self, force)
elseif type(wire.data) ~= "table" or type(wire.data.detail_list) ~= "table" then
cb(nil, _("番茄书架响应不完整,保留本地书架"))
else
require("utils.paths").ensureLayout("ext.fanqie")
require("utils.paths").ensureLayout("fanqie")
cb(wire)
end
end)
@@ -265,7 +265,7 @@ end
local function persistAnchorsFromHtml(identity, chapter, html)
local Toc = require("source.toc")
local Content = require("moonsource_fanqie.content")
local source_id = identity.source_id or "ext.fanqie"
local source_id = identity.source_id or "fanqie"
local list = Toc.read(source_id, identity.stable_id)
if not list then return end
local target
+1 -1
View File
@@ -268,7 +268,7 @@ do -- 搜索免登录(不带 Cookie、App UA);书架加 / 删走网页接
c:shelfActionAsync("delete", "42", function(r, err) d, e = r, err end)
Assert.is_nil(d)
Assert.matches(e, "重新登录")
Assert.is_true(Auth.expired("ext.fanqie"))
Assert.is_true(Auth.expired("fanqie"))
Auth.reset()
-- HTTP 错误给用户只留短句:诊断串(URL/状态码拼接)只进日志;
+3 -3
View File
@@ -162,7 +162,7 @@ local stored
package.preload["book.books_db"] = function()
return {
reconcile = function(id, books)
Assert.eq(id, "ext.fanqie")
Assert.eq(id, "fanqie")
stored = books
return true, 0
end,
@@ -214,7 +214,7 @@ package.preload["source.chapter"] = function()
cb()
end,
cacheAllAsync = function(source, identity, fetchContent, on_progress, cb, interval)
Assert.eq(source.id, "ext.fanqie")
Assert.eq(source.id, "fanqie")
Assert.eq(interval, 6)
on_progress(1, 1)
fetchContent(identity, { idx = 1, uid = "9876543210987654321", title = "第一章" }, function(payload)
@@ -270,7 +270,7 @@ do
source_cfg.category_as_group = nil
end
local ref = { source_id = "ext.fanqie", stable_id = "1234567890123456789" }
local ref = { source_id = "fanqie", stable_id = "1234567890123456789" }
src:openBookAsync(ref, { chapter_idx = 1 }, function(path)
Assert.eq(path, "ready.html")
count = count + 1
+1 -1
View File
@@ -6,7 +6,7 @@ moonsource_fanqie.qrlogin:预热 → 取码 → 轮询 → 跟跳拿 sessionid
local Assert = require("support.assert")
local Stubs = require("support.stubs")
require("source.logout").replaceLibrary = function(id, commit)
Assert.eq(id, "ext.fanqie")
Assert.eq(id, "fanqie")
commit()
return true
end
+1 -1
View File
@@ -22,7 +22,7 @@ local html = '<script>(function(){window.__INITIAL_STATE__={"rank":{"book_list":
do
local rank = Rank.state(html)
Assert.eq(rank.rankCategoryTypeList.male[1].name, "西方奇幻")
local books = Rank.books(rank, "ext.fanqie")
local books = Rank.books(rank, "fanqie")
Assert.len(books, 1)
Assert.eq(books[1].stable_id, "7654593151348247614")
Assert.matches(books[1].title, "在诡异$")
+1 -1
View File
@@ -30,7 +30,7 @@ src.client.officialGetContentAsync = function(_self, _bid, _iid, cb)
return { cancel = function() end }
end
local identity = { source_id = "ext.fanqie", stable_id = "fanqie-toc-anchors" }
local identity = { source_id = "fanqie", stable_id = "fanqie-toc-anchors" }
local poison = '<h2 id="toc_99">不该扫到</h2><p>旧正文</p>'
local function writeChapterHtml(idx, html)