refactor(sync): extract shared OAuth into oauth.lua
Problem: `gcal.lua` and `gtasks.lua` duplicated ~250 lines of identical OAuth code (token management, PKCE flow, credential loading, curl helpers, url encoding). Solution: Extract a shared `OAuthClient` metatable in `oauth.lua` with module-level utilities and instance methods. Both backends now delegate all OAuth to `oauth.new()`. Skip `oauth` in `health.lua` backend discovery by checking for a `name` field.
This commit is contained in:
parent
6e21f883f6
commit
25c8bd4eb0
5 changed files with 686 additions and 729 deletions
|
|
@ -65,7 +65,7 @@ function M.check()
|
|||
for _, path in ipairs(sync_paths) do
|
||||
local name = vim.fn.fnamemodify(path, ':t:r')
|
||||
local bok, backend = pcall(require, 'pending.sync.' .. name)
|
||||
if bok and type(backend.health) == 'function' then
|
||||
if bok and backend.name and type(backend.health) == 'function' then
|
||||
vim.health.start('pending.nvim: sync/' .. name)
|
||||
backend.health()
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue