♻️ 书源 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
@@ -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
|
||||
|
||||
Reference in new issue
Block a user