♻️ 书源 id 去掉 ext. 前缀,沿用旧内置源数据
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
7a09f7c834
commit
86b1f0c562
11 files changed
+26
-26
No files matched your search
@@ -7,7 +7,7 @@
|
||||
local _ = require("l10n").get("moonsource_zymk")
|
||||
|
||||
return {
|
||||
id = "ext.zymk",
|
||||
id = "zymk",
|
||||
name = _("知音漫客"),
|
||||
type = "chapter",
|
||||
description = _("知音漫客在线阅读"),
|
||||
|
||||
@@ -62,10 +62,10 @@ end
|
||||
---@return { cancel: fun() }
|
||||
function Client.shelfAsync(account, cb)
|
||||
local Settings = require("utils.settings")
|
||||
if not Mapper.account(account) or require("source.auth").expired("ext.zymk") then
|
||||
if not Mapper.account(account) or require("source.auth").expired("zymk") then
|
||||
return SourceBase.defer(cb, nil, _("请先登录知音漫客"))
|
||||
end
|
||||
if Settings.getSource("ext.zymk").account ~= account then
|
||||
if Settings.getSource("zymk").account ~= account then
|
||||
return SourceBase.defer(cb, nil, _("登录状态已变化,请重试"))
|
||||
end
|
||||
if not require("ui/network/manager"):isConnected() then
|
||||
@@ -75,7 +75,7 @@ function Client.shelfAsync(account, cb)
|
||||
local cancelled = false
|
||||
local job = Client.authAsync("/apinew/getuserrecord/", fields, function(data, err)
|
||||
if cancelled then return end
|
||||
if Settings.getSource("ext.zymk").account ~= account then
|
||||
if Settings.getSource("zymk").account ~= account then
|
||||
cb(nil, _("登录状态已变化,请重试")); return
|
||||
end
|
||||
local books = data and Mapper.shelf(data)
|
||||
|
||||
@@ -23,12 +23,12 @@ local Login = {}
|
||||
Login.__index = Login
|
||||
|
||||
function Login.new()
|
||||
return setmetatable({ previous = Settings.getSource("ext.zymk").account, serial = 0 }, Login)
|
||||
return setmetatable({ previous = Settings.getSource("zymk").account, serial = 0 }, Login)
|
||||
end
|
||||
|
||||
function Login.hasAccount()
|
||||
return Mapper.account(Settings.getSource("ext.zymk").account) ~= nil
|
||||
and not require("source.auth").expired("ext.zymk")
|
||||
return Mapper.account(Settings.getSource("zymk").account) ~= nil
|
||||
and not require("source.auth").expired("zymk")
|
||||
end
|
||||
|
||||
function Login:cancel()
|
||||
@@ -46,7 +46,7 @@ function Login:request(path, fields, cb)
|
||||
pending = false
|
||||
if self.serial ~= serial then return end
|
||||
self.job = nil
|
||||
if Settings.getSource("ext.zymk").account ~= self.previous then
|
||||
if Settings.getSource("zymk").account ~= self.previous then
|
||||
cb(nil, _("登录状态已变化,请重试")); return
|
||||
end
|
||||
cb(data, err and tostring(err) or nil)
|
||||
@@ -66,15 +66,15 @@ function Login:confirm(fields, cb)
|
||||
cb(nil, _("登录响应无效")); return
|
||||
end
|
||||
if self.previous and (self.previous.openid ~= account.openid or self.previous.type ~= account.type) then
|
||||
local cleared = require("source.logout").clear("ext.zymk", function()
|
||||
Settings.getSource("ext.zymk").account = nil
|
||||
Settings.saveSource("ext.zymk")
|
||||
local cleared = require("source.logout").clear("zymk", function()
|
||||
Settings.getSource("zymk").account = nil
|
||||
Settings.saveSource("zymk")
|
||||
end)
|
||||
if not cleared then cb(nil, _("准备本地同步失败")); return end
|
||||
end
|
||||
Settings.getSource("ext.zymk").account = account
|
||||
Settings.saveSource("ext.zymk")
|
||||
require("source.auth").ok("ext.zymk")
|
||||
Settings.getSource("zymk").account = account
|
||||
Settings.saveSource("zymk")
|
||||
require("source.auth").ok("zymk")
|
||||
require("source.registry").reload()
|
||||
cb(account)
|
||||
end)
|
||||
@@ -101,7 +101,7 @@ function Login:sendSmsAsync(phone, points, refresh, cb)
|
||||
end
|
||||
self.captcha = nil
|
||||
self:request("/apinew/sendsms/", {
|
||||
mobile = phone, service = "ext.zymk", imgCode = img_code, refresh = refresh and 1 or 0,
|
||||
mobile = phone, service = "zymk", imgCode = img_code, refresh = refresh and 1 or 0,
|
||||
}, function(data, err)
|
||||
if data and data.sent then self.sms_phone, self.retry_at = phone, os.time() + 60
|
||||
elseif data then self.captcha = data end
|
||||
|
||||
@@ -12,7 +12,7 @@ local Text = require("utils.text")
|
||||
local Mapper = {}
|
||||
|
||||
Mapper.TOC_VERSION = 1
|
||||
local SOURCE_ID = "ext.zymk"
|
||||
local SOURCE_ID = "zymk"
|
||||
local COVER = "https://chapter-cover.yyhao.com/file/cover/%s.jpg-300x400"
|
||||
|
||||
---@class ZymkAccount
|
||||
|
||||
@@ -87,11 +87,11 @@ function Setting.rows()
|
||||
callback = function() Setting.prompt(false) end })
|
||||
end,
|
||||
}
|
||||
if require("utils.settings").getSource("ext.zymk").account then
|
||||
rows[#rows + 1] = require("source.logout").row("ext.zymk", _("确定退出知音漫客账号?"), function()
|
||||
if require("utils.settings").getSource("zymk").account then
|
||||
rows[#rows + 1] = require("source.logout").row("zymk", _("确定退出知音漫客账号?"), function()
|
||||
local Settings = require("utils.settings")
|
||||
Settings.getSource("ext.zymk").account = nil
|
||||
Settings.saveSource("ext.zymk")
|
||||
Settings.getSource("zymk").account = nil
|
||||
Settings.saveSource("zymk")
|
||||
end)
|
||||
end
|
||||
return rows
|
||||
|
||||
@@ -30,7 +30,7 @@ function Zhiyinmanke.new()
|
||||
local meta = Zhiyinmanke.meta()
|
||||
return setmetatable({
|
||||
id = meta.id, name = meta.name, type = meta.type,
|
||||
account = require("utils.settings").getSource("ext.zymk").account,
|
||||
account = require("utils.settings").getSource("zymk").account,
|
||||
}, Source)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user