tauri-plugin-captcha-breaker-api 0.3.2
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 +50 -0
- package/dist-js/index.cjs +32 -0
- package/dist-js/index.d.ts +16 -0
- package/dist-js/index.js +28 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Tauri Plugin: Captcha Breaker
|
|
2
|
+
|
|
3
|
+
A drop-in Tauri plugin for local, offline captcha solving.
|
|
4
|
+
Powered by `captcha-engine` with the embedded model.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Zero Config**: No model paths, no downloads, no network requests.
|
|
9
|
+
- **Offline Ready**: Model is bundled directly into the application binary.
|
|
10
|
+
- **Fast**: ~50ms inference time on CPU.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
1. Add to `Cargo.toml`:
|
|
15
|
+
|
|
16
|
+
```toml
|
|
17
|
+
[dependencies]
|
|
18
|
+
tauri-plugin-captcha-breaker = { path = "plugins/tauri-plugin-captcha-breaker" }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Register in `lib.rs`:
|
|
22
|
+
|
|
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
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage (Frontend)
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { invoke } from '@tauri-apps/api/core';
|
|
36
|
+
|
|
37
|
+
// Optional: Pre-load model at startup for instant first prediction
|
|
38
|
+
await invoke('plugin:captcha-breaker|init_model');
|
|
39
|
+
|
|
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
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@tauri-apps/api/core');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Breaks a captcha from a local file path or a remote URL.
|
|
7
|
+
*
|
|
8
|
+
* @param imagePath Local path or HTTP/HTTPS URL of the captcha image.
|
|
9
|
+
* @returns The decoded captcha text.
|
|
10
|
+
*/
|
|
11
|
+
async function breakCaptcha(imagePath) {
|
|
12
|
+
return await core.invoke('plugin:captcha-breaker|break_captcha', {
|
|
13
|
+
imagePath,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Ensures the model is downloaded and loaded into memory.
|
|
18
|
+
* This can be called pre-emptively to avoid lag on the first captcha break.
|
|
19
|
+
*/
|
|
20
|
+
async function initModel() {
|
|
21
|
+
return await core.invoke('plugin:captcha-breaker|init_model');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deletes the model from disk and from memory.
|
|
25
|
+
*/
|
|
26
|
+
async function deleteModel() {
|
|
27
|
+
return await core.invoke('plugin:captcha-breaker|delete_model');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.breakCaptcha = breakCaptcha;
|
|
31
|
+
exports.deleteModel = deleteModel;
|
|
32
|
+
exports.initModel = initModel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breaks a captcha from a local file path or a remote URL.
|
|
3
|
+
*
|
|
4
|
+
* @param imagePath Local path or HTTP/HTTPS URL of the captcha image.
|
|
5
|
+
* @returns The decoded captcha text.
|
|
6
|
+
*/
|
|
7
|
+
export declare function breakCaptcha(imagePath: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Ensures the model is downloaded and loaded into memory.
|
|
10
|
+
* This can be called pre-emptively to avoid lag on the first captcha break.
|
|
11
|
+
*/
|
|
12
|
+
export declare function initModel(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Deletes the model from disk and from memory.
|
|
15
|
+
*/
|
|
16
|
+
export declare function deleteModel(): Promise<void>;
|
package/dist-js/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { invoke } from '@tauri-apps/api/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Breaks a captcha from a local file path or a remote URL.
|
|
5
|
+
*
|
|
6
|
+
* @param imagePath Local path or HTTP/HTTPS URL of the captcha image.
|
|
7
|
+
* @returns The decoded captcha text.
|
|
8
|
+
*/
|
|
9
|
+
async function breakCaptcha(imagePath) {
|
|
10
|
+
return await invoke('plugin:captcha-breaker|break_captcha', {
|
|
11
|
+
imagePath,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Ensures the model is downloaded and loaded into memory.
|
|
16
|
+
* This can be called pre-emptively to avoid lag on the first captcha break.
|
|
17
|
+
*/
|
|
18
|
+
async function initModel() {
|
|
19
|
+
return await invoke('plugin:captcha-breaker|init_model');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Deletes the model from disk and from memory.
|
|
23
|
+
*/
|
|
24
|
+
async function deleteModel() {
|
|
25
|
+
return await invoke('plugin:captcha-breaker|delete_model');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { breakCaptcha, deleteModel, initModel };
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tauri-plugin-captcha-breaker-api",
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"author": "Milan Gress",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/milangress/voucher-captcha-system.git",
|
|
9
|
+
"directory": "plugins/tauri-plugin-captcha-breaker"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"description": "Tauri plugin for breaking captchas.",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"types": "./dist-js/index.d.ts",
|
|
17
|
+
"main": "./dist-js/index.cjs",
|
|
18
|
+
"module": "./dist-js/index.js",
|
|
19
|
+
"exports": {
|
|
20
|
+
"types": "./dist-js/index.d.ts",
|
|
21
|
+
"import": "./dist-js/index.js",
|
|
22
|
+
"require": "./dist-js/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist-js",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@tauri-apps/api": "^2.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@rollup/plugin-typescript": "^12.0.0",
|
|
33
|
+
"rollup": "^4.9.6",
|
|
34
|
+
"typescript": "^5.3.3",
|
|
35
|
+
"tslib": "^2.6.2"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rollup -c",
|
|
39
|
+
"pretest": "pnpm build"
|
|
40
|
+
}
|
|
41
|
+
}
|