A simple CAPTCHA service implementation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Alexander Andreev d7a04516e3
Not found error moved to db.go where it belongs.
2 weeks ago
bin Initial commit with a fully working program, lel. 2 months ago
build/archlinux Minor version number incremented. 2 weeks ago
cmd/justcaptchad Refactor of main.go to correct terms. 2 months ago
init/systemd -expire flag changed to a new -expiry in systemd unit. 2 months ago
internal handlers.go. Now image is being returned by value. 2 weeks ago
pkg Not found error moved to db.go where it belongs. 2 weeks ago
.gitignore Initial commit with a fully working program, lel. 2 months ago
LICENSE Initial commit with a fully working program, lel. 2 months ago
Makefile In Makefile -expire flag fixed to a new -expiry. 2 months ago
README.md Minor version number incremented. 2 weeks ago
go.mod Removed unneded dependency on github.com/pkg/errors. 1 month ago
go.sum Removed unneded dependency on github.com/pkg/errors. 1 month ago

README.md

justcaptcha ver. 1.1

A simple CAPTCHA service implementation.

Usage

justcaptchad -expiry 5m -listen /var/run/justcaptchad/j.sock

-expiry takes time for CAPTCHA to be valid for in format XX{s,m,h}.

-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