Skip to content

Migrate to tauri 2.0#1

Open
girish946 wants to merge 37 commits into
mainfrom
dev
Open

Migrate to tauri 2.0#1
girish946 wants to merge 37 commits into
mainfrom
dev

Conversation

@girish946

Copy link
Copy Markdown
Owner

This pull request introduces significant updates to the Tauri application setup, build configuration, and code structure to modernize the project, transition to Tauri v2, and simplify both the Rust and JavaScript codebases. The changes streamline dependency management, update build workflows, and refactor the Rust backend to use a library-based approach. Additionally, the frontend JavaScript is simplified to a minimal example.

Build and Dependency Updates:

  • Migrated the Tauri app and its dependencies to version 2, updating Cargo.toml, tauri.conf.json, and related build scripts. The project now directly depends on the liblitho Rust crate for device operations instead of the external litho binary. [1] [2] [3]
  • Updated the GitHub Actions workflow to use Tauri v1 action, Ubuntu 22.04, and improved caching and dependency installation. The workflow now triggers on both push and pull request events.

Codebase Refactoring:

  • Replaced the custom Rust logic in src-tauri/src/main.rs with a call to lithographer_lib::run(), delegating all application logic to the library crate and simplifying the entry point.
  • Drastically simplified the frontend JavaScript in src/main.js to a minimal Tauri command invocation example, removing all device selection and flashing logic.

Configuration and Metadata Improvements:

  • Updated project metadata including version, description, and author in Cargo.toml and tauri.conf.json. Added a new package.json for the frontend. [1] [2] [3]
  • Added a default capability JSON for Tauri v2 plugin permissions and improved .gitignore to exclude generated schemas. [1] [2]

Summary of Key Changes:

Build System & Dependencies

  • Migrated to Tauri v2, updated Rust and JS dependencies, and switched to using the liblitho crate for device operations. [1] [2]
  • Overhauled the GitHub Actions workflow for improved compatibility and build reliability.

Codebase Refactoring

  • Replaced the Rust application entry point with a call to lithographer_lib::run(), offloading logic to a library crate.
  • Simplified the frontend JavaScript to a basic Tauri command example, removing complex device and flashing logic.

Configuration & Metadata

  • Updated application metadata and configuration files for Tauri v2 and new build conventions. [1] [2]
  • Added Tauri v2 capability configuration and improved .gitignore for generated files. [1] [2]

girish946 added 30 commits June 21, 2026 13:03
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
…p the app

Signed-off-by: Girish <mail@girishjoshi.io>
Modernize the lithographer frontend and add real image path selection via
the system file dialog.

Backend:
- Add pick_image_path Tauri command using rfd (open for flash, save for clone)
- Register command in invoke handler; add rfd dependency
- Remove no-op litho binary beforeBundleCommand from tauri.conf.json
- Set default window to 920×720 (min 300×360, resizable)

Frontend:
- Replace simulated file pick with invoke("pick_image_path")
- Mode-aware file section (SOURCE IMAGE vs OUTPUT IMAGE)
- Light/dark theme toggle with localStorage; CSS variables for both themes
- Swap logo by theme; enlarge header logo
- Replace static "Connected" badge with get_startup_diagnostics privilege state
- Responsive layout: flexible width, scrollable body, compact header on narrow screens

Simulation for flash/clone progress is unchanged (real liblitho I/O not wired yet).
Signed-off-by: Girish <mail@girishjoshi.io>
…ction

Mirror litho-tui protections in the Lithographer frontend so users cannot
casually target internal disks without an explicit warning.

- Sort the device dropdown removable-first (client-side, matching backend order)
- Auto-select the first removable device on load
- Show a confirmation modal when a fixed (non-removable) device is chosen
- Keep an amber warning banner visible while a fixed device remains selected
- Support Esc/Cancel and Enter/Continue in the confirm dialog
- Await device load before applying launch params to avoid selection races
- Treat unknown CLI --device paths as fixed so they go through confirm

Aligns GUI device-picker behavior with litho-tui NonRemovableConfirm and
default_device_index.

Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Restore fast flash/clone I/O in the GUI by computing buffer size from the
target device, wiring optional checksum verification, and building the litho
sidecar with real block I/O.

Backend:
- Compute I/O block size via `liblitho::devices::optimal_io_block_size` when
  `block_size` is omitted (replaces hardcoded 4096)
- Add `verify` parameter to `start_litho_operation`; pass `--verify` to litho
  sidecar for flash when enabled
- Build sidecar with `--no-default-features --features real-io` in
  `prepare-litho-sidecar.sh`
- Prefer `target/release/litho` over debug in dev sidecar resolution

Frontend:
- Remove hardcoded `blockSize: 4096` from start invocation
- Add VERIFICATION checkbox (flash mode only, default off)
- Hide and reset verify UI in clone mode; disable while operation runs
- Read checkbox state directly at start time

---

# previous commits (already applied)

feat(ui): native file picker, themes, and privilege status

Modernize the lithographer frontend and add real image path selection via
the system file dialog.

Backend:
- Add pick_image_path Tauri command using rfd (open for flash, save for clone)
- Register command in invoke handler; add rfd dependency
- Remove no-op litho binary beforeBundleCommand from tauri.conf.json
- Set default window to 920×720 (min 300×360, resizable)

Frontend:
- Replace simulated file pick with invoke("pick_image_path")
- Mode-aware file section (SOURCE IMAGE vs OUTPUT IMAGE)
- Light/dark theme toggle with localStorage; CSS variables for both themes
- Swap logo by theme; enlarge header logo
- Replace static "Connected" badge with get_startup_diagnostics privilege state
- Responsive layout: flexible width, scrollable body, compact header on narrow screens

Simulation for flash/clone progress is unchanged (real liblitho I/O not wired yet).

---

# committed as 371ad17 on dev
feat(io): optimal block size, optional verify, and real-io sidecar
Signed-off-by: Girish <mail@girishjoshi.io>
Stop loading Tailwind, Font Awesome, and Google Fonts from CDNs at runtime.
Vendor assets ship under src/vendor/ for faster, offline-first startup in
the Tauri webview.

Frontend:
- Replace CDN script/link tags with local vendor/tailwindcss-3.4.17.js,
  vendor/fontawesome/, and vendor/fonts/
- Move font loading out of inline @import into vendor/fonts/fonts.css
- Refresh index.html styling (cyan accent, card/surface tokens, layout polish)
- Keep privilege status in the header badge only; drop redundant footer copy

Tooling:
- Add scripts/vendor-frontend-assets.sh to download/update bundled assets
- Add npm run vendor-assets
- Run vendor-assets in GitHub Actions before the Tauri build

Signed-off-by: Girish <mail@girishjoshi.io>
Wire Lithographer cancel to litho's  protocol so flash/clone
stop between blocks when pkexec elevates the sidecar. Stdin cancel and
parent signals do not work across the privilege boundary.

Runner:
- Create  per operation; pass
- On cancel, write marker file (and stdin as best-effort fallback)
- Fix runner lock: take child before  so cancel does not deadlock
- Remove spent cancel file when the sidecar exits

Protocol / UI:
- Parse ; extend  event with  field
- Cancel shows Cancelling… until litho stops; ignore stale progress
- Fire-and-forget cancel invoke so the webview does not block

Requires rebuilt litho sidecar:
  ./src-tauri/scripts/prepare-litho-sidecar.sh

Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Enable Lithographer on Windows alongside the existing Linux build.

Elevation: when flash/clone needs admin, relaunch Lithographer via UAC
with --auto-run instead of elevating litho.exe directly, so litho runs as
a hidden piped child and progress streams into the GUI. Add privilege
module (UAC + TokenElevation), win_console attach for dev logging, and
handoff CLI args including block size and verify.

CI: clone litho from the windows-implementation branch in both jobs;
add a windows-latest workflow that installs OpenSSL, builds the sidecar,
and uploads MSI/NSIS artifacts.

UI: privilege/UAC badges, preserve litho errors on failure, register
litho-event listener before auto-start, and relax device-list validation
on elevated --auto-run handoff.

Window chrome: keep frameless on Linux (tauri.linux.conf.json) and use
the native frame on Windows (tauri.windows.conf.json).

Also gate webkit2gtk to Linux, resolve litho sidecar .exe paths, and
update README clone instructions to match CI.

Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Signed-off-by: Girish Joshi <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
girish946 added 7 commits July 6, 2026 23:02
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Signed-off-by: Girish <mail@girishjoshi.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant