Skip to content

Commit

Permalink
🎉 v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Reverier-Xu committed Aug 28, 2023
0 parents commit be94409
Show file tree
Hide file tree
Showing 9 changed files with 726 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/target


# Added by cargo
#
# already existing elements were commented out

#/target
/Cargo.lock
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svg.preview.background": "black"
}
19 changes: 19 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "biosvg"
version = "0.1.0"
edition = "2021"
authors = ["Reverier-Xu <reverier.xu@xdsec.club>"]
description = "Captcha based on SVG."
homepage = "https://github.com/XDSEC/biosvg"
documentation = "https://docs.rs/biosvg"
repository = "https://github.com/XDSEC/biosvg"
readme = "README.md"
license = "MPL-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
once_cell = "1.18"
rand = "0.8"
regex = "1.9"
thiserror = "1.0"
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# BioSvg

Captcha based on SVG.

## Original idea

[SVG绘制原理与验证码](https://blog.woooo.tech/posts/svg_1/)

## Usage

`cargo add biosvg`

```rust
let (answer, svg) = BiosvgBuilder::new()
.length(4)
.difficulty(6)
.colors(vec![
"#0078D6".to_string(),
"#aa3333".to_string(),
"#f08012".to_string(),
"#33aa00".to_string(),
"#aa33aa".to_string(),
])
.build()
.unwrap();
println!("answer: {}", answer);
println!("svg: {}", svg);
```

## Example

![ncuz](samples/ncuz.svg)
![wxgc](samples/wxgc.svg)
77 changes: 77 additions & 0 deletions samples/ncuz.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions samples/wxgc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit be94409

Please sign in to comment.