fix(credentials): pack CSES token into single credential entry
Problem: the CSES API token was stored as a separate git credential entry using `path=api-token`, but many credential helpers (e.g. `cache`) ignore the `path` field, so the token was lost on retrieval. The scraper `on_event` callback also called `git_credential.store` from a `uv.spawn` fast event context, causing `vim.wait` errors. Solution: encode the CSES token into the password field as `password<TAB>token` and decode on retrieval. One credential entry per platform, no `path` dependency. Wrap `store` calls in `scraper.lua` with `vim.schedule` to avoid fast event context.
This commit is contained in:
parent
0d06d5cb89
commit
a255fa47a0
2 changed files with 40 additions and 29 deletions
|
|
@ -347,7 +347,9 @@ function M.login(platform, credentials, on_status, callback)
|
|||
stdin = vim.json.encode(credentials),
|
||||
on_event = function(ev)
|
||||
if ev.credentials ~= nil and next(ev.credentials) ~= nil then
|
||||
require('cp.git_credential').store(platform, ev.credentials)
|
||||
vim.schedule(function()
|
||||
require('cp.git_credential').store(platform, ev.credentials)
|
||||
end)
|
||||
end
|
||||
if ev.status ~= nil then
|
||||
if type(on_status) == 'function' then
|
||||
|
|
@ -395,7 +397,9 @@ function M.submit(
|
|||
stdin = vim.json.encode(credentials),
|
||||
on_event = function(ev)
|
||||
if ev.credentials ~= nil and next(ev.credentials) ~= nil then
|
||||
require('cp.git_credential').store(platform, ev.credentials)
|
||||
vim.schedule(function()
|
||||
require('cp.git_credential').store(platform, ev.credentials)
|
||||
end)
|
||||
end
|
||||
if ev.status ~= nil then
|
||||
if type(on_status) == 'function' then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue