feat(cses): implement submit via REST API

Problem: CSES submit was a stub returning "not yet implemented".

Solution: authenticate via web login + API token bridge (POST
`/login` form, then POST `/api/login` and confirm the auth page),
submit source to `/api/courses/problemset/submissions` with
base64-encoded content, and poll for verdict. Uses the same
username/password credential model as AtCoder.

Also update `scraper.lua` to pass the full ndjson event to `on_status`
(instead of just the status string) and handle `credentials` events
for platforms that return updated credentials.
This commit is contained in:
Barrett Ruth 2026-03-05 01:03:53 -05:00
parent c194f12eee
commit 972044fd0f
3 changed files with 165 additions and 9 deletions

View file

@ -64,9 +64,9 @@ function M.submit(opts)
language,
source_code,
creds,
function(status)
function(ev)
vim.schedule(function()
vim.notify('[cp.nvim] ' .. (STATUS_MSGS[status] or status), vim.log.levels.INFO)
vim.notify('[cp.nvim] ' .. (STATUS_MSGS[ev.status] or ev.status), vim.log.levels.INFO)
end)
end,
function(result)