Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
5324724260 | |||
8fec483fa2 | |||
625da21941 | |||
8b17b6d824 | |||
e5defe0f61 | |||
0f83f29c85 |
7 changed files with 25 additions and 11 deletions
|
@ -18,7 +18,7 @@ jobs:
|
|||
- name: Build the source code
|
||||
run: cargo build
|
||||
- name: Build examples
|
||||
run: cargo build -F 'cacache-storage' --example simple_login
|
||||
run: cargo build -F 'simple-generator' --example simple_login
|
||||
- name: Run tests
|
||||
run: cargo test --tests --all-features
|
||||
- name: Check the code format
|
||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "salvo-captcha"
|
||||
version = "0.2.0"
|
||||
version = "0.3.1"
|
||||
rust-version = "1.75.0"
|
||||
edition = "2021"
|
||||
authors = ["Awiteb <a@4rs.nl>"]
|
||||
|
@ -24,7 +24,11 @@ either = { version = "1.13.0", default-features = false }
|
|||
|
||||
[features]
|
||||
cacache-storage = ["dep:cacache"]
|
||||
simple_generator = ["dep:captcha"]
|
||||
simple-generator = ["dep:captcha"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.9"
|
||||
|
@ -35,4 +39,4 @@ rstest = "0.22.0"
|
|||
|
||||
[[example]]
|
||||
name = "simple_login"
|
||||
required-features = ["simple_generator"]
|
||||
required-features = ["simple-generator"]
|
||||
|
|
2
Justfile
2
Justfile
|
@ -19,7 +19,7 @@ _default:
|
|||
# Run the CI (Local use only)
|
||||
@ci:
|
||||
cargo fmt --all --check
|
||||
cargo build -F 'simple_generator' --example simple_login
|
||||
cargo build -F 'simple-generator' --example simple_login
|
||||
cargo clippy --workspace --all-targets --examples --tests --all-features -- -D warnings
|
||||
cargo nextest run --workspace --all-targets --all-features
|
||||
@{{JUST_EXECUTABLE}} msrv
|
||||
|
|
13
README.md
13
README.md
|
@ -14,7 +14,7 @@ First, add the following to your `Cargo.toml`:
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
salvo-captcha = "0.2"
|
||||
salvo-captcha = "0.3"
|
||||
```
|
||||
|
||||
Or use [`cargo add`] to add the dependency to your `Cargo.toml`:
|
||||
|
@ -37,7 +37,7 @@ A high-performance, concurrent, content-addressable disk cache. The storage is b
|
|||
|
||||
```toml
|
||||
[dependencies]
|
||||
salvo-captcha = { version = "0.2", features = ["cacache-storage"] }
|
||||
salvo-captcha = { version = "0.3", features = ["cacache-storage"] }
|
||||
```
|
||||
|
||||
## Captcha Finder
|
||||
|
@ -46,7 +46,14 @@ We provide fully customizable query parameters, form fields, and headers to find
|
|||
|
||||
## Captcha Generator
|
||||
|
||||
We provide [`SimpleCaptchaGenerator`] which is a simple captcha generator based on the [`captcha`] crate. You can implement your own captcha generator by implementing the [`CaptchaGenerator`] trait.
|
||||
We provide [`SimpleCaptchaGenerator`] which is a simple captcha generator based on the [`captcha`] crate, you can enable it by enabling the `simple-generator` feature.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
salvo-captcha = { version = "0.3", features = ["simple-generator"] }
|
||||
```
|
||||
|
||||
You can implement your own generator by implementing the [`CaptchaGenerator`] trait.
|
||||
|
||||
### Captcha name and difficulty
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#[cfg(feature = "simple_generator")]
|
||||
#[cfg(feature = "simple-generator")]
|
||||
mod simple_generator;
|
||||
|
||||
#[cfg(feature = "simple_generator")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "simple-generator")))]
|
||||
#[cfg(feature = "simple-generator")]
|
||||
pub use simple_generator::*;
|
||||
|
||||
/// Captcha generator, used to generate a new captcha image and answer.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#![deny(warnings)]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(clippy::print_stdout)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
mod captcha_gen;
|
||||
mod finder;
|
||||
|
|
|
@ -15,6 +15,7 @@ use std::{sync::Arc, time::Duration};
|
|||
mod cacache_storage;
|
||||
mod memory_storage;
|
||||
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "cacache-storage")))]
|
||||
#[cfg(feature = "cacache-storage")]
|
||||
pub use cacache_storage::*;
|
||||
pub use memory_storage::*;
|
||||
|
|
Loading…
Reference in a new issue