### All-in-One Pastebar App Build Command (Windows Command Prompt) Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md A single command line that chains all necessary build steps for the Pastebar application on Windows ARM64. It includes Rust target setup, Visual Studio environment configuration, setting the private key, installing npm dependencies, and initiating the build. ```cmd rustup target add aarch64-pc-windows-msvc && "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64 && set TAURI_PRIVATE_KEY=your-key-here && npm install && npm run app:build:windows:arm ``` -------------------------------- ### Install npm Dependencies and Build Pastebar App for Windows ARM64 Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Installs project dependencies using npm and then triggers the build process for the Windows ARM64 platform using the 'npm run app:build:windows:arm' script. This is the final step in the build sequence. ```bash npm install npm run app:build:windows:arm ``` -------------------------------- ### Install Rust ARM64 Target Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Installs the necessary Rust target for ARM64 Windows compilation. This is a prerequisite for cross-compiling Rust code to the ARM64 architecture on a Windows machine. ```bash rustup target add aarch64-pc-windows-msvc ``` -------------------------------- ### Debian/Ubuntu Package Installation (Bash) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/tao-0.16.7/README.md Commands to install the GTK3 development package on Debian and Ubuntu systems. It also includes commands to install either libappindicator3-dev or libayatana-appindicator3-dev, both of which are required for the 'tray' feature on Linux. ```bash sudo apt install libgtk-3-dev ``` ```bash sudo apt install libappindicator3-dev ``` ```bash sudo apt install libayatana-appindicator3-dev ``` -------------------------------- ### Verify Rust ARM64 Target Installation Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Checks if the ARM64 Rust target has been successfully installed. This command helps confirm that the Rust toolchain is ready for ARM64 cross-compilation. ```bash # Check if ARM64 target is installed rustup target list | findstr aarch64-pc-windows-msvc # Should show: aarch64-pc-windows-msvc (installed) ``` -------------------------------- ### Arch Linux Package Installation (Bash) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/tao-0.16.7/README.md Commands to install the GTK3 development package on Arch Linux and Manjaro systems. It also includes the command to install the libappindicator-gtk3 package, which is required for the 'tray' feature on Linux. ```bash sudo pacman -S gtk3 ``` ```bash sudo pacman -S libappindicator-gtk3 ``` -------------------------------- ### Project Development Commands - Bash Source: https://context7.com/pastebar/pastebarapp/llms.txt Common bash commands for managing the Pastebar project, including dependency installation, starting the development server, building the application for production, and running database migrations. ```bash # Install dependencies npm install # Install Diesel CLI for database migrations cargo install diesel_cli --no-default-features --features sqlite # Start development (frontend + backend) npm start # or npm run dev # Build for production npm run build # Platform-specific builds npm run app:build:osx:universal # macOS universal binary npm run app:build:osx:x86_64 # macOS Intel npm run app:build:windows:arm # Windows ARM # Run database migrations npm run diesel:migration:run # Format code npm run format # Frontend only development (port 4422) cd packages/pastebar-app-ui npm run dev ``` -------------------------------- ### Install Dependencies and Update Cargo Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Installs project dependencies using npm and updates the Rust dependencies within the `src-tauri` directory using Cargo. This ensures all necessary packages and crates are up-to-date. ```bash # Ensure all dependencies are installed npm install cd src-tauri cargo update cd .. ``` -------------------------------- ### Install Tauri Plugin Window State JavaScript Bindings Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/window-state/README.md Install the JavaScript Guest bindings for the Tauri plugin window state using a package manager. Read-only mirrors are provided for ergonomic use. ```sh pnpm add https://github.com/tauri-apps/tauri-plugin-window-state # or npm add https://github.com/tauri-apps/tauri-plugin-window-state # or yarn add https://github.com/tauri-apps/tauri-plugin-window-state ``` -------------------------------- ### Settings Management Example (TypeScript) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Illustrates how settings are managed in the frontend using `settingsStore.ts`. It shows the usage of `updateSetting()` and the necessity of invoking `build_system_menu` for settings affecting the system tray. Assumes a context where `settingsStore` and `invoke` are available. ```typescript // Example usage within a React component or hook import { settingsStore } from './settingsStore'; import { invoke } from '@tauri-apps/api/tauri'; async function updateTraySetting(newSettingValue: string) { await settingsStore.updateSetting('trayIconPath', newSettingValue); await invoke('build_system_menu'); // Rebuild menu after changing tray-related settings } // Example of reading a setting const currentDbPath = settingsStore.getSetting('databasePath'); ``` -------------------------------- ### Set Up ARM64 Cross-Compilation Environment Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Configures the Visual Studio build environment for ARM64 cross-compilation on an x64 host using `vcvarsall.bat`. This script sets up the necessary compiler and linker paths. ```cmd "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64 ``` -------------------------------- ### Markdown Table Example Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/store/example.md Provides an example of a markdown table with four columns. It demonstrates default alignment, left, center, and right alignment using colons in the separator row. ```markdown | Column 1 | Column 2 | Column 3 | Column 4 | | -------- | :------- | :------: | -------: | | default | left | center | right | ``` -------------------------------- ### Install Diesel CLI (Bash) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Installs the Diesel CLI, a command-line interface for the Diesel ORM, with support for SQLite. This is a prerequisite for database migrations. ```bash cargo install diesel_cli --no-default-features --features sqlite ``` -------------------------------- ### Manage Auto Launch on macOS with Rust (Launch Agent/AppleScript) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/auto-launch/README.md Illustrates auto-launch management on macOS, supporting both Launch Agent and AppleScript methods. The example demonstrates enabling, checking status, and disabling the auto-launch feature, with notes on path and name requirements. ```rust use auto_launch::AutoLaunch fn main() { let app_name = "the-app"; let app_path = "/path/to/the-app.app"; let auto = AutoLaunch::new(app_name, app_path, false, &[] as &[&str]); // enable the auto launch auto.enable().is_ok(); auto.is_enabled().unwrap(); // disable the auto launch auto.disable().is_ok(); auto.is_enabled().unwrap(); } ``` -------------------------------- ### Build Tauri Application for ARM64 Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Executes the npm script defined to build the Tauri application for the ARM64 Windows target. This command initiates the cross-compilation and packaging process. ```bash npm run app:build:windows:arm ``` -------------------------------- ### Frontend Development Commands (npm) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Commands specific to the frontend development of PasteBar, located in the `packages/pastebar-app-ui/` directory. Includes starting a development server and building the frontend assets. ```bash cd packages/pastebar-app-ui npm run dev # Development server on port 4422 npm run build # Build to dist-ui/ npm run build:ts # TypeScript check and build ``` -------------------------------- ### Install Tauri Plugin Window State Core Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/window-state/README.md Add the Tauri plugin window state core dependency to your Cargo.toml file. This requires a Rust version of at least 1.64. ```toml [dependencies] tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } ``` -------------------------------- ### Main Development and Build Commands (npm) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Provides essential npm commands for PasteBar development, including starting the development server, building for production, creating debug builds, and performing platform-specific builds. It also includes commands for database migrations, code formatting, and version management. ```bash # Development (starts both frontend and backend in dev mode) npm start # or npm run dev # Build for production npm run build # Build debug version npm run app:build:debug # Platform-specific builds npm run app:build:osx:universal npm run app:build:osx:x86_64 npm run app:build:windows:arm # Database migrations npm run diesel:migration:run # Code formatting npm run format # Version management npm run version:sync # Translation audit npm run translation-audit ``` -------------------------------- ### Ordered Lists in Markdown Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/store/example.md Demonstrates creating ordered lists in markdown using numbers followed by a period or parenthesis. Lists can start with any number. ```markdown 1. Ordered 2. Lists 3. Numbers are ignored 4. Ordered 121) Ordered lists can start 122) with any number and 123) use . as well as ) as a separator. ``` -------------------------------- ### GET /list_backups Source: https://context7.com/pastebar/pastebarapp/llms.txt Lists all available backup files stored by the application. It provides metadata for each backup, including filename, full path, creation date, and size. ```APIDOC ## GET /list_backups ### Description Lists all backup files with their metadata. ### Method GET ### Endpoint /list_backups ### Parameters None ### Response #### Success Response (200) - **BackupListResponse** (Object) - Contains a list of backups and total size information. - **backups** (Array) - An array of backup file details. - **filename** (String) - The name of the backup file. - **fullPath** (String) - The complete path to the backup file. - **createdDate** (String) - The date and time the backup was created. - **size** (Number) - The size of the backup file in bytes. - **sizeFormatted** (String) - The human-readable formatted size of the backup file. - **totalSize** (Number) - The total size of all backups in bytes. - **totalSizeFormatted** (String) - The human-readable formatted total size of all backups. #### Response Example ```json { "backups": [ { "filename": "pastebar-data-backup-2024-01-15-14-30.zip", "fullPath": "/path/to/backup.zip", "createdDate": "January 15, 2024 at 02:30 PM", "size": 1048576, "sizeFormatted": "1.0 MB" } ], "totalSize": 2097152, "totalSizeFormatted": "2.0 MB" } ``` ``` -------------------------------- ### Install mid using Cargo CLI Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Adds the 'mid' crate as a dependency to the project using the Cargo command-line interface. This is a convenient alternative to manually editing the Cargo.toml file. ```bash cargo add mid ``` -------------------------------- ### Tauri Build Script Configuration Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Defines the npm script for building a Tauri application specifically for the ARM64 Windows target. This script utilizes the Tauri CLI to perform the cross-compilation. ```json { "scripts": { "app:build:windows:arm": "tauri build --target aarch64-pc-windows-msvc" } } ``` -------------------------------- ### Get All Collections (Rust) Source: https://context7.com/pastebar/pastebarapp/llms.txt Retrieves a list of all available collections from the database. Each collection object contains details such as collection ID, title, and description. This command is essential for displaying or managing user-defined categories. ```rust // Tauri command signature #[tauri::command] pub fn get_collections() -> Vec ``` ```javascript // Frontend invocation const collections = await invoke('get_collections') // Returns array of Collection objects with collection_id, title, description, etc. ``` -------------------------------- ### Configure Tauri Build for Faster Linking and Job Control Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Optimizes the Tauri build process by configuring Cargo to use `lld-link.exe` for faster linking and reducing the number of parallel build jobs to manage memory usage. This is done by adding a configuration to `.cargo/config.toml`. ```toml [build] jobs = 2 # Reduce parallel jobs [target.aarch64-pc-windows-msvc] linker = "lld-link.exe" # Use faster linker ``` -------------------------------- ### Android Dynamic System Library Configuration (TOML) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/tao-0.16.7/README.md Configures a Rust project to build a dynamic system library for Android, necessary for running applications on Android devices using the TAO library. This is achieved by setting the crate type to 'cdylib' for a specific example. ```toml [[example]] name = "request_redraw_threaded" crate-type = ["cdylib"] ``` -------------------------------- ### Clean Previous Tauri Build Artifacts Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Removes old build artifacts to ensure a clean build. This can be done using an npm script or by manually deleting the target directory. ```bash # Remove old build artifacts npm run clean # or manually rmdir /s /q src-tauri\target ``` -------------------------------- ### Custom Data Location Helpers (Rust) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Provides examples of utility functions in Rust for accessing custom data directories. These functions are crucial for handling file operations when the user specifies a custom database location, ensuring path consistency. ```rust use crate::utils::paths::get_data_dir; use std::path::PathBuf; fn get_user_data_path() -> PathBuf { get_data_dir().expect("Failed to get data directory") } fn get_clip_images_path() -> PathBuf { get_data_dir().unwrap().join("clip_images") } // Other path helpers like get_clip_images_dir() would follow a similar pattern. ``` -------------------------------- ### Database Migrations Command Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Shows the command used to run database migrations, which are essential for managing schema changes over time. This command assumes a setup where Diesel migrations are managed via npm scripts. ```bash npm run diesel:migration:run ``` -------------------------------- ### Create a Horizontal Resizable Panel Layout with React Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/components/libs/react-resizable-panels/README.md This example demonstrates how to create a horizontal layout with three resizable panels using the PanelGroup, Panel, and PanelResizeHandle components. The PanelGroup manages the layout, and PanelResizeHandle allows users to adjust the size of adjacent panels. The default sizes are set using the 'defaultSize' prop on the Panel components. ```jsx import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels' ``` -------------------------------- ### Rust: Simulate Keyboard Input with InputBot Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/inputbot/README.md This Rust code snippet demonstrates how to use the `inputbot` library to simulate keyboard input. It shows how to bind a key (Numrow1Key) to send a predefined text sequence ('Hello, world!') and how to create a loop that simulates mouse clicks while a key (CapsLockKey) is toggled. It requires the `inputbot` crate as a dependency. ```rust use inputbot::{KeySequence, KeybdKey::*, MouseButton::*}; use std::{thread::sleep, time::Duration}; fn main() { // Bind the number 1 key your keyboard to a function that types // "Hello, world!" when pressed. Numrow1Key.bind(|| KeySequence("Hello, world!").send()); // Bind your caps lock key to a function that starts an autoclicker. CapsLockKey.bind(move || { while CapsLockKey.is_toggled() { LeftButton.press(); LeftButton.release(); sleep(Duration::from_millis(30)); } }); // Call this to start listening for bound inputs. inputbot::handle_input_events(); } ``` -------------------------------- ### Configure and Manage Auto Launch with Rust Builder Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/auto-launch/README.md Demonstrates using the `AutoLaunchBuilder` to abstract platform-specific configurations for setting up an application to auto-launch. It shows enabling, checking status, and disabling the auto-launch feature. ```rust use auto_launch::* fn main() { let auto = AutoLaunchBuilder::new() .set_app_name("the-app") .set_app_path("/path/to/the-app") .set_use_launch_agent(true) .build() .unwrap(); auto.enable().unwrap(); auto.is_enabled().unwrap(); auto.disable().unwrap(); auto.is_enabled().unwrap(); } ``` -------------------------------- ### Get Machine ID Hash (Rust) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Retrieves the machine ID hash using a provided secret key. This function is essential for generating the unique identifier for software licensing. It returns a Result which can be unwrapped to get the hash string. ```rust let machine_id = mid::get("mySecretKey").unwrap(); // Example: 3f9af06fd78d3390ef35e059623f58af03b7f6ca91690f5af031b774fd541977 ``` -------------------------------- ### List Available Backups Command Source: https://context7.com/pastebar/pastebarapp/llms.txt Lists all available backup files, including their metadata such as filename, full path, creation date, and size. It also provides the total size of all backups. ```rust // Tauri command signature (async) #[tauri::command] pub async fn list_backups() -> Result ``` ```javascript // Frontend invocation const backups = await invoke('list_backups') // Returns BackupListResponse: // { // backups: [ // { filename: "pastebar-data-backup-2024-01-15-14-30.zip", // fullPath: "/path/to/backup.zip", // createdDate: "January 15, 2024 at 02:30 PM", // size: 1048576, // sizeFormatted: "1.0 MB" } // ], // totalSize: 2097152, // totalSizeFormatted: "2.0 MB" // } ``` -------------------------------- ### Embedded HTML Example in Markdown Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/store/example.md Demonstrates how markdown-wasm allows embedded HTML. This functionality is typically enabled by default but can be disabled using ParseFlags.NO_HTML for security. ```markdown With default settings, markdown-wasm allows embedded HTML. > It has been disabled in this demo for safety reasons, by means of setting `ParseFlags.NO_HTML`. > Not setting the `NO_HTML` flag allows embedding HTML like this: ``` -------------------------------- ### Manage Auto Launch on Linux with Rust Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/auto-launch/README.md Shows how to configure and control application auto-launch specifically on Linux using the `AutoLaunch` struct. It includes enabling, checking status, and disabling the auto-launch functionality. ```rust use auto_launch::AutoLaunch fn main() { let app_name = "the-app"; let app_path = "/path/to/the-app"; let auto = AutoLaunch::new(app_name, app_path, &[] as &[&str]); // enable the auto launch auto.enable().is_ok(); auto.is_enabled().unwrap(); // disable the auto launch auto.disable().is_ok(); auto.is_enabled().unwrap(); } ``` -------------------------------- ### Unordered Lists in Markdown Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/store/example.md Shows the syntax for creating unordered lists in markdown using hyphens or asterisks. Each list item starts on a new line. ```markdown - Unordered - Lists - Hello ``` -------------------------------- ### Create Data Backup Command Source: https://context7.com/pastebar/pastebarapp/llms.txt Creates a zip backup of the application's database. It includes an option to also back up associated images. The command returns the full path to the generated backup file. ```rust // Tauri command signature (async) #[tauri::command] pub async fn create_backup(include_images: bool) -> Result ``` ```javascript // Frontend invocation const backupPath = await invoke('create_backup', { includeImages: true }) // Returns: full path to backup file like "/path/to/pastebar-data-backup-2024-01-15-14-30.zip" ``` -------------------------------- ### Set Tauri Private Key Environment Variable Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Sets the TAURI_PRIVATE_KEY environment variable, which is required for signing the application during the build process. Replace 'your-key-here' with your actual private key. ```batch set TAURI_PRIVATE_KEY=your-key-here ``` -------------------------------- ### POST /create_backup Source: https://context7.com/pastebar/pastebarapp/llms.txt Creates a backup of the application's data. It can optionally include images in the backup. The function returns the full path to the created backup file. ```APIDOC ## POST /create_backup ### Description Creates a zip backup of the database and optionally images. ### Method POST ### Endpoint /create_backup ### Parameters #### Request Body - **include_images** (Boolean) - Required - Whether to include images in the backup. ### Request Example ```json { "include_images": true } ``` ### Response #### Success Response (200) - **backupPath** (String) - The full path to the created backup file. #### Response Example ```json { "backupPath": "/path/to/pastebar-data-backup-2024-01-15-14-30.zip" } ``` ``` -------------------------------- ### Manage Auto Launch on Windows with Rust (Registry) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/auto-launch/README.md Details how to manage application auto-launch on Windows using registry entries. The code shows enabling, checking status, and disabling the auto-launch, including handling potential re-enabling if disabled via system UI. ```rust use auto_launch::AutoLaunch fn main() { let app_name = "the-app"; let app_path = "C:\\path\\to\\the-app.exe"; let auto = AutoLaunch::new(app_name, app_path, &[] as &[&str]); // enable the auto launch auto.enable().is_ok(); auto.is_enabled().unwrap(); // disable the auto launch auto.disable().is_ok(); auto.is_enabled().unwrap(); } ``` -------------------------------- ### Set Tauri Private Key Environment Variable Source: https://github.com/pastebar/pastebarapp/blob/main/BUILD_GUIDE_ARM64_WINDOWS.md Sets the `TAURI_PRIVATE_KEY` environment variable, which is required for signing your Tauri application during the build process. Ensure you replace '....your-full-key-here' with your actual private key. ```cmd set TAURI_PRIVATE_KEY=....your-full-key-here ``` -------------------------------- ### Create New Collection (Rust) Source: https://context7.com/pastebar/pastebarapp/llms.txt Creates a new collection with a specified title, description, and selection status. It can optionally initialize the collection with default menu, tab, and board items. Returns 'ok' on success or an error message on failure. ```rust // Tauri command signature #[tauri::command] pub fn create_collection( create_collection: CreateCollection, add_default_menu_tab_board: bool, ) -> Result ``` ```javascript // Frontend invocation await invoke('create_collection', { createCollection: { title: 'My Collection', description: 'Collection for work items', isSelected: true }, addDefaultMenuTabBoard: true }) // Returns: "ok" or error message ``` -------------------------------- ### Get MacOS Secure Element Information (Bash) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Executes the 'system_profiler SPSecureElementDataType' command on MacOS to retrieve information about the Secure Element. Parameters such as Platform ID and SEID are used in the machine ID calculation. ```bash system_profiler SPSecureElementDataType ``` -------------------------------- ### Rust/Tauri Development Commands (cargo) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Commands for building and running the Rust/Tauri backend of PasteBar, located in the `src-tauri/` directory. Includes commands for development mode and production builds. ```bash cd src-tauri cargo run --no-default-features # Development mode cargo build --release # Production build ``` -------------------------------- ### SplitView with Resize Event Handling Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/components/libs/split-view/docs/index.md Shows how to use the onResize prop to capture and display the current size of the primary pane, updating the UI dynamically. ```jsx const DEFAULT_SIZE = 200; const [size, setSize] = React.useState(DEFAULT_SIZE); return ( Primary: {size}px Secondary ); ``` -------------------------------- ### Tauri Command Pattern (Rust) Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Illustrates the standard pattern for defining Tauri commands in Rust. It shows how to access the `AppHandle`, `State`, and parameters within a command function, and how to return a `Result` for success or failure. ```rust #[tauri::command] pub fn command_name( app_handle: tauri::AppHandle, state: tauri::State, params: Type ) -> Result { // Implementation } ``` -------------------------------- ### Get Clipboard History (Rust) Source: https://context7.com/pastebar/pastebarapp/llms.txt Fetches the clipboard history data with support for pagination (limit and offset). It also includes automatic word masking for privacy. The command requires access to application settings and returns a vector of `ClipboardHistoryWithMetaData` objects. ```rust // Tauri command signature #[tauri::command] pub fn get_clipboard_history( app_settings: tauri::State>>, limit: Option, offset: Option, ) -> Vec ``` ```javascript const history = await invoke('get_clipboard_history', { limit: 50, offset: 0 }) // Returns array of ClipboardHistoryWithMetaData objects ``` -------------------------------- ### Get Windows Processor Identifier (PowerShell) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Uses PowerShell to query the Win32_Processor WMI object for the computer's processor identifier. While generally stable, this parameter might change if the processor is replaced, impacting the machine ID. ```powershell powershell -command "Get-WmiObject Win32_Processor" ``` -------------------------------- ### Frontend Build Output Configuration Source: https://github.com/pastebar/pastebarapp/blob/main/CLAUDE.md Specifies the output directory for the frontend build process (`packages/pastebar-app-ui/dist-ui/`) and the development server port (4422). It also mentions the separate Tauri configuration files for development and production builds. ```plaintext Frontend build output: packages/pastebar-app-ui/dist-ui/ Dev server runs on port: 4422 Tauri configs: tauri.conf.json (dev), tauri.release.conf.json (production) ``` -------------------------------- ### Get MID Data Structure (Rust) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Retrieves a structured data object containing the secret key, the list of OS parameters used for hashing, and the resulting hash. This is useful for inspecting the components that form the machine ID. ```rust let mid_data = mid::data("mySecretKey").unwrap(); // MacOS example: MidData { key: "mySecretKey", result: ["ModelNumber", "SerialNumber", "HardwareUUID", "ProvisioningUDID", "PlatformID", "SEID"], hash: "3f9af06fd78d3390ef35e059623f58af03b7f6ca91690f5af031b774fd541977" } ``` -------------------------------- ### Save All Window States in Rust Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/window-state/README.md Use the `save_window_state` method from the `AppHandleExt` trait to save the state of all open windows to disk. This requires importing `AppHandleExt` and `StateFlags`. ```rust use tauri_plugin_window_state::{AppHandleExt, StateFlags}; // `tauri::AppHandle` now has the following additional method app.save_window_state(StateFlags::all()); // will save the state of all open windows to disk ``` -------------------------------- ### Get Active Collection with Clips (Rust) Source: https://context7.com/pastebar/pastebarapp/llms.txt Retrieves the currently active collection, including all its associated clips, tabs, and boards. This is useful for displaying the contents of the user's current working context. Returns a `CollectionWithClips` object or `null` if no collection is active. ```rust // Tauri command signature #[tauri::command] pub fn get_active_collection_with_clips() -> Option ``` ```javascript // Frontend invocation const activeCollection = await invoke('get_active_collection_with_clips') // Returns CollectionWithClips object or null ``` -------------------------------- ### Restore Window State from Disk in Rust Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/window-state/README.md Use the `restore_state` method from the `WindowExt` trait to manually restore a window's state from disk. This requires importing `WindowExt` and `StateFlags`. ```rust use tauri_plugin_window_state::{WindowExt, StateFlags}; // all `Window` types now have the following additional method window.restore_state(StateFlags::all()); // will restore the windows state from disk ``` -------------------------------- ### Get Windows BIOS Serial Number (PowerShell) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Uses PowerShell to query the Win32_BIOS WMI object for the computer's BIOS serial number. This parameter is generally static and contributes to a stable machine ID on Windows systems. ```powershell powershell -command "Get-WmiObject Win32_BIOS" ``` -------------------------------- ### Restore Backup - Tauri Command Source: https://context7.com/pastebar/pastebarapp/llms.txt Restores data from a specified backup file. It can optionally create a backup of the current data before restoring. This is an asynchronous command. ```rust // Tauri command signature (async) #[tauri::command] pub async fn restore_backup( backup_path: String, create_pre_restore_backup: bool, ) -> Result ``` ```javascript // Frontend invocation await invoke('restore_backup', { backupPath: '/path/to/pastebar-data-backup-2024-01-15-14-30.zip', createPreRestoreBackup: true }) // Returns: "Backup restored successfully" ``` -------------------------------- ### Get MacOS Hardware Information (Bash) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Executes the 'system_profiler SPHardwareDataType' command on MacOS to retrieve hardware characteristics. Key parameters like Model Number, Serial Number, and Hardware UUID are extracted for machine ID generation. ```bash system_profiler SPHardwareDataType ``` -------------------------------- ### Get Windows Computer System Product UUID (PowerShell) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Uses PowerShell to query the Win32_ComputerSystemProduct WMI object for the computer's unique product identifier (UUID). This value is often tied to the motherboard and is a key component for Windows machine IDs. ```powershell powershell -command "Get-WmiObject Win32_ComputerSystemProduct" ``` -------------------------------- ### Basic SplitView Layout Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/components/libs/split-view/docs/index.md Demonstrates a standard SplitView with primary and secondary panes, configurable with minimum, maximum, and default sizes, and a specified height. ```jsx Primary Secondary ``` -------------------------------- ### Get Windows Baseboard Serial Number (PowerShell) Source: https://github.com/pastebar/pastebarapp/blob/main/src-tauri/libs/mid-hardware-id/README.md Uses PowerShell to query the Win32_BaseBoard WMI object for the computer's baseboard serial number. Similar to the BIOS serial number, this value is typically constant and aids in consistent machine identification on Windows. ```powershell powershell -command "Get-WmiObject Win32_BaseBoard" ``` -------------------------------- ### Panel Component API Source: https://github.com/pastebar/pastebarapp/blob/main/packages/pastebar-app-ui/src/components/libs/react-resizable-panels/README.md Documentation for the Panel component, including its props and imperative API for managing panel states like size and collapse. ```APIDOC ## Panel Component API ### Description The `Panel` component represents a resizable and collapsible section within a layout group. It accepts various props to control its appearance, behavior, and state, and also exposes an imperative API for programmatic control. ### Props #### `children` - **Type**: `ReactNode` - **Description**: Arbitrary React element(s) to be rendered inside the panel. #### `className` - **Type**: `?string` - **Description**: A CSS class name to attach to the root element of the panel. #### `collapsedSize` - **Type**: `?number = 0` - **Description**: The size the panel should collapse to. Defaults to 0. #### `collapsible` - **Type**: `?boolean = false` - **Description**: If true, the panel can be collapsed when resized beyond its `minSize`. #### `defaultSize` - **Type**: `?number` - **Description**: The initial size of the panel, specified as a numeric value between 1 and 100. #### `id` - **Type**: `?string` - **Description**: A unique identifier for the panel within its group. If not provided, a unique ID is generated using `useId`. #### `maxSize` - **Type**: `?number = 100` - **Description**: The maximum allowable size of the panel, specified as a numeric value between 1 and 100. Defaults to 100. #### `minSize` - **Type**: `?number = 10` - **Description**: The minimum allowable size of the panel, specified as a numeric value between 1 and 100. Defaults to 10. #### `onCollapse` - **Type**: `?(collapsed: boolean) => void` - **Description**: A callback function that is called when the panel's collapsed state changes. It receives a boolean indicating the new collapsed state. #### `onResize` - **Type**: `?(size: number) => void` - **Description**: A callback function that is called when the panel is resized. It receives the new size as a numeric value between 1 and 100. #### `order` - **Type**: `?number` - **Description**: The order of the panel within its group. This prop is required for groups with conditionally rendered panels. #### `style` - **Type**: `?CSSProperties` - **Description**: Custom CSS styles to apply to the root element of the panel. #### `tagName` - **Type**: `?string = "div"` - **Description**: The HTML element tag name to use for the root element of the panel. Defaults to 'div'. ### Imperative API #### `collapse()` - **Description**: If the panel is `collapsible`, this method collapses it fully. #### `expand()` - **Description**: If the panel is currently collapsed, this method expands it to its most recently saved size. #### `getCollapsed(): boolean` - **Description**: Returns `true` if the panel is currently collapsed (size is 0), `false` otherwise. #### `getSize(): number` - **Description**: Returns the most recently committed size of the panel as a percentage (1-100). #### `resize(percentage: number)` - **Description**: Resizes the panel to the specified percentage (1-100). ```