aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 67890838f9819d8cc42ad667f14883c595d65fb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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": "<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
```


```json
{ "token": "<uuid>", "answers": [0, 3, 9] }
```
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage