2024-01-29 21:23:41 +01:00
< div align = "center" >
# salvo-captcha
A captcha middleware for [salvo ](salvo.rs ) framework. It uses [`captcha` ](https://github.com/daniel-e/captcha ) crate to generate captcha images.
[![salvo-captcha-video ](https://i.suar.me/9NjJ1 )](https://ibb.co/XVRVMZj)
< / div >
2024-08-08 16:51:21 +02:00
## Add to your project
2024-01-29 21:23:41 +01:00
First, add the following to your `Cargo.toml` :
```toml
[dependencies]
salvo-captcha = "0.1"
```
Or use [cargo-add ](https://doc.rust-lang.org/cargo/commands/cargo-add.html ) to add the dependency to your `Cargo.toml` :
```sh
$ cargo add salvo-captcha
```
2024-08-08 16:51:21 +02:00
## Usage
2024-01-29 21:23:41 +01:00
See the [examples ](examples ) directory for a complete example.
2024-08-08 16:51:21 +02:00
## Storage
2024-01-29 21:23:41 +01:00
2024-08-08 16:51:21 +02:00
The storage of the captcha is handled by a [`CaptchaStore`] trait. You can implement your own storage or use the [`cacache-rs`] by enabling the `cacache-storage` feature.
2024-01-29 21:23:41 +01:00
```toml
[dependencies]
salvo-captcha = { version = "0.1", features = ["cacache-storage"] }
```
2024-08-08 16:51:21 +02:00
## Captcha name and difficulty
In this table, you can see the difference between the difficulties and the name of the captcha.
| Name | Easy | Medium | Hard |
| :----: | :----------------------------------: | :----------------------------------: | :----------------------------------: |
| Amelia | ![Simple ](https://i.suar.me/1JaxG/s ) | ![Simple ](https://i.suar.me/l7zBl/s ) | ![Simple ](https://i.suar.me/qXAlx/s ) |
| Lucy | ![Simple ](https://i.suar.me/edwBG/s ) | ![Simple ](https://i.suar.me/NJmg0/s ) | ![Simple ](https://i.suar.me/OJK7M/s ) |
| Mila | ![Simple ](https://i.suar.me/dO78z/s ) | ![Simple ](https://i.suar.me/PXBwK/s ) | ![Simple ](https://i.suar.me/8edgE/s ) |
## Mirrors
2024-01-29 21:23:41 +01:00
2024-08-08 16:51:21 +02:00
- Github (https://github.com/TheAwiteb/salvo-captcha)
- Codeberg (https://codeberg.org/awiteb/salvo-captcha)
### Main Repository
- My Git (https://git.4rs.nl/awiteb/salvo-captcha)
## License
This project is licensed under the MIT license for more details see [LICENSE ](LICENSE ) or http://opensource.org/licenses/MIT.
2024-01-29 21:23:41 +01:00
[`CaptchaStore`]: https://docs.rs/salvo_captcha/0.1.0/salvo_captcha/trait.CaptchaStore.html
2024-08-08 16:51:21 +02:00
[`cacache-rs`]: https://github.com/zkat/cacache-rs