4gCAPTCHA
4gcaptcha is a captcha server based on the one used in 4get
Setup
Copy .env.template to .env and configure the variables accordingly
FONT_PATHis a path to a.ttffile- The default font is RedHat Mono Bold licensed under OFL-1.1
CAPTCHA_DIRis a path to a directory of captcha images in the following format:
captcha/
birds/
1.png
2.png
3.png
anime/
1.png
2.png
Requires ImageMagick
uv sync
uv run server.py

API
GET /generate
Generates a new CAPTCHA
{
"token": "<uuid>",
"image": "data:image/jpeg;base64,...",
"expires_in": 90
}
POST /verify
Check user submitted answers for the provided token. A token expires on failure
The image grid is by default 4x4 mapped from 0 -> 15
0,1,2,3
4,5,6,7
8,9,10,11
12,13,14,15
{ "token": "<uuid>", "answers": [0, 3, 9] }
