✨ 初始提交:月读第三方书源插件集合
每个书源一个独立插件目录,含微信读书公众号订阅、书架导入等完整功能。 Co-authored-by: Copilot <[email protected]>
This commit is contained in:
commit
9190db9019
38 files changed
+5783
No files matched your search
@@ -0,0 +1,80 @@
|
||||
--[[--
|
||||
番茄源设置入口。
|
||||
|
||||
@module koplugin.book.moonsource_fanqie.setting
|
||||
--]]
|
||||
|
||||
local _ = require("l10n").get("moonsource_fanqie")
|
||||
|
||||
local SOURCE_ID = "ext.fanqie"
|
||||
local M = {}
|
||||
|
||||
function M.rowTitle()
|
||||
return _("番茄账号与登录")
|
||||
end
|
||||
|
||||
function M.rowStatus()
|
||||
local ok = require("moonsource_fanqie.settings"):new():is_cookie_configured()
|
||||
return ok and _("已登录") or _("未登录 · 点此扫码"), ok
|
||||
end
|
||||
|
||||
function M.open()
|
||||
local settings = require("moonsource_fanqie.settings"):new()
|
||||
local owner = {}
|
||||
function owner:closeBusy()
|
||||
if self.busy then self.busy:close(); self.busy = nil end
|
||||
end
|
||||
function owner:showBusy(text)
|
||||
self:closeBusy()
|
||||
self.busy = require("ui.themes.widgets.progress_dialog"):new{
|
||||
title = _("番茄扫码登录"), text = text, dismissable = false,
|
||||
}
|
||||
self.busy:show()
|
||||
end
|
||||
function owner:onLoginSuccess()
|
||||
require("source.auth").ok(SOURCE_ID)
|
||||
require("source.registry").reload()
|
||||
end
|
||||
require("ui/network/manager"):runWhenConnected(function()
|
||||
require("moonsource_fanqie.qrlogin"):new(settings, owner):start()
|
||||
end)
|
||||
end
|
||||
|
||||
--- 设置页行:账号(扫码)与阅读选项。
|
||||
---@param plugin table|nil
|
||||
---@return table[]
|
||||
function M.rows(plugin)
|
||||
local Row = require("ui.themes.widgets.row")
|
||||
local rows = {
|
||||
function(iw)
|
||||
local status, status_on = M.rowStatus()
|
||||
return Row.widget({ width = iw, chevron = true, kind = "nav", icon = "account_circle",
|
||||
title = M.rowTitle(), status = status, status_on = status_on,
|
||||
callback = function() M.open() end })
|
||||
end,
|
||||
function(iw)
|
||||
local settings = require("moonsource_fanqie.settings"):new()
|
||||
local on = settings:get("show_paragraph_reviews", false) == true
|
||||
return Row.widget({ width = iw, chevron = false, kind = "toggle", icon = "forum",
|
||||
title = _("显示段评"), subtitle = _("阅读时给有他人段评的段落末尾画线,点按查看;需联网"),
|
||||
status = on and _("开") or _("关"), status_on = on,
|
||||
callback = function()
|
||||
settings:set("show_paragraph_reviews", not on)
|
||||
settings:flush()
|
||||
if plugin and plugin.desktop then plugin.desktop:updateView() end
|
||||
end })
|
||||
end,
|
||||
require("source.category_setting").row("ext.fanqie", plugin),
|
||||
}
|
||||
local _status, logged_in = M.rowStatus()
|
||||
if logged_in then
|
||||
rows[#rows + 1] = require("source.logout").row("ext.fanqie", _("确定退出番茄账号?"), function()
|
||||
local settings = require("moonsource_fanqie.settings"):new()
|
||||
settings:set("cookies", nil)
|
||||
settings:flush()
|
||||
end)
|
||||
end
|
||||
return rows
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in new issue
Block a user