Import LeetCode problems from a pasted link on the site
The problem list's admin row gains a link box beside "Today's LeetCode":
POST /leetcode/import takes {url} and does what `usaco new
<leetcode-link>` does, through the same lib/leetcode.py run and "Start
<slug>" commit as the daily question, then opens the solve page. A
problem already in the repo is only opened.
leetcode.Slug reads the link as slug_of in lib/leetcode.py does: full
links with /description/ and query strings, www., no scheme, or a bare
slug. Anything else is a 400.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+2
-1
@@ -56,7 +56,7 @@ internal/transcribe/ OpenAI-compatible speech-to-text client, and pace/pause/fil
|
||||
internal/review/ the review prompt and schema, reviews/<id>.md rendering
|
||||
internal/evaluate/ the solve page's evaluation: prompt, schema and the run's verdicts for Claude
|
||||
internal/audiostore/ optional S3 bucket (Garage) that keeps review recordings for playback
|
||||
internal/leetcode/ today's daily question, imported by running the clone's lib/leetcode.py
|
||||
internal/leetcode/ today's daily question or a pasted link, imported by running the clone's lib/leetcode.py
|
||||
internal/statement/ fetches statements from LeetCode (GraphQL) and USACO (the problem page)
|
||||
web/ Vue 3 + Vite SPA, built for base /usaco/
|
||||
```
|
||||
@@ -87,6 +87,7 @@ Everything is served under `BASE_PATH` (`/usaco`). nginx proxies the prefix thro
|
||||
| `GET /usaco/api/problems/<name>/evaluate` | admin | the latest evaluation job, shaped like the explain one, with the evaluation as `result` once it is done |
|
||||
| `PUT /usaco/api/problems/<name>/code` | admin | `{lang, source}`: commits `main.cpp`, or `main.py` (`sol.py` where that is the existing file), as "Edit <name>" |
|
||||
| `POST /usaco/api/leetcode/daily` | admin | imports today's LeetCode daily question into `solving/` with the CLI's `lib/leetcode.py` and commits it as "Start <slug>", or finds it if it is already a problem; answers `{name, created}`. 502 if LeetCode or the import fails |
|
||||
| `POST /usaco/api/leetcode/import` | admin | `{url}`: the same for the problem a LeetCode link names (`usaco new <leetcode-link>`); a bare slug works too. 400 if it is not a LeetCode problem link, 502 if LeetCode or the import fails |
|
||||
| `GET /usaco/api/concepts` | open | the concept library, newest first, without content or snippets |
|
||||
| `GET /usaco/api/concepts/<slug>` | open | one concept: `{slug, title, summary, tags, content, snippet, updated}` |
|
||||
| `POST /usaco/api/concepts` | admin | `{topic, code?}`: starts explaining a new concept and answers 202 `{id, status}`. 503 without `CLAUDE_API_KEY` |
|
||||
|
||||
Reference in New Issue
Block a user