new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Tauri · Plugins and security · all subjects

plugin development

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Plugin command creation and permission auto-generation

To create a plugin command that gets auto-generated permissions, implement the command with the #[command] attribute in src/commands.rs, then add the command name to the COMMANDS array in src/build.rs. This triggers automatic creation of allow and deny permissions for that command.

Exposing plugin commands to the frontend

Plugin commands must be registered in the invoke_handler using tauri::generate_handler! macro in src/lib.rs, and then exposed in the guest-js/index.ts frontend module with wrapper functions that use the invoke function from @tauri-apps/api/core.

Frontend invoke parameter naming convention

When invoking plugin commands from the frontend, parameter names must be in CamelCase, not snake_case. For example, a Rust parameter 'user_input' should be passed as 'userInput' in the frontend invoke call.

Plugin generation using Tauri CLI

A new Tauri plugin can be created using 'cargo tauri plugin new <name>' command. This generates a complete plugin source code structure including src/commands.rs, src/lib.rs, guest-js/index.ts, permissions/default.toml, and an examples/tauri-app directory for testing.

Plugin setup requires Tauri CLI version 2.x

Creating and building Tauri plugins requires Tauri CLI version 2.x or later. This can be verified by running 'cargo tauri info' which should indicate the tauri-cli version as 2.x.

Example: write_custom_file plugin command

A plugin command 'write_custom_file' can be implemented to write user input to a file. The Rust function accepts a String for user_input and an AppHandle, then uses std::fs::write() with app.path().temp_dir() to write to the temporary directory. The frontend wrapper accepts user_input as a parameter and invokes the command using 'plugin:test|write_custom_file'.

Tauri v2.0.0-alpha.3 MSRV

Tauri v2.0.0-alpha.3 bumps the Minimum Supported Rust Version (MSRV) to 1.64.

Give your agent this brain