Commit graph

4 commits

Author SHA1 Message Date
b7b79fa9c2 fix(timeouts): reduce AtCoder submit nav timeout to 20s 2026-03-06 21:33:16 -05:00
ab67270472 fix: expand language IDs, fix AtCoder submit, normalize logging
Problem: AtCoder submit used a cookie fast-path that silently failed on
stale sessions; `_LANGUAGE_ID_EXTENSION` only covered 2 of 116 languages;
`LANGUAGE_VERSIONS` was incomplete for AtCoder, CF, and Kattis; AtCoder
`prolog` and `racket` entries had wrong IDs. Raw `vim.notify` calls
throughout bypassed `logger.log`, producing inconsistent or missing
`[cp.nvim]:` prefixes.

Solution: Remove cookie persistence from AtCoder login/submit — always
use a fresh login within a single session. Increase
`BROWSER_SUBMIT_NAV_TIMEOUT["atcoder"]` to 40s and switch to in-memory
buffer upload with the correct per-language extension. Expand
`LANGUAGE_VERSIONS` with all 116 AtCoder languages, 15 new CF languages
with full version variants (java8/21, kotlin 1.7/1.9/2.2, rust 2021/2024,
etc.), and 50+ Kattis languages. Fix AtCoder `prolog` ID (`6079`→`6081`,
was Pony) and remove non-existent `racket` entry. Replace all raw
`vim.notify` calls with `logger.log`.
2026-03-06 21:28:21 -05:00
Barrett Ruth
a202725cc5
fix(submit): use file path over stdin; fix CF CodeMirror textarea (#305)
## Problem

After the initial submit hardening, two issues remained: source code was
read in Lua and piped as stdin to the scraper (unnecessary roundtrip
since
the file exists on disk), and CF's `page.fill()` timed out on the hidden
`textarea[name="source"]` because CodeMirror owns the editor state.

## Solution

Pass the source file path as a CLI arg instead — AtCoder calls
`page.set_input_files(file_path)` directly, CF reads it with
`Path(file_path).read_text()`. Fix CF source injection via
`page.evaluate()`
into the CodeMirror instance. Extract `BROWSER_SUBMIT_NAV_TIMEOUT` as a
per-platform `defaultdict` (CF defaults to 2× nav timeout). Save the
buffer
with `vim.cmd.update()` before submitting.
2026-03-05 14:34:14 -05:00
Barrett Ruth
6fcb5d1bbc
feat(codeforces): implement submit; cache CSES token (#300)
## Problem

Codeforces submit was a stub. CSES submit re-ran the full login flow on
every invocation (~1.5s overhead).

## Solution

**Codeforces**: headless browser submit via StealthySession (same
pattern as AtCoder). Solves Cloudflare Turnstile on login, uploads
source via file input, caches cookies at
`~/.cache/cp-nvim/codeforces-cookies.json` so repeat submits skip login.

**CSES**: persist the API token in credentials via a `credentials`
ndjson event. Subsequent submits validate the cached token with a single
GET before falling back to full login.

Also includes a vimdoc table of contents.
2026-03-05 10:37:39 -05:00