From f64d5d678bc69fa429e99eab87abca787f10a9ca Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 28 May 2026 17:27:49 -0700 Subject: init commit --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..6789083 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# 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] } +``` -- cgit v1.2.3