justcaptcha/README.md

61 lines
1.1 KiB
Markdown
Raw Normal View History

2022-08-19 02:26:03 +04:00
justcaptcha ver. 1.1.2
======================
A simple CAPTCHA service implementation.
2022-06-26 21:01:47 +04:00
## Usage
justcaptchad -expiry 5m -listen /var/run/justcaptchad/j.sock
2022-08-19 21:37:51 +04:00
`-expiry` takes time for CAPTCHA to be valid for in format X{s,m,h}.
2022-06-26 21:01:47 +04:00
`-listen` is `ip:port` or `/path/to/unix.sock` to listen on.
## API
### Get a new captcha
GET /
It will return an ID of a new captcha in plaintext.
#### HTTP codes
- `200` if created
### Get an image for a captcha
GET /:captcha_id/image?style=
Responds with an image (e.g. in PNG format).
An optional query parameter `style=` could be supplied if captcha implementation
support different styles.
#### HTTP codes
- `200` if exists
- `404` if doesn't exist
- `500` if for some reason Image wasn't created
### Submit an answer
POST /:captcha_id
It takes one form-data parameter `answer=123456`.
Responds with empty body and one of HTTP codes.
#### HTTP codes
- `200` if solved
- `403` if not solved
- `404` if doesn't exist
### Check if captcha is solved
GET /:captcha_id
Responds with empty body and one of HTTP codes.
#### HTTP codes
- `200` if solved
- `403` if not solved
- `404` if doesn't exist