tauri-plugin-captcha-breaker-api 0.3.2 → 0.4.7

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.
Files changed (2) hide show
  1. package/README.md +56 -29
  2. 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 the embedded model.
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**: Model is bundled directly into the application binary.
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. Add to `Cargo.toml`:
14
+ 1. **Add dependency**:
15
15
 
16
- ```toml
17
- [dependencies]
18
- tauri-plugin-captcha-breaker = { path = "plugins/tauri-plugin-captcha-breaker" }
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. Register in `lib.rs`:
22
+ 2. **Register the plugin** in `src-tauri/src/lib.rs`:
22
23
 
23
- ```rust
24
- pub fn run() {
25
- tauri::Builder::default()
26
- .plugin(tauri_plugin_captcha_breaker::init())
27
- .run(tauri::generate_context!())
28
- .expect("error running app");
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
- // Optional: Pre-load model at startup for instant first prediction
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
- // Solve a captcha
41
- const text = await invoke('plugin:captcha-breaker|break_captcha', {
42
- imagePath: 'https://example.com/captcha.png'
43
- // Supports:
44
- // - Remote URLs (downloaded automatically)
45
- // - Data URIs (data:image/png;base64,...)
46
- // - Local file paths
47
- });
48
-
49
- console.log('Solved:', text);
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-captcha-breaker-api",
3
- "version": "0.3.2",
3
+ "version": "0.4.7",
4
4
  "author": "Milan Gress",
5
5
  "license": "MIT",
6
6
  "repository": {