Skip to main content

Module http

Module http 

Source
Expand description

HTTP handlers, grouped as Lichess’s API docs group them.

Modules§

account
Account, user and bot endpoints.
admin
Running the server, for its admins (with a fresh passkey check): the accounts here and their roles, and partners (other services’ API access).
app_files
The Chess lab training app (web/chess, built with its wasm engine), served as static files under /app/ from CHESS_APP_DIR.
challenges
Challenge endpoints.
fairplay
Fair-play review (open-chess endpoints, not Lichess’s): the queue of flagged games, a game’s reports, a player’s record, and reviewers’ verdicts. Needs a token with chess:fairplay held by a manager or an admin.
feed
GET /api/feed: every game on the server as server-sent events, for sites and dashboards that follow it (esports-lab follows it for its ratings and pricing). No token needed; it shows what the public game streams show.
games
Game export: PGN by default, JSON with Accept: application/json.
lab
open-chess additions to the Lichess API, used by the chess training app:
oauth
OAuth 2.0 with PKCE, as Lichess does it: no client registration (the client_id is any name the app picks), S256 code challenges, and long-lived access tokens.
play
Board API and Bot API game actions (the same handlers serve both; the matched path says which).
streams
NDJSON streams: a player’s event stream, a game’s board/bot stream and the public move stream.
web
Signing in to this server: its own accounts (a username and a password), and, with ESPORTS_LOGIN, “Sign in with the host site” (esports-lab). Both end in this server’s session cookie, which the OAuth consent page and the Account page (API tokens) use.

Constants§

LOGO_SVG
The open-chess logo (the Chess lab’s icon, web/chess/icon.svg).

Functions§

docs
GET /docs and /docs/{guide}: the guides, shown in the Chess lab (/app/#docs/…) when it’s installed, otherwise on GitHub.
favicon
GET /favicon.svg and /favicon.ico: the logo (browsers take an SVG whatever the name).
form
A urlencoded body (missing or empty is fine: no fields).
html_escape
index
GET /: what this is. Browsers go to the training app when it’s installed.
line
One NDJSON line.
logo
The logo at size pixels, inline in a page.
ndjson
The response half of an NDJSON stream; a task writes lines into the sender and stops when sending fails (the client went away).
ok
profile
GET /@/{username}: a player’s profile, in the Chess lab.