✨ 初始提交:月读第三方书源插件集合

每个书源一个独立插件目录,含微信读书公众号订阅、书架导入等完整功能。

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
GarfieldandCopilot committed 2026-11-16 12:08:03 +08:00
commit 20ee051d8c
23 files changed
+2557

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
--[[--
扫码同步回调不会覆盖在飞句柄,关闭后忽略迟到结果。
@module tests.moonsource_tadu.qrlogin_spec
--]]
---@diagnostic disable: undefined-field, missing-fields, param-type-mismatch
local Assert = require("support.assert")
local poll, exchange, stopped, signed_in
package.loaded["moonsource_tadu.client"] = {
qrCreateAsync = function(cb)
cb("uuid")
return { cancel = function() error("cancelled completed QR request") end }
end,
qrPollAsync = function(_uuid, _last, cb)
poll = cb
return { cancel = function() stopped = "poll" end }
end,
exchangeAsync = function(_code, cb)
exchange = cb
return { cancel = function() stopped = "exchange" end }
end,
}
package.loaded["ui.themes.widgets.qr"] = {
new = function(_class, spec)
return { show = function() end, close = function() spec.close_callback() end }
end,
}
local login = require("moonsource_tadu.qrlogin"):new(function() signed_in = true end)
login:start()
login:cancel()
Assert.eq(stopped, "poll")
poll("ok", "code", 405)
Assert.is_nil(exchange)
login:start()
poll("ok", "code", 405)
login:cancel()
Assert.eq(stopped, "exchange")
exchange({ name = "测试" })
Assert.is_nil(signed_in)