tauri-plugin-captcha-breaker-api 0.3.2 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,50 +1,77 @@
|
|
|
1
1
|
# Tauri Plugin: Captcha Breaker
|
|
2
2
|
|
|
3
3
|
A drop-in Tauri plugin for local, offline captcha solving.
|
|
4
|
-
Powered by `captcha-engine` with
|
|
4
|
+
Powered by `captcha-engine` with a custom-trained ONNX model.
|
|
5
5
|
|
|
6
6
|
## Features
|
|
7
7
|
|
|
8
|
-
- **Zero Config**: No model paths, no downloads, no network requests.
|
|
9
|
-
- **Offline Ready**:
|
|
8
|
+
- **Zero Runtime Config**: No model paths, no downloads, no network requests at runtime.
|
|
9
|
+
- **Offline Ready**: The model is downloaded at *build time* and embedded directly into the application binary.
|
|
10
10
|
- **Fast**: ~50ms inference time on CPU.
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
1.
|
|
14
|
+
1. **Add dependency**:
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
Full feature set (recommended):
|
|
17
|
+
```toml
|
|
18
|
+
[dependencies]
|
|
19
|
+
tauri-plugin-captcha-breaker = { git = "https://github.com/milangress/voucher-captcha-system", branch = "main" }
|
|
20
|
+
```
|
|
20
21
|
|
|
21
|
-
2.
|
|
22
|
+
2. **Register the plugin** in `src-tauri/src/lib.rs`:
|
|
22
23
|
|
|
23
|
-
```rust
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
```rust
|
|
25
|
+
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
26
|
+
pub fn run() {
|
|
27
|
+
tauri::Builder::default()
|
|
28
|
+
.plugin(tauri_plugin_captcha_breaker::init())
|
|
29
|
+
.run(tauri::generate_context!())
|
|
30
|
+
.expect("error running app");
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. **Allow permissions** in `src-tauri/capabilities/default.json` (or similar):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"permissions": [
|
|
39
|
+
"captcha-breaker:default"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
31
43
|
|
|
32
44
|
## Usage (Frontend)
|
|
33
45
|
|
|
34
46
|
```typescript
|
|
35
47
|
import { invoke } from '@tauri-apps/api/core';
|
|
36
48
|
|
|
37
|
-
//
|
|
49
|
+
// 1. Initialize (Optional)
|
|
50
|
+
// Pre-loads the model into memory. If you skip this, it auto-loads on first use.
|
|
51
|
+
// Doing this at app startup makes the first user interaction feel instant.
|
|
38
52
|
await invoke('plugin:captcha-breaker|init_model');
|
|
39
53
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
// 2. Break a Captcha
|
|
55
|
+
try {
|
|
56
|
+
const result = await invoke<string>('plugin:captcha-breaker|break_captcha', {
|
|
57
|
+
// You can pass:
|
|
58
|
+
// - A URL (http://...) -> Plugin will download it
|
|
59
|
+
// - A Data URI (data:image/png;base64,...)
|
|
60
|
+
// - A local file path (/Users/...)
|
|
61
|
+
imagePath: 'https://example.com/captcha.png'
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
console.log('Captcha Result:', result);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error('Failed to break captcha:', error);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## How it Works (Model Downloading)
|
|
71
|
+
|
|
72
|
+
You might wonder where the model comes from if you don't provide it.
|
|
73
|
+
|
|
74
|
+
1. **Build Time**: When you run `cargo build`, the `captcha-engine` build script checks for the model file (`assets/captcha_schwarz_finetuned.onnx`).
|
|
75
|
+
2. **Auto-Download**: If the file is missing (e.g., in a CI environment or fresh clone), it automatically downloads the latest version from HuggingFace (`Milang/captcha-solver`) to Rust's `OUT_DIR`.
|
|
76
|
+
3. **Embedding**: The model bytes (~19MB) are then compiled **into the binary** itself.
|
|
77
|
+
4. **Runtime**: When your app runs, the plugin loads the model directly from memory. This guarantees the model is always available and version-matched to the code.
|