forked from moon-source/moonsource-fanqie
♻️ 书源 id 去掉 ext. 前缀,沿用旧内置源数据
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
088a1a2d94
commit
241cea9599
12 files changed
+21
-21
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user