Start the LeetCode daily question from the site

A "Today's LeetCode" button on the problem list (admin only) does what
`usaco daily` does: it asks LeetCode for the daily question, runs the
clone's lib/leetcode.py to import it into solving/ (statement, starter,
driver.h and the examples as tests), commits it as "Start <slug>" and
opens its solve page. A daily question already in the repo is only
opened. The importer stays the CLI's one script rather than a Go copy
of its driver generator, so the site image now has python3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-20 11:29:39 +01:00
co-authored by Claude Opus 5.5
parent c972fa9fd9
commit af070ffcf9
9 changed files with 337 additions and 2 deletions
+4
View File
@@ -53,6 +53,9 @@ type Server struct {
// Statements reads a statement from the problem's judge; nil means the
// real judges.
Statements Fetcher
// LeetCode starts the daily question; nil means the real API and the
// clone's lib/leetcode.py.
LeetCode LeetCode
// Transcriber turns review recordings into text; nil when
// TRANSCRIBE_API_KEY is not set, which turns reviews off.
Transcriber Transcriber
@@ -108,6 +111,7 @@ func (s *Server) Routes(api *gin.RouterGroup) {
admin.PUT("/problems/:name/code", s.saveCode)
admin.POST("/problems/:name/run", s.run)
admin.POST("/problems/:name/lint", s.lint)
admin.POST("/leetcode/daily", s.startDaily)
api.POST("/hooks/gitea", s.webhook)
}