tauri-plugin-outis-captcha 1.0.1

Tauri plugin for reading captchas.
docs.rs failed to build tauri-plugin-outis-captcha-1.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

Tauri Plugin: Outis Captcha

A drop-in Tauri plugin for local, offline captcha solving. Powered by outis-captcha-core with a custom-trained ONNX model.

Features

  • Zero Runtime Config: No model paths, no downloads, no network requests at runtime.
  • Offline Ready: The model is downloaded at build time and embedded directly into the application binary.
  • Fast: ~50ms inference time on CPU.

Installation

  1. Add dependency:

    Full feature set (recommended):

    [dependencies]
    tauri-plugin-outis-captcha = { git = "https://github.com/milangress/outis", branch = "main" }
    
  2. Register the plugin in src-tauri/src/lib.rs:

    #[cfg_attr(mobile, tauri::mobile_entry_point)]
    pub fn run() {
        tauri::Builder::default()
            .plugin(tauri_plugin_outis_captcha::init())
            .run(tauri::generate_context!())
            .expect("error running app");
    }
    
  3. Allow permissions in src-tauri/capabilities/default.json (or similar):

    {
      "permissions": [
        "outis-captcha:default"
      ]
    }
    

Usage (Frontend)

import { invoke } from '@tauri-apps/api/core';

// 1. Initialize (Optional)
// Pre-loads the model into memory. If you skip this, it auto-loads on first use.
// Doing this at app startup makes the first user interaction feel instant.
await invoke('plugin:outis-captcha|init_model');

// 2. Break a Captcha
try {
    const result = await invoke<string>('plugin:outis-captcha|read_captcha', {
        // You can pass:
        // - A URL (http://...) -> Plugin will download it
        // - A Data URI (data:image/png;base64,...)
        // - A local file path (/Users/...)
        imagePath: 'https://example.com/captcha.png'
    });

    console.log('Captcha Result:', result);
} catch (error) {
    console.error('Failed to break captcha:', error);
}

How it Works (Model Downloading)

You might wonder where the model comes from if you don't provide it.

  1. Build Time: When you run cargo build, the outis-captcha-core build script checks for the model file (assets/outis-model.rten).
  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/outis) to Rust's OUT_DIR.
  3. Embedding: The model bytes (~19MB) are then compiled into the binary itself.
  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.