A simple CAPTCHA service implementation.
Go to file
Alexander "Arav" Andreev 149675cd86
Fixed mutexes. Now program doesn't fall under high load.
Seems like an old expiry comparing didn't work as left thousands of expired captchas in a map, so it was replaced by a forgotten by me time.Since() function.
2022-06-27 02:48:55 +04:00
bin Initial commit with a fully working program, lel. 2022-06-24 23:09:46 +04:00
build/archlinux Initial commit with a fully working program, lel. 2022-06-24 23:09:46 +04:00
cmd/justcaptchad Refactor of main.go to correct terms. 2022-06-26 20:43:18 +04:00
init/systemd -expire flag changed to a new -expiry in systemd unit. 2022-06-26 20:44:38 +04:00
internal Made use of a new style name feature and implemented a dark style, and now by default light version is being rendered. 2022-06-27 01:30:28 +04:00
pkg Fixed mutexes. Now program doesn't fall under high load. 2022-06-27 02:48:55 +04:00
.gitignore Initial commit with a fully working program, lel. 2022-06-24 23:09:46 +04:00
go.mod Removed unneded dependency on github.com/pkg/errors. 2022-06-26 23:24:10 +04:00
go.sum Removed unneded dependency on github.com/pkg/errors. 2022-06-26 23:24:10 +04:00
LICENSE Initial commit with a fully working program, lel. 2022-06-24 23:09:46 +04:00
Makefile In Makefile -expire flag fixed to a new -expiry. 2022-06-26 21:00:34 +04:00
README.md In README.md added style query parameter for image endpoint and its description. 2022-06-27 01:21:16 +04:00

justcaptcha ver. 1.0

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