feat(cses): implement submit via REST API (#299)
## 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 — no browser dependencies needed. Tested end-to-end with a real CSES account (verdict: `ACCEPTED`). Also updates `scraper.lua` to pass the full ndjson event object to `on_status` and handle `credentials` events for future platform use.
This commit is contained in:
parent
e674265527
commit
e9f72dfbbc
4 changed files with 210 additions and 9 deletions
|
|
@ -298,9 +298,12 @@ function M.submit(
|
|||
stdin = source_code,
|
||||
env_extra = { CP_CREDENTIALS = vim.json.encode(credentials) },
|
||||
on_event = function(ev)
|
||||
if ev.credentials ~= nil then
|
||||
require('cp.cache').set_credentials(platform, ev.credentials)
|
||||
end
|
||||
if ev.status ~= nil then
|
||||
if type(on_status) == 'function' then
|
||||
on_status(ev.status)
|
||||
on_status(ev)
|
||||
end
|
||||
elseif ev.success ~= nil then
|
||||
done = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue