# 4gCAPTCHA 4gcaptcha is a captcha server based on the one used in [4get](https://git.lolcat.ca/lolcat/4get) # Setup Copy `.env.template` to `.env` and configure the variables accordingly - `FONT_PATH` is a path to a `.ttf` file - The default font is [RedHat Mono Bold](https://github.com/RedHatOfficial/RedHatFont) licensed under OFL-1.1 - `CAPTCHA_DIR` is 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](https://imagemagick.org/) ``` uv sync uv run server.py ``` ![](./docs/img.png) # API ## GET `/generate` Generates a new CAPTCHA ```json { "token": "", "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 ``` ```json { "token": "", "answers": [0, 3, 9] } ```