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

barcode-scanner

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

Barcode Scanner plugin supported barcode types

The Barcode Scanner plugin allows scanning of QR codes, EAN-13, and other kinds of barcodes.

Barcode Scanner plugin installation automatic setup

The barcode-scanner plugin can be installed automatically using the package manager command: npm run tauri add barcode-scanner (or equivalent for yarn, pnpm, deno, bun, cargo).

Barcode Scanner plugin Cargo dependency for mobile

Add the plugin to Cargo.toml by running: cargo add tauri-plugin-barcode-scanner --target 'cfg(any(target_os = "android", target_os = "ios"))'

Barcode Scanner plugin JavaScript bindings installation

Install JavaScript guest bindings using: npm install @tauri-apps/plugin-barcode-scanner (or equivalent for yarn, pnpm, deno, bun).

Barcode Scanner iOS camera usage description requirement

On iOS, the barcode scanner plugin requires the NSCameraUsageDescription information property list value in src-tauri/Info.ios.plist to describe why the app needs camera access. Example: <key>NSCameraUsageDescription</key><string>Read QR codes</string>

Barcode Scanner JavaScript usage example

Import and use the barcode scanner as follows: import { scan, Format } from '@tauri-apps/plugin-barcode-scanner'; scan({ windowed: true, formats: [Format.QRCode] });. The windowed: true option sets the webview to transparent instead of opening a separate view for the camera.

Barcode Scanner capability file example

Create a capabilities file (e.g., src-tauri/capabilities/mobile.json) with $schema: ../gen/schemas/mobile-schema.json, identifier: mobile-capability, windows: ["main"], platforms: ["iOS", "android"], and permissions: ["barcode-scanner:allow-scan", "barcode-scanner:allow-cancel"].

Barcode Scanner plugin security model default behavior

By default, all potentially dangerous plugin commands and scopes are blocked and cannot be accessed. Permissions must be explicitly modified in the capabilities configuration to enable the plugin's functionality.

Barcode Scanner plugin purpose

The Barcode Scanner plugin allows mobile applications to use the camera to scan QR codes, EAN-13, and other types of barcodes.

Barcode Scanner cargo add command

To manually install the Barcode Scanner plugin, run: cargo add tauri-plugin-barcode-scanner --target 'cfg(any(target_os = "android", target_os = "ios"))'

Barcode Scanner plugin initialization in Rust

In lib.rs, initialize the Barcode Scanner plugin by adding the following inside the setup closure: app.handle().plugin(tauri_plugin_barcode_scanner::init());. This must be wrapped in #[cfg(mobile)] to only compile for mobile targets.

Barcode Scanner JavaScript import

Import the Barcode Scanner plugin in JavaScript using: import { scan, Format } from '@tauri-apps/plugin-barcode-scanner';. When using "withGlobalTauri": true, use: const { scan, Format } = window.__TAURI__.barcodeScanner;

Barcode Scanner scan function usage

Call the scan function with options like scan({ windowed: true, formats: [Format.QRCode] }). The windowed: true option sets the webview to transparent instead of opening a separate view for the camera, requiring the UI to be ready to display what is underneath with a transparent element.

Barcode Scanner iOS camera permission configuration

On iOS, the Barcode Scanner plugin requires the NSCameraUsageDescription property in the Info.plist file to describe why the application needs to use the camera. Add this to src-tauri/Info.ios.plist: <key>NSCameraUsageDescription</key><string>Leer códigos QR</string>

Barcode Scanner required permissions

The Barcode Scanner plugin requires two permission scopes to be enabled in the capabilities file: barcode-scanner:allow-scan and barcode-scanner:allow-cancel. These must be added to the permissions array in the mobile.json capability file.

Barcode Scanner npm installation

Install the Barcode Scanner JavaScript bindings using: npm install @tauri-apps/plugin-barcode-scanner

Give your agent this brain