diff --git a/.cairn/baseline.json b/.cairn/baseline.json index 923bca3bc3..3646b363c8 100644 --- a/.cairn/baseline.json +++ b/.cairn/baseline.json @@ -1,65 +1,58 @@ -{ - "R1 obc-app board-inputs": 1, - "R1 obc-app card-storage": 5, - "R1 obc-app device-link": 1, - "R1 obc-app discovery": 10, - "R1 obc-app firmware-update": 1, - "R1 obc-app navigation": 11, - "R1 obc-app ride-recording": 8, - "R1 obc-app rider-interface": 87, - "R1 obc-data-steps content": 3, - "R1 obc-data-steps device-map-baking": 3, - "R1 obc-data-steps planner-map-baking": 2, - "R1 obc-data-steps source-preparation": 7, - "R1 obc-fw-nrf54l board-support": 26, - "R2 content host host/": 1, - "R2 content host tools/": 1, - "R2 data-engine host host/": 1, - "R2 data-engine host tools/": 1, - "R2 device-link host host/": 1, - "R2 device-link host sim/": 1, - "R2 device-map-baking host host/": 1, - "R2 device-map-baking host tools/": 1, - "R2 map-assembly web builder/wasm/": 1, - "R2 map-assembly web builder/web/": 1, - "R2 planner-map-baking host host/": 1, - "R2 planner-map-baking host tools/": 1, - "R2 repository-tooling host firmware/tools/": 1, - "R2 repository-tooling host host/": 1, - "R2 repository-tooling host tools/": 1, - "R2 routing host planner/": 1, - "R2 routing host tools/": 1, - "R2 search host host/": 1, - "R2 search host planner/": 1, - "R2 search host tools/": 1, - "R2 source-preparation host host/": 1, - "R2 source-preparation host tools/": 1, - "R2 trailview host host/": 1, - "R2 trailview host tools/": 1, - "R3 companion-ios": 48450, - "R3 device-firmware": 13702, - "R3 device-map-builder": 17788, - "R3 obc-data": 2006, - "R3 planner-tile-server": 636, - "R3 simulators": 15003, - "R3 trailview-page": 63, - "R3 web-planner": 13, - "R3 website": 2008, - "R4 content": 8, - "R4 data-engine": 5, - "R4 device-map-baking": 1, - "R4 planner-map-baking": 17, - "R4 routing": 1, - "R4 search": 2, - "R4 source-preparation": 3, - "R4 trailview": 13, - "cycle card-storage -> device-link": 1, - "cycle content -> device-map-baking": 1, - "cycle content -> map-reading": 1, - "cycle device-link -> card-storage": 1, - "cycle device-map-baking -> content": 1, - "cycle device-map-baking -> map-reading": 1, - "cycle device-map-baking -> source-preparation": 1, - "cycle map-reading -> device-map-baking": 1, - "cycle source-preparation -> map-reading": 1 -} +[ + "R1 obc-app board-inputs", + "R1 obc-app card-storage", + "R1 obc-app device-link", + "R1 obc-app discovery", + "R1 obc-app firmware-update", + "R1 obc-app navigation", + "R1 obc-app ride-recording", + "R1 obc-app rider-interface", + "R1 obc-data-steps content", + "R1 obc-data-steps device-map-baking", + "R1 obc-data-steps planner-map-baking", + "R1 obc-data-steps source-preparation", + "R1 obc-fw-nrf54l board-support", + "R4 content", + "R4 data-engine", + "R4 device-map-baking", + "R4 planner-map-baking", + "R4 routing", + "R4 search", + "R4 source-preparation", + "R4 trailview", + "cycle card-storage -> device-link", + "cycle content -> device-map-baking", + "cycle content -> map-reading", + "cycle device-link -> card-storage", + "cycle device-link -> device-map-builder", + "cycle device-link -> firmware-update", + "cycle device-link -> map-assembly", + "cycle device-map-baking -> content", + "cycle device-map-baking -> map-reading", + "cycle device-map-baking -> source-preparation", + "cycle device-map-builder -> device-link", + "cycle device-map-builder -> firmware-update", + "cycle device-map-builder -> map-assembly", + "cycle device-map-builder -> map-style", + "cycle device-map-builder -> route-planning", + "cycle device-map-builder -> trailview", + "cycle firmware-update -> device-link", + "cycle host-runtime -> card-storage", + "cycle map-assembly -> card-storage", + "cycle map-assembly -> device-link", + "cycle map-assembly -> device-map-builder", + "cycle map-assembly -> host-runtime", + "cycle map-assembly -> map-style", + "cycle map-assembly -> route-planning", + "cycle map-reading -> device-map-baking", + "cycle map-style -> device-map-builder", + "cycle map-style -> map-assembly", + "cycle route-planning -> device-map-builder", + "cycle route-planning -> map-assembly", + "cycle route-planning -> trailview", + "cycle source-preparation -> map-reading", + "cycle trailview -> route-planning", + "dependency search -> device-map-builder", + "test dependency route-planning -> planner-map-baking", + "test dependency trailview -> device-map-builder" +] diff --git a/.cairn/config.json b/.cairn/config.json index 93d8ab12cf..181b5769f4 100644 --- a/.cairn/config.json +++ b/.cairn/config.json @@ -1,15 +1,10 @@ { "docs": "docs/design", "baseline": ".cairn/baseline.json", - "specs": "specs", "leaf_lines": 4000, "leaf_files": 60, "skill": {"path": "tools/cairn/skill/cairn", "router_tokens": 2000, "reference_tokens": 2000}, "tests": ["**/tests/**", "tests.rs", "*_tests.rs", "*_test.py", "*Tests.swift", "*.test.ts"], - "size": { - "S": {"systems": 1, "lines": 500}, - "M": {"systems": 3, "lines": 1500} - }, "sources": { "extensions": [".rs", ".ts", ".svelte", ".py", ".swift", ".wgsl", ".js", ".mjs", ".sh", ".h", ".c"], "files": ["tools/obc"] @@ -17,19 +12,11 @@ "adapters": { "cargo": { "ignore": ["**/vendor/**"] + }, + "imports": { + "extensions": [".ts", ".svelte", ".js", ".mjs"] } }, - "runtimes": { - "firmware/": "device", - "firmware/tools/": "host", - "host/": "host", - "planner/": "host", - "sim/": "host", - "tools/": "host", - "builder/web/": "web", - "builder/wasm/": "web", - "companion-ios/": "ios" - }, "tooling": { "path": "tools/", "area": "Tooling" @@ -42,25 +29,10 @@ "code-review": { "tier": "strong", "effort": "high" }, "doc-peanut": { "tier": "balanced", "effort": "medium" }, "doc-hay": { "tier": "balanced", "effort": "medium" }, - "implementer": { "tier": "inherit" }, - "drift": { "tier": "balanced", "effort": "low" } + "implementer": { "tier": "inherit" } }, "tiers": { "claude-code": { "strong": "opus", "balanced": "sonnet", "fast": "haiku" }, - "api": { "strong": "claude-opus", "balanced": "claude-sonnet", "fast": "claude-haiku" }, "codex": { "strong": "gpt-6-astra", "balanced": "gpt-6.1-sol", "fast": "gpt-6-luna" } - }, - "report": { - "budget_usd": 5, - "max_input_chars": 40000, - "max_tokens": 8000, - "timeout_minutes": 180, - "ignore": ["*.lock", "package-lock.json", "*.svg", "*.webp", "*.bin", "*.raw", "*.step", "*.stp", - "*.kicad_mod", "*.kicad_pcb", "*.kicad_sch", "*.gpx", "*.sha256"], - "batch_prices": { - "claude-opus-5-5": { "input": 2, "output": 10, "cache_read": 0.1 }, - "claude-sonnet-5-5": { "input": 1, "output": 5, "cache_read": 0.05 }, - "claude-haiku-5-5": { "input": 0.05, "output": 0.25, "cache_read": 0.005 } - } } } diff --git a/.claude/launch.json b/.claude/launch.json index 49410ac402..adc89e47dd 100644 --- a/.claude/launch.json +++ b/.claude/launch.json @@ -21,13 +21,6 @@ "cwd": "builder/web", "port": 5173 }, - { - "name": "web-builder-desktop", - "runtimeExecutable": "npm", - "runtimeArgs": ["run", "dev", "--", "--mode", "desktop", "--port", "5173"], - "cwd": "builder/web", - "port": 5173 - }, { "name": "data-page", "runtimeExecutable": "tools/obc", diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index c16686dd6e..d590278a3c 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -1,7 +1,7 @@ name: Bake -# Build catalog cells once, centrally, so the website and desktop app can select, -# download, and assemble the same verified inputs. +# Build catalog cells once, centrally, so the website can select, download, and +# assemble the same verified inputs. # # ── READ THIS BEFORE ADDING A COUNTRY TO THE MATRIX ──────────────────────────────── # diff --git a/.github/workflows/cairn-report.yml b/.github/workflows/cairn-report.yml index 57e61a045b..c755bb74a4 100644 --- a/.github/workflows/cairn-report.yml +++ b/.github/workflows/cairn-report.yml @@ -1,7 +1,7 @@ name: cairn report -# The weekly report on skipped pull requests, size estimates, the ratchet and drift. It replaces the body of the open issue -# labelled cairn-report. Only this workflow's environment holds the Anthropic API key. +# The weekly report on skipped pull requests, the ratchet and the approved system docs to check. It replaces the body of +# the open issue labelled cairn-report. on: schedule: @@ -20,13 +20,11 @@ permissions: jobs: report: runs-on: ubuntu-24.04 - environment: cairn-report - # The batch may take up to `report.timeout_minutes` in .cairn/config.json. - timeout-minutes: 200 + timeout-minutes: 10 steps: - uses: actions/checkout@v4 with: - # Step 1 reads the history since each approved doc last changed. + # The report reads the history since each approved doc last changed. fetch-depth: 0 persist-credentials: false # The Rust adapter reads `cargo metadata`; the report builds nothing. @@ -37,5 +35,4 @@ jobs: env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - run: python3 tools/cairn/cairn.py report --publish --drift + run: python3 tools/cairn/cairn.py report --publish diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29b0a3ab13..caf936acda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,12 +21,7 @@ name: CI # board crate; its job adds a flash-size guard against the 32 KB slot. # * obc-builder-bridge is a workspace library and the builder's shared WASM core. # The wasm-bridges job gates its production size and hands the same bytes to frontend jobs. -# * obc-desktop (#906) is the third excluded + standalone crate: a Tauri app, so it brings a -# platform webview with it (WebKitGTK on Linux) and would otherwise put those headers in -# every renderer test's way. The shell embeds the frontend, so both halves are built there. -# The planner artifact verifier also needs the locked Node reader dependencies. -# It is the only **three-OS matrix** in this file because it is the artifact a user installs. -# * `--locked` everywhere so a stale Cargo.lock (any of the four) fails CI. +# * `--locked` everywhere so a stale Cargo.lock (any of them) fails CI. on: workflow_call: @@ -220,9 +215,6 @@ jobs: echo "::group::obc-boot (workspace-excluded)" cargo fmt --check --manifest-path firmware/obc-boot/Cargo.toml || rc=1 echo "::endgroup::" - echo "::group::obc-desktop (workspace-excluded)" - cargo fmt --check --manifest-path builder/desktop/Cargo.toml || rc=1 - echo "::endgroup::" exit $rc # Blocking clippy on the host workspace: -D warnings from day one (the baseline is clean). @@ -689,10 +681,6 @@ jobs: run: cargo deny --manifest-path firmware/obc-boot/Cargo.toml --all-features --config tools/licenses/deny.toml check - name: cargo-deny (obc-sensor-sim) run: cargo deny --manifest-path firmware/obc-sensor-sim/Cargo.toml --all-features --config tools/licenses/deny.toml check - # The desktop shell is the one artifact a *user* installs, so its tree is the - # one where a bad licence or a live advisory matters most. - - name: cargo-deny (obc-desktop app) - run: cargo deny --manifest-path builder/desktop/Cargo.toml --all-features --config tools/licenses/deny.toml check # deny.toml skips the repository's own crates, so it cannot see obc-data reach one. - name: obc-data depends on no GPL crate run: python3 tools/check_obc_data_licence.py @@ -1030,9 +1018,8 @@ jobs: # The web builder's Svelte frontend: type-check, unit tests, production builds. # - # One source tree, three hosts (#895): `npm run build` is the local FastAPI one, - # `build:web` the static hosted site and `build:desktop` the Tauri shell. All three - # are built here — a host that stops compiling is otherwise invisible until someone + # One source tree, two hosts: `npm run build` is the local FastAPI one and + # `build:web` the static hosted site. Both are built here — a host that stops compiling is otherwise invisible until someone # tries to ship it. The *contents* of the web bundle (no job polling, no style # editor) are asserted by vitest, which builds and inspects the emitted chunks. # @@ -1063,8 +1050,7 @@ jobs: with: name: obc-ground-plan-bridge-pkg path: builder/web/src/lib/trailview/plan/pkg - # The device the USB suites run against. The desktop-frontend job does not download it: that - # job only builds the shipped bundle, which must not contain this package at all. + # The device the USB suites run against. The shipped bundle must not contain this package. - uses: actions/download-artifact@v4 with: name: obc-flat-device-pkg @@ -1082,7 +1068,7 @@ jobs: run: | rm -f "$RUNNER_TEMP/web-builder-junit.xml" npm run test:components -- --reporter=default --reporter=junit --outputFile="$RUNNER_TEMP/web-builder-junit.xml" - - name: production builds (dev + web + desktop hosts) + - name: production builds (dev + web hosts) run: npm run build:all # naga is the WGSL front end of Firefox; Chrome's Tint compiles the same files in the TrailView smoke. - name: Cache the WGSL validator @@ -1135,6 +1121,11 @@ jobs: with: name: obc-ground-plan-bridge-pkg path: builder/web/src/lib/trailview/plan/pkg + # The planner build of the browser tests holds the pretend device of `?fake-device`. + - uses: actions/download-artifact@v4 + with: + name: obc-flat-device-pkg + path: builder/web/test-support/flat-device/pkg - uses: actions/setup-node@v4 with: node-version: "22" @@ -1171,149 +1162,6 @@ jobs: path: .artifacts/web-builder/ if-no-files-found: error - desktop-frontend: - needs: [selection, wasm-bridges] - if: contains(fromJSON(needs.selection.outputs.jobs), 'desktop-frontend') - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.source_sha || github.sha }} - persist-credentials: false - - uses: actions/download-artifact@v4 - with: - name: obc-builder-bridge-pkg - path: builder/web/src/lib/core/pkg - - uses: actions/download-artifact@v4 - with: - name: obc-ground-plan-bridge-pkg - path: builder/web/src/lib/trailview/plan/pkg - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - cache-dependency-path: builder/web/package-lock.json - - name: Build the desktop bundle - working-directory: builder/web - run: | - npm ci - npm run build:desktop - - uses: actions/upload-artifact@v4 - with: - name: obc-desktop-frontend - path: builder/web/dist/desktop - retention-days: 1 - - desktop: - needs: [selection, desktop-frontend] - if: contains(fromJSON(needs.selection.outputs.jobs), 'desktop') - runs-on: ${{ matrix.os }} - env: - # Baked into packaged apps; a runtime variable can still override it for a - # maintainer testing an unpublished tree. - OBC_CATALOG_URL: ${{ vars.OBC_CATALOG_URL }} - strategy: - # One platform's failure must not hide another's. - fail-fast: false - matrix: - include: - - os: ubuntu-24.04 - slug: linux-x86_64 - exe: obc-desktop - - os: macos-latest - slug: macos-arm64 - exe: obc-desktop - - os: windows-latest - slug: windows-x86_64-msvc - exe: obc-desktop.exe - defaults: - run: - # Git Bash on the Windows runner, so the shared steps below are one script - # rather than three. Nothing here needs a Windows-native shell. - shell: bash - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.source_sha || github.sha }} - persist-credentials: false - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - cache: false - - uses: Swatinem/rust-cache@v2 - with: - workspaces: builder/desktop - key: desktop-${{ matrix.slug }} - # wry's Linux backend. macOS and Windows need nothing extra — which is most of - # why Tauri was chosen over Electron (#906) — but Linux wants WebKitGTK. - - name: Install the Linux webview deps - if: runner.os == 'Linux' - uses: ./.github/actions/apt-install - with: - packages: libwebkit2gtk-4.1-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libgtk-3-dev librsvg2-dev - # The bundle the shell embeds, built once on Linux by `desktop-frontend` and - # unpacked here. It is byte-identical on all three runners — a Vite build of the - # same sources — so building it per-platform was three runs of `npm ci` and - # three Node toolchains for one output. Landing it at the path tauri.conf.json's - # `frontendDist` names is the whole integration; nothing here runs npm, and the - # `beforeBuildCommand` in that file is never executed (there is no Tauri CLI in - # this repo — see the note above about `custom-protocol`). - - uses: actions/download-artifact@v4 - with: - name: obc-desktop-frontend - path: builder/web/dist/desktop - # Order matters. `cargo test` never produces the plain binary — even with - # --all-targets it builds bins as *test harnesses*, a different artifact — so the - # `build` below is a full codegen + link either way. Running it first means the - # normal lib it produces is already there for `test` to link against, instead of - # `test` building one set of artifacts and `build` starting a second. - - name: "obc-desktop: clippy" - working-directory: builder/desktop - run: cargo clippy --release --all-targets --locked -- -D warnings - - name: "obc-desktop: build (release)" - working-directory: builder/desktop - run: cargo build --release --locked - - uses: taiki-e/install-action@v2 - with: - tool: cargo-nextest@0.9.143 - - name: "obc-desktop: test" - id: desktop-tests - working-directory: builder/desktop - env: - NEXTEST_PROFILE: ci - run: | - rm -f target/nextest/ci/junit.xml - cargo nextest run --release --locked --config-file ../../.config/nextest.toml --no-tests fail - - name: Upload native desktop test results - if: ${{ !cancelled() && (steps.desktop-tests.outcome == 'success' || steps.desktop-tests.outcome == 'failure') }} - uses: actions/upload-artifact@v4 - with: - name: desktop-tests-${{ matrix.slug }}-${{ github.run_attempt }} - path: builder/desktop/target/nextest/ci/junit.xml - if-no-files-found: error - # Recorded so an accidental native dependency or bundling regression is visible. - - name: "obc-desktop: record the artifact size" - working-directory: builder/desktop - run: | - bytes=$(wc -c < "target/release/${{ matrix.exe }}") - echo "| ${{ matrix.slug }} | $bytes bytes |" >> "$GITHUB_STEP_SUMMARY" - - uses: actions/upload-artifact@v4 - with: - name: obc-desktop-${{ matrix.slug }} - path: builder/desktop/target/release/${{ matrix.exe }} - retention-days: 7 - # macOS ships two architectures and this crate is built on the Apple-silicon - # runner, so cross-build the Intel slice to keep a future universal bundle open. - # - # Push events only: a second target triple is build-only insurance, not a - # correctness gate on the app anyone runs. - - name: "obc-desktop: the macOS Intel slice (build-only)" - if: runner.os == 'macOS' && github.event_name == 'push' - working-directory: builder/desktop - run: | - rustup target add x86_64-apple-darwin - cargo build --release --locked --target x86_64-apple-darwin - file target/x86_64-apple-darwin/release/obc-desktop - planner-search: needs: selection if: contains(fromJSON(needs.selection.outputs.jobs), 'planner-search') @@ -1375,7 +1223,7 @@ jobs: # publishes no plan, which fails this gate rather than silently passing. ci: if: always() - needs: [selection, guards, cairn, fmt, clippy, test, ui-snapshots, builder-python, embedded, boot, device, deny, wasm, wasm-bridges, docs, ios-unit, ios-app, ios-release, web, web-browser, desktop-frontend, desktop, verification, planner-search] + needs: [selection, guards, cairn, fmt, clippy, test, ui-snapshots, builder-python, embedded, boot, device, deny, wasm, wasm-bridges, docs, ios-unit, ios-app, ios-release, web, web-browser, verification, planner-search] runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 683eabdf7c..166cdd885d 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -156,8 +156,8 @@ jobs: # VITE_SITE_BASE makes the builder's links to the docs and the landing relative: # they are siblings inside this artifact, so naming them by absolute URL would be - # the one place a domain move still bit us. Left unset everywhere else (dev - # server, desktop app), where the site genuinely is somewhere else. + # the one place a domain move still bit us. Left unset everywhere else (the dev + # server), where the site genuinely is somewhere else. - name: Build the static map builder working-directory: builder/web env: diff --git a/.gitignore b/.gitignore index e5373e6d3f..05a1dc13dc 100644 --- a/.gitignore +++ b/.gitignore @@ -72,14 +72,13 @@ builder/web/src/lib/trailview/plan/pkg/ # virtualenv + the optional local maps drop. The tooling itself (everything in # tools/ except obc.local) is committed. tools/obc.local -# Planner tile settings for a local desktop build (see builder/desktop/README.md). +# Local Vite settings of the web builder. builder/web/.env.local .venv/ /maps/ # Web builder frontend: dependencies + the Vite build output (CI builds it). # The dev host builds into builder/server/static/dist/ (what the FastAPI server -# mounts); the static-web and desktop hosts into builder/web/dist// — see -# #895. Both entries must keep matching vite.config.ts's outDirs: when they +# mounts); the static-web host into builder/web/dist/web/. Both entries must keep matching vite.config.ts's outDirs: when they # drifted apart, `npm run build` wrote to an unignored path and 640 KB of bundle # got committed by accident (and the server mounted nothing). node_modules/ diff --git a/AGENTS.md b/AGENTS.md index e39e01518b..b894ea03a4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,7 +19,7 @@ The goal for this codebase is to make this a robust and extendable open source m The layout table is in [README.md](README.md#repository-layout). The root Cargo workspace lists its crates in `Cargo.toml`. Keep device-reachable dependencies in `firmware/`. -The nRF54L board image, the bootloader, the Tauri desktop app and the sensor simulator are standalone Cargo roots; build +The nRF54L board image, the bootloader and the sensor simulator are standalone Cargo roots; build and test them from their own directories. The nearest README has the surface's setup; `companion-ios/README.md` is the iOS on-ramp. diff --git a/Cargo.lock b/Cargo.lock index 1ab57cc9fd..44103dfbb3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3703,6 +3703,7 @@ dependencies = [ "js-sys", "obc-bake", "obc-draw", + "obc-fit", "obc-flat-device", "obc-formats", "obc-host-core", @@ -3853,6 +3854,10 @@ dependencies = [ "obcm-testkit", ] +[[package]] +name = "obc-fit" +version = "0.1.0" + [[package]] name = "obc-fixtures" version = "0.1.0" @@ -4157,6 +4162,7 @@ dependencies = [ "obc-ports", "obc-reader", "obcm-testkit", + "serde_json", ] [[package]] @@ -4258,7 +4264,6 @@ dependencies = [ "nusb", "obc-flat-device", "obc-link", - "serde", "tokio", ] @@ -4954,6 +4959,7 @@ dependencies = [ "osmpbfreader", "planner-router", "postcard", + "rayon", "rusqlite", "serde_json", "sha2 0.10.9", diff --git a/Cargo.toml b/Cargo.toml index f5afa4009c..e5229db09a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ members = [ "planner/router", "planner/router-build", "host/obc-file-source", + "host/obc-fit", "host/obc-inspect", "host/obc-fixtures", "host/obc-pack", @@ -56,14 +57,14 @@ members = [ "sim/phone/host", "sim/desktop", "sim/web-demo", - # Product bridges. obc-desktop carries its own [workspace]. + # Product bridges. "planner/service", "builder/wasm", "builder/ground-plan-wasm", ] # obc-fw-nrf54l is a standalone board crate (own target + .cargo/config.toml, own empty # [workspace]); it's built on its own, not as part of this host workspace (which builds its -# members for the host target). obc-boot, obc-desktop and obc-sensor-sim carry their own +# members for the host target). obc-boot and obc-sensor-sim carry their own # [workspace] tables, which excludes them automatically for the same reason. exclude = ["firmware/obc-fw-nrf54l"] resolver = "2" @@ -97,6 +98,7 @@ obc-app = { path = "firmware/obc-app" } obc-dem = { path = "host/obc-dem", default-features = false } obc-dfu = { path = "firmware/obc-dfu" } obc-file-source = { path = "host/obc-file-source" } +obc-fit = { path = "host/obc-fit" } obc-host-core = { path = "sim/host-core" } obc-places = { path = "host/obc-places" } obc-platform = { path = "firmware/obc-platform" } diff --git a/README.md b/README.md index 2213d4cbac..edc216081d 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ over BLE and USB. The custom PCB and enclosure are still under development. KiCa | `host/` | Host tools, map bakers, fixtures, and test support | | `planner/` | Router, build tools, service, search, and tile worker | | `sim/` | Desktop, web and phone simulators, host core, replay, feeder and benchmarks | -| `builder/` | Web and desktop builder, Rust/WASM core, USB transport, presets, and server | +| `builder/` | Web builder, Rust/WASM core, USB transport, presets, and server | | `companion-ios/` | SwiftUI companion app and shared iOS package | | `specs/` | Normative binary, wire, and vector contracts | | `fixtures/` | Scenario registry, source provenance, and fixture builders | @@ -159,7 +159,7 @@ over BLE and USB. The custom PCB and enclosure are still under development. KiCa | `tools/` | The `obc` command, repository tools, and verification console | `Cargo.toml` lists the root workspace crates. The nRF54L board image, -bootloader, Tauri desktop app, and sensor simulator are standalone Cargo roots. The +bootloader, and sensor simulator are standalone Cargo roots. The [architecture guide](https://openbikecomputer.com/docs/software/architecture/) explains the boundaries. ## Other open bike computers diff --git a/builder/__init__.py b/builder/__init__.py index 3f67f2b2d7..51a0a53899 100644 --- a/builder/__init__.py +++ b/builder/__init__.py @@ -1,8 +1,8 @@ """The map builder. -`app/` is the Svelte UI, shared by all three of its hosts — the static web -tier, the Tauri desktop app, and the FastAPI dev server in `server/` (see -`app/vite.config.ts`: one frontend, three hosts). None of them packs anything +`app/` is the Svelte UI, shared by its two hosts — the static web tier and +the FastAPI dev server in `server/` (see `app/vite.config.ts`: one frontend, +two hosts). None of them packs anything itself: they drive the native `obc-pack` packer (`host/obc-pack`) to build OpenStreetMap extracts into `.obcm` maps for the OBC firmware. diff --git a/builder/desktop/.gitignore b/builder/desktop/.gitignore deleted file mode 100644 index f4a858a832..0000000000 --- a/builder/desktop/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# `tauri-build` regenerates these from tauri.conf.json + capabilities/ on every -# build. They are IDE aids (the `$schema` in capabilities/default.json points at -# one), derived from committed inputs, and platform-specific — so committing them -# would mean a diff every time someone builds on a different OS. -/gen/ diff --git a/builder/desktop/Cargo.lock b/builder/desktop/Cargo.lock deleted file mode 100644 index 6ff8b998aa..0000000000 --- a/builder/desktop/Cargo.lock +++ /dev/null @@ -1,5240 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" - -[[package]] -name = "async-broadcast" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" -dependencies = [ - "event-listener", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-channel" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-executor" -version = "1.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "pin-project-lite", - "slab", -] - -[[package]] -name = "async-io" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" -dependencies = [ - "autocfg", - "cfg-if", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-lock" -version = "3.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" -dependencies = [ - "event-listener", - "event-listener-strategy", - "pin-project-lite", -] - -[[package]] -name = "async-process" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" -dependencies = [ - "async-channel", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "rustix", -] - -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "async-signal" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix", - "signal-hook-registry", - "slab", - "windows-sys 0.61.2", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "async-trait" -version = "0.1.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.3", -] - -[[package]] -name = "atk" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" -dependencies = [ - "atk-sys", - "glib", - "libc", -] - -[[package]] -name = "atk-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "autocfg" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bit-set" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" -dependencies = [ - "serde_core", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" -dependencies = [ - "objc2", -] - -[[package]] -name = "blocking" -version = "1.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" -dependencies = [ - "async-channel", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "brotli" -version = "8.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "5.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "bumpalo" -version = "3.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" - -[[package]] -name = "bytemuck" -version = "1.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" -dependencies = [ - "serde", -] - -[[package]] -name = "cairo-rs" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" -dependencies = [ - "bitflags 2.13.1", - "cairo-sys-rs", - "glib", - "libc", - "once_cell", - "thiserror 1.0.69", -] - -[[package]] -name = "cairo-sys-rs" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" -dependencies = [ - "glib-sys", - "libc", - "system-deps", -] - -[[package]] -name = "camino" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2d30e4173c4026932d51d31d6b0613b1fd3014bf3f9f8943d4ba139c437ba0" -dependencies = [ - "serde_core", -] - -[[package]] -name = "cargo-platform" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror 2.0.19", -] - -[[package]] -name = "cargo_toml" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77" -dependencies = [ - "serde", - "toml 0.9.12+spec-1.1.0", -] - -[[package]] -name = "cc" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" -dependencies = [ - "find-msvc-tools", - "shlex", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cfb" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" -dependencies = [ - "byteorder", - "fnv", - "uuid", -] - -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[package]] -name = "chrono" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" -dependencies = [ - "iana-time-zone", - "num-traits", - "serde", - "windows-link 0.2.1", -] - -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "cookie" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" -dependencies = [ - "time", - "version_check", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "core-graphics" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" -dependencies = [ - "bitflags 2.13.1", - "core-foundation", - "core-graphics-types", - "foreign-types", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" -dependencies = [ - "bitflags 2.13.1", - "core-foundation", - "libc", -] - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d85363c37faeca707aef026efa9f3b34d077bce547e48f770770625c6013679e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "cssparser" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" -dependencies = [ - "cssparser-macros", - "dtoa-short", - "itoa", - "phf", - "smallvec", -] - -[[package]] -name = "cssparser-macros" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "ctor" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "352d39c2f7bef1d6ad73db6f5160efcaed66d94ef8c6c573a8410c00bf909a98" -dependencies = [ - "ctor-proc-macro", - "dtor", -] - -[[package]] -name = "ctor-proc-macro" -version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" - -[[package]] -name = "darling" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" -dependencies = [ - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.119", -] - -[[package]] -name = "darling_macro" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "dbus" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e" -dependencies = [ - "libc", - "libdbus-sys", - "windows-sys 0.61.2", -] - -[[package]] -name = "deranged" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" -dependencies = [ - "serde_core", -] - -[[package]] -name = "derive_more" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" -dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.119", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "dirs" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.59.0", -] - -[[package]] -name = "dispatch2" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" -dependencies = [ - "bitflags 2.13.1", - "block2", - "libc", - "objc2", -] - -[[package]] -name = "displaydoc" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "dlopen2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4" -dependencies = [ - "dlopen2_derive", - "libc", - "once_cell", - "winapi", -] - -[[package]] -name = "dlopen2_derive" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "dom_query" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" -dependencies = [ - "bit-set", - "cssparser", - "foldhash", - "html5ever", - "precomputed-hash", - "selectors", - "tendril", -] - -[[package]] -name = "dpi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" -dependencies = [ - "serde", -] - -[[package]] -name = "dtoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" - -[[package]] -name = "dtoa-short" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" -dependencies = [ - "dtoa", -] - -[[package]] -name = "dtor" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1057d6c64987086ff8ed0fd3fbf377a6b7d205cc7715868cd401705f715cbe4" -dependencies = [ - "dtor-proc-macro", -] - -[[package]] -name = "dtor-proc-macro" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5" - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] -name = "embed-resource" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbfdaacccebec3b28e4866b8973543c7647797db5ada1bdab552e48fe665fbbd" -dependencies = [ - "cc", - "memchr", - "rustc_version", - "toml 1.1.3+spec-1.1.0", - "vswhom", - "winreg", -] - -[[package]] -name = "embed_plist" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" - -[[package]] -name = "endi" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" - -[[package]] -name = "enumflags2" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" -dependencies = [ - "enumflags2_derive", - "serde", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "erased-serde" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" -dependencies = [ - "serde", - "serde_core", - "typeid", -] - -[[package]] -name = "errno" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "event-listener" -version = "5.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - -[[package]] -name = "fastrand" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" - -[[package]] -name = "fdeflate" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "field-offset" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" -dependencies = [ - "memoffset", - "rustc_version", -] - -[[package]] -name = "find-msvc-tools" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" - -[[package]] -name = "flate2" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.3", -] - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "form_urlencoded" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" - -[[package]] -name = "futures-executor" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6754879cc9f2c66f88c6e5c35344bb0bdb0708b0352b1201815667c7eabc7458" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a" - -[[package]] -name = "futures-lite" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - -[[package]] -name = "futures-macro" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "futures-sink" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" - -[[package]] -name = "futures-task" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" - -[[package]] -name = "futures-util" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" -dependencies = [ - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "slab", -] - -[[package]] -name = "gdk" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" -dependencies = [ - "cairo-rs", - "gdk-pixbuf", - "gdk-sys", - "gio", - "glib", - "libc", - "pango", -] - -[[package]] -name = "gdk-pixbuf" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" -dependencies = [ - "gdk-pixbuf-sys", - "gio", - "glib", - "libc", - "once_cell", -] - -[[package]] -name = "gdk-pixbuf-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" -dependencies = [ - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "gdk-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" -dependencies = [ - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "pango-sys", - "pkg-config", - "system-deps", -] - -[[package]] -name = "gdkwayland-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" -dependencies = [ - "gdk-sys", - "glib-sys", - "gobject-sys", - "libc", - "pkg-config", - "system-deps", -] - -[[package]] -name = "gdkx11" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" -dependencies = [ - "gdk", - "gdkx11-sys", - "gio", - "glib", - "libc", - "x11", -] - -[[package]] -name = "gdkx11-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" -dependencies = [ - "gdk-sys", - "glib-sys", - "libc", - "system-deps", - "x11", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - -[[package]] -name = "getrandom" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" -dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", -] - -[[package]] -name = "gio" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "gio-sys", - "glib", - "libc", - "once_cell", - "pin-project-lite", - "smallvec", - "thiserror 1.0.69", -] - -[[package]] -name = "gio-sys" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", - "winapi", -] - -[[package]] -name = "glib" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" -dependencies = [ - "bitflags 2.13.1", - "futures-channel", - "futures-core", - "futures-executor", - "futures-task", - "futures-util", - "gio-sys", - "glib-macros", - "glib-sys", - "gobject-sys", - "libc", - "memchr", - "once_cell", - "smallvec", - "thiserror 1.0.69", -] - -[[package]] -name = "glib-macros" -version = "0.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" -dependencies = [ - "heck 0.4.1", - "proc-macro-crate 2.0.2", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "glib-sys" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" -dependencies = [ - "libc", - "system-deps", -] - -[[package]] -name = "glob" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" - -[[package]] -name = "gobject-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" -dependencies = [ - "glib-sys", - "libc", - "system-deps", -] - -[[package]] -name = "gtk" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" -dependencies = [ - "atk", - "cairo-rs", - "field-offset", - "futures-channel", - "gdk", - "gdk-pixbuf", - "gio", - "glib", - "gtk-sys", - "gtk3-macros", - "libc", - "pango", - "pkg-config", -] - -[[package]] -name = "gtk-sys" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" -dependencies = [ - "atk-sys", - "cairo-sys-rs", - "gdk-pixbuf-sys", - "gdk-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "pango-sys", - "system-deps", -] - -[[package]] -name = "gtk3-macros" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "html5ever" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" -dependencies = [ - "log", - "markup5ever", -] - -[[package]] -name = "http" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "hyper" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-util" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "ipnet", - "libc", - "percent-encoding", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core 0.62.2", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ico" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371" -dependencies = [ - "byteorder", - "png 0.17.16", -] - -[[package]] -name = "icu_collections" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" - -[[package]] -name = "icu_properties" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" - -[[package]] -name = "icu_provider" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" -dependencies = [ - "equivalent", - "hashbrown 0.17.1", - "serde", - "serde_core", -] - -[[package]] -name = "infer" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" -dependencies = [ - "cfb", -] - -[[package]] -name = "io-kit-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d3a048d09fbb6597dbf7c69f40d14df4a49487db1487191618c893fc3b1c26" -dependencies = [ - "core-foundation-sys", - "mach2", -] - -[[package]] -name = "ipnet" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" - -[[package]] -name = "is-docker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" -dependencies = [ - "once_cell", -] - -[[package]] -name = "is-wsl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" -dependencies = [ - "is-docker", - "once_cell", -] - -[[package]] -name = "itoa" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" - -[[package]] -name = "javascriptcore-rs" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" -dependencies = [ - "bitflags 1.3.2", - "glib", - "javascriptcore-rs-sys", -] - -[[package]] -name = "javascriptcore-rs-sys" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys 0.3.1", - "log", - "thiserror 1.0.69", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn 2.0.119", -] - -[[package]] -name = "js-sys" -version = "0.3.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" -dependencies = [ - "cfg-if", - "futures-util", - "wasm-bindgen", -] - -[[package]] -name = "json-patch" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" -dependencies = [ - "jsonptr", - "serde", - "serde_json", - "thiserror 1.0.69", -] - -[[package]] -name = "jsonptr" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "keyboard-types" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" -dependencies = [ - "bitflags 2.13.1", - "serde", - "unicode-segmentation", -] - -[[package]] -name = "libappindicator" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" -dependencies = [ - "glib", - "gtk", - "gtk-sys", - "libappindicator-sys", - "log", -] - -[[package]] -name = "libappindicator-sys" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" -dependencies = [ - "gtk-sys", - "libloading", - "once_cell", -] - -[[package]] -name = "libc" -version = "0.2.189" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" - -[[package]] -name = "libdbus-sys" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" -dependencies = [ - "pkg-config", -] - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libredox" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" -dependencies = [ - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" - -[[package]] -name = "litemap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" - -[[package]] -name = "mach2" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea" -dependencies = [ - "libc", -] - -[[package]] -name = "markup5ever" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" -dependencies = [ - "log", - "tendril", - "web_atoms", -] - -[[package]] -name = "memchr" -version = "2.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "muda" -version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd04e60bc0b07438a6771710ee1698f98f6ebbc7f89b61264af1563b8aeb878" -dependencies = [ - "crossbeam-channel", - "dpi", - "gtk", - "keyboard-types", - "objc2", - "objc2-app-kit", - "objc2-core-foundation", - "objc2-foundation", - "once_cell", - "png 0.18.1", - "serde", - "thiserror 2.0.19", - "windows-sys 0.60.2", -] - -[[package]] -name = "ndk" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" -dependencies = [ - "bitflags 2.13.1", - "jni-sys 0.3.1", - "log", - "ndk-sys", - "num_enum", - "raw-window-handle", - "thiserror 1.0.69", -] - -[[package]] -name = "ndk-sys" -version = "0.6.0+11769913" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" -dependencies = [ - "jni-sys 0.3.1", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "num-conv" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_enum" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" -dependencies = [ - "num_enum_derive", - "rustversion", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" -dependencies = [ - "proc-macro-crate 3.5.0", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "nusb" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1553b6f47685e4c658b2100a6d7262abdc73cb97f423453546ca020155ae9" -dependencies = [ - "core-foundation", - "core-foundation-sys", - "futures-core", - "io-kit-sys", - "linux-raw-sys", - "log", - "once_cell", - "rustix", - "slab", - "tokio", - "windows-sys 0.60.2", -] - -[[package]] -name = "obc-crc" -version = "0.1.0" - -[[package]] -name = "obc-desktop" -version = "0.1.0" -dependencies = [ - "futures-core", - "nusb", - "obc-usb", - "serde", - "serde_json", - "tauri", - "tauri-build", - "tauri-plugin-dialog", - "tauri-plugin-opener", - "tokio", - "ureq", - "url", -] - -[[package]] -name = "obc-link" -version = "0.1.0" -dependencies = [ - "obc-crc", -] - -[[package]] -name = "obc-usb" -version = "0.1.0" -dependencies = [ - "getrandom 0.4.3", - "nusb", - "obc-link", - "serde", - "tokio", -] - -[[package]] -name = "objc2" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" -dependencies = [ - "objc2-encode", - "objc2-exception-helper", -] - -[[package]] -name = "objc2-app-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" -dependencies = [ - "bitflags 2.13.1", - "block2", - "objc2", - "objc2-core-foundation", - "objc2-foundation", -] - -[[package]] -name = "objc2-cloud-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" -dependencies = [ - "bitflags 2.13.1", - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-data" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" -dependencies = [ - "bitflags 2.13.1", - "dispatch2", - "objc2", -] - -[[package]] -name = "objc2-core-graphics" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" -dependencies = [ - "bitflags 2.13.1", - "dispatch2", - "objc2", - "objc2-core-foundation", - "objc2-io-surface", -] - -[[package]] -name = "objc2-core-image" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-location" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-core-text" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" -dependencies = [ - "bitflags 2.13.1", - "objc2", - "objc2-core-foundation", - "objc2-core-graphics", -] - -[[package]] -name = "objc2-encode" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" - -[[package]] -name = "objc2-exception-helper" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" -dependencies = [ - "cc", -] - -[[package]] -name = "objc2-foundation" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" -dependencies = [ - "bitflags 2.13.1", - "block2", - "libc", - "objc2", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-io-surface" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" -dependencies = [ - "bitflags 2.13.1", - "objc2", - "objc2-core-foundation", -] - -[[package]] -name = "objc2-quartz-core" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" -dependencies = [ - "bitflags 2.13.1", - "objc2", - "objc2-core-foundation", - "objc2-foundation", -] - -[[package]] -name = "objc2-ui-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" -dependencies = [ - "bitflags 2.13.1", - "block2", - "objc2", - "objc2-cloud-kit", - "objc2-core-data", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-core-image", - "objc2-core-location", - "objc2-core-text", - "objc2-foundation", - "objc2-quartz-core", - "objc2-user-notifications", -] - -[[package]] -name = "objc2-user-notifications" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" -dependencies = [ - "objc2", - "objc2-foundation", -] - -[[package]] -name = "objc2-web-kit" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" -dependencies = [ - "bitflags 2.13.1", - "block2", - "objc2", - "objc2-app-kit", - "objc2-core-foundation", - "objc2-foundation", -] - -[[package]] -name = "once_cell" -version = "1.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" - -[[package]] -name = "open" -version = "5.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0b3d059e795d52b8a72fef45658620edd4d9c359b338564aa14391ffa511ed5" -dependencies = [ - "dunce", - "is-wsl", - "libc", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "ordered-stream" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" -dependencies = [ - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "pango" -version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" -dependencies = [ - "gio", - "glib", - "libc", - "once_cell", - "pango-sys", -] - -[[package]] -name = "pango-sys" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" -dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link 0.2.1", -] - -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "phf" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" -dependencies = [ - "phf_macros", - "phf_shared", - "serde", -] - -[[package]] -name = "phf_codegen" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" -dependencies = [ - "fastrand", - "phf_shared", -] - -[[package]] -name = "phf_macros" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "phf_shared" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" - -[[package]] -name = "piper" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "pkg-config" -version = "0.3.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" - -[[package]] -name = "plist" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da1d65da6dd5d1e44199ac0f58712d241c0f439f80adea8924d832384087f85" -dependencies = [ - "base64 0.22.1", - "indexmap 2.14.0", - "quick-xml", - "serde", - "time", -] - -[[package]] -name = "png" -version = "0.17.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - -[[package]] -name = "png" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" -dependencies = [ - "bitflags 2.13.1", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - -[[package]] -name = "polling" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" -dependencies = [ - "cfg-if", - "concurrent-queue", - "hermit-abi", - "pin-project-lite", - "rustix", - "windows-sys 0.61.2", -] - -[[package]] -name = "potential_utf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" -dependencies = [ - "zerovec", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-crate" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" -dependencies = [ - "toml_datetime 0.6.3", - "toml_edit 0.20.2", -] - -[[package]] -name = "proc-macro-crate" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" -dependencies = [ - "toml_edit 0.25.13+spec-1.1.0", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quick-xml" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - -[[package]] -name = "raw-window-handle" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags 2.13.1", -] - -[[package]] -name = "redox_users" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" -dependencies = [ - "getrandom 0.2.17", - "libredox", - "thiserror 2.0.19", -] - -[[package]] -name = "ref-cast" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216e8f773d7923bcba9ceb86a86c93cabb3903a11872fc3f138c49630e50b96d" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9283685feec7d69af75fb0e858d5e7378f33fe4fc699383b2916ab9273e03c" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.3", -] - -[[package]] -name = "regex" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" - -[[package]] -name = "reqwest" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-util", - "js-sys", - "log", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "sync_wrapper", - "tokio", - "tokio-util", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", -] - -[[package]] -name = "rfd" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672" -dependencies = [ - "block2", - "dispatch2", - "glib-sys", - "gobject-sys", - "gtk-sys", - "js-sys", - "log", - "objc2", - "objc2-app-kit", - "objc2-core-foundation", - "objc2-foundation", - "raw-window-handle", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "windows-sys 0.60.2", -] - -[[package]] -name = "ring" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.17", - "libc", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustc-hash" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" -dependencies = [ - "bitflags 2.13.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustls" -version = "0.23.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" -dependencies = [ - "log", - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pki-types" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" -dependencies = [ - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.103.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schemars" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" -dependencies = [ - "dyn-clone", - "indexmap 1.9.3", - "schemars_derive", - "serde", - "serde_json", - "url", - "uuid", -] - -[[package]] -name = "schemars" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" -dependencies = [ - "dyn-clone", - "ref-cast", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.119", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "selectors" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" -dependencies = [ - "bitflags 2.13.1", - "cssparser", - "derive_more", - "log", - "new_debug_unreachable", - "phf", - "phf_codegen", - "precomputed-hash", - "rustc-hash", - "servo_arc", - "smallvec", -] - -[[package]] -name = "semver" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" -dependencies = [ - "serde", - "serde_core", -] - -[[package]] -name = "serde" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" -dependencies = [ - "serde_core", - "serde_derive", -] - -[[package]] -name = "serde-untagged" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" -dependencies = [ - "erased-serde", - "serde", - "serde_core", - "typeid", -] - -[[package]] -name = "serde_core" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.229" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.3", -] - -[[package]] -name = "serde_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "serde_json" -version = "1.0.151" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_repr" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.3", -] - -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_spanned" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" -dependencies = [ - "serde_core", -] - -[[package]] -name = "serde_with" -version = "3.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" -dependencies = [ - "base64 0.22.1", - "bs58", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.14.0", - "schemars 0.9.0", - "schemars 1.2.1", - "serde_core", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "serialize-to-javascript" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" -dependencies = [ - "serde", - "serde_json", - "serialize-to-javascript-impl", -] - -[[package]] -name = "serialize-to-javascript-impl" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "servo_arc" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "simd-adler32" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" - -[[package]] -name = "siphasher" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "smallvec" -version = "1.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" - -[[package]] -name = "socket2" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" -dependencies = [ - "libc", - "windows-sys 0.60.2", -] - -[[package]] -name = "softbuffer" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" -dependencies = [ - "bytemuck", - "js-sys", - "ndk", - "objc2", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation", - "objc2-quartz-core", - "raw-window-handle", - "redox_syscall", - "tracing", - "wasm-bindgen", - "web-sys", - "windows-sys 0.61.2", -] - -[[package]] -name = "soup3" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" -dependencies = [ - "futures-channel", - "gio", - "glib", - "libc", - "soup3-sys", -] - -[[package]] -name = "soup3-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" -dependencies = [ - "gio-sys", - "glib-sys", - "gobject-sys", - "libc", - "system-deps", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "string_cache" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" -dependencies = [ - "new_debug_unreachable", - "parking_lot", - "phf_shared", - "precomputed-hash", -] - -[[package]] -name = "string_cache_codegen" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "swift-rs" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" -dependencies = [ - "base64 0.21.7", - "serde", - "serde_json", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "system-deps" -version = "6.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" -dependencies = [ - "cfg-expr", - "heck 0.5.0", - "pkg-config", - "toml 0.8.2", - "version-compare", -] - -[[package]] -name = "tao" -version = "0.35.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c93047acf68669466a34690ac58cca7010bd1b201e1ec86f1fd0a75d3dd4a9" -dependencies = [ - "bitflags 2.13.1", - "block2", - "core-foundation", - "core-graphics", - "crossbeam-channel", - "dbus", - "dispatch2", - "dlopen2", - "dpi", - "gdkwayland-sys", - "gdkx11-sys", - "gtk", - "jni", - "libc", - "log", - "ndk", - "ndk-sys", - "objc2", - "objc2-app-kit", - "objc2-foundation", - "objc2-ui-kit", - "once_cell", - "parking_lot", - "percent-encoding", - "raw-window-handle", - "tao-macros", - "unicode-segmentation", - "url", - "windows", - "windows-core 0.61.2", - "windows-version", - "x11-dl", -] - -[[package]] -name = "tao-macros" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - -[[package]] -name = "tauri" -version = "2.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "667b20e2726d572dea2de7370da16e188eb06008faf9a92fab7cdc46791190b5" -dependencies = [ - "anyhow", - "bytes", - "cookie", - "dirs", - "dunce", - "embed_plist", - "getrandom 0.3.4", - "glob", - "gtk", - "heck 0.5.0", - "http", - "jni", - "libc", - "log", - "mime", - "muda", - "objc2", - "objc2-app-kit", - "objc2-foundation", - "objc2-ui-kit", - "objc2-web-kit", - "percent-encoding", - "plist", - "raw-window-handle", - "reqwest", - "serde", - "serde_json", - "serde_repr", - "serialize-to-javascript", - "swift-rs", - "tauri-build", - "tauri-macros", - "tauri-runtime", - "tauri-runtime-wry", - "tauri-utils", - "thiserror 2.0.19", - "tokio", - "tray-icon", - "url", - "webkit2gtk", - "webview2-com", - "window-vibrancy", - "windows", -] - -[[package]] -name = "tauri-build" -version = "2.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9ce40b16101cb6ea63d3e221567affd1c3a9205f95d7bc574941a10636b632" -dependencies = [ - "anyhow", - "cargo_toml", - "dirs", - "glob", - "heck 0.5.0", - "json-patch", - "schemars 0.8.22", - "semver", - "serde", - "serde_json", - "tauri-utils", - "tauri-winres", - "walkdir", -] - -[[package]] -name = "tauri-codegen" -version = "2.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08279169ff42f8fc45a1dbc9dcae888893ba95288142e5880c59b93a26d2cfc5" -dependencies = [ - "base64 0.22.1", - "brotli", - "ico", - "json-patch", - "plist", - "png 0.17.16", - "proc-macro2", - "quote", - "semver", - "serde", - "serde_json", - "sha2", - "syn 2.0.119", - "tauri-utils", - "thiserror 2.0.19", - "time", - "url", - "uuid", - "walkdir", -] - -[[package]] -name = "tauri-macros" -version = "2.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b394794f399a421811d06966343e7933fcae92d59f5180b9388d1174497a45" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.119", - "tauri-codegen", - "tauri-utils", -] - -[[package]] -name = "tauri-plugin" -version = "2.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74be5dd4bed9afbd145e5716b5fa2ec28cbc29c34ffa61c258c9273d896c8020" -dependencies = [ - "anyhow", - "glob", - "plist", - "schemars 0.8.22", - "serde", - "serde_json", - "tauri-utils", - "walkdir", -] - -[[package]] -name = "tauri-plugin-dialog" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2d3c1dbe38037e7f590cdf2492594d5ceebe031e7bc7e827509b22a999d2940" -dependencies = [ - "log", - "raw-window-handle", - "rfd", - "serde", - "serde_json", - "tauri", - "tauri-plugin", - "tauri-plugin-fs", - "thiserror 2.0.19", - "url", -] - -[[package]] -name = "tauri-plugin-fs" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ecc274121aca0c036a2b42d1cbe83d368d348f54e0bb8a735c2b1548e8f371" -dependencies = [ - "anyhow", - "dunce", - "glob", - "log", - "objc2-foundation", - "percent-encoding", - "schemars 0.8.22", - "serde", - "serde_json", - "serde_repr", - "tauri", - "tauri-plugin", - "tauri-utils", - "thiserror 2.0.19", - "toml 1.1.3+spec-1.1.0", - "url", -] - -[[package]] -name = "tauri-plugin-opener" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e1bea14edce6b793a04e2417e3fd924b9bc4faae83cdee7d714156cceeed29" -dependencies = [ - "dunce", - "glob", - "objc2-app-kit", - "objc2-foundation", - "open", - "schemars 0.8.22", - "serde", - "serde_json", - "tauri", - "tauri-plugin", - "thiserror 2.0.19", - "url", - "windows", - "zbus", -] - -[[package]] -name = "tauri-runtime" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b4bc95aed361b0019067d189a1174a603d460d0f6c72606512d59fc9c12ec8" -dependencies = [ - "cookie", - "dpi", - "gtk", - "http", - "jni", - "objc2", - "objc2-ui-kit", - "objc2-web-kit", - "raw-window-handle", - "serde", - "serde_json", - "tauri-utils", - "thiserror 2.0.19", - "url", - "webkit2gtk", - "webview2-com", - "windows", -] - -[[package]] -name = "tauri-runtime-wry" -version = "2.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e6fac707727b7a2f48e4ded90976324267371073edbb415ffb73bb0458d203f" -dependencies = [ - "gtk", - "http", - "jni", - "log", - "objc2", - "objc2-app-kit", - "once_cell", - "percent-encoding", - "raw-window-handle", - "softbuffer", - "tao", - "tauri-runtime", - "tauri-utils", - "url", - "webkit2gtk", - "webview2-com", - "windows", - "wry", -] - -[[package]] -name = "tauri-utils" -version = "2.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e176a18e67764923c4f1ce66f25ae4abe5f688384d5eb1a0fa6c77f3d90f887" -dependencies = [ - "anyhow", - "brotli", - "cargo_metadata", - "ctor", - "dom_query", - "dunce", - "glob", - "http", - "infer", - "json-patch", - "log", - "memchr", - "phf", - "plist", - "proc-macro2", - "quote", - "regex", - "schemars 0.8.22", - "semver", - "serde", - "serde-untagged", - "serde_json", - "serde_with", - "swift-rs", - "thiserror 2.0.19", - "toml 1.1.3+spec-1.1.0", - "url", - "urlpattern", - "uuid", - "walkdir", -] - -[[package]] -name = "tauri-winres" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc65d45c68858bfe420dd29e834b5d15dbecf8a07a8a16cf4d532c7b1f69d4b6" -dependencies = [ - "dunce", - "embed-resource", - "toml 1.1.3+spec-1.1.0", -] - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.3", - "once_cell", - "rustix", - "windows-sys 0.52.0", -] - -[[package]] -name = "tendril" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" -dependencies = [ - "new_debug_unreachable", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" -dependencies = [ - "thiserror-impl 2.0.19", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" -dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.3", -] - -[[package]] -name = "time" -version = "0.3.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e1d5e639ff6bab73cb6885cc7e7b1de96c3f32c68ec55f3952614bec1092244" -dependencies = [ - "deranged", - "num-conv", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" - -[[package]] -name = "time-macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tinystr" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.53.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "tokio-util" -version = "0.7.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" -dependencies = [ - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.3", - "toml_edit 0.20.2", -] - -[[package]] -name = "toml" -version = "0.9.12+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" -dependencies = [ - "indexmap 2.14.0", - "serde_core", - "serde_spanned 1.1.1", - "toml_datetime 0.7.5+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 0.7.15", -] - -[[package]] -name = "toml" -version = "1.1.3+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c96ecdfa941c8fc4fcaed14f99ada8ebed502eef533015095a07e3301d4c3c" -dependencies = [ - "indexmap 2.14.0", - "serde_core", - "serde_spanned 1.1.1", - "toml_datetime 1.1.1+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 1.0.4", -] - -[[package]] -name = "toml_datetime" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_datetime" -version = "1.1.1+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.14.0", - "toml_datetime 0.6.3", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" -dependencies = [ - "indexmap 2.14.0", - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.3", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.25.13+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" -dependencies = [ - "indexmap 2.14.0", - "toml_datetime 1.1.1+spec-1.1.0", - "toml_parser", - "winnow 1.0.4", -] - -[[package]] -name = "toml_parser" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" -dependencies = [ - "winnow 1.0.4", -] - -[[package]] -name = "toml_writer" -version = "1.1.2+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2" - -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "pin-project-lite", - "sync_wrapper", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" -dependencies = [ - "bitflags 2.13.1", - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", - "url", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "tray-icon" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ba1e5f6b9ef9fd87e21b9c6f351554dbd717960089168fcfdef854686961dc" -dependencies = [ - "crossbeam-channel", - "dirs", - "libappindicator", - "muda", - "objc2", - "objc2-app-kit", - "objc2-core-foundation", - "objc2-core-graphics", - "objc2-foundation", - "once_cell", - "png 0.18.1", - "serde", - "thiserror 2.0.19", - "windows-sys 0.60.2", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - -[[package]] -name = "typenum" -version = "1.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" - -[[package]] -name = "uds_windows" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" -dependencies = [ - "memoffset", - "tempfile", - "windows-sys 0.60.2", -] - -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-ucd-ident" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-version" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" -dependencies = [ - "unic-common", -] - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-segmentation" -version = "1.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "ureq" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0" -dependencies = [ - "base64 0.22.1", - "flate2", - "log", - "percent-encoding", - "rustls", - "rustls-pki-types", - "ureq-proto", - "utf8-zero", - "webpki-roots", -] - -[[package]] -name = "ureq-proto" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c" -dependencies = [ - "base64 0.22.1", - "http", - "httparse", - "log", -] - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", - "serde_derive", -] - -[[package]] -name = "urlpattern" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" -dependencies = [ - "regex", - "serde", - "unic-ucd-ident", - "url", -] - -[[package]] -name = "utf8-zero" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "uuid" -version = "1.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239" -dependencies = [ - "getrandom 0.4.3", - "js-sys", - "serde_core", - "wasm-bindgen", -] - -[[package]] -name = "version-compare" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "vswhom" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" -dependencies = [ - "libc", - "vswhom-sys", -] - -[[package]] -name = "vswhom-sys" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn 2.0.119", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-streams" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" -dependencies = [ - "futures-util", - "js-sys", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "web-sys" -version = "0.3.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "web_atoms" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "075474b12bcb3d2e3d4546580e9de478eeeead668a1761e2a8860c836b7ef297" -dependencies = [ - "phf", - "phf_codegen", - "string_cache", - "string_cache_codegen", -] - -[[package]] -name = "webkit2gtk" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793" -dependencies = [ - "bitflags 1.3.2", - "cairo-rs", - "gdk", - "gdk-sys", - "gio", - "gio-sys", - "glib", - "glib-sys", - "gobject-sys", - "gtk", - "gtk-sys", - "javascriptcore-rs", - "libc", - "once_cell", - "soup3", - "webkit2gtk-sys", -] - -[[package]] -name = "webkit2gtk-sys" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5" -dependencies = [ - "bitflags 1.3.2", - "cairo-sys-rs", - "gdk-sys", - "gio-sys", - "glib-sys", - "gobject-sys", - "gtk-sys", - "javascriptcore-rs-sys", - "libc", - "pkg-config", - "soup3-sys", - "system-deps", -] - -[[package]] -name = "webpki-roots" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "webview2-com" -version = "0.38.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a" -dependencies = [ - "webview2-com-macros", - "webview2-com-sys", - "windows", - "windows-core 0.61.2", - "windows-implement", - "windows-interface", -] - -[[package]] -name = "webview2-com-macros" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "webview2-com-sys" -version = "0.38.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c" -dependencies = [ - "thiserror 2.0.19", - "windows", - "windows-core 0.61.2", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "window-vibrancy" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" -dependencies = [ - "objc2", - "objc2-app-kit", - "objc2-core-foundation", - "objc2-foundation", - "raw-window-handle", - "windows-sys 0.59.0", - "windows-version", -] - -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections", - "windows-core 0.61.2", - "windows-future", - "windows-link 0.1.3", - "windows-numerics", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", -] - -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - -[[package]] -name = "windows-link" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" - -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-result" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-strings" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", -] - -[[package]] -name = "windows-sys" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link 0.2.1", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", -] - -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link 0.1.3", -] - -[[package]] -name = "windows-version" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" -dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" - -[[package]] -name = "winnow" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.55.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" -dependencies = [ - "cfg-if", - "windows-sys 0.59.0", -] - -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - -[[package]] -name = "writeable" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" - -[[package]] -name = "wry" -version = "0.55.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186f9871daa55fd9c016578b810d149de58367113db7fb72b462d2323ce19514" -dependencies = [ - "base64 0.22.1", - "block2", - "cookie", - "crossbeam-channel", - "dirs", - "dom_query", - "dpi", - "dunce", - "gdkx11", - "gtk", - "http", - "javascriptcore-rs", - "jni", - "libc", - "ndk", - "objc2", - "objc2-app-kit", - "objc2-core-foundation", - "objc2-foundation", - "objc2-ui-kit", - "objc2-web-kit", - "once_cell", - "percent-encoding", - "raw-window-handle", - "sha2", - "soup3", - "tao-macros", - "thiserror 2.0.19", - "url", - "webkit2gtk", - "webkit2gtk-sys", - "webview2-com", - "windows", - "windows-core 0.61.2", - "windows-version", - "x11-dl", -] - -[[package]] -name = "x11" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "yoke" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", - "synstructure", -] - -[[package]] -name = "zbus" -version = "5.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe18fb60dc696039e738717b76eaea21e7a4489bbb1885020b43c94236d7e98a" -dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", - "async-trait", - "blocking", - "enumflags2", - "event-listener", - "futures-core", - "futures-lite", - "hex", - "libc", - "ordered-stream", - "rustix", - "serde", - "serde_repr", - "tracing", - "uds_windows", - "uuid", - "windows-sys 0.61.2", - "winnow 1.0.4", - "zbus_macros", - "zbus_names", - "zvariant", -] - -[[package]] -name = "zbus_macros" -version = "5.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe96480bed92df2b442a1a30df364e12d08eed03aeb061f2b8dc6afb2be91119" -dependencies = [ - "proc-macro-crate 3.5.0", - "proc-macro2", - "quote", - "syn 2.0.119", - "zbus_names", - "zvariant", - "zvariant_utils", -] - -[[package]] -name = "zbus_names" -version = "4.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" -dependencies = [ - "serde", - "winnow 1.0.4", - "zvariant", -] - -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" - -[[package]] -name = "zerotrie" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "zmij" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" - -[[package]] -name = "zvariant" -version = "5.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee2a0bcd2a907786a456fff45aaaaf54c9ba5f50b71ae9ec1a4edd200c94911" -dependencies = [ - "endi", - "enumflags2", - "serde", - "winnow 1.0.4", - "zvariant_derive", - "zvariant_utils", -] - -[[package]] -name = "zvariant_derive" -version = "5.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a708216a18780796770bfe3f4739c7c83a3e8f789b755534bbbc06e4e23e12" -dependencies = [ - "proc-macro-crate 3.5.0", - "proc-macro2", - "quote", - "syn 2.0.119", - "zvariant_utils", -] - -[[package]] -name = "zvariant_utils" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90cb9383f9b45290407a1258b202d3f8f01db719eb60b4e4055c6375af4fc7c7" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 2.0.119", - "winnow 1.0.4", -] diff --git a/builder/desktop/Cargo.toml b/builder/desktop/Cargo.toml deleted file mode 100644 index 9b9140dfa0..0000000000 --- a/builder/desktop/Cargo.toml +++ /dev/null @@ -1,75 +0,0 @@ -[package] -name = "obc-desktop" -version = "0.1.0" -edition = "2021" -publish = false # internal app crate — not published to crates.io -description = "OpenBikeComputer desktop app: the published-cell builder in a Tauri shell" - -# A standalone cargo root, like obc-fw-nrf54l and obc-boot — deliberately NOT a -# member of the root Cargo.toml. Tauri drags in wry and a platform webview -# (WebKitGTK on Linux, WebView2 on Windows), so joining the workspace would put a -# GUI toolkit and its system headers in the way of `cargo test` for the renderer. -# The cost is the usual one for an excluded crate: its own Cargo.lock, its own -# fmt/clippy/test invocations, and its own CI job — see the repo AGENTS.md and -# .github/workflows/ci.yml's `desktop` job. -[workspace] - -[features] -# Plain `cargo build` produces a shippable app rather than a dev-server shell. -default = ["custom-protocol"] - -# `tauri/custom-protocol` is what decides whether the app *is* an app: with it, -# `tauri::generate_context!` embeds the built frontend and the webview loads it -# over the `tauri://` protocol; without it, Tauri is in "dev" mode and points the -# window at `build.devUrl`. The Tauri templates leave it off and have their CLI -# add it for `tauri build` — which silently produces a blank window for anyone -# running plain `cargo run`, which is how this repo builds everything. -# -# So it is ON by default here, and the live-reload loop is the explicit opt-out: -# -# npm --prefix ../web run dev -- --mode desktop -# cargo run --no-default-features # follows Vite -custom-protocol = ["tauri/custom-protocol"] - -[build-dependencies] -# Generates the Tauri context (config + the embedded frontend bundle). -tauri-build = { version = "2", features = [] } - -[dependencies] -obc-usb = { path = "../usb" } -tauri = { version = "2", features = [] } -# Native USB (#909). Pure Rust: there is no C library to vendor, no CMake leg, -# and nothing for a user to install. It talks to each platform's own USB -# stack directly — usbfs on Linux, IOKit on macOS, WinUSB on Windows. -# -# `features = ["tokio"]` is load-bearing, not tuning. nusb wraps every blocking -# syscall in a `MaybeFuture`, and without a runtime feature the `.await` arm of -# that type is a `panic!` — it compiles on all three platforms and dies the first -# time anything is actually awaited. Tauri's runtime is tokio, so this is the -# arm to enable. See `usb::runtime_guard` for what stops it happening again. -nusb = { version = "0.2", features = ["tokio"] } -# `HotplugWatch` is a `futures_core::Stream`; this is the trait, and nothing else -# (futures-core has no dependencies of its own). -futures-core = "0.3" -# Tauri's async runtime is tokio, and these are the pieces the USB plane needs: -# `sync` for the per-endpoint mutexes and the cancel epochs, `macros` for the -# select! that makes a parked transfer cancellable, `fs` to read a map off the -# disk without blocking a runtime worker. -tokio = { version = "1", features = ["sync", "macros", "fs", "io-util"] } -# Used from Rust only (no JS permission needed): "show the file I just built" in -# the platform's own file manager. -tauri-plugin-opener = "2" -# The one place the *user* names a directory: relocating the ride library (E2 -# #912). Called from Rust, like the opener above, so `capabilities/default.json` -# stays at `core:default` and no JS gets a file-picker. That is also the crate's -# standing rule about paths, met rather than bent — the frontend still never -# names a place; here the OS's own chooser does, with the person driving it. -tauri-plugin-dialog = "2" -serde = { version = "1", features = ["derive"] } -serde_json = "1" -# Blocking HTTP for the small map catalog document. The caller runs on a worker -# thread, and rustls-by-default avoids an OpenSSL system dependency. -ureq = "3" -# Parses catalog/object URLs so the native fetch command can enforce same-origin -# access instead of handing the webview a general HTTP proxy. -url = "2" diff --git a/builder/desktop/README.md b/builder/desktop/README.md deleted file mode 100644 index 3e75854ea8..0000000000 --- a/builder/desktop/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# obc-desktop - -The website's cell-catalog map builder in a Tauri v2 window. The Svelte coverage UI, digest -verification, corridor selection and wasm assembly engine are the same in both products. Rust -supplies native HTTPS, durable map-set output, USB and the ride library; it does not link -`obc-pack` and it does not process `.osm.pbf` files. - -## Setup - -| | | -|---|---| -| Rust | stable, via `rustup` | -| Node | 22+, for the embedded frontend | -| Linux only | WebKitGTK for `wry`: `libwebkit2gtk-4.1-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libgtk-3-dev librsvg2-dev` | - -No GEOS, CMake, libusb or Python dependency. `nusb` talks to each platform's native USB stack. - -USB on macOS and Windows needs no extra setup. On Linux: - -```sh -sudo cp linux/99-openbikecomputer.rules /etc/udev/rules.d/ -sudo udevadm control --reload-rules -sudo udevadm trigger -# unplug and reconnect the device -``` - -## Build and run - -Build the two wasm bridges and the desktop frontend first, then run the standalone Rust crate: - -```sh -cd builder/web -npm ci -npm run build:wasm -npm run build:desktop - -cd ../desktop -cargo run --release -``` - -`custom-protocol` is a default feature, so plain `cargo run` embeds `builder/web/dist/desktop`. -For the Vite live-reload loop: - -```sh -# terminal 1, from builder/desktop -npm --prefix ../web run dev -- --mode desktop - -# terminal 2 -cargo run --no-default-features -``` - -Packaged builds compile their catalog root from `OBC_CATALOG_URL`, which defaults to -`https://maps.openbikecomputer.com/cell-catalog/catalog.json`. A runtime variable of the same name -overrides it to test an unpublished catalog: - -```sh -OBC_CATALOG_URL=https://maps.example.test/catalog.json cargo run --release -``` - -Rust fetches the catalog root, every satellite and every cell. Object URLs must use the configured -root's HTTPS origin; loopback HTTP is allowed for local testing. The webview never gets a general -network proxy. - -## Basemap - -The region picker, ride library and route previews draw the same basemap from -`tiles.openbikecomputer.com`. Each map reads the active release from -`https://maps.openbikecomputer.com/planner/catalog.json` when it opens. The basemap needs WebGL2 -and shows detail only within the published tile coverage. If it cannot load, the map shows a -notice and keeps the selection or route overlays. It sends no tile requests to a third-party map -server. - -The webview loads tiles, fonts and symbols itself. The Content Security Policy in -`tauri.conf.json` names the two hosts. The asset host must list the app origin in its CORS rules: -`tauri://localhost` on macOS and Linux, `http://tauri.localhost` on Windows. - -## Test - -This is a standalone cargo root, like `obc-fw-nrf54l` and `obc-boot`, so it needs its own checks: - -```sh -cargo fmt -- --check -cargo check --release --locked -cargo clippy --release --locked --all-targets -- -D warnings -cargo test --release --locked -- --nocapture -``` - -The shared Svelte checks run from `builder/web`: `npm run check`, `npm test`, `npm run build:all`. - -### Linux release-launch test - -The manual suite `manual.desktop-linux-launch` opens the real window under Xvfb, checks its -`tauri://localhost` origin, searches for Switzerland and adds it to the map, against a loopback -catalog. CI does not run it. On a Linux host with no OBC device attached, build the release app -first, then from the repository root: - -```sh -sudo apt-get install webkit2gtk-driver xvfb imagemagick dbus-daemon -cargo install tauri-driver --version 2.0.6 --locked -xvfb-run -a dbus-run-session -- uv run --locked --group desktop-e2e python builder/desktop/e2e/launch.py -``` - -**Use a WebKit driver with the same version as the installed WebKitGTK runtime.** -`dbus-run-session` gives the app and the desktop portal services a private session bus with the -Xvfb display. - -`OBC_DESKTOP_BINARY` names an existing release executable. Evidence goes to -`target/desktop-launch`, or `OBC_DESKTOP_EVIDENCE`: `result.json`, native catalog request logs, -application and driver logs, rendered HTML and a screenshot, plus `failure.png` when a webview -session is available. - -The suite covers Linux software launch and catalog integration only: no USB permission, no -enumeration with a physical device and no route upload. Windows launch is not automated, and -Tauri's native WebDriver route does not support macOS. - -## Reference - -| | | -|---|---| -| Assembled maps | `~/Documents/OpenBikeComputer//` | -| Pulled rides (GPX) | `~/Documents/OpenBikeComputer/rides/` — relocatable | -| Ride archive | `/ride-archive/` — internal, not relocatable | - -Each completed assembly is a uniquely named folder. Files are written to `.part`, flushed and -atomically renamed before the assembly is reported complete. The website gets the same -worker-produced bytes through browser downloads. The visible ride folder holds GPX files only; -device ride objects and the index live in the internal archive, and `src/rides.rs` documents the -durable import and relocation rules. Catalog cells are held only for the assembly run: there is no -`.pbf`, land-polygon, Geofabrik-index or persistent cell cache. - -| | | -|---|---| -| `src/main.rs` | Tauri commands and the deliberately small webview capability surface | -| `src/catalog.rs`, `src/http.rs` | Configured catalog root and same-origin native object reads | -| `src/map_output.rs` | Opaque output sessions and atomic map-set writes | -| `src/storage.rs`, `src/paths.rs` | Visible app-owned locations | -| `src/rides.rs` | Managed GPX library plus the durable ride archive | -| `src/usb/` | Native USB discovery and byte pipes beneath the shared TypeScript protocol | - -The window has `core:default` and no filesystem, shell or HTTP plugin; Rust commands hold those -policies. `dragDropEnabled: false` in `tauri.conf.json` turns off Tauri's OS-level interception so -the shared HTML5 GPX drop targets get files. - -The device protocol is the shared TypeScript implementation in `builder/web/src/lib/usb/`; Rust -supplies the native pipes only. Large app-owned files stream from the maps folder without entering -the webview. A newly assembled volume set streams to the device with the manifest last. The device -page also accepts a standalone `.obcm` from elsewhere. - -There are no installers, signing or auto-update. There is no native arbitrary-file picker; files -selected in the webview use the ordinary chunked transfer path. diff --git a/builder/desktop/build.rs b/builder/desktop/build.rs deleted file mode 100644 index 261851f6b6..0000000000 --- a/builder/desktop/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - tauri_build::build(); -} diff --git a/builder/desktop/capabilities/default.json b/builder/desktop/capabilities/default.json deleted file mode 100644 index 61c5f8d64b..0000000000 --- a/builder/desktop/capabilities/default.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "../gen/schemas/desktop-schema.json", - "identifier": "default", - "description": "The app's own commands need no permission; this grants the core set the webview itself uses (window, event, IPC channels). Nothing here opens a filesystem, shell or HTTP capability to JavaScript — every one of those is a Rust command with the policy written in Rust, which is the reason the backend exists.", - "windows": ["main"], - "permissions": ["core:default"] -} diff --git a/builder/desktop/e2e/launch.py b/builder/desktop/e2e/launch.py deleted file mode 100644 index 81190fe337..0000000000 --- a/builder/desktop/e2e/launch.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python3 -"""Launch the embedded Linux frontend and select a local catalog region.""" - -from contextlib import suppress -import json -import os -from pathlib import Path -import shlex -import signal -import socket -import subprocess -import sys -from tempfile import TemporaryDirectory -import traceback -from urllib.parse import urlsplit - -from selenium import webdriver -from selenium.webdriver.common.by import By -from selenium.webdriver.remote.client_config import ClientConfig -from selenium.webdriver.support import expected_conditions as EC -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.webkitgtk.options import Options - -ROOT = Path(__file__).resolve().parents[3] -sys.path.insert(0, str(ROOT / "tools")) - -from fixture_catalog import CatalogServer, schema_examples # noqa: E402 — needs ROOT on the path - - -def main(): - if sys.platform != "linux": - raise SystemExit("The release-launch suite requires Linux and Xvfb.") - binary = Path(os.environ.get("OBC_DESKTOP_BINARY", ROOT / "builder/desktop/target/release/obc-desktop")).resolve() - evidence = Path(os.environ.get("OBC_DESKTOP_EVIDENCE", ROOT / "target/desktop-launch")).resolve() - evidence.mkdir(parents=True, exist_ok=True) - for name in ("result.json", "failure.png", "ready.png", "page.html", "driver.log", "application.log", "catalog.jsonl", "processes.txt"): - (evidence / name).unlink(missing_ok=True) - result = {"passed": False, "binary": str(binary)} - browser = process = server = None - objects = schema_examples() - - with TemporaryDirectory(prefix="obc-desktop-launch-") as scratch, (evidence / "driver.log").open("w") as driver_log: - try: - if not binary.is_file() or not os.access(binary, os.X_OK): - raise RuntimeError(f"Missing executable release app: {binary}") - server = CatalogServer(objects, log=evidence / "catalog.jsonl").start() - catalog_url = f"{server.origin}/catalog.json" - # WebKit launches this wrapper once. exec preserves its PID and captures Rust output. - wrapper = Path(scratch) / "application.sh" - pidfile = Path(scratch) / "application.pid" - wrapper.write_text("#!/bin/sh\n" + f"echo $$ > {shlex.quote(str(pidfile))}\n" + - f"exec > {shlex.quote(str(evidence / 'application.log'))} 2>&1\n" + - 'printf "automation=%s inspector=%s display=%s\\n" "$TAURI_WEBVIEW_AUTOMATION" "$WEBKIT_INSPECTOR_SERVER" "$DISPLAY"\n' + - f'exec {shlex.quote(str(binary))} "$@"\n') - wrapper.chmod(0o755) - environment = {**os.environ, "OBC_CATALOG_URL": catalog_url, "RUST_BACKTRACE": "1", - "XDG_DATA_HOME": scratch, "XDG_CONFIG_HOME": scratch, "XDG_CACHE_HOME": scratch} - process = subprocess.Popen(["tauri-driver"], env=environment, stdout=driver_log, - stderr=subprocess.STDOUT, start_new_session=True) - - def listening(_): - if process.poll() is not None: - raise RuntimeError("tauri-driver exited before readiness") - try: - with socket.create_connection(("127.0.0.1", 4444), timeout=1): - return True - except OSError: - return False - - WebDriverWait(None, 15).until(listening, "tauri-driver did not listen") - options = Options() - options.set_capability("browserName", "wry") - options.set_capability("tauri:options", {"application": str(wrapper)}) - browser = webdriver.Remote(command_executor="http://127.0.0.1:4444", options=options, - client_config=ClientConfig(remote_server_addr="http://127.0.0.1:4444", timeout=30)) - wait = WebDriverWait(browser, 30) - search = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, '[aria-label="Search regions"]'))) - result["url"] = browser.current_url - origin = urlsplit(result["url"]) - if (origin.scheme, origin.netloc) != ("tauri", "localhost"): - raise AssertionError(f"Expected embedded custom-protocol frontend, got {result['url']}") - search.send_keys("Switzerland") - wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '[aria-label="Add Switzerland (1.0 KB)"]'))).click() - wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, '[aria-label="Switzerland is already in the map"]'))) - wait.until(EC.text_to_be_present_in_element((By.CSS_SELECTOR, '.ledger .total'), "1.0 KB")) - if browser.find_elements(By.CSS_SELECTOR, '.catalog-error, .ledger .error, .parts .retry'): - raise AssertionError("Catalog or region resolution failed") - missing = set(objects) - set(server.requests) - if missing: - raise AssertionError(f"Native catalog requests missing: {sorted(missing)}") - result["region"] = "Switzerland" - result["price"] = browser.find_element(By.CSS_SELECTOR, '.ledger .total').text - result["capabilities"] = browser.capabilities - browser.save_screenshot(str(evidence / "ready.png")) - (evidence / "page.html").write_text(browser.page_source) - browser.quit() - browser = None - pid = int(pidfile.read_text()) - WebDriverWait(None, 10).until(lambda _: not Path(f"/proc/{pid}").exists(), "Application did not exit after session quit") - result["application_exited"] = True - if "panicked at" in (evidence / "application.log").read_text(): - raise AssertionError("The release app panicked") - result["passed"] = True - except Exception: - result["error"] = traceback.format_exc() - with suppress(Exception): - # A session can fail before WebDriver can capture the still-open app window. - subprocess.run(["import", "-window", "root", str(evidence / "failure.png")], - check=True, timeout=5) - (evidence / "processes.txt").write_text(subprocess.check_output( - ["ps", "-eo", "pid,ppid,stat,comm"], text=True, timeout=5)) - if browser: - with suppress(Exception): - browser.save_screenshot(str(evidence / "failure.png")) - (evidence / "page.html").write_text(browser.page_source) - raise - finally: - if browser: - with suppress(Exception): - browser.quit() - if process: - with suppress(ProcessLookupError): - os.killpg(process.pid, signal.SIGTERM) - try: - process.wait(timeout=5) - except subprocess.TimeoutExpired: - os.killpg(process.pid, signal.SIGKILL) - process.wait() - if server: - server.shutdown() - server.server_close() - result["requests"] = server.requests if server else [] - (evidence / "result.json").write_text(json.dumps(result, indent=2) + "\n") - print(json.dumps(result, indent=2)) - - -if __name__ == "__main__": - main() diff --git a/builder/desktop/icons/128x128.png b/builder/desktop/icons/128x128.png deleted file mode 100644 index 8152165d92..0000000000 Binary files a/builder/desktop/icons/128x128.png and /dev/null differ diff --git a/builder/desktop/icons/128x128@2x.png b/builder/desktop/icons/128x128@2x.png deleted file mode 100644 index 2b13445fbe..0000000000 Binary files a/builder/desktop/icons/128x128@2x.png and /dev/null differ diff --git a/builder/desktop/icons/32x32.png b/builder/desktop/icons/32x32.png deleted file mode 100644 index 2f1c11b745..0000000000 Binary files a/builder/desktop/icons/32x32.png and /dev/null differ diff --git a/builder/desktop/icons/icon.icns b/builder/desktop/icons/icon.icns deleted file mode 100644 index 9537f6d4b7..0000000000 Binary files a/builder/desktop/icons/icon.icns and /dev/null differ diff --git a/builder/desktop/icons/icon.ico b/builder/desktop/icons/icon.ico deleted file mode 100644 index c2dbaabbc2..0000000000 Binary files a/builder/desktop/icons/icon.ico and /dev/null differ diff --git a/builder/desktop/icons/icon.png b/builder/desktop/icons/icon.png deleted file mode 100644 index f3bd39b9dc..0000000000 Binary files a/builder/desktop/icons/icon.png and /dev/null differ diff --git a/builder/desktop/src/catalog.rs b/builder/desktop/src/catalog.rs deleted file mode 100644 index 1f79d9daa9..0000000000 --- a/builder/desktop/src/catalog.rs +++ /dev/null @@ -1,56 +0,0 @@ -//! The published map catalog, fetched for the desktop app. The desktop and hosted builders consume -//! the same document over HTTP and hand it to the same frontend catalog client. -//! -//! Two things a `fetch()` in the webview would not do: the window has no network capability at all, -//! so every request the app makes is Rust code in [`crate::http`], and the catalog admits nothing -//! partial, so the body is read whole and handed over as one string with the URL it came from. -//! -//! `OBC_CATALOG_URL` overrides the compiled default at run time, which is how a maintainer tests a -//! bake tree before publishing. - -use serde::Serialize; - -const DEFAULT_CATALOG_URL: &str = "https://maps.openbikecomputer.com/cell-catalog/catalog.json"; -const COMPILED_CATALOG_URL: Option<&str> = option_env!("OBC_CATALOG_URL"); - -/// The manifest body plus the URL it was read from. Relative references resolve against the -/// manifest's own location, and only this side knows it. -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct FetchedCatalog { - pub url: String, - pub body: String, -} - -pub fn url() -> String { - selected_url(std::env::var("OBC_CATALOG_URL").ok()) -} - -fn selected_url(runtime: Option) -> String { - runtime - .filter(|value| !value.trim().is_empty()) - .or_else(|| COMPILED_CATALOG_URL.filter(|value| !value.trim().is_empty()).map(str::to_owned)) - .unwrap_or_else(|| DEFAULT_CATALOG_URL.to_owned()) -} - -pub fn fetch() -> Result { - let url = url(); - let body = crate::http::get_text(&url).map_err(|e| format!("map catalog: {e}"))?; - Ok(FetchedCatalog { url, body }) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn the_catalog_url_is_absolute_and_overridable() { - // It must be absolute: the frontend resolves catalog references against it. - assert_eq!(selected_url(None), "https://maps.openbikecomputer.com/cell-catalog/catalog.json"); - assert_eq!( - selected_url(Some("https://example.invalid/catalog.json".into())), - "https://example.invalid/catalog.json" - ); - assert_ne!(selected_url(Some(String::new())), "", "an empty override must fall back"); - } -} diff --git a/builder/desktop/src/http.rs b/builder/desktop/src/http.rs deleted file mode 100644 index 37f6b33e1a..0000000000 --- a/builder/desktop/src/http.rs +++ /dev/null @@ -1,74 +0,0 @@ -//! The desktop app's small native network surface. Map selection, verification and assembly are -//! shared with the web builder; Rust moves the catalog bytes, because the Tauri webview has no -//! blanket network permission. - -use std::io::Read; -use std::sync::OnceLock; -use std::time::Duration; - -/// A cell is megabytes and a connection to a CDN edge can wedge half-open, and without a deadline -/// that read never returns. Sized for the largest object over a poor link: the point is to fail a -/// long stall, not to police a slow connection. -/// -/// Retrying is not done here. Every catalog object is digest-pinned, and the frontend's -/// `fetchVerified` owns that policy for both this host and the website. -const CONNECT_TIMEOUT: Duration = Duration::from_secs(15); -const RESPONSE_TIMEOUT: Duration = Duration::from_secs(30); -const BODY_TIMEOUT: Duration = Duration::from_secs(300); - -fn agent() -> &'static ureq::Agent { - static AGENT: OnceLock = OnceLock::new(); - AGENT.get_or_init(|| { - ureq::Agent::config_builder() - .timeout_connect(Some(CONNECT_TIMEOUT)) - .timeout_recv_response(Some(RESPONSE_TIMEOUT)) - .timeout_recv_body(Some(BODY_TIMEOUT)) - .build() - .into() - }) -} - -/// Read a small text document whole. -pub fn get_text(url: &str) -> Result { - let mut response = agent().get(url).call().map_err(|e| format!("GET {url}: {e}"))?; - response.body_mut().read_to_string().map_err(|e| format!("read {url}: {e}")) -} - -/// Read one digest-pinned catalog object. It is not a general HTTP proxy: every URL must share the -/// configured catalog root's origin. -pub fn get_catalog_object(url: &str) -> Result, String> { - same_catalog_origin(url, &crate::catalog::url())?; - let mut response = agent().get(url).call().map_err(|e| format!("GET {url}: {e}"))?; - let mut bytes = Vec::new(); - response.body_mut().as_reader().read_to_end(&mut bytes).map_err(|e| format!("read {url}: {e}"))?; - Ok(bytes) -} - -fn same_catalog_origin(requested: &str, catalog: &str) -> Result<(), String> { - let requested = url::Url::parse(requested).map_err(|e| format!("catalog object URL: {e}"))?; - let catalog = url::Url::parse(catalog).map_err(|e| format!("configured catalog URL: {e}"))?; - let local_http = - requested.scheme() == "http" && matches!(requested.host_str(), Some("localhost" | "127.0.0.1" | "::1")); - if requested.scheme() != "https" && !local_http { - return Err("catalog objects must use https (or loopback http for local testing)".into()); - } - if requested.origin() != catalog.origin() { - return Err(format!("catalog objects must stay on {}", catalog.origin().ascii_serialization())); - } - Ok(()) -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn catalog_reads_are_https_and_same_origin() { - let root = "https://maps.example.test/prefix/catalog.json"; - assert!(same_catalog_origin("https://maps.example.test/prefix/cells/fine/index.json", root).is_ok()); - assert!(same_catalog_origin("https://other.example.test/cell.obcm", root).is_err()); - assert!(same_catalog_origin("http://maps.example.test/cell.obcm", root).is_err()); - assert!(same_catalog_origin("file:///tmp/cell.obcm", root).is_err()); - assert!(same_catalog_origin("http://127.0.0.1:8123/cell.obcm", "http://127.0.0.1:8123/catalog.json").is_ok()); - } -} diff --git a/builder/desktop/src/main.rs b/builder/desktop/src/main.rs deleted file mode 100644 index 06842624b3..0000000000 --- a/builder/desktop/src/main.rs +++ /dev/null @@ -1,224 +0,0 @@ -//! The OpenBikeComputer desktop app: the same published-cell map builder as the website, in a -//! Tauri shell with native storage and device access. -//! -//! It adds three things the webview cannot do itself: [`catalog`] fetches the published map -//! catalog, [`usb`] drives the device because the webview has no WebUSB, and [`rides`] keeps a -//! durable copy of a ride. -//! -//! The window is granted `core:default` and nothing else: no filesystem, no shell, no HTTP. Every -//! one of those policies is written in Rust, where it can be read, and catalog object reads are -//! restricted to the configured catalog origin. - -mod catalog; -mod http; -mod map_output; -mod paths; -mod rides; -mod usb; - -use std::sync::Arc; - -use tauri::Manager; - -/// The published cell catalog, body and base URL. -#[tauri::command] -async fn catalog() -> Result { - tauri::async_runtime::spawn_blocking(catalog::fetch).await.map_err(|e| e.to_string())? -} - -/// One catalog satellite or cell, restricted to the catalog root's origin. -#[tauri::command] -async fn catalog_get(url: String) -> Result { - let bytes = tauri::async_runtime::spawn_blocking(move || http::get_catalog_object(&url)) - .await - .map_err(|e| e.to_string())??; - Ok(tauri::ipc::Response::new(bytes)) -} - -#[tauri::command] -fn map_output_begin( - app: tauri::AppHandle, - outputs: tauri::State<'_, Arc>, - name: String, -) -> Result { - outputs.begin(&maps_dir(&app), &name) -} - -#[tauri::command] -async fn map_output_write( - outputs: tauri::State<'_, Arc>, - request: tauri::ipc::Request<'_>, -) -> Result { - let header = |name: &str| { - request - .headers() - .get(name) - .and_then(|value| value.to_str().ok()) - .ok_or_else(|| format!("a map output write is missing its `{name}` header")) - }; - let id: u64 = header("output-id")?.parse().map_err(|_| "a map output write has an invalid id".to_string())?; - let name = header("filename")?.to_owned(); - let tauri::ipc::InvokeBody::Raw(bytes) = request.body() else { - return Err("a map output write must carry raw bytes".into()); - }; - let bytes = bytes.clone(); - let outputs = outputs.inner().clone(); - tauri::async_runtime::spawn_blocking(move || outputs.write(id, &name, &bytes)).await.map_err(|e| e.to_string())? -} - -#[tauri::command] -async fn map_output_finish(outputs: tauri::State<'_, Arc>, id: u64) -> Result<(), String> { - let outputs = outputs.inner().clone(); - tauri::async_runtime::spawn_blocking(move || outputs.finish(id)).await.map_err(|e| e.to_string())? -} - -#[tauri::command] -async fn map_output_discard(outputs: tauri::State<'_, Arc>, id: u64) -> Result<(), String> { - let outputs = outputs.inner().clone(); - tauri::async_runtime::spawn_blocking(move || outputs.discard(id)).await.map_err(|e| e.to_string())? -} - -/// Where built maps go. Shown in the UI, so the user can act on it. -fn maps_dir(app: &tauri::AppHandle) -> std::path::PathBuf { - paths::maps_dir(app.path().document_dir().ok()) -} - -/// Show a produced file in the platform's file manager. -/// -/// Scoped to the folders this app owns: a webview can call this command, and revealing any path is -/// a wider door than the features need. The ride library is listed separately from the maps folder, -/// because a relocated library is not inside it. -#[tauri::command] -fn reveal_file(app: tauri::AppHandle, path: String) -> Result<(), String> { - let path = std::path::PathBuf::from(path); - let roots = [maps_dir(&app), ride_library(&app).0.root().to_path_buf()]; - if !roots.iter().any(|root| path.starts_with(root)) { - let names: Vec = roots.iter().map(|r| r.display().to_string()).collect(); - return Err(format!("only files under {} can be revealed", names.join(" or "))); - } - tauri_plugin_opener::reveal_item_in_dir(&path).map_err(|e| format!("reveal {}: {e}", path.display())) -} - -/// The library, and whether its visible GPX folder is the default one. -/// -/// Resolved per call rather than held in state: the folder can move while the app is running, and a -/// cached root would then be wrong exactly when a rider is looking at it. The archive lives in app -/// data and never moves. -fn ride_library(app: &tauri::AppHandle) -> (rides::Library, bool) { - let default = paths::rides_dir(app.path().document_dir().ok()); - let archive = paths::ride_archive_dir(app.path().app_data_dir().ok()); - let (root, is_default) = match app.path().app_config_dir().ok().and_then(|dir| rides::configured(&dir)) { - Some(chosen) if chosen != default => (chosen, false), - _ => (default, true), - }; - (rides::Library::new(root, archive), is_default) -} - -/// The library folder and everything in it. -#[tauri::command] -fn rides_index(app: tauri::AppHandle) -> rides::IndexView { - let (library, is_default) = ride_library(&app); - library.view(is_default) -} - -/// Land one pulled ride durably, and only then resolve. -/// -/// It lands the bytes with `fsync` before it resolves, so a ride the frontend believes it has is a -/// ride on this disk. A ride whose write failed rejects here and is absent from the durable index, -/// so a power cut costs at worst a re-download. -/// -/// It runs on the blocking pool, because `fsync` blocks. -#[tauri::command] -async fn rides_import(app: tauri::AppHandle, request: rides::ImportRequest) -> Result { - let (library, _) = ride_library(&app); - tauri::async_runtime::spawn_blocking(move || library.import(&request)).await.map_err(|e| e.to_string())? -} - -/// The stored ride object of one key, which a GPX re-export decodes. -#[tauri::command] -async fn rides_read(app: tauri::AppHandle, key: String) -> Result { - let (library, _) = ride_library(&app); - let bytes = - tauri::async_runtime::spawn_blocking(move || library.read_object(&key)).await.map_err(|e| e.to_string())??; - // The raw path, like `usb_read`: a ride object is hundreds of kilobytes and a JSON number - // array would be four times that in text. - Ok(tauri::ipc::Response::new(bytes)) -} - -/// Write one ride's GPX into the visible folder: the repair for a GPX somebody deleted, and the -/// fallback when the file to show is not there yet. -#[tauri::command] -async fn rides_write_gpx(app: tauri::AppHandle, key: String, gpx: String) -> Result { - let (library, _) = ride_library(&app); - tauri::async_runtime::spawn_blocking(move || library.write_gpx(&key, &gpx)).await.map_err(|e| e.to_string())? -} - -/// Let the rider pick a new home for the library, and move it there. -/// -/// The native chooser is opened from Rust, because the frontend names a file and never a place, and -/// the OS's own directory picker is the one way a person can name a place without the webview being -/// handed a filesystem. It answers `None` when the chooser was dismissed, which is an ordinary -/// outcome. -#[tauri::command] -async fn rides_choose_folder(app: tauri::AppHandle) -> Result, String> { - use tauri_plugin_dialog::DialogExt; - - let (library, _) = ride_library(&app); - let from = library.root().to_path_buf(); - let (tx, rx) = std::sync::mpsc::channel(); - app.dialog().file().set_title("Where should pulled rides be kept?").pick_folder(move |picked| { - let _ = tx.send(picked); - }); - // The chooser answers on the UI thread, so parking a blocking-pool thread on the reply keeps - // the event loop free to run it. - let picked = - tauri::async_runtime::spawn_blocking(move || rx.recv().ok().flatten()).await.map_err(|e| e.to_string())?; - let Some(picked) = picked else { return Ok(None) }; - let to = picked.into_path().map_err(|e| format!("that folder could not be used: {e}"))?; - - let config = app.path().app_config_dir().map_err(|e| format!("no config directory: {e}"))?; - let moved = to.clone(); - tauri::async_runtime::spawn_blocking(move || { - rides::relocate(&from, &moved)?; - rides::remember(&config, &moved) - }) - .await - .map_err(|e| e.to_string())??; - Ok(Some(to.display().to_string())) -} - -fn main() { - tauri::Builder::default() - .plugin(tauri_plugin_opener::init()) - // Registered for its Rust API only, which `rides_choose_folder` calls. No JS permission is - // granted, so the webview cannot open a picker of its own. - .plugin(tauri_plugin_dialog::init()) - .manage(Arc::new(usb::UsbState::default())) - .manage(Arc::new(map_output::Outputs::default())) - .invoke_handler(tauri::generate_handler![ - catalog, - catalog_get, - map_output_begin, - map_output_write, - map_output_finish, - map_output_discard, - reveal_file, - // The library is a folder plus an index, and the ack follows `rides_import`. - rides_index, - rides_import, - rides_read, - rides_write_gpx, - rides_choose_folder, - // Bytes only: the protocol lives once, in TypeScript, over these. - usb::usb_watch, - usb::usb_list, - usb::usb_open, - usb::usb_close, - usb::usb_read, - usb::usb_write, - usb::usb_cancel, - usb::usb_reset, - ]) - .run(tauri::generate_context!()) - .expect("run the OpenBikeComputer app"); -} diff --git a/builder/desktop/src/map_output.rs b/builder/desktop/src/map_output.rs deleted file mode 100644 index 7b9600042f..0000000000 --- a/builder/desktop/src/map_output.rs +++ /dev/null @@ -1,144 +0,0 @@ -//! Native landing place for verified assemblies. -//! -//! The wasm worker produces the same bytes in every host. The website hands each file to the -//! browser downloader; the desktop writes the files into one newly created folder under the maps -//! directory. An opaque id keeps the webview from turning this into a write-anywhere command. - -use std::collections::HashMap; -use std::io::Write; -use std::path::{Path, PathBuf}; -use std::sync::atomic::{AtomicU64, Ordering}; -use std::sync::Mutex; - -use serde::Serialize; - -#[derive(Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Opened { - pub id: u64, - pub path: String, -} - -#[derive(Default)] -pub struct Outputs { - next: AtomicU64, - open: Mutex>, -} - -impl Outputs { - pub fn begin(&self, maps: &Path, name: &str) -> Result { - std::fs::create_dir_all(maps).map_err(|e| format!("{}: {e}", maps.display()))?; - let base = folder_name(name); - let path = (1..10_000) - .find_map(|n| { - let candidate = maps.join(if n == 1 { base.clone() } else { format!("{base}-{n}") }); - match std::fs::create_dir(&candidate) { - Ok(()) => Some(Ok(candidate)), - Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => None, - Err(e) => Some(Err(format!("{}: {e}", candidate.display()))), - } - }) - .ok_or_else(|| format!("{}: could not allocate an output folder", maps.display()))??; - let id = self.next.fetch_add(1, Ordering::Relaxed).wrapping_add(1); - self.open.lock().map_err(|_| "map output registry is poisoned".to_string())?.insert(id, path.clone()); - Ok(Opened { id, path: path.display().to_string() }) - } - - pub fn write(&self, id: u64, name: &str, bytes: &[u8]) -> Result { - let open = self.open.lock().map_err(|_| "map output registry is poisoned".to_string())?; - let root = open.get(&id).ok_or_else(|| "that map output session is not open".to_string())?; - write_file(root, name, bytes) - } - - pub fn finish(&self, id: u64) -> Result<(), String> { - self.take(id)?; - Ok(()) - } - - pub fn discard(&self, id: u64) -> Result<(), String> { - let mut open = self.open.lock().map_err(|_| "map output registry is poisoned".to_string())?; - let path = open.get(&id).ok_or_else(|| "that map output session is not open".to_string())?; - match std::fs::remove_dir_all(path) { - Ok(()) => {} - Err(e) if e.kind() == std::io::ErrorKind::NotFound => {} - Err(e) => return Err(format!("discard {}: {e}", path.display())), - } - open.remove(&id); - Ok(()) - } - - fn take(&self, id: u64) -> Result { - self.open - .lock() - .map_err(|_| "map output registry is poisoned".to_string())? - .remove(&id) - .ok_or_else(|| "that map output session is not open".into()) - } -} - -fn write_file(root: &Path, name: &str, bytes: &[u8]) -> Result { - validate_filename(name)?; - let final_path = root.join(name); - let part_path = root.join(format!(".{name}.part")); - let result = (|| { - let mut file = std::fs::OpenOptions::new() - .write(true) - .create_new(true) - .open(&part_path) - .map_err(|e| format!("{}: {e}", part_path.display()))?; - file.write_all(bytes).map_err(|e| format!("{}: {e}", part_path.display()))?; - file.sync_all().map_err(|e| format!("{}: {e}", part_path.display()))?; - std::fs::rename(&part_path, &final_path).map_err(|e| format!("{}: {e}", final_path.display())) - })(); - if result.is_err() { - let _ = std::fs::remove_file(&part_path); - } - result?; - Ok(final_path.display().to_string()) -} - -fn folder_name(name: &str) -> String { - let cleaned: String = - name.trim().chars().filter(|c| c.is_alphanumeric() || matches!(c, ' ' | '_' | '-')).take(80).collect(); - if cleaned.is_empty() { - "Map".into() - } else { - cleaned - } -} - -fn validate_filename(name: &str) -> Result<(), String> { - let safe = !name.is_empty() - && name != "." - && name != ".." - && name.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '-')); - if safe { - Ok(()) - } else { - Err(format!("unsafe map output filename `{name}`")) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn an_output_is_grouped_and_cannot_escape() { - let maps = std::env::temp_dir().join(format!("obc-map-output-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&maps); - let outputs = Outputs::default(); - let opened = outputs.begin(&maps, "Baden-Württemberg / tour").unwrap(); - let path = outputs.write(opened.id, "MS1.OBS", b"set").unwrap(); - assert!(Path::new(&path).starts_with(&maps)); - assert_eq!(std::fs::read(path).unwrap(), b"set"); - assert!(outputs.write(opened.id, "../escape", b"no").is_err()); - outputs.finish(opened.id).unwrap(); - assert!(outputs.write(opened.id, "MS1.OBS", b"late").is_err()); - let discarded = outputs.begin(&maps, "Discarded").unwrap(); - outputs.write(discarded.id, "MS1.OBS", b"partial").unwrap(); - outputs.discard(discarded.id).unwrap(); - assert!(!Path::new(&discarded.path).exists()); - let _ = std::fs::remove_dir_all(&maps); - } -} diff --git a/builder/desktop/src/paths.rs b/builder/desktop/src/paths.rs deleted file mode 100644 index c3ada6052e..0000000000 --- a/builder/desktop/src/paths.rs +++ /dev/null @@ -1,72 +0,0 @@ -//! Where the app keeps things. -//! -//! Two locations are visible to the user. Assembled maps go somewhere the user can find them: the -//! desktop tier exists because it has a real filesystem, and a build that landed in an opaque -//! app-support directory would be a download manager with extra steps. Pulled rides live beside -//! them in a relocatable GPX folder, with their durable archive in app data. - -use std::path::PathBuf; - -/// The visible output folder for built maps. -pub fn maps_dir(documents: Option) -> PathBuf { - documents.unwrap_or_else(home).join("OpenBikeComputer") -} - -/// The default home of the managed ride library, beside the maps, so one folder answers where this -/// app puts things and `reveal_file`'s rule covers it without widening. -/// -/// It is only the default. A rider whose rides belong on an external drive relocates it, and the -/// choice is remembered in the app's config directory: a folder that named itself could not be -/// found once it moved. -pub fn rides_dir(documents: Option) -> PathBuf { - maps_dir(documents).join("rides") -} - -/// The internal ride archive: the index plus the ride objects the library keeps behind the visible -/// GPX folder. It is app data and not user files, and it does not follow the GPX folder when the -/// rider moves it, because a store that follows another folder around is two ways to lose it. -/// -/// `app_data` is Tauri's per-app data directory. The fallback exists so a platform that cannot name -/// one still gets a deterministic, private location rather than a panic. -pub fn ride_archive_dir(app_data: Option) -> PathBuf { - app_data.unwrap_or_else(|| home().join(".openbikecomputer")).join("ride-archive") -} - -fn home() -> PathBuf { - #[cfg(windows)] - let var = "USERPROFILE"; - #[cfg(not(windows))] - let var = "HOME"; - std::env::var_os(var).map(PathBuf::from).unwrap_or_else(std::env::temp_dir) -} - -/// The same rule for any suffix: strip every path separator, keep only characters that mean nothing -/// to a shell or a filesystem, and force the extension. It is the reason a name typed into the -/// window cannot name a place. `fallback` is the stem used when nothing survives the filter. -pub fn sanitize_basename(name: &str, ext: &str, fallback: &str) -> String { - let base = name.trim().rsplit(['/', '\\']).next().unwrap_or(""); - let mut cleaned: String = - base.chars().filter(|c| c.is_alphanumeric() || matches!(c, '.' | '_' | '-' | ' ')).collect(); - cleaned = cleaned.trim().to_string(); - if cleaned.is_empty() || cleaned == ext { - cleaned = fallback.to_string(); - } - if !cleaned.ends_with(ext) { - cleaned.push_str(ext); - } - cleaned -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn the_same_rule_forces_any_other_suffix() { - assert_eq!(sanitize_basename("bikepacking", ".json", "style"), "bikepacking.json"); - assert_eq!(sanitize_basename("../../.ssh/config", ".json", "style"), "config.json"); - assert_eq!(sanitize_basename("", ".json", "style"), "style.json"); - assert_eq!(sanitize_basename(".json", ".json", "style"), "style.json"); - assert_eq!(sanitize_basename("obcm-style-default.json", ".json", "style"), "obcm-style-default.json"); - } -} diff --git a/builder/desktop/src/rides.rs b/builder/desktop/src/rides.rs deleted file mode 100644 index a80656e5c6..0000000000 --- a/builder/desktop/src/rides.rs +++ /dev/null @@ -1,1144 +0,0 @@ -//! Durable desktop ride library. [`Library::import`] returns only after it has flushed -//! the ride object, GPX, and index in that order. -//! -//! ```text -//! / rider-owned, relocatable GPX files -//! 2026-07-20-schauinsland.gpx -//! -//! /ride-archive/ internal, fixed-location archive -//! index.json -//! 2026-07-20-schauinsland.obcride -//! ``` -//! -//! The lossless `.obcride` copy makes GPX re-export possible. Identity is -//! `(serial, store_id, id)` because object ids can be reused after a card change. - -use std::fs::File; -use std::io::{self, Write}; -use std::path::{Path, PathBuf}; -use std::sync::{Mutex, MutexGuard}; -use std::time::{SystemTime, UNIX_EPOCH}; - -use serde::{Deserialize, Serialize}; - -/// Serializes imports and relocation so temp names and index updates cannot interleave. -static LIBRARY_LOCK: Mutex<()> = Mutex::new(()); - -fn lock() -> MutexGuard<'static, ()> { - // A panic while holding the lock poisons it; the disk state is still governed by the - // rename-last discipline, so the next operation may simply proceed. - LIBRARY_LOCK.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) -} - -/// The index's filename. It is readable JSON on purpose: it is the record a person can open and -/// read. -pub const INDEX_FILE: &str = "index.json"; -/// Bumped only when an older index can no longer be read. An unreadable index is not fatal: it -/// re-imports and never deletes. -const INDEX_VERSION: u32 = 2; -/// The stored ride object's extension, chosen so it cannot be mistaken for a GPX. -const RIDE_EXT: &str = "obcride"; -const GPX_EXT: &str = "gpx"; - -/// Largest ride object this command accepts. It is a ceiling and not an expectation: it is roughly -/// ten days of continuous recording, and it exists because a Tauri command is a door. -const MAX_RIDE_BYTES: usize = 16 * 1024 * 1024; -/// The GPX is the same track as text, five to six times the object, so its ceiling keeps the same -/// margin. -const MAX_GPX_BYTES: usize = 128 * 1024 * 1024; -/// Preview tracks are drawn a few hundred pixels wide, so more points than this would be index -/// weight nobody can see. The frontend downsamples to it and this is the enforcement. -const MAX_TRACK_POINTS: usize = 512; -/// Longest filename stem the library will mint, before its extension. -const MAX_STEM: usize = 64; - -/// The pointer file that remembers a relocated library. It lives in the app's config directory: a -/// folder that named itself could not be found once it moved. -const LOCATION_FILE: &str = "ride-library.json"; - -/// One ride in the library, as `index.json` stores it. -/// -/// It holds only facts that stay true: no absolute paths, because the GPX folder can move, and no -/// existence, because a person can delete a GPX in the file manager. Those are [`RideEntry`]'s, -/// recomputed on every read. -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -#[serde(rename_all = "camelCase")] -pub struct LibraryRide { - /// `serial:storeId:objectId`, minted here and never taken from the caller. - pub key: String, - pub serial: String, - #[serde(deserialize_with = "deserialize_store_id")] - pub store_id: String, - #[serde(serialize_with = "serialize_object_id", deserialize_with = "deserialize_object_id")] - pub object_id: u64, - pub name: String, - /// Ride start, unix seconds UTC. `0` on a device that never had a trusted clock. - pub start_time: u32, - pub distance_m: u32, - pub moving_time_s: u32, - pub climb_m: u32, - pub points: u32, - /// Length of the stored ride object, bytes. - pub bytes: u64, - /// The device's whole-object CRC-32, kept so the stored copy can be re-checked without the - /// device. - pub crc32: u32, - /// When this app first landed the ride, unix seconds. Never re-stamped, so a second pull is a - /// no-op, which matches the first-ack-wins rule on the device. - pub imported_at: u64, - /// Basename of the archived ride object, in the archive directory. - pub ride_file: String, - /// Basename of the GPX, in the visible folder. - pub gpx_file: String, - /// A downsampled `[lat, lon]` track for the list's preview, in degrees, drawn from the ride's - /// own points. - pub track: Vec<[f64; 2]>, -} - -/// One ride as the UI reads it: the stored record plus what only the filesystem can say. -/// -/// The two extra pairs are recomputed on every read and never written down. `present` means the -/// archive file exists: a ride whose object is gone is not a durable copy, so it is not acked and -/// it is pulled again. A missing GPX is only a re-export away, because the archive is its source. -#[derive(Serialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -pub struct RideEntry { - #[serde(flatten)] - pub ride: LibraryRide, - pub ride_path: String, - pub gpx_path: String, - pub present: bool, - pub gpx_present: bool, -} - -/// So an entry reads as the ride it describes. The wrapper adds facts about the filesystem; it is -/// not a different kind of thing. -impl std::ops::Deref for RideEntry { - type Target = LibraryRide; - - fn deref(&self) -> &LibraryRide { - &self.ride - } -} - -/// The index file's whole body. -#[derive(Serialize, Deserialize, Clone, Debug, Default)] -struct Index { - version: u32, - rides: Vec, -} - -/// What the UI is handed: where the visible folder is, and what is in the library. -#[derive(Serialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -pub struct IndexView { - pub folder: String, - /// True when the folder is the app's default rather than one the user picked. - pub is_default: bool, - pub rides: Vec, -} - -/// One ride, as the pull hands it over. The bytes and the GPX both cross the IPC boundary here. -/// -/// A ride is orders of magnitude smaller than the maps and firmware images that need the raw-body -/// path in [`crate::usb`], and the GPX beside it is text, so a structured command with a stated -/// ceiling is the cheaper thing to review. -#[derive(Deserialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -pub struct ImportRequest { - pub serial: String, - #[serde(deserialize_with = "deserialize_store_id")] - pub store_id: String, - #[serde(deserialize_with = "deserialize_object_id")] - pub object_id: u64, - pub name: String, - pub start_time: u32, - pub distance_m: u32, - pub moving_time_s: u32, - pub climb_m: u32, - /// Points in the recorded track, from the caller's decode of the object. This crate has no - /// ride-object decoder and must not grow one: the codecs live once, in `lib/usb/objects.ts`. - pub points: u32, - pub crc32: u32, - pub track: Vec<[f64; 2]>, - /// The ride object exactly as it came off the wire. - pub object: Vec, - /// The GPX 1.1 document, from the same `obc_route::track_to_gpx` the device runs. There is no - /// GPX writer in this crate and there must never be one. - pub gpx: String, -} - -/// [`Library::import`]'s answer. `imported` is false when the ride was already in the library, -/// which is the idempotent case and must not re-stamp anything. -#[derive(Serialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -pub struct Imported { - pub ride: RideEntry, - pub imported: bool, -} - -/// Where a durable write is interrupted. -/// -/// Production constructs a [`Library`] with [`CrashPoint::None`], and nothing outside this module -/// can ask for anything else. The other variants exist so the rule that the ack follows the fsync -/// is checked by running the real code with the power cut at a chosen instant. -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub enum CrashPoint { - #[default] - None, - /// The bytes reached `write()` and the process died before `fsync`: the case that decides - /// whether this feature can lose a ride. - BeforeObjectFsync, - /// The ride's two files are durable and the process died before the index committed. - BeforeIndexCommit, -} - -/// The message a simulated crash returns, so a test can tell it from a real IO error. -const CRASH_MSG: &str = "simulated power loss"; - -pub struct Library { - /// The visible, relocatable GPX folder. - root: PathBuf, - /// The internal archive: `index.json` plus the ride objects. It is app data, so it does not - /// move when the rider moves the GPX folder. - archive: PathBuf, - crash: CrashPoint, -} - -impl Library { - pub fn new(root: PathBuf, archive: PathBuf) -> Self { - Library { root, archive, crash: CrashPoint::None } - } - - /// A library that dies at `crash`. Test-only by construction, not by convention. - #[cfg(test)] - fn crashing_at(root: PathBuf, archive: PathBuf, crash: CrashPoint) -> Self { - Library { root, archive, crash } - } - - pub fn root(&self) -> &Path { - &self.root - } - - /// The index as it is on disk right now, with existence recomputed per ride. - /// - /// A missing index is an empty library, and so is a corrupt one. That is the safe direction: - /// the worst it costs is re-downloading rides the device still holds, while salvaging a - /// half-parsed index risks writing over the files it half-understood. - fn load(&self) -> Index { - read_index(&self.archive.join(INDEX_FILE)) - .unwrap_or_else(|| Index { version: INDEX_VERSION, rides: Vec::new() }) - } - - /// A stored record, joined to the filesystem as it is right now. - fn entry(&self, ride: LibraryRide) -> RideEntry { - let ride_path = self.archive.join(&ride.ride_file); - let gpx_path = self.root.join(&ride.gpx_file); - // Existence alone is not durability. `present` feeds the ack, so a truncated or swapped - // archive file must read as absent: the ride is then pulled again, which costs a download - // instead of a ride. The index's own `bytes` is the cheap whole-file check; hashing every - // archive on every read would make listing a library cost its size. - let present = std::fs::metadata(&ride_path).is_ok_and(|m| m.is_file() && m.len() == ride.bytes); - RideEntry { - present, - gpx_present: gpx_path.is_file(), - ride_path: ride_path.display().to_string(), - gpx_path: gpx_path.display().to_string(), - ride, - } - } - - fn entries(&self) -> Vec { - self.load().rides.into_iter().map(|ride| self.entry(ride)).collect() - } - - pub fn view(&self, is_default: bool) -> IndexView { - let _guard = lock(); - IndexView { folder: self.root.display().to_string(), is_default, rides: self.entries() } - } - - /// Land one pulled ride durably. Idempotent on its `(serial, store_id, id)` key. - /// - /// It returns only after the ride object, the GPX and the index have each been fsynced. The - /// caller may ack after this resolves and at no earlier point. - pub fn import(&self, req: &ImportRequest) -> Result { - let _guard = lock(); - if req.serial.is_empty() { - return Err("this device reports no serial number, so a ride from it cannot be keyed".into()); - } - validate_store_id(&req.store_id)?; - if req.object_id == 0 { - return Err("objectId zero names no object".into()); - } - if req.object.is_empty() { - return Err("that ride object is empty".into()); - } - if req.object.len() > MAX_RIDE_BYTES { - return Err(format!("that ride object is {} bytes; the limit is {MAX_RIDE_BYTES}", req.object.len())); - } - if req.gpx.is_empty() { - return Err("that ride converted to an empty GPX".into()); - } - if req.gpx.len() > MAX_GPX_BYTES { - return Err(format!("that GPX is {} bytes; the limit is {MAX_GPX_BYTES}", req.gpx.len())); - } - if req.track.len() > MAX_TRACK_POINTS { - return Err(format!("a preview track carries at most {MAX_TRACK_POINTS} points")); - } - - std::fs::create_dir_all(&self.root).map_err(|e| format!("create {}: {e}", self.root.display()))?; - std::fs::create_dir_all(&self.archive).map_err(|e| format!("create {}: {e}", self.archive.display()))?; - let mut index = self.load(); - let key = ride_key(&req.serial, &req.store_id, req.object_id); - - // The idempotent path: everything is already here, so nothing is written or re-stamped. - if let Some(existing) = index.rides.iter().find(|r| r.key == key) { - let entry = self.entry(existing.clone()); - if entry.present && entry.gpx_present { - return Ok(Imported { ride: entry, imported: false }); - } - } - - let existing = index.rides.iter().position(|r| r.key == key); - let (ride_file, gpx_file, imported_at) = match existing { - // A repair: the record survived and a file did not. Keep the names and the original - // `imported_at`, because this is the same ride arriving again. - Some(at) => { - let r = &index.rides[at]; - (r.ride_file.clone(), r.gpx_file.clone(), r.imported_at) - } - None => { - let stem = unique_stem(&index, &self.root, &self.archive, &key, &stem_for(req))?; - (format!("{stem}.{RIDE_EXT}"), format!("{stem}.{GPX_EXT}"), now_secs()) - } - }; - - // Order is the contract: the lossless object, then the portable GPX, then the index that - // claims both. A crash at any point leaves an index that does not name this ride. - durable_write(&self.archive, &ride_file, &req.object, self.crash_at(CrashPoint::BeforeObjectFsync)) - .map_err(|e| format!("write {}: {e}", self.archive.join(&ride_file).display()))?; - durable_write(&self.root, &gpx_file, req.gpx.as_bytes(), CrashPoint::None) - .map_err(|e| format!("write {}: {e}", self.root.join(&gpx_file).display()))?; - - let ride = LibraryRide { - key: key.clone(), - serial: req.serial.clone(), - store_id: req.store_id.clone(), - object_id: req.object_id, - name: req.name.clone(), - start_time: req.start_time, - distance_m: req.distance_m, - moving_time_s: req.moving_time_s, - climb_m: req.climb_m, - points: req.points, - bytes: req.object.len() as u64, - crc32: req.crc32, - imported_at, - ride_file, - gpx_file, - track: req.track.clone(), - }; - - match existing { - Some(at) => index.rides[at] = ride.clone(), - None => index.rides.push(ride.clone()), - } - if self.crash == CrashPoint::BeforeIndexCommit { - return Err(format!("{CRASH_MSG} before the index committed")); - } - self.commit(&index)?; - Ok(Imported { ride: self.entry(ride), imported: existing.is_none() }) - } - - /// The stored ride object of one key, which is what a re-export reads. - pub fn read_object(&self, key: &str) -> Result, String> { - let _guard = lock(); - let ride = self.find(key)?; - std::fs::read(self.archive.join(&ride.ride_file)) - .map_err(|e| format!("read {}: {e}", self.archive.join(&ride.ride_file).display())) - } - - /// Write one ride's GPX durably into the visible folder: the repair for a GPX somebody deleted - /// or renamed. The archived object is the source, so it can always be run again. - pub fn write_gpx(&self, key: &str, gpx: &str) -> Result { - let _guard = lock(); - if gpx.is_empty() || gpx.len() > MAX_GPX_BYTES { - return Err(format!("a GPX of {} bytes is outside 1..={MAX_GPX_BYTES}", gpx.len())); - } - let ride = self.find(key)?; - std::fs::create_dir_all(&self.root).map_err(|e| format!("create {}: {e}", self.root.display()))?; - durable_write(&self.root, &ride.gpx_file, gpx.as_bytes(), CrashPoint::None) - .map_err(|e| format!("write {}: {e}", self.root.join(&ride.gpx_file).display()))?; - Ok(self.root.join(&ride.gpx_file).display().to_string()) - } - - fn find(&self, key: &str) -> Result { - self.load().rides.into_iter().find(|r| r.key == key).ok_or_else(|| format!("no ride {key} in this library")) - } - - /// Rewrite the index durably, through its own temp and rename, so a crash mid-write leaves the - /// previous index whole and loses only the last ride's record. - fn commit(&self, index: &Index) -> Result<(), String> { - let body = serde_json::to_vec_pretty(index).map_err(|e| format!("encode {INDEX_FILE}: {e}"))?; - durable_write(&self.archive, INDEX_FILE, &body, CrashPoint::None) - .map_err(|e| format!("write {}: {e}", self.archive.join(INDEX_FILE).display())) - } - - fn crash_at(&self, point: CrashPoint) -> CrashPoint { - if self.crash == point { - point - } else { - CrashPoint::None - } - } -} - -/// Read and parse an index file. `None` means missing or unreadable, and the caller decides what -/// that means. -fn read_index(path: &Path) -> Option { - let bytes = std::fs::read(path).ok()?; - match serde_json::from_slice::(&bytes) { - Ok(index) if index.version == INDEX_VERSION => Some(index), - Ok(_) => None, - Err(e) => { - eprintln!("ride library: {} is unreadable ({e}); treating it as empty", path.display()); - None - } - } -} - -/// Move one file into `dir/name` so that no point of interruption loses it: `rename` on the same -/// volume, otherwise copy, fsync, atomic rename into place, and only then unlink the source. The -/// copy path makes a cross-filesystem move as safe as a same-volume one. -fn move_file_durably(source: &Path, dir: &Path, name: &str) -> Result<(), String> { - if std::fs::rename(source, dir.join(name)).is_ok() { - return sync_dir(dir).map_err(|e| format!("sync {}: {e}", dir.display())); - } - let bytes = std::fs::read(source).map_err(|e| format!("read {}: {e}", source.display()))?; - durable_write(dir, name, &bytes, CrashPoint::None) - .map_err(|e| format!("write {}: {e}", dir.join(name).display()))?; - std::fs::remove_file(source).map_err(|e| format!("remove {}: {e}", source.display())) -} - -/// Shared with `lib/device/rides.ts`: full StoreId hex and decimal u64 ObjectId. -pub fn ride_key(serial: &str, store_id: &str, object_id: u64) -> String { - format!("{serial}:{store_id}:{object_id}") -} - -fn validate_store_id(value: &str) -> Result<(), String> { - if value.len() == 32 && value.bytes().all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b)) { - Ok(()) - } else { - Err("storeId must contain exactly 32 lowercase hexadecimal digits".into()) - } -} - -fn deserialize_store_id<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result { - let value = String::deserialize(deserializer)?; - validate_store_id(&value).map_err(serde::de::Error::custom)?; - Ok(value) -} - -fn serialize_object_id(value: &u64, serializer: S) -> Result { - serializer.collect_str(value) -} - -fn deserialize_object_id<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result { - let text = String::deserialize(deserializer)?; - let value = text.parse::().map_err(serde::de::Error::custom)?; - if value == 0 || text != value.to_string() { - return Err(serde::de::Error::custom("objectId must be a canonical nonzero decimal u64 string")); - } - Ok(value) -} - -/// Write `bytes` to `dir/name` so that a power cut cannot leave a half-file behind. -/// -/// Four steps, none of them optional. The write goes into a `.part` sibling, so the destination -/// keeps its previous contents for the whole write. `sync_all` puts the bytes and the inode on the -/// disk; on macOS Rust's std implements it as `F_FULLFSYNC`, which also flushes the drive's own -/// write cache, where plain `fsync` does not. The `rename` is atomic on every filesystem this app -/// runs on, so a reader sees the old file or the new one. The directory fsync makes that rename -/// durable; skipping it is the classic failure where the data survives and the name does not. -/// -/// A real IO failure cleans its `.part` up. A [`CrashPoint`] does not, because the point of -/// simulating a power cut is to leave the mess a power cut leaves. -fn durable_write(dir: &Path, name: &str, bytes: &[u8], crash: CrashPoint) -> io::Result<()> { - let tmp = dir.join(format!(".{name}.part")); - let result = write_and_sync(&tmp, bytes, crash); - if result.is_err() { - if crash == CrashPoint::None { - let _ = std::fs::remove_file(&tmp); - } - return result; - } - std::fs::rename(&tmp, dir.join(name))?; - sync_dir(dir) -} - -fn write_and_sync(tmp: &Path, bytes: &[u8], crash: CrashPoint) -> io::Result<()> { - let mut file = File::create(tmp)?; - file.write_all(bytes)?; - if crash != CrashPoint::None { - // The process dies here. The bytes are in the page cache, the rename never happened, and - // nothing above this line told anyone the ride was safe. - return Err(io::Error::new(io::ErrorKind::Interrupted, format!("{CRASH_MSG} before fsync"))); - } - file.sync_all() -} - -/// fsync the directory entry, so the rename itself survives a power cut. -/// -/// Unix opens the directory read-only and fsyncs the handle. Windows has no equivalent and does not -/// need one: `File::open` on a directory fails without `FILE_FLAG_BACKUP_SEMANTICS`, and NTFS -/// records a rename in its metadata log, which is committed before `MoveFileEx` returns, so the -/// file's own flush is the whole requirement there. -#[cfg(unix)] -fn sync_dir(dir: &Path) -> io::Result<()> { - File::open(dir)?.sync_all() -} - -#[cfg(not(unix))] -fn sync_dir(_dir: &Path) -> io::Result<()> { - Ok(()) -} - -/// `YYYY-MM-DD-some-ride-name`, or just the name when the device had no clock. -/// -/// The date leads because a folder sorts by name and rides are read in order. It is UTC, matching -/// the ride object's `start_time`: rendering it locally would file a late-evening ride under the -/// wrong day for anyone west of Greenwich. -fn stem_for(req: &ImportRequest) -> String { - let name = crate::paths::sanitize_basename(&req.name, "", "ride"); - let mut stem = match utc_date(req.start_time) { - Some(date) => format!("{date}-{name}"), - None => name, - }; - if stem.len() > MAX_STEM { - // On a char boundary: a stem is a filename, and half a UTF-8 sequence is not one. - let cut = (0..=MAX_STEM).rev().find(|&n| stem.is_char_boundary(n)).unwrap_or(0); - stem.truncate(cut); - } - stem.trim().trim_end_matches(['.', '-']).to_string() -} - -/// A stem unclaimed by the index or either folder, including files from an unreadable index. -fn unique_stem(index: &Index, root: &Path, archive: &Path, key: &str, base: &str) -> Result { - let taken = |candidate: &str| { - let ride_file = format!("{candidate}.{RIDE_EXT}"); - let gpx_file = format!("{candidate}.{GPX_EXT}"); - index.rides.iter().any(|r| r.ride_file == ride_file || r.gpx_file == gpx_file) - || archive.join(ride_file).exists() - || root.join(gpx_file).exists() - }; - let base = if base.is_empty() { "ride" } else { base }; - if !taken(base) { - return Ok(base.to_string()); - } - let with_id = format!("{base}-{}", key.rsplit(':').next().unwrap_or("0")); - if !taken(&with_id) { - return Ok(with_id); - } - (2..10_000) - .map(|n| format!("{with_id}-{n}")) - .find(|candidate| !taken(candidate)) - .ok_or_else(|| "no unused ride filename is available".into()) -} - -/// `YYYY-MM-DD` in UTC, or `None` for a device whose clock was never set. -/// -/// Civil-from-days arithmetic, because a date is fifteen lines and a date library is a dependency. -/// Valid for every timestamp a `u32` can hold. -fn utc_date(start_time: u32) -> Option { - if start_time == 0 { - return None; - } - let days = (start_time / 86_400) as i64; - let z = days + 719_468; - let era = z.div_euclid(146_097); - let doe = z.rem_euclid(146_097); - let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; - let y = yoe + era * 400; - let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - let mp = (5 * doy + 2) / 153; - let d = doy - (153 * mp + 2) / 5 + 1; - let m = if mp < 10 { mp + 3 } else { mp - 9 }; - let y = if m <= 2 { y + 1 } else { y }; - Some(format!("{y:04}-{m:02}-{d:02}")) -} - -fn now_secs() -> u64 { - SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0) -} - -#[derive(Serialize, Deserialize)] -struct Location { - dir: String, -} - -/// The folder the user relocated the library to, if they did. -/// -/// A folder that no longer exists is not replaced by the default: the app would then start a second -/// library on an unplugged external drive and report nothing missing. The caller surfaces it. -pub fn configured(config_dir: &Path) -> Option { - let bytes = std::fs::read(config_dir.join(LOCATION_FILE)).ok()?; - let location: Location = serde_json::from_slice(&bytes).ok()?; - let dir = PathBuf::from(location.dir); - (!dir.as_os_str().is_empty()).then_some(dir) -} - -/// Remember a relocated library. Durable, because forgetting where the rides went is its own kind -/// of data loss. -pub fn remember(config_dir: &Path, dir: &Path) -> Result<(), String> { - std::fs::create_dir_all(config_dir).map_err(|e| format!("create {}: {e}", config_dir.display()))?; - let body = serde_json::to_vec_pretty(&Location { dir: dir.display().to_string() }) - .map_err(|e| format!("encode {LOCATION_FILE}: {e}"))?; - durable_write(config_dir, LOCATION_FILE, &body, CrashPoint::None) - .map_err(|e| format!("write {}: {e}", config_dir.join(LOCATION_FILE).display())) -} - -/// Move the visible library, the GPX files, to a new folder. -/// -/// The internal archive stays in app data. Existing destination files are never replaced. -/// Cross-filesystem moves copy and flush before unlinking the source, and the caller updates the -/// configured location only after success. -pub fn relocate(from: &Path, to: &Path) -> Result<(), String> { - let _guard = lock(); - if from == to { - return Ok(()); - } - if to.starts_with(from) || from.starts_with(to) { - return Err("pick a folder that is not inside the current one".into()); - } - std::fs::create_dir_all(to).map_err(|e| format!("create {}: {e}", to.display()))?; - if !from.exists() { - return Ok(()); - } - - let entries = std::fs::read_dir(from).map_err(|e| format!("read {}: {e}", from.display()))?; - let mut names: Vec = entries - .flatten() - .filter(|entry| entry.path().is_file()) - .filter_map(|entry| entry.file_name().to_str().map(str::to_owned)) - .filter(|name| !name.starts_with('.') && Path::new(name).extension().is_some_and(|e| e == GPX_EXT)) - .collect(); - names.sort(); - - // Two passes: the first discovers a collision before anything has moved, and the second - // re-checks per file, because `rename` clobbers and std has no portable no-clobber rename. The - // re-check narrows the race to the one rename; a file another program drops into that window - // can still be lost. The library lock rules out this process racing itself. - for name in &names { - if to.join(name).exists() { - return Err(format!("{} already contains a file named {name} — pick another folder", to.display())); - } - } - for name in &names { - if to.join(name).exists() { - return Err(format!("{} now contains a file named {name} — nothing further was moved", to.display())); - } - move_file_durably(&from.join(name), to, name)?; - } - sync_dir(to).map_err(|e| format!("sync {}: {e}", to.display()))?; - let _ = sync_dir(from); - // Best effort: an empty folder left behind is untidy and a failed move is not. A folder that - // still holds the rider's other files stays. - let _ = std::fs::remove_dir(from); - Ok(()) -} - -#[cfg(test)] -mod tests { - /// The ack set, as a test helper: which rides are durably on this disk. It is a filter over - /// `view()`'s entries, and the tests below are about that property. - fn durable_ids(lib: &Library, serial: &str, store_id: u128) -> Vec { - let mut ids: Vec = lib - .view(false) - .rides - .into_iter() - .filter(|e| e.present && e.ride.serial == serial && e.ride.store_id == format!("{store_id:032x}")) - .map(|e| e.ride.object_id) - .collect(); - ids.sort_unstable(); - ids.dedup(); - ids - } - - use super::*; - - fn temp(tag: &str) -> PathBuf { - let dir = std::env::temp_dir().join(format!( - "obc-rides-{tag}-{}-{:?}", - std::process::id(), - std::time::SystemTime::now().duration_since(UNIX_EPOCH).unwrap().subsec_nanos() - )); - std::fs::create_dir_all(&dir).expect("temp dir"); - dir - } - - /// A library over a visible folder and an internal archive: the production shape, in a - /// sandbox. - fn library(base: &Path) -> Library { - Library::new(base.join("rides"), base.join("archive")) - } - - fn request(serial: &str, store_id: u128, id: u64, name: &str) -> ImportRequest { - ImportRequest { - serial: serial.into(), - store_id: format!("{store_id:032x}"), - object_id: id, - name: name.into(), - start_time: 1_764_547_200, // 2025-12-01 - distance_m: 42_195, - moving_time_s: 7_200, - climb_m: 640, - points: 4_211, - crc32: 0xdead_beef, - track: vec![[48.0, 7.85], [48.01, 7.86]], - object: format!("ride-object-{name}-{id}").into_bytes(), - gpx: format!("{name}"), - } - } - - fn file_names(dir: &Path) -> Vec { - let mut names: Vec = std::fs::read_dir(dir) - .map(|entries| entries.flatten().filter_map(|e| e.file_name().to_str().map(str::to_owned)).collect()) - .unwrap_or_default(); - names.sort(); - names - } - - #[test] - fn a_second_import_of_the_same_ride_writes_nothing_and_re_stamps_nothing() { - let base = temp("idem"); - let lib = library(&base); - let req = request("OBC-24-000317", 0xa1b2c3d4, 7, "Dawn Patrol"); - - let first = lib.import(&req).expect("first import"); - assert!(first.imported, "the first pull lands the ride"); - let stamp = first.ride.imported_at; - let archive = base.join("archive"); - let ride_mtime = std::fs::metadata(archive.join(&first.ride.ride_file)).unwrap().modified().unwrap(); - - let second = lib.import(&req).expect("second import"); - assert!(!second.imported, "the second pull is a no-op, not a duplicate"); - assert_eq!(second.ride.imported_at, stamp, "imported_at is first-import-wins, like synced_at"); - assert_eq!(second.ride.key, first.ride.key); - assert_eq!( - std::fs::metadata(archive.join(&first.ride.ride_file)).unwrap().modified().unwrap(), - ride_mtime, - "the ride file was not rewritten" - ); - assert_eq!(lib.load().rides.len(), 1, "one record, not two"); - assert_eq!(durable_ids(&lib, "OBC-24-000317", 0xa1b2c3d4), vec![7]); - - let _ = std::fs::remove_dir_all(&base); - } - - /// The visible folder holds GPX and nothing else; the archive holds the object and the - /// index. - #[test] - fn an_import_leaves_only_gpx_in_the_visible_folder() { - let base = temp("split"); - let lib = library(&base); - let landed = lib.import(&request("S", 1, 1, "Split")).expect("import"); - - assert_eq!(file_names(&base.join("rides")), vec![landed.ride.gpx_file.clone()]); - let mut archived = vec![INDEX_FILE.to_string(), landed.ride.ride_file.clone()]; - archived.sort(); - assert_eq!(file_names(&base.join("archive")), archived); - assert!(landed.ride.ride_path.starts_with(base.join("archive").to_str().unwrap())); - assert!(landed.ride.gpx_path.starts_with(base.join("rides").to_str().unwrap())); - - let _ = std::fs::remove_dir_all(&base); - } - - /// The power goes out between `write()` and `fsync()`. The real `import` runs, and what is - /// checked is what a restart then sees, because that is what the ack list is computed from. The - /// ride must be absent from it, so the device is never told and the next pull fetches it - /// again. - #[test] - fn a_crash_between_write_and_fsync_leaves_the_ride_unacked() { - let base = temp("crash"); - let good = request("OBC-24-000317", 7, 1, "Landed"); - let lost = request("OBC-24-000317", 7, 2, "Interrupted"); - - library(&base).import(&good).expect("the first ride lands"); - - let err = Library::crashing_at(base.join("rides"), base.join("archive"), CrashPoint::BeforeObjectFsync) - .import(&lost) - .expect_err("a crash before fsync must not report success"); - assert!(err.contains(CRASH_MSG), "unexpected failure: {err}"); - - // Restart: a new Library over the same folders, reading the index a relaunched app would - // read. - let restarted = library(&base); - assert_eq!( - durable_ids(&restarted, "OBC-24-000317", 7), - vec![1], - "only the fsynced ride is ackable; the interrupted one is not" - ); - assert!( - !base.join("archive").join(format!("2025-12-01-Interrupted.{RIDE_EXT}")).exists(), - "nothing was committed under the destination name" - ); - assert_eq!(restarted.load().rides.len(), 1, "the index never learned about the lost ride"); - - // The next pull, with the power on, lands it and only then makes it ackable. - library(&base).import(&lost).expect("the retry lands"); - assert_eq!(durable_ids(&library(&base), "OBC-24-000317", 7), vec![1, 2]); - - let _ = std::fs::remove_dir_all(&base); - } - - /// The other half of the ordering: the files are durable and the index never committed. The - /// ride is still not ackable, and the retry repairs the record without minting a second one. - #[test] - fn a_crash_before_the_index_commits_also_leaves_the_ride_unacked() { - let base = temp("crash-index"); - let req = request("OBC-24-000317", 7, 3, "Half landed"); - - Library::crashing_at(base.join("rides"), base.join("archive"), CrashPoint::BeforeIndexCommit) - .import(&req) - .expect_err("crash"); - let restarted = library(&base); - assert!(durable_ids(&restarted, "OBC-24-000317", 7).is_empty(), "an uncommitted index acks nothing"); - assert!(base.join("archive").join(format!("2025-12-01-Half landed.{RIDE_EXT}")).exists(), "the bytes did land"); - - let retry = restarted.import(&req).expect("the retry commits"); - assert!(retry.imported); - assert_eq!(restarted.load().rides.len(), 1, "the retry did not mint a second record"); - - let _ = std::fs::remove_dir_all(&base); - } - - /// Card identities that share their first 32 bits must keep recycled object ids distinct. - #[test] - fn a_card_change_with_a_recycled_id_keeps_both_rides() { - let base = temp("store_id"); - let lib = library(&base); - let serial = "OBC-24-000317"; - - let old = - lib.import(&request(serial, 0xa1b2c3d4_00000000_00000000_00000000, 1, "Old era ride")).expect("old era"); - let new = - lib.import(&request(serial, 0xa1b2c3d4_00000000_00000000_00000001, 1, "New era ride")).expect("new era"); - - assert!(old.imported && new.imported, "the recycled id is a different ride, not a duplicate"); - assert_ne!(old.ride.key, new.ride.key); - assert_ne!(old.ride.ride_file, new.ride.ride_file, "and it gets its own file"); - assert_eq!(lib.load().rides.len(), 2); - - // Each era acks only its own ids. The old era's record is archival: it names a ride the - // device no longer has, and nothing in the new era may claim it. - assert_eq!(durable_ids(&lib, serial, 0xa1b2c3d4_00000000_00000000_00000000), vec![1]); - assert_eq!(durable_ids(&lib, serial, 0xa1b2c3d4_00000000_00000000_00000001), vec![1]); - // A different device with the same id is a third ride again. - assert!(durable_ids(&lib, "OBC-24-000999", 0xa1b2c3d4_00000000_00000000_00000001).is_empty()); - - let _ = std::fs::remove_dir_all(&base); - } - - /// What the device is told matches what is on the disk, including after something deletes an - /// archive file, which `present` must notice. - #[test] - fn durable_ids_follow_the_filesystem_not_the_index() { - let base = temp("present"); - let lib = library(&base); - let serial = "OBC-24-000317"; - for id in [4u64, 5, 6] { - lib.import(&request(serial, 9, id, &format!("Ride {id}"))).expect("import"); - } - assert_eq!(durable_ids(&lib, serial, 9), vec![4, 5, 6]); - - let gone = lib.load().rides.iter().find(|r| r.object_id == 5).expect("ride 5").ride_file.clone(); - std::fs::remove_file(base.join("archive").join(&gone)).expect("delete the archive file"); - - assert_eq!(durable_ids(&lib, serial, 9), vec![4, 6], "a deleted ride is not durable and is not acked"); - let listed = lib.entries(); - assert_eq!(listed.len(), 3, "the record survives so the UI can say the file is missing"); - assert!(!listed.iter().find(|r| r.object_id == 5).unwrap().present); - - let _ = std::fs::remove_dir_all(&base); - } - - #[test] - fn a_missing_gpx_is_repaired_without_re_downloading_the_ride() { - let base = temp("regpx"); - let lib = library(&base); - let landed = lib.import(&request("S", 1, 8, "Export me")).expect("import"); - std::fs::remove_file(base.join("rides").join(&landed.ride.gpx_file)).expect("delete the gpx"); - assert!(!lib.entries()[0].gpx_present); - - let object = lib.read_object(&landed.ride.key).expect("the archive is still there"); - assert_eq!(object, request("S", 1, 8, "Export me").object); - lib.write_gpx(&landed.ride.key, "rebuilt").expect("re-export"); - assert!(lib.entries()[0].gpx_present); - assert_eq!( - std::fs::read_to_string(base.join("rides").join(&landed.ride.gpx_file)).unwrap(), - "rebuilt" - ); - - let _ = std::fs::remove_dir_all(&base); - } - - #[test] - fn a_corrupt_index_reads_as_empty_rather_than_as_nonsense() { - let base = temp("corrupt"); - let lib = library(&base); - lib.import(&request("S", 1, 1, "A ride")).expect("import"); - std::fs::write(base.join("archive").join(INDEX_FILE), b"{ this is not json").expect("corrupt it"); - - assert!(lib.load().rides.is_empty(), "an unreadable index is an empty library"); - assert!(durable_ids(&lib, "S", 1).is_empty(), "and acks nothing — the safe direction"); - // The files are still there, so the next pull re-imports over them. - assert!(lib.import(&request("S", 1, 1, "A ride")).expect("re-import").imported); - - let _ = std::fs::remove_dir_all(&base); - } - - #[test] - fn two_rides_that_want_the_same_filename_get_different_ones() { - let base = temp("stems"); - let lib = library(&base); - let a = lib.import(&request("S", 1, 11, "Commute")).expect("a"); - let b = lib.import(&request("S", 1, 12, "Commute")).expect("b"); - assert_ne!(a.ride.ride_file, b.ride.ride_file); - assert_eq!(a.ride.ride_file, format!("2025-12-01-Commute.{RIDE_EXT}")); - assert_eq!(b.ride.ride_file, format!("2025-12-01-Commute-12.{RIDE_EXT}")); - let _ = std::fs::remove_dir_all(&base); - } - - #[test] - fn a_ride_name_can_never_name_a_place() { - let req = request("S", 1, 1, "../../.ssh/authorized_keys"); - let stem = stem_for(&req); - assert!(!stem.contains('/') && !stem.contains('\\') && !stem.contains(".."), "{stem}"); - assert_eq!(stem, "2025-12-01-authorized_keys"); - assert_eq!(stem_for(&request("S", 1, 1, "")), "2025-12-01-ride"); - } - - #[test] - fn dates_are_utc_and_absent_when_the_device_had_no_clock() { - assert_eq!(utc_date(0), None); - assert_eq!(utc_date(1).as_deref(), Some("1970-01-01")); - assert_eq!(utc_date(1_764_547_200).as_deref(), Some("2025-12-01")); - assert_eq!(utc_date(1_767_225_599).as_deref(), Some("2025-12-31")); - assert_eq!(utc_date(1_767_225_600).as_deref(), Some("2026-01-01")); - // A leap day, and the last instant a u32 can hold. - assert_eq!(utc_date(1_709_164_800).as_deref(), Some("2024-02-29")); - assert_eq!(utc_date(u32::MAX).as_deref(), Some("2106-02-07")); - } - - #[test] - fn the_key_uses_full_store_hex_and_decimal_u64() { - let store = "a1b2c3d4000000000000000000000000"; - for id in [65536, 9007199254740993, u64::MAX] { - assert_eq!(ride_key("OBC-24-000317", store, id), format!("OBC-24-000317:{store}:{id}")); - } - assert_eq!(ride_key("a:b", store, 2), "a:b:a1b2c3d4000000000000000000000000:2"); - } - - fn json_request() -> serde_json::Value { - serde_json::json!({ - "serial": "OBC-24-000317", - "storeId": "a1b2c3d4000000000000000000000000", - "objectId": "65536", - "name": "Same name", - "startTime": 1764547200_u32, - "distanceM": 42195, - "movingTimeS": 7200, - "climbM": 640, - "points": 1, - "crc32": 0, - "track": [], - "object": [1, 2, 3], - "gpx": "" - }) - } - - #[test] - fn json_identity_survives_import_reload_and_duplicate_detection() { - let base = temp("full-identity"); - for store in ["a1b2c3d4000000000000000000000000", "a1b2c3d4000000000000000000000001"] { - for id in ["65536", "9007199254740993", "18446744073709551615"] { - let mut json = json_request(); - json["storeId"] = store.into(); - json["objectId"] = id.into(); - let req: ImportRequest = serde_json::from_value(json).expect("JSON request"); - let landed = library(&base).import(&req).expect("import"); - assert!(landed.imported); - assert_eq!(landed.ride.key, format!("OBC-24-000317:{store}:{id}")); - let reply = serde_json::to_value(&landed).expect("JSON response"); - assert_eq!(reply["ride"]["storeId"], store); - assert_eq!(reply["ride"]["objectId"], id); - assert!(!library(&base).import(&req).expect("reload and repeat").imported); - } - } - let rides = library(&base).view(false).rides; - assert_eq!(rides.len(), 6); - assert!(rides.iter().all(|r| r.present && r.gpx_present)); - let _ = std::fs::remove_dir_all(base); - } - - #[test] - fn malformed_json_identity_is_refused_before_file_creation() { - let base = temp("invalid-identity"); - for field in ["storeId", "objectId"] { - let invalid = if field == "storeId" { - vec![ - serde_json::json!(7), - serde_json::json!(null), - "".into(), - "a1b2c3d4".into(), - "A1B2C3D4000000000000000000000000".into(), - "g1b2c3d4000000000000000000000000".into(), - ] - } else { - vec![ - serde_json::json!(65536), - serde_json::json!(null), - "".into(), - "0".into(), - "-1".into(), - "+1".into(), - "01".into(), - "1.0".into(), - "1e3".into(), - "18446744073709551616".into(), - ] - }; - for value in invalid { - let mut json = json_request(); - json[field] = value; - assert!(serde_json::from_value::(json).is_err(), "invalid {field}"); - } - } - let mut req = request("S", 1, 1, "Bad card"); - req.store_id = "invalid".into(); - assert!(library(&base).import(&req).is_err()); - assert!(file_names(&base).is_empty()); - let _ = std::fs::remove_dir_all(base); - } - - #[test] - fn an_old_index_never_overwrites_archived_objects_or_gpx() { - let base = temp("old-index"); - let req = request("S", 1, 1, "Same name"); - let old = library(&base).import(&req).unwrap(); - let object_path = PathBuf::from(&old.ride.ride_path); - let gpx_path = PathBuf::from(&old.ride.gpx_path); - let mut index: serde_json::Value = - serde_json::from_slice(&std::fs::read(base.join("archive").join(INDEX_FILE)).unwrap()).unwrap(); - index["version"] = 1.into(); - index["rides"][0].as_object_mut().unwrap().remove("storeId"); - index["rides"][0]["epoch"] = 1.into(); - index["rides"][0]["objectId"] = 1.into(); - std::fs::write(base.join("archive").join(INDEX_FILE), serde_json::to_vec(&index).unwrap()).unwrap(); - assert!(library(&base).view(false).rides.is_empty()); - let mut new_req = req.clone(); - new_req.object = b"different ride".to_vec(); - new_req.gpx = "different ride".into(); - let new = library(&base).import(&new_req).unwrap(); - assert!(new.imported); - assert_ne!(new.ride.ride_path, old.ride.ride_path); - assert_ne!(new.ride.gpx_path, old.ride.gpx_path); - assert_eq!(std::fs::read(object_path).unwrap(), req.object); - assert_eq!(std::fs::read_to_string(gpx_path).unwrap(), req.gpx); - let _ = std::fs::remove_dir_all(base); - } - - #[test] - fn oversized_and_empty_imports_are_refused_before_anything_is_written() { - let base = temp("limits"); - let lib = library(&base); - let mut req = request("S", 1, 1, "Huge"); - req.object = vec![0; MAX_RIDE_BYTES + 1]; - assert!(lib.import(&req).is_err()); - let mut req = request("S", 1, 1, "Empty"); - req.object.clear(); - assert!(lib.import(&req).is_err()); - let mut req = request("", 1, 1, "No serial"); - req.serial.clear(); - assert!(lib.import(&req).is_err(), "a device with no serial cannot key a ride"); - assert!(lib.load().rides.is_empty(), "nothing was written"); - let _ = std::fs::remove_dir_all(&base); - } - - /// `present` is not bare existence: a truncated archive file must read as not durable, drop out - /// of the ack list, and be repaired by the next pull. - #[test] - fn a_truncated_archive_is_not_durable_and_is_repaired() { - let base = temp("truncated"); - let lib = library(&base); - let landed = lib.import(&request("S", 1, 4, "Torn")).expect("import"); - assert_eq!(durable_ids(&lib, "S", 1), vec![4]); - - let path = base.join("archive").join(&landed.ride.ride_file); - let whole = std::fs::read(&path).expect("read"); - std::fs::write(&path, &whole[..whole.len() / 2]).expect("truncate"); - - assert!(durable_ids(&lib, "S", 1).is_empty(), "a torn file acks nothing"); - assert!(!lib.entries()[0].present, "…and the UI sees it as missing"); - - let repaired = lib.import(&request("S", 1, 4, "Torn")).expect("the next pull repairs it"); - assert!(!repaired.imported, "the same ride arriving again, not a new one"); - assert_eq!(durable_ids(&lib, "S", 1), vec![4]); - assert_eq!(std::fs::read(&path).expect("whole again"), whole); - - let _ = std::fs::remove_dir_all(&base); - } - - // Relocation. - - #[test] - fn relocating_moves_the_gpx_files_and_only_them() { - let base = temp("move"); - let from = base.join("old"); - let to = base.join("new"); - - let lib = Library::new(from.clone(), base.join("archive")); - let landed = lib.import(&request("S", 1, 1, "Travelling")).expect("import"); - - assert!(relocate(&from, &from.join("inside")).is_err(), "a move into itself is not a move"); - - relocate(&from, &to).expect("relocate"); - let moved = Library::new(to.clone(), base.join("archive")); - assert_eq!(durable_ids(&moved, "S", 1), vec![1], "the archive did not move, so nothing was lost"); - assert!(to.join(&landed.ride.gpx_file).is_file()); - assert!(moved.entries()[0].gpx_present); - assert!(!from.exists(), "the old folder is gone once it is empty"); - - // Moving into a folder the app has never used works, and a second relocate from an already - // moved source is a no-op rather than an error. - relocate(&from, &base.join("third")).expect("nothing to move"); - - let _ = std::fs::remove_dir_all(&base); - } - - #[test] - fn relocating_refuses_to_overwrite_a_same_named_file() { - let base = temp("move-collide"); - let from = base.join("old"); - let to = base.join("new"); - let lib = Library::new(from.clone(), base.join("archive")); - let landed = lib.import(&request("S", 1, 1, "Collides")).expect("import"); - std::fs::create_dir_all(&to).expect("to"); - std::fs::write(to.join(&landed.ride.gpx_file), b"someone else's file").expect("occupy"); - - assert!(relocate(&from, &to).is_err(), "an existing file is never overwritten"); - assert!(from.join(&landed.ride.gpx_file).is_file(), "and the source did not move"); - - let _ = std::fs::remove_dir_all(&base); - } - - #[test] - fn the_configured_location_survives_a_restart() { - let base = temp("location"); - let config = base.join("config"); - assert_eq!(configured(&config), None); - remember(&config, &base.join("rides")).expect("remember"); - assert_eq!(configured(&config), Some(base.join("rides"))); - let _ = std::fs::remove_dir_all(&base); - } -} diff --git a/builder/desktop/src/usb/mod.rs b/builder/desktop/src/usb/mod.rs deleted file mode 100644 index b587f7a166..0000000000 --- a/builder/desktop/src/usb/mod.rs +++ /dev/null @@ -1,252 +0,0 @@ -//! Native USB: `nusb` under the shared byte-pipe seam. -//! -//! Tauri's webview has no WebUSB, so the desktop app drives USB itself. This is the only universal -//! USB path, and it is what a Safari or Firefox user installs the app for. -//! -//! The protocol is not reimplemented here. The object model, the descriptor codecs, the -//! whole-object CRC and the client live once, in TypeScript, over a pluggable `BytePipe`, so a -//! second host drops a transport underneath them instead of growing a parallel implementation that -//! drifts from a byte-exact wire contract. This module moves bytes and nothing else: every `0x` in -//! the non-test code is USB's own vocabulary, a vendor id, a product id, an interface class or an -//! endpoint-address direction bit. -//! -//! The control plane carries the protocol's control records and the stream plane carries its stream -//! records, both over IPC. -//! -//! There is no path that streams a file straight from disk into the endpoint. A record stream is -//! framed, and a raw byte streamer cannot produce one without a second implementation of the wire -//! contract. If a measurement ever says the IPC boundary is the bottleneck, the honest shape is a -//! Rust-side record sender that shares the codec. -//! -//! Both IPC directions carry raw binary and not JSON: a command result is [`tauri::ipc::Response`] -//! and a write arrives as [`tauri::ipc::InvokeBody::Raw`] with its handle and plane in headers. A -//! `Vec` argument would be serialised as a JSON array of numbers, about four bytes of text per -//! byte of payload. -//! -//! The window has no filesystem capability. A file the rider picks arrives through the webview as a -//! `File` with no path at all, exactly as it does on the web. - -pub mod runtime_guard; -pub mod watch; - -use std::collections::HashMap; -use std::sync::atomic::{AtomicU32, Ordering}; -use std::sync::{Arc, Mutex}; - -use tauri::ipc::{Channel, InvokeBody, Request, Response}; -use tauri::State; - -use obc_usb::{Dir, OpenLink, OpenedLink, PipeFault, Plane}; -use watch::{DeviceSummary, UsbEvent}; - -pub use obc_usb::{PRODUCT_ID, VENDOR_ID}; - -/// Every device this app has open, plus the one hot-plug watch behind them. -#[derive(Default)] -pub struct UsbState { - links: Mutex>>, - next_handle: AtomicU32, - /// Where the watch task sends events. Replaceable, so a window that reloaded re-points the - /// existing watch at its new channel instead of starting a second one. - sink: Mutex>>, - watching: Mutex, -} - -impl UsbState { - fn link(&self, handle: u32) -> Result, PipeFault> { - self.links - .lock() - .expect("usb links") - .get(&handle) - .cloned() - .ok_or_else(|| PipeFault::closed("The device link is closed.")) - } - - /// Fail and forget every link on a device that has gone away. - fn disconnected(&self, device_id: &str) { - let mut links = self.links.lock().expect("usb links"); - links.retain(|_, link| { - if link.device_id == device_id { - link.cancel_all(); - false - } else { - true - } - }); - } - - fn drop_all(&self) { - for (_, link) in self.links.lock().expect("usb links").drain() { - link.cancel_all(); - } - } -} - -/// Start or re-point the hot-plug watch and report what is attached now. -/// -/// It answers the matching devices after the watch is live, which is the order that cannot miss a -/// device plugged in during the call. -/// -/// Any link left over from a previous page load is dropped first. A reloaded window has no handles -/// but the backend still holds the interface claim, and a stale claim is what makes the next -/// `usb_open` fail as busy. -#[tauri::command] -pub async fn usb_watch( - state: State<'_, Arc>, - on_event: Channel, -) -> Result, String> { - let state = Arc::clone(&state); - state.drop_all(); - *state.sink.lock().expect("usb sink") = Some(on_event); - - { - let mut watching = state.watching.lock().expect("usb watching"); - if !*watching { - *watching = true; - let for_events = Arc::clone(&state); - let for_disconnect = Arc::clone(&state); - // One long-lived watch serves a window that reloads, because the task resolves the - // sink per event rather than capturing the channel it was born with. - watch::spawn( - Arc::new(move |event: UsbEvent| { - if let Some(channel) = for_events.sink.lock().expect("usb sink").as_ref() { - let _ = channel.send(event); - } - }), - Arc::new(move |device_id: &str| for_disconnect.disconnected(device_id)), - ); - } - } - - watch::list().await -} - -/// The matching devices attached right now, without touching the watch. A native host has no -/// chooser, so asking for a device is looking again. -#[tauri::command] -pub async fn usb_list() -> Result, String> { - watch::list().await -} - -/// Open, configure and claim a device; hand back a handle and the two pipes' packet sizes. -#[tauri::command] -pub async fn usb_open(state: State<'_, Arc>, device_id: String) -> Result { - let devices = - nusb::list_devices().await.map_err(|e| PipeFault::device(format!("USB devices could not be listed: {e}")))?; - let info = devices - .filter(watch::matches) - .find(|info| watch::device_key(info.id()) == device_id) - .ok_or_else(|| PipeFault::closed("That device is no longer attached."))?; - - let (link, mut opened) = obc_usb::open(&info, device_id).await?; - let handle = state.next_handle.fetch_add(1, Ordering::Relaxed) + 1; - opened.handle = handle; - state.links.lock().expect("usb links").insert(handle, link); - Ok(opened) -} - -/// Release a link. Idempotent; everything parked on it settles first. -#[tauri::command] -pub fn usb_close(state: State<'_, Arc>, handle: u32) { - let link = state.links.lock().expect("usb links").remove(&handle); - // The cancel lets a pending read return instead of holding the interface claim until the - // device says something. The claim drops with the last `Arc`, which the cancelled transfers - // hold. - if let Some(link) = link { - link.cancel_all(); - } -} - -/// One transfer's worth of bytes off a plane's IN endpoint. -/// -/// A read is not a message on the bulk plane: it hands back whatever the transport delivered, and -/// the client accumulates to the length its descriptor announced. -#[tauri::command] -pub async fn usb_read(state: State<'_, Arc>, handle: u32, plane: Plane) -> Result { - let link = state.link(handle)?; - let bytes = link.plane(plane).read().await?; - // `Response` is the raw path: the frontend gets an ArrayBuffer, not a JSON array of numbers. - Ok(Response::new(bytes)) -} - -/// Write one transfer to a plane's OUT endpoint. -/// -/// It takes the raw invoke body rather than a `Vec` argument. `handle` and `plane` ride in -/// headers, because a raw body is the whole payload. -#[tauri::command] -pub async fn usb_write(state: State<'_, Arc>, request: Request<'_>) -> Result<(), PipeFault> { - let header = |name: &str| { - request - .headers() - .get(name) - .and_then(|v| v.to_str().ok()) - .ok_or_else(|| PipeFault::device(format!("a usb_write is missing its `{name}` header."))) - }; - let handle: u32 = - header("handle")?.parse().map_err(|_| PipeFault::device("a usb_write carried an unreadable handle."))?; - let plane = match header("plane")? { - "control" => Plane::Control, - "bulk" => Plane::Bulk, - other => return Err(PipeFault::device(format!("a usb_write named an unknown plane `{other}`."))), - }; - let InvokeBody::Raw(bytes) = request.body() else { - return Err(PipeFault::device("a usb_write must carry its bytes as a raw body.")); - }; - let link = state.link(handle)?; - link.plane(plane).write(bytes).await -} - -/// Cancel whatever is parked on one direction of a plane, so the caller's `AbortSignal` reaches the -/// transport rather than only releasing the JavaScript promise. -#[tauri::command] -pub fn usb_cancel(state: State<'_, Arc>, handle: u32, plane: Plane, dir: Option) { - if let Ok(link) = state.link(handle) { - link.plane(plane).cancel(dir); - } -} - -/// Return a plane to a known-empty state. -#[tauri::command] -pub async fn usb_reset(state: State<'_, Arc>, handle: u32, plane: Plane) -> Result<(), PipeFault> { - state.link(handle)?.plane(plane).reset().await -} - -#[cfg(test)] -mod tests { - /// The policy without a Tauri app handle: the same canonicalise-then-prefix rule, over a real - /// temp tree so the symlink case is real. - fn allowed(root: &std::path::Path, candidate: &std::path::Path) -> bool { - let (Ok(root), Ok(candidate)) = (std::fs::canonicalize(root), std::fs::canonicalize(candidate)) else { - return false; - }; - candidate.is_file() && candidate.starts_with(&root) - } - - #[test] - fn only_files_inside_an_app_owned_root_are_sendable() { - let base = std::env::temp_dir().join(format!("obc-usb-policy-{}", std::process::id())); - let root = base.join("maps"); - let outside = base.join("elsewhere"); - std::fs::create_dir_all(&root).expect("root"); - std::fs::create_dir_all(&outside).expect("outside"); - std::fs::write(root.join("ok.obcm"), b"x").expect("write"); - std::fs::write(outside.join("secret"), b"x").expect("write"); - - assert!(allowed(&root, &root.join("ok.obcm"))); - assert!(!allowed(&root, &outside.join("secret"))); - // The traversal a prefix check alone would admit, and canonicalising does not. - assert!(!allowed(&root, &root.join("../elsewhere/secret"))); - // A directory is not a file. - assert!(!allowed(&root, &root)); - - #[cfg(unix)] - { - // Why both sides are canonicalised: a symlink inside the root that points out of it - // resolves to its target, and the target fails the prefix check. - let link = root.join("escape"); - std::os::unix::fs::symlink(outside.join("secret"), &link).expect("symlink"); - assert!(!allowed(&root, &link)); - } - let _ = std::fs::remove_dir_all(&base); - } -} diff --git a/builder/desktop/src/usb/runtime_guard.rs b/builder/desktop/src/usb/runtime_guard.rs deleted file mode 100644 index 5b86155c3a..0000000000 --- a/builder/desktop/src/usb/runtime_guard.rs +++ /dev/null @@ -1,51 +0,0 @@ -//! A test that the cargo feature which makes `nusb` usable from an async context is still on. -//! -//! `nusb` returns [`MaybeFuture`](nusb::MaybeFuture) rather than a plain future, so the same call -//! serves a blocking caller and an async one. The async arm needs somewhere to put the blocking -//! syscall, and which executor that is comes from the `smol` or `tokio` cargo feature. With neither -//! enabled, `BlockingTask::spawn` panics. That is not a compile error: the crate builds, clippy is -//! happy, and every `.await` on a `nusb` future panics the first time a real device is touched. -//! -//! What enforces it: Windows builds `list_devices()` from a blocking arm, so awaiting it reaches -//! the panic with no device attached, and the Windows CI leg fails if the feature is dropped. Linux -//! and macOS build the same call from a ready arm, so only the second half of this module covers -//! them, and that half runs only where a device is plugged in. - -#[cfg(test)] -mod tests { - /// Await a `nusb` `MaybeFuture` and require it not to panic. - /// - /// `list_devices()` is the only entry point that needs no hardware, so it is the one a CI - /// machine can run. The assertion is about reaching the result and not about its contents: a - /// machine with no USB devices is a legitimate pass. - #[tokio::test] - async fn awaiting_nusb_does_not_panic() { - let devices = nusb::list_devices().await.expect("the USB bus should be enumerable"); - // Draining it proves this is a real iterator and not an unpolled future. - let count = devices.count(); - println!("nusb enumerated {count} device(s)"); - } - - /// The half that covers macOS and Linux, on any machine with the device plugged in. - /// - /// Opening is blocking on all three platforms, so this reaches the panicking arm everywhere. It - /// skips loudly when the device is absent, because a silent skip would read as coverage that - /// does not exist. - #[tokio::test] - async fn opening_the_device_does_not_panic() { - let Some(info) = nusb::list_devices() - .await - .expect("the USB bus should be enumerable") - .find(|d| d.vendor_id() == super::super::VENDOR_ID && d.product_id() == super::super::PRODUCT_ID) - else { - println!("no OpenBikeComputer attached — skipping (this half needs hardware)"); - return; - }; - // The failure this guards is a panic, not an `Err`. A device held open by the app is an - // ordinary `Err` and must not fail the test. - match info.open().await { - Ok(_) => println!("opened the device"), - Err(e) => println!("device present but not openable ({e}) — the await itself is what mattered"), - } - } -} diff --git a/builder/desktop/src/usb/watch.rs b/builder/desktop/src/usb/watch.rs deleted file mode 100644 index 902d4dcc7c..0000000000 --- a/builder/desktop/src/usb/watch.rs +++ /dev/null @@ -1,130 +0,0 @@ -//! Discovery and hot-plug: what makes plugging a cable in light the window up. -//! -//! Plugging in must light up the UI within about a second, and unplugging must not leave a stuck -//! spinner. The browser gets that from `navigator.usb`'s events; here it comes from the OS -//! notification streams nusb wraps, which are edge-driven rather than polled, so the latency budget -//! is spent on the device side. -//! -//! A native host has no chooser and no permission prompt, so it sees the device the moment it -//! appears. The session shape stays the same as the browser's anyway: `requestDevice()` here is -//! looking again, so the same button keeps working and no UI branches on the transport. - -use std::sync::Arc; - -use futures_core::Stream; -use nusb::hotplug::HotplugEvent; -use nusb::DeviceInfo; -use serde::Serialize; - -use super::{PRODUCT_ID, VENDOR_ID}; - -/// A device the app is willing to talk to, as the frontend sees it. -#[derive(Debug, Clone, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct DeviceSummary { - /// Opaque and stable for as long as the device stays plugged in: the key `usb_open` takes and - /// the key a `disconnected` event carries. Never parsed by the frontend. - pub id: String, - pub vendor_id: u16, - pub product_id: u16, - pub product: Option, - /// The nRF `FICR.DEVICEID`, which is what tells two boards apart. - pub serial_number: Option, -} - -/// What the watch task tells the frontend. -#[derive(Debug, Clone, Serialize)] -#[serde(rename_all = "camelCase", tag = "type")] -pub enum UsbEvent { - Connected { - device: DeviceSummary, - }, - Disconnected { - id: String, - }, - /// The OS notification stream ended or could not be started. Reported rather than swallowed: a - /// watch that died silently looks like nothing ever being plugged in. - WatchFailed { - message: String, - }, -} - -/// The frontend's handle on a device, stable for the life of the connection. -/// -/// `DeviceId` is opaque and platform-specific in shape, so it is stringified rather than -/// interpreted. The only property anything depends on is that one physical connection produces the -/// same string in a `connected` event, in `usb_list` and in the matching `disconnected`. -pub fn device_key(id: nusb::DeviceId) -> String { - format!("{id:?}") -} - -/// Is this one of ours? -/// -/// The pair is pid.codes' prototype and testing range, and the firmware declares the same one. -/// Allocating a real product id moves this constant, the firmware's `PRODUCT_ID` and the web -/// filters together. -pub fn matches(info: &DeviceInfo) -> bool { - info.vendor_id() == VENDOR_ID && info.product_id() == PRODUCT_ID -} - -pub fn summarize(info: &DeviceInfo) -> DeviceSummary { - DeviceSummary { - id: device_key(info.id()), - vendor_id: info.vendor_id(), - product_id: info.product_id(), - product: info.product_string().map(str::to_owned), - serial_number: info.serial_number().map(str::to_owned), - } -} - -/// Every matching device attached right now. -pub async fn list() -> Result, String> { - let devices = nusb::list_devices().await.map_err(|e| format!("USB devices could not be listed: {e}"))?; - Ok(devices.filter(matches).map(|info| summarize(&info)).collect()) -} - -/// What the watch task hands its events to. -/// -/// A closure rather than a [`Channel`], because the channel is replaceable: a window that reloads -/// opens a new one, and the watch outlives the page. -pub type Emit = Arc; - -/// Follow hot-plug forever. -/// -/// `on_disconnect` runs before the event reaches the frontend, and that ordering matters: it is -/// where the pipes of a link on the vanished device are failed, so an in-flight transfer's UI says -/// unplugged now instead of spinning until a timeout. -pub fn spawn(emit: Emit, on_disconnect: Arc) { - // Created before the caller lists devices: a device attached in the window between listing - // and watching would otherwise be missed. - let mut watch = match nusb::watch_devices() { - Ok(watch) => watch, - Err(e) => { - emit(UsbEvent::WatchFailed { message: format!("USB hot-plug is unavailable: {e}") }); - return; - } - }; - tauri::async_runtime::spawn(async move { - loop { - let event = std::future::poll_fn(|cx| std::pin::Pin::new(&mut watch).poll_next(cx)).await; - let Some(event) = event else { - emit(UsbEvent::WatchFailed { message: "The system stopped reporting USB device changes.".into() }); - return; - }; - match event { - HotplugEvent::Connected(info) if matches(&info) => { - emit(UsbEvent::Connected { device: summarize(&info) }); - } - HotplugEvent::Connected(_) => {} - HotplugEvent::Disconnected(id) => { - // Not filtered by vendor and product id: a disconnect carries only an id, and - // an id with no link is a no-op on both sides. Filtering here would mean - // keeping a device table only to discard events that are already ignored. - let key = device_key(id); - on_disconnect(&key); - emit(UsbEvent::Disconnected { id: key }); - } - } - } - }); -} diff --git a/builder/desktop/tauri.conf.json b/builder/desktop/tauri.conf.json deleted file mode 100644 index be82ac6bc2..0000000000 --- a/builder/desktop/tauri.conf.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$schema": "https://schema.tauri.app/config/2", - "productName": "OpenBikeComputer", - "version": "0.1.0", - "identifier": "de.timohueser.openbikecomputer", - "build": { - "frontendDist": "../web/dist/desktop", - "devUrl": "http://localhost:5173", - "beforeDevCommand": "npm --prefix ../web run dev -- --mode desktop", - "beforeBuildCommand": "npm --prefix ../web run build:desktop" - }, - "app": { - "windows": [ - { - "label": "main", - "title": "OpenBikeComputer", - "width": 1360, - "height": 900, - "minWidth": 900, - "minHeight": 620, - "dragDropEnabled": false - } - ], - "security": { - "csp": "default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self' ipc: http://ipc.localhost https://tiles.openbikecomputer.com https://maps.openbikecomputer.com" - } - }, - "bundle": { - "active": true, - "targets": "all", - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.ico", - "icons/icon.icns", - "icons/icon.png" - ] - } -} diff --git a/builder/server/schema_preview.py b/builder/server/schema_preview.py index 825e3a2ccf..b33ffbcf76 100644 --- a/builder/server/schema_preview.py +++ b/builder/server/schema_preview.py @@ -1,6 +1,6 @@ """Bounded native packing for the localhost maintainer schema lab. -The product web and desktop hosts never import or expose this module. The +The product web host never imports or exposes this module. The FastAPI maintainer host accepts only a JSON config; the source, binary, crop, command line, output path and resource bounds all remain server-owned. """ diff --git a/builder/usb/Cargo.toml b/builder/usb/Cargo.toml index 4a7192d255..4e4c9528b5 100644 --- a/builder/usb/Cargo.toml +++ b/builder/usb/Cargo.toml @@ -3,13 +3,12 @@ name = "obc-usb" version = "0.1.0" edition = "2021" publish = false -description = "Shared native USB byte transport and maintenance CLI for OpenBikeComputer" +description = "Native USB byte transport and card-format CLI for OpenBikeComputer" [dependencies] getrandom = { workspace = true } nusb = { version = "=0.2.5", features = ["tokio"] } obc-link = { workspace = true, features = ["client"] } -serde = { workspace = true, features = ["derive"] } tokio = { workspace = true, features = ["macros", "rt-multi-thread", "sync", "time"] } [dev-dependencies] diff --git a/builder/usb/README.md b/builder/usb/README.md new file mode 100644 index 0000000000..711818ec0e --- /dev/null +++ b/builder/usb/README.md @@ -0,0 +1,24 @@ +# obc-usb + +The native USB byte transport and the flat-store client over it, for a computer that talks to the +device over the cable. Its one program is `obc-format-card`, which `obc format-card` runs. + +## Linux USB permission + +macOS and Windows need no setup. On Linux, the USB device node belongs to root, so a program +cannot open the device until a udev rule gives the person at the machine access. Chrome and Edge +need the same rule for WebUSB. + +```sh +sudo cp builder/usb/linux/99-openbikecomputer.rules /etc/udev/rules.d/ +sudo udevadm control --reload-rules +sudo udevadm trigger +# unplug and reconnect the device +``` + +## Test + +```sh +obc test -p obc-usb +obc exec cargo clippy -p obc-usb --all-targets -- -D warnings +``` diff --git a/builder/desktop/linux/99-openbikecomputer.rules b/builder/usb/linux/99-openbikecomputer.rules similarity index 79% rename from builder/desktop/linux/99-openbikecomputer.rules rename to builder/usb/linux/99-openbikecomputer.rules index d46b583c73..e3142011cd 100644 --- a/builder/desktop/linux/99-openbikecomputer.rules +++ b/builder/usb/linux/99-openbikecomputer.rules @@ -1,16 +1,17 @@ -# OpenBikeComputer — let a logged-in desktop session open the device (#909). +# OpenBikeComputer — let the person at the machine open the device over USB, +# from Chrome or Edge (WebUSB) or from `obc format-card`. # # Linux is the only platform that needs anything. The device declares a -# vendor-specific interface (class 0xFF, #889), and: +# vendor-specific interface (class 0xFF), and: # # * macOS lets an application open one with no driver, no entitlement and no # kext — IOKit hands it over as long as nothing else has claimed it. # * Windows binds WinUSB automatically from the MS OS 2.0 BOS descriptors the # firmware ships, so there is no .inf, no Zadig and no driver install. # * Linux exposes it through usbfs at /dev/bus/usb/BBB/DDD, which is -# root-owned by default. Without a rule the app can enumerate the device and -# then fail to open it, which reads as "Permission denied" and looks like a -# bug in the app. +# root-owned by default. Without a rule a program can enumerate the device +# and then fail to open it, which reads as "Permission denied" and looks like +# a bug in the program. # # TAG+="uaccess" is the modern answer: systemd-logind grants the *currently # active local session* an ACL on the node, so the person sitting at the machine diff --git a/builder/usb/src/client/usb.rs b/builder/usb/src/client/usb.rs index 5115d87d2b..5d1bdd9a5f 100644 --- a/builder/usb/src/client/usb.rs +++ b/builder/usb/src/client/usb.rs @@ -158,7 +158,7 @@ pub(super) struct UsbTransport { impl UsbTransport { pub(super) async fn open(info: &nusb::DeviceInfo) -> Result { - let (link, _) = crate::open(info, format!("{:?}", info.id())).await?; + let link = crate::open(info).await?; let readers = Readers::start(&link); Ok(Self { link: Some(link), readers: Some(readers), serial: info.serial_number().map(str::to_owned) }) } @@ -249,7 +249,7 @@ impl Transport for UsbTransport { if devices.next().is_some() { return Err(PipeFault::device("More than one device has the saved serial number.")); } - if let Ok((link, _)) = crate::open(&info, format!("{:?}", info.id())).await { + if let Ok(link) = crate::open(&info).await { self.readers = Some(Readers::start(&link)); self.link = Some(link); return Ok(()); diff --git a/builder/usb/src/lib.rs b/builder/usb/src/lib.rs index 5a2d0bd901..5622715748 100644 --- a/builder/usb/src/lib.rs +++ b/builder/usb/src/lib.rs @@ -1,8 +1,8 @@ //! One claimed device: endpoint discovery, and the two byte pipes over it. //! //! Everything here moves **bytes**. Nothing in this file knows what a transfer descriptor is, what -//! a status envelope means, or which object an upload belongs to. The desktop app and maintenance -//! CLI share this transport; their protocol clients sit above it. +//! a status envelope means, or which object an upload belongs to. The protocol client in `client` +//! sits above it. pub mod client; @@ -10,7 +10,6 @@ use std::sync::Arc; use nusb::transfer::{Buffer, Bulk, Completion, In, Out, TransferError}; use nusb::{Device, DeviceInfo, Endpoint, Interface}; -use serde::{Deserialize, Serialize}; use tokio::sync::{watch, Mutex}; /// pid.codes' prototype/testing pair, shared with the board descriptors and WebUSB filter. @@ -35,8 +34,7 @@ const USB_BINDING_MAJOR: u8 = 5; const BULK_READ_TARGET: usize = 16 * 1024; /// Which of the two planes a call means. The names match `lib/usb/pipe.ts`'s `DeviceLink`. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] -#[serde(rename_all = "lowercase")] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Plane { Control, Bulk, @@ -44,8 +42,7 @@ pub enum Plane { /// Which half of an endpoint pair. Cancellation is per-direction: an abort on a download must not /// also tear down the write the caller is about to make. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] -#[serde(rename_all = "lowercase")] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Dir { In, Out, @@ -53,11 +50,8 @@ pub enum Dir { /// A transport failure, in the vocabulary `lib/usb/pipe.ts`'s `PipeError` already speaks. /// -/// The `code` is the contract — the TS side switches on it — and the `message` is for a human. -/// `unsupported` never appears here: it means "this browser has no WebUSB", which is exactly the -/// condition the desktop app exists to not have. -#[derive(Debug, Clone, Serialize)] -#[serde(rename_all = "camelCase")] +/// `unsupported` never appears here: it means "this browser has no WebUSB". +#[derive(Debug, Clone)] pub struct PipeFault { /// `closed` | `aborted` | `device-error`. pub code: &'static str, @@ -170,10 +164,7 @@ fn check_binding_major(interface_protocol: u8, device_release: u16) -> Result<() /// The mechanism is a `watch` channel rather than a `Notify` because the race matters: a cancel /// that arrives between the caller deciding to abort and the read parking itself must not be lost. /// A monotonic epoch the reader snapshots before it parks cannot miss one. -/// that arrives between "the caller decided to abort" and "the read parked itself" must not be -/// lost. A monotonic epoch the reader snapshots before it parks cannot miss one. pub struct Pipe { - pub max_packet: usize, read_len: usize, ep_in: Mutex>, ep_out: Mutex>, @@ -194,7 +185,6 @@ impl Pipe { // OS would fail the URB anyway. Round down, floor at one packet. let read_len = (target_read / max_packet).max(1) * max_packet; Ok(Self { - max_packet, read_len, ep_in: Mutex::new(ep_in), ep_out: Mutex::new(ep_out), @@ -329,10 +319,6 @@ async fn cancel_and_drain(ep: &mut Endpoin /// The `Interface` is held for its whole life because dropping it releases the claim — nothing /// reads it directly. pub struct OpenLink { - /// The stable key the frontend knows this device by; a hot-plug `Disconnected` carries the same - /// one, which is how a pulled cable reaches the pipes without waiting for a transfer to time - /// out. - pub device_id: String, pub control: Pipe, pub bulk: Pipe, _interface: Interface, @@ -345,29 +331,10 @@ impl OpenLink { Plane::Bulk => &self.bulk, } } - - /// Fail everything parked on both planes. Called on an unplug and on close. - pub fn cancel_all(&self) { - self.control.cancel(None); - self.bulk.cancel(None); - } -} - -/// What `usb_open` tells the frontend about the link it just got. -#[derive(Debug, Clone, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct OpenedLink { - pub handle: u32, - pub device_id: String, - pub interface_number: u8, - pub control_packet_size: usize, - pub bulk_packet_size: usize, - pub product: Option, - pub serial_number: Option, } /// Open, configure and claim a device, returning its two pipes. -pub async fn open(info: &DeviceInfo, device_id: String) -> Result<(Arc, OpenedLink), PipeFault> { +pub async fn open(info: &DeviceInfo) -> Result, PipeFault> { let device: Device = info .open() .await @@ -414,23 +381,14 @@ pub async fn open(info: &DeviceInfo, device_id: String) -> Result<(Arc let control = Pipe::new(&interface, layout.control.0, layout.control.1, layout.control.2)?; let bulk = Pipe::new(&interface, layout.bulk.0, layout.bulk.1, BULK_READ_TARGET)?; - let opened = OpenedLink { - handle: 0, // filled in by the registry - device_id: device_id.clone(), - interface_number: layout.interface, - control_packet_size: control.max_packet, - bulk_packet_size: bulk.max_packet, - product: info.product_string().map(str::to_owned), - serial_number: info.serial_number().map(str::to_owned), - }; - Ok((Arc::new(OpenLink { device_id, control, bulk, _interface: interface }), opened)) + Ok(Arc::new(OpenLink { control, bulk, _interface: interface })) } /// The two failures whose remedy is not "try again", spelled out where they happen. /// /// On Linux the usbfs node is root-owned unless a udev rule says otherwise, and the error the user /// would otherwise read is a bare `Permission denied` with nothing to suggest that a one-line file -/// fixes it (`builder/desktop/linux/`). macOS needs nothing for a vendor interface; Windows +/// fixes it (`builder/usb/linux/`). macOS needs nothing for a vendor interface; Windows /// binds WinUSB from the MS OS 2.0 descriptors the firmware already ships. /// /// `Busy` is the other one, and it is not platform-specific: an interface may be claimed once, so a @@ -439,7 +397,7 @@ pub async fn open(info: &DeviceInfo, device_id: String) -> Result<(Arc fn permission_hint(error: &nusb::Error) -> &'static str { match error.kind() { nusb::ErrorKind::PermissionDenied if cfg!(target_os = "linux") => { - " — install the udev rule from the app's `linux/` folder, then unplug and re-plug the device." + " — install the udev rule from `builder/usb/linux/`, then unplug and re-plug the device." } nusb::ErrorKind::PermissionDenied => " — this account is not allowed to open the device.", nusb::ErrorKind::Busy => " — something else has it open. Close the other app or browser tab and try again.", diff --git a/builder/wasm/Cargo.toml b/builder/wasm/Cargo.toml index 03f8303bd9..5af5173397 100644 --- a/builder/wasm/Cargo.toml +++ b/builder/wasm/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"] test-device = ["dep:obc-flat-device", "obc-link/std", "dep:obc-storage"] [dependencies] -obc-route = { workspace = true } +obc-route = { workspace = true, features = ["alloc"] } obc-formats = { workspace = true } obcm-assemble = { workspace = true } obc-map-scene = { workspace = true } @@ -27,6 +27,7 @@ obc-link = { workspace = true, features = ["client"] } obc-storage = { workspace = true, features = ["std"], optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] +obc-fit = { workspace = true } wasm-bindgen = { workspace = true } js-sys = { workspace = true } console_error_panic_hook = { workspace = true } diff --git a/builder/wasm/src/browser.rs b/builder/wasm/src/browser.rs index d2c32ecdbb..76306cdeae 100644 --- a/builder/wasm/src/browser.rs +++ b/builder/wasm/src/browser.rs @@ -26,7 +26,6 @@ pub fn obc_builder_constants() -> Vec { grid::MIN_CELL_LOG2 as f64, grid::MAX_CELL_LOG2 as f64, 65_536.0, - crate::gpx::MAX_ROUTE_POINTS as f64, ] } @@ -164,12 +163,6 @@ pub fn obc_gpx_read(text: &str, fallback: &str) -> Result { serde_json::to_string(&imported).map_err(|e| error("GpxError", &e.to_string())) } -#[wasm_bindgen] -pub fn obc_gpx_parse(text: &str, fallback: &str) -> Result { - let route = crate::gpx::parse(text, fallback).map_err(|e| error("GpxError", &e))?; - serde_json::to_string(&route).map_err(|e| error("GpxError", &e.to_string())) -} - #[wasm_bindgen(js_name = IncrementalSha256)] pub struct IncrementalSha256(Option); diff --git a/builder/wasm/src/client_web.rs b/builder/wasm/src/client_web.rs index b37501a4f8..6bcd13434f 100644 --- a/builder/wasm/src/client_web.rs +++ b/builder/wasm/src/client_web.rs @@ -3,7 +3,7 @@ use obc_link::flat::{ client::{Action, Client, Error, Event, Options, Outcome, QueryId, QueryOutcome}, wire::*, - Ceilings, Channel, DisplayName, EntryMeta, ObjectId, ObjectKind, Revision, StoreId, + ArchiveSource, Ceilings, Channel, DisplayName, EntryMeta, ObjectId, ObjectKind, Revision, StoreId, }; use serde::Deserialize; use serde_json::{json, Value}; @@ -20,6 +20,7 @@ enum BrowserRequest { Cancel { transfer: u32 }, Arm { id: String, revision: String }, Format { expected: String, replacement: String }, + ArchiveRide { store: String, id: String, revision: String, length: String, crc: u32 }, } #[derive(Deserialize)] @@ -93,6 +94,13 @@ impl BrowserRequest { Self::Format { expected, replacement } => { Request::Format(FormatRequest { expected: store(&expected)?, replacement: store(&replacement)? }) } + Self::ArchiveRide { store: card, id, revision, length, crc } => Request::ArchiveRide(ArchiveSource { + store: store(&card)?, + id: ObjectId(number(&id)?), + revision: Revision(number(&revision)?), + payload_len: number(&length)?, + payload_crc: crc, + }), }) } } @@ -158,7 +166,9 @@ fn outcome(outcome: Outcome) -> Value { "kind": "arm", "rollbackObjectId": reserve.0.to_string(), "commitSequence": sequence.to_string(), }), Outcome::Format(store) => json!({"kind": "format", "storeId": store_text(store)}), - Outcome::ArchiveRide(_) => unreachable!("The browser surface has no archive request."), + Outcome::ArchiveRide(result) => json!({ + "kind": "archiveRide", "commitSequence": result.sequence.to_string(), "timestamp": result.timestamp, + }), } } diff --git a/builder/wasm/src/convert.rs b/builder/wasm/src/convert.rs index b207a1737b..c718cfd56d 100644 --- a/builder/wasm/src/convert.rs +++ b/builder/wasm/src/convert.rs @@ -3,8 +3,8 @@ //! and the two guards below are tested natively. use obc_formats::io::{ByteSink, Error, SliceSource}; -use obc_formats::obcr::WAYPOINT_ELE_NONE; -use obc_route::{for_each_waypoint, BikeType, RouteIndex, RouteReader, MAX_POINTS_PER_CHUNK, MAX_ROUTE_CHUNKS}; +use obc_formats::obcr::{ELEVATION_NONE, WAYPOINT_ELE_NONE, WAYPOINT_NAME_CAP}; +use obc_route::{BikeType, RoutePoint, Waypoint, MAX_POINTS_PER_CHUNK, MAX_ROUTE_CHUNKS}; /// Largest point count an `.obcr` can store, and so the ceiling [`gpx_to_obcr`] converts up to: /// every chunk full, with consecutive chunks sharing their seam vertex. @@ -57,8 +57,6 @@ pub enum ErrorCode { RideNoPoints, /// A read ran past the end of the input: the file is truncated or the upload was cut short. InputTruncated, - /// The bytes handed to [`obcr_to_track`] are not an OBCR route. - NotRoute, /// A defect in this bridge or in the shared converter. Internal, } @@ -75,7 +73,6 @@ impl ErrorCode { ErrorCode::NotRide => "not-ride", ErrorCode::RideNoPoints => "ride-no-points", ErrorCode::InputTruncated => "input-truncated", - ErrorCode::NotRoute => "not-route", ErrorCode::Internal => "internal", } } @@ -114,6 +111,66 @@ pub fn gpx_to_obcr(gpx: &[u8], name: &str, bike: BikeType) -> Result, Co Ok(sink.0) } +/// A waypoint of a calculated line. `distance_m` is along the line as the caller gave it, before +/// decimation; the waypoint lies on the line. +#[derive(Debug, Clone, PartialEq, serde::Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LineWaypoint { + pub lon: i32, + pub lat: i32, + pub distance_m: f64, + pub category: u8, + pub name: String, +} + +/// Encode a calculated line into a `.obcr` route named `name` and typed `bike`, with the shared +/// emitter that the phone uses. `points` are microdegrees with the height in metres; +/// `surfaces[i]` is the surface class of the segment that ends at point `i`. A waypoint name is +/// cut to the field on a char boundary. +pub fn line_to_obcr( + points: &[(i32, i32, Option)], + surfaces: &[u8], + waypoints: &[LineWaypoint], + name: &str, + bike: BikeType, +) -> Result, ConvertFailure> { + let points: Vec = points + .iter() + .enumerate() + .map(|(i, &(lon, lat, ele))| RoutePoint { + lon, + lat, + ele: ele.unwrap_or(ELEVATION_NONE), + surface: surfaces.get(i).copied().unwrap_or(0), + elevation_incomplete: ele.is_none(), + }) + .collect(); + let waypoints: Vec<(Waypoint, f64)> = waypoints + .iter() + .map(|w| { + let mut waypoint = Waypoint { + dist_along_m: 0, + lon: w.lon, + lat: w.lat, + ele: WAYPOINT_ELE_NONE, + category_id: w.category, + lateral_offset_m: 0, + name: Default::default(), + provenance: None, + }; + for ch in w.name.chars() { + if waypoint.name.len() + ch.len_utf8() > WAYPOINT_NAME_CAP || waypoint.name.push(ch).is_err() { + break; + } + } + (waypoint, w.distance_m) + }) + .collect(); + let mut sink = VecSink(Vec::new()); + obc_route::convert::points_to_obcr(&points, &waypoints, name, bike, &mut sink).map_err(describe_line_error)?; + Ok(sink.0) +} + /// Convert a finished ride-v6 object's bytes into a GPX 1.1 document named `name`. /// /// Byte-for-byte the same output as `obc_route::track_to_gpx`; only the buffer adapter is new. @@ -148,111 +205,6 @@ pub fn track_to_gpx(ride: &[u8], name: &str) -> Result { }) } -/// Decode an `.obcr` route's polyline: flat `[lat, lon, ele]` triples in route order. A missing -/// elevation is NaN, never a fabricated sea-level sample. -/// -/// It reads back through the same [`RouteReader`] the firmware streams its map draw from, so what -/// the preview traces is what the device traces. Flat `f64` triples because this crosses the wasm -/// boundary as one `Float64Array`. -/// -/// Chunks share their seam vertex, so every chunk after the first drops its first decoded point and -/// the stored `point_count` is what comes back. -pub fn obcr_to_track(obcr: &[u8]) -> Result, ConvertFailure> { - let src = SliceSource(obcr); - let idx = RouteIndex::read(&src).map_err(describe_route_read_error)?; - let reader = RouteReader::new(&idx, &src); - - // Every chunk's bbox lies inside the route's own, so the route bbox visits them all. - let mut chunks: Vec = Vec::new(); - idx.for_each_visible_chunk(&idx.bbox, |k, _| chunks.push(k)); - chunks.sort_unstable(); - - let mut out: Vec = Vec::with_capacity(idx.point_count as usize * 3); - for (i, k) in chunks.iter().enumerate() { - let skip = usize::from(i > 0); // the shared seam vertex - reader - .with_chunk(*k, |points| { - for p in points.skip(skip) { - out.push(f64::from(p.lat) * 1e-6); - out.push(f64::from(p.lon) * 1e-6); - out.push(p.elevation().map_or(f64::NAN, f64::from)); - } - }) - .map_err(|_| { - ConvertFailure::new( - ErrorCode::NotRoute, - "A geometry chunk in this route failed to decode — the file is damaged.", - ) - })?; - } - Ok(out) -} - -/// One waypoint read back out of an `.obcr` route, with the wire encodings already unfolded: -/// microdegrees to degrees, and the elevation sentinel to `None`. -#[derive(Debug, Clone, PartialEq)] -pub struct RouteWaypoint { - /// The stored UTF-8 short name, at most 24 bytes, and possibly empty. - pub name: String, - /// The waypoint's own coordinate in degrees. It can sit off the polyline. - pub lat: f64, - pub lon: f64, - /// Elevation in meters, or `None` where the source carried none. - pub ele: Option, - /// The stored category byte, raw: `0` is generic and `1..=6` are the POI category ids. A - /// consumer renders any other value as generic. - pub category: u8, - /// Meters from the route start to the waypoint's position on the track: the stored field, not - /// a recomputation. - pub dist_along_m: u32, -} - -/// Decode an `.obcr` route's waypoint table, in ascending distance order: name, position, raw -/// category byte and along-track distance for each stored waypoint. -/// -/// `dist_along_m` is returned as stored. The format fixes it at conversion time against the raw -/// geometry the converter saw, which a reader of the decimated file could not reproduce. -pub fn obcr_to_waypoints(obcr: &[u8]) -> Result, ConvertFailure> { - let src = SliceSource(obcr); - let mut out: Vec = Vec::new(); - for_each_waypoint(&src, |w| { - out.push(RouteWaypoint { - name: w.name.as_str().into(), - lat: f64::from(w.lat) * 1e-6, - lon: f64::from(w.lon) * 1e-6, - ele: (w.ele != WAYPOINT_ELE_NONE).then(|| f64::from(w.ele)), - category: w.category_id, - dist_along_m: w.dist_along_m, - }); - }) - .map_err(describe_route_read_error)?; - Ok(out) -} - -/// Map a failure to open or read an `.obcr` onto the browser vocabulary. Exhaustive like the other -/// maps in this file: a new seam variant must break this build. -fn describe_route_read_error(e: Error) -> ConvertFailure { - match e { - Error::BadMagic | Error::BadVersion => { - ConvertFailure::new(ErrorCode::NotRoute, "These bytes are not an OBCR route this bridge can read.") - } - Error::BadOffset => ConvertFailure::new( - ErrorCode::InputTruncated, - "This route file ends mid-structure — the download or copy was cut short.", - ), - Error::TooLarge => ConvertFailure::new( - ErrorCode::NotRoute, - "This route's chunk index exceeds the reader's limits — it was not written by this \ - toolchain.", - ), - Error::Io | Error::Empty => ConvertFailure::new( - ErrorCode::Internal, - "Internal error: reading from an in-memory buffer failed. This is a bug in the \ - conversion bridge — please report it.", - ), - } -} - /// The bytes after an optional UTF-8 BOM and any leading whitespace. fn document_start(bytes: &[u8]) -> &[u8] { let body = bytes.strip_prefix(&[0xEF, 0xBB, 0xBF]).unwrap_or(bytes); @@ -311,6 +263,24 @@ fn describe_gpx_error(e: Error) -> ConvertFailure { } } +/// Map a line-to-OBCR failure onto the browser vocabulary. +fn describe_line_error(e: Error) -> ConvertFailure { + match e { + Error::Empty => ConvertFailure::new(ErrorCode::GpxNoTrackPoints, "This route has no line to send."), + Error::TooLarge => ConvertFailure::new( + ErrorCode::GpxTooManyPoints, + format!( + "This route is too long for the device: it needs more than {MAX_STORED_POINTS} stored \ + points. Split it into shorter routes." + ), + ), + Error::BadOffset | Error::BadMagic | Error::BadVersion | Error::Io => ConvertFailure::new( + ErrorCode::Internal, + "Internal error: the route line could not be encoded. This is a bug — please report it.", + ), + } +} + /// Map a track-to-GPX failure onto the browser vocabulary. Split from [`describe_gpx_error`] /// because the same [`Error`] means a different thing in each direction: `Empty` is a GPX with no /// track one way and an empty recording the other. @@ -396,87 +366,6 @@ mod tests { r.expect_err("expected a failure").code } - /// What `gpx_to_obcr` stored, `obcr_to_track` returns: point for point, in order, elevation - /// included. - #[test] - fn obcr_round_trips_to_the_track_it_stored() { - let obcr = gpx_to_obcr(TINY_GPX.as_bytes(), "Tiny", BikeType::Road).unwrap(); - let flat = obcr_to_track(&obcr).unwrap(); - assert_eq!(flat.len() % 3, 0); - let points: Vec<[f64; 3]> = flat.as_chunks::<3>().0.iter().map(|c| [c[0], c[1], c[2]]).collect(); - // The tiny track survives decimation whole: 3 in, 3 out. - assert_eq!(points.len(), 3); - let expect = [[48.0000, 7.8200, 236.0], [48.0005, 7.8230, 241.0], [48.0002, 7.8265, 249.5]]; - for (got, want) in points.iter().zip(expect) { - assert!((got[0] - want[0]).abs() < 1e-5, "lat {got:?} vs {want:?}"); - assert!((got[1] - want[1]).abs() < 1e-5, "lon {got:?} vs {want:?}"); - assert!((got[2] - want[2]).abs() < 1.0, "ele {got:?} vs {want:?}"); - } - } - - /// The tiny track with two waypoints ahead of it: one categorized with an elevation, one with - /// an unmapped symbol and no elevation. They sit near different ends of the track, so the - /// stored distances must differ. - const WPT_GPX: &str = r#" - - AussichtViewpoint - 238.0BrunnenDrinking Water - t - 236.0 - 241.0 - 249.5 - - -"#; - - /// What the converter stored, `obcr_to_waypoints` returns, sorted by distance along. - #[test] - fn obcr_round_trips_the_waypoints_it_stored() { - let obcr = gpx_to_obcr(WPT_GPX.as_bytes(), "Tiny", BikeType::Road).unwrap(); - let wps = obcr_to_waypoints(&obcr).unwrap(); - assert_eq!(wps.len(), 2); - - // Sorted ascending by distance along: Brunnen sits by the start, Aussicht by the end. - let (near, far) = (&wps[0], &wps[1]); - assert_eq!(near.name, "Brunnen"); - assert_eq!(near.category, 1, "Drinking Water maps to water (§4.1)"); - assert_eq!(near.ele, Some(238.0)); - assert!((near.lat - 48.0001).abs() < 1e-5); - assert!((near.lon - 7.8201).abs() < 1e-5); - - assert_eq!(far.name, "Aussicht"); - assert_eq!(far.category, 0, "Viewpoint is deliberately unmapped — generic"); - assert_eq!(far.ele, None, "no comes back as None, not as the sentinel"); - assert!(near.dist_along_m < far.dist_along_m, "route order: {near:?} vs {far:?}"); - // The track is about 500 m long, and the far waypoint's anchor is near its end. - assert!(far.dist_along_m > 300 && far.dist_along_m < 700, "{far:?}"); - } - - /// A route without waypoints is an empty list, which is the common case and not an error. - #[test] - fn a_waypoint_free_route_decodes_to_no_waypoints() { - let obcr = gpx_to_obcr(TINY_GPX.as_bytes(), "Tiny", BikeType::Road).unwrap(); - assert_eq!(obcr_to_waypoints(&obcr).unwrap(), Vec::new()); - } - - /// The waypoint direction shares the track direction's error vocabulary. - #[test] - fn obcr_to_waypoints_refuses_what_is_not_a_route() { - assert_eq!(code_of(obcr_to_waypoints(&[0u8; 200])), ErrorCode::NotRoute); - assert_eq!(code_of(obcr_to_waypoints(b"short")), ErrorCode::InputTruncated); - } - - #[test] - fn obcr_to_track_refuses_what_is_not_a_route() { - // Long enough to read a header out of, wrong magic: not a route. - assert_eq!(code_of(obcr_to_track(&[0u8; 200])), ErrorCode::NotRoute); - // Too short for even the header, which reads the same as a cut-off copy. - assert_eq!(code_of(obcr_to_track(b"short")), ErrorCode::InputTruncated); - // A valid header cut off mid-index reads as truncation too. - let obcr = gpx_to_obcr(TINY_GPX.as_bytes(), "Tiny", BikeType::Road).unwrap(); - assert_eq!(code_of(obcr_to_track(&obcr[..116])), ErrorCode::InputTruncated); - } - /// The bridge adds nothing to the bytes: its output equals the shared converter's, and the /// picked bike type lands in the header. #[test] @@ -533,6 +422,48 @@ mod tests { assert!(mine.contains("a < b"), "name escaping survives: {mine}"); } + /// The line encoder adds nothing to the shared emitter: the same points, surfaces and waypoints + /// give the same bytes, and a long waypoint name is cut on a char boundary. + #[test] + fn line_conversion_matches_the_shared_emitter() { + let line = + [(7_820_000, 48_000_000, Some(236)), (7_823_000, 48_000_500, None), (7_826_500, 48_000_200, Some(249))]; + let long = "Brunnen am Marktplatz Süd"; + let waypoint = + LineWaypoint { lon: 7_823_000, lat: 48_000_500, distance_m: 230.0, category: 1, name: long.into() }; + let mine = line_to_obcr(&line, &[0, 1, 3], core::slice::from_ref(&waypoint), "Day", BikeType::Gravel).unwrap(); + + let points: Vec = line + .iter() + .zip([0, 1, 3]) + .map(|(&(lon, lat, ele), surface)| RoutePoint { + lon, + lat, + ele: ele.unwrap_or(ELEVATION_NONE), + surface, + elevation_incomplete: ele.is_none(), + }) + .collect(); + let mut stored = Waypoint { + dist_along_m: 0, + lon: waypoint.lon, + lat: waypoint.lat, + ele: WAYPOINT_ELE_NONE, + category_id: 1, + lateral_offset_m: 0, + name: Default::default(), + provenance: None, + }; + // "ü" would end at byte 25 of the 24-byte field. + stored.name.push_str("Brunnen am Marktplatz S").unwrap(); + let mut reference = VecSink(Vec::new()); + obc_route::convert::points_to_obcr(&points, &[(stored, 230.0)], "Day", BikeType::Gravel, &mut reference) + .unwrap(); + assert_eq!(mine, reference.0); + assert_eq!(mine[obc_formats::obcr::BIKE_TYPE_OFF], BikeType::Gravel as u8); + assert_eq!(code_of(line_to_obcr(&[], &[], &[], "x", BikeType::Road)), ErrorCode::GpxNoTrackPoints); + } + /// An empty file, a non-GPX file and a GPX without a track are three different answers, not one /// invalid-file message. #[test] diff --git a/builder/wasm/src/convert_web.rs b/builder/wasm/src/convert_web.rs index 7c9f7723ea..e45e5e7084 100644 --- a/builder/wasm/src/convert_web.rs +++ b/builder/wasm/src/convert_web.rs @@ -12,64 +12,58 @@ mod web { /// Throws an `Error` carrying `code` and `message` on failure; see [`crate::convert::ErrorCode`]. #[wasm_bindgen] pub fn obc_convert_gpx_to_obcr(bytes: &[u8], name: &str, bike: f64) -> Result, JsValue> { + crate::convert::gpx_to_obcr(bytes, name, bike_type(bike)?).map_err(to_js) + } + + fn bike_type(bike: f64) -> Result { let whole = bike.fract() == 0.0 && (0.0..=3.0).contains(&bike); - let bike = whole.then_some(bike as u8).and_then(obc_route::BikeType::from_u8).ok_or_else(|| { + whole.then_some(bike as u8).and_then(obc_route::BikeType::from_u8).ok_or_else(|| { to_js(ConvertFailure { code: crate::convert::ErrorCode::Internal, // A static message: formatting the `f64` would link float printing into the module. message: "Internal error: the bike type is not 0 to 3. This is a bug in the builder.".into(), }) - })?; - crate::convert::gpx_to_obcr(bytes, name, bike).map_err(to_js) - } - - /// Convert a finished ride-v6 object into a GPX 1.1 document, naming the track `name`. - /// - /// Throws an `Error` carrying `code` and `message` on failure; see [`crate::convert::ErrorCode`]. - #[wasm_bindgen] - pub fn obc_convert_track_to_gpx(bytes: &[u8], name: &str) -> Result { - crate::convert::track_to_gpx(bytes, name).map_err(to_js) + }) } - /// Decode a `.obcr` route's polyline for the device page's preview: flat `[lat, lon, ele]` - /// triples in route order, crossing as one `Float64Array`. - /// - /// Throws an `Error` carrying `code` and `message` on failure; see [`crate::convert::ErrorCode`]. + /// Encode a calculated line into `.obcr` bytes; see [`crate::convert::line_to_obcr`]. + /// `coordinates` holds longitude and latitude in microdegrees for each point; `heights` holds + /// metres, `i16::MIN` where none is known; `waypoints` is a JSON array of + /// [`crate::convert::LineWaypoint`] with camelCase fields. #[wasm_bindgen] - pub fn obc_convert_obcr_to_track(bytes: &[u8]) -> Result, JsValue> { - crate::convert::obcr_to_track(bytes).map_err(to_js) + pub fn obc_convert_line_to_obcr( + coordinates: &[i32], + heights: &[i16], + surfaces: &[u8], + waypoints: &str, + name: &str, + bike: f64, + ) -> Result, JsValue> { + let bike = bike_type(bike)?; + let internal = |message: &str| { + to_js(ConvertFailure { code: crate::convert::ErrorCode::Internal, message: message.into() }) + }; + if coordinates.len() != heights.len() * 2 { + return Err(internal("Internal error: each point needs one height. This is a bug in the planner.")); + } + let waypoints: Vec = serde_json::from_str(waypoints) + .map_err(|_| internal("Internal error: the waypoints are not valid. This is a bug in the planner."))?; + let points: Vec<_> = coordinates + .as_chunks::<2>() + .0 + .iter() + .zip(heights) + .map(|(&[lon, lat], &height)| (lon, lat, (height != i16::MIN).then_some(height))) + .collect(); + crate::convert::line_to_obcr(&points, surfaces, &waypoints, name, bike).map_err(to_js) } - /// Decode a `.obcr` route's waypoint table: an `Array` of plain - /// `{name, lat, lon, ele, category, distAlongM}` objects in ascending `distAlongM` order. - /// `ele` is `null` where the source carried none, `category` is the stored byte raw, and - /// `distAlongM` is the stored placement-time distance and not a recomputation. A route without - /// waypoints yields `[]`. - /// - /// Plain objects rather than a flat array because names are strings, and at most 32 waypoints - /// cross per route. + /// Convert a finished ride-v6 object into a GPX 1.1 document, naming the track `name`. /// /// Throws an `Error` carrying `code` and `message` on failure; see [`crate::convert::ErrorCode`]. #[wasm_bindgen] - pub fn obc_convert_obcr_to_waypoints(bytes: &[u8]) -> Result { - let wps = crate::convert::obcr_to_waypoints(bytes).map_err(to_js)?; - let arr = js_sys::Array::new(); - for w in wps { - let obj = js_sys::Object::new(); - set(&obj, "name", &JsValue::from_str(&w.name)); - set(&obj, "lat", &JsValue::from_f64(w.lat)); - set(&obj, "lon", &JsValue::from_f64(w.lon)); - set(&obj, "ele", &w.ele.map_or(JsValue::NULL, JsValue::from_f64)); - set(&obj, "category", &JsValue::from_f64(f64::from(w.category))); - set(&obj, "distAlongM", &JsValue::from_f64(f64::from(w.dist_along_m))); - arr.push(&obj.into()); - } - Ok(arr) - } - - /// `Reflect::set` on a fresh plain object, which cannot fail, so the result is ignored. - fn set(obj: &js_sys::Object, key: &str, value: &JsValue) { - let _ = js_sys::Reflect::set(obj, &JsValue::from_str(key), value); + pub fn obc_convert_track_to_gpx(bytes: &[u8], name: &str) -> Result { + crate::convert::track_to_gpx(bytes, name).map_err(to_js) } /// Build the JS exception as a real `Error` instance, so it carries a stack and survives diff --git a/builder/wasm/src/fit.rs b/builder/wasm/src/fit.rs new file mode 100644 index 0000000000..897f878dc2 --- /dev/null +++ b/builder/wasm/src/fit.rs @@ -0,0 +1,145 @@ +//! Browser FIT import and export: a ride or a course from FIT bytes, and FIT bytes from both. +//! +//! The numbers cross as `Float64Array`s, with NaN for an absent value. A course does not cross as +//! JSON text, because that would link the JSON parser into the module. + +use obc_fit::{Course, File, Point, Ride, Sample, Sport, Waypoint}; +use wasm_bindgen::prelude::*; + +/// A sample crosses as 10 values: Unix time, latitude, longitude, segment start (1 or 0), +/// elevation, speed, heart rate, cadence, power and temperature. +const SAMPLE_VALUES: usize = 10; + +const SPORTS: [(Sport, &str); 7] = [ + (Sport::Road, "road"), + (Sport::Gravel, "gravel"), + (Sport::Mtb, "mtb"), + (Sport::Bike, "bike"), + (Sport::Foot, "foot"), + (Sport::Other, "other"), + (Sport::Unknown, "unknown"), +]; + +fn error(name: &str, message: &str, code: Option<&str>) -> JsValue { + let error = js_sys::Error::new(message); + error.set_name(name); + if let Some(code) = code { + let _ = js_sys::Reflect::set(&error, &"code".into(), &code.into()); + } + error.into() +} + +fn present(value: f64) -> Option { + (!value.is_nan()).then_some(value) +} + +fn whole>(value: f64) -> Option { + present(value).and_then(|v| T::try_from(v.round() as i64).ok()) +} + +fn nan(value: Option>) -> f64 { + value.map_or(f64::NAN, Into::into) +} + +/// Gives `{ sport, samples }` for a ride, or `{ name, points, waypoints, names, elapsedS }` for a +/// course: points as latitude, longitude and elevation, waypoints as latitude and longitude, and +/// the waypoint names (`undefined` for none). Throws a `FitError` with a `code`. +#[wasm_bindgen] +pub fn obc_fit_read(bytes: &[u8], fallback: &str) -> Result { + let file = obc_fit::read(bytes).map_err(|e| error("FitError", e.message(), Some(e.code())))?; + let out = js_sys::Object::new(); + let set = |key: &str, value: &JsValue| js_sys::Reflect::set(&out, &key.into(), value); + let array = |values: Vec| JsValue::from(js_sys::Float64Array::from(&values[..])); + match file { + File::Ride(ride) => { + let sport = SPORTS.iter().find(|(s, _)| *s == ride.sport).map_or("other", |(_, code)| code); + let samples = ride.samples.iter().flat_map(|s| { + [ + s.time as f64, + s.lat.into(), + s.lon.into(), + f64::from(u8::from(s.segment_start)), + nan(s.elevation), + nan(s.speed), + nan(s.heart_rate), + nan(s.cadence), + nan(s.power), + nan(s.temperature), + ] + }); + set("sport", &sport.into())?; + set("samples", &array(samples.collect()))?; + } + File::Course(course) => { + let name = if course.name.is_empty() { fallback } else { &course.name }; + let points = course.points.iter().flat_map(|p| [p.lat.into(), p.lon.into(), nan(p.elevation)]); + let waypoints = course.waypoints.iter().flat_map(|w| [w.lat.into(), w.lon.into()]); + let names: js_sys::Array = + course.waypoints.iter().map(|w| w.name.as_deref().map_or(JsValue::UNDEFINED, JsValue::from)).collect(); + set("name", &name.into())?; + set("points", &array(points.collect()))?; + set("waypoints", &array(waypoints.collect()))?; + set("names", &names)?; + set("elapsedS", &course.seconds.into())?; + } + } + Ok(out) +} + +#[wasm_bindgen] +pub fn obc_fit_write_ride(sport: &str, samples: &[f64]) -> Result, JsValue> { + let sport = SPORTS.iter().find(|(_, code)| *code == sport).ok_or_else(|| error("Error", "unknown sport", None))?.0; + let (samples, rest) = samples.as_chunks::(); + if !rest.is_empty() { + return Err(error("Error", "a sample has 10 values", None)); + } + let samples = samples + .iter() + .map(|v| Sample { + time: v[0] as i64, + lat: v[1].round() as i32, + lon: v[2].round() as i32, + segment_start: v[3] != 0.0, + elevation: present(v[4]), + speed: present(v[5]), + heart_rate: whole(v[6]), + cadence: whole(v[7]), + power: whole(v[8]), + temperature: whole(v[9]), + }) + .collect(); + Ok(obc_fit::write_ride(&Ride { sport, samples })) +} + +/// Takes a course in the shape that `obc_fit_read` gives. An empty name is no name. +#[wasm_bindgen] +pub fn obc_fit_write_course( + name: String, + points: &[f64], + waypoints: &[f64], + names: Vec, + elapsed_s: f64, +) -> Result, JsValue> { + let (points, rest) = points.as_chunks::<3>(); + let (waypoints, odd) = waypoints.as_chunks::<2>(); + if !rest.is_empty() || !odd.is_empty() || waypoints.len() != names.len() { + return Err(error("Error", "a point has 3 values, and a waypoint has 2 values and a name", None)); + } + Ok(obc_fit::write_course(&Course { + name, + points: points + .iter() + .map(|p| Point { lat: p[0].round() as i32, lon: p[1].round() as i32, elevation: present(p[2]) }) + .collect(), + waypoints: waypoints + .iter() + .zip(names) + .map(|(w, name)| Waypoint { + lat: w[0].round() as i32, + lon: w[1].round() as i32, + name: (!name.is_empty()).then_some(name), + }) + .collect(), + seconds: elapsed_s.round().clamp(0.0, f64::from(u32::MAX)) as u32, + })) +} diff --git a/builder/wasm/src/gpx.rs b/builder/wasm/src/gpx.rs index bfac45aae3..c3d0b72c4e 100644 --- a/builder/wasm/src/gpx.rs +++ b/builder/wasm/src/gpx.rs @@ -1,15 +1,28 @@ -//! Browser GPX import: full planner points and the bounded corridor preview. +//! Browser GPX import: the points and waypoints of a GPX file. use serde::Serialize; -pub const MAX_ROUTE_POINTS: usize = 2048; - #[derive(Clone, Copy, Debug, Serialize)] +#[serde(rename_all = "camelCase")] pub struct Point { pub lat: f64, pub lon: f64, #[serde(skip_serializing_if = "Option::is_none")] pub ele: Option, + /// Unix seconds, with the fraction of the file. + #[serde(skip_serializing_if = "Option::is_none")] + pub time: Option, + /// The first point of the file, and of each `trk` and `trkseg`. + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub segment_start: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub hr_bpm: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub cadence_rpm: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub power_w: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub temperature_c: Option, } #[derive(Debug, Serialize)] @@ -26,14 +39,9 @@ pub struct Import { pub name: String, pub points: Vec, pub waypoints: Vec, -} - -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Route { - pub name: String, - pub points: Vec, - pub distance_km: f64, + /// The `` of the first track, such as `cycling`. + #[serde(skip_serializing_if = "Option::is_none")] + pub kind: Option, } fn whitespace(c: char) -> bool { @@ -135,6 +143,12 @@ fn point(attributes: &str) -> Option { lat: round(lat * 1e6), lon: round(lon * 1e6), ele: None, + time: None, + segment_start: false, + hr_bpm: None, + cadence_rpm: None, + power_w: None, + temperature_c: None, }) } @@ -150,6 +164,55 @@ fn round(value: f64) -> f64 { } } +/// `YYYY-MM-DDTHH:MM:SS`, an optional fraction, then `Z`, `±HH:MM` or no zone, which is UTC. +fn time(text: &str) -> Option { + let b = text.as_bytes(); + let digits = |at: usize, len: usize| -> Option { + let part = b.get(at..at + len)?; + part.iter().all(u8::is_ascii_digit).then(|| part.iter().fold(0, |n, c| n * 10 + i64::from(c - b'0'))) + }; + let [year, month, day, hour, minute, second] = + [(0, 4), (5, 2), (8, 2), (11, 2), (14, 2), (17, 2)].map(|(at, len)| digits(at, len)); + let (year, month, day, hour, minute, second) = (year?, month?, day?, hour?, minute?, second?); + if b[4] != b'-' || b[7] != b'-' || !matches!(b[10], b'T' | b't' | b' ') || b[13] != b':' || b[16] != b':' { + return None; + } + if !(1..=12).contains(&month) || !(1..=31).contains(&day) || hour > 23 || minute > 59 || second > 60 { + return None; + } + let mut rest = &b[19..]; + let mut fraction = 0.0; + if let Some(after) = rest.strip_prefix(b".") { + let end = after.iter().position(|c| !c.is_ascii_digit()).unwrap_or(after.len()); + fraction = after[..end].iter().rev().fold(0.0, |f, c| (f + f64::from(c - b'0')) / 10.0); + rest = &after[end..]; + } + let offset = match rest { + b"" | b"Z" | b"z" => 0, + [sign @ (b'+' | b'-'), h1, h2, b':', m1, m2] | [sign @ (b'+' | b'-'), h1, h2, m1, m2] => { + let zone = [h1, h2, m1, m2]; + if !zone.iter().all(|c| c.is_ascii_digit()) { + return None; + } + let [h1, h2, m1, m2] = zone.map(|c| i64::from(c - b'0')); + let seconds = (h1 * 10 + h2) * 3600 + (m1 * 10 + m2) * 60; + if *sign == b'-' { + -seconds + } else { + seconds + } + } + _ => return None, + }; + // Days since 1970-01-01 in the Gregorian calendar (`days_from_civil` of Howard Hinnant). + let y = if month <= 2 { year - 1 } else { year }; + let era = y.div_euclid(400); + let yoe = y - era * 400; + let doy = (153 * ((month + 9) % 12) + 2) / 5 + day - 1; + let days = era * 146_097 + yoe * 365 + yoe / 4 - yoe / 100 + doy - 719_468; + Some((days * 86_400 + hour * 3600 + minute * 60 + second - offset) as f64 + fraction) +} + fn first_text(text: &str, tag: &str) -> Option { let begin = text.find(&format!("<{tag}>"))? + tag.len() + 2; let end = text[begin..].find(&format!(""))? + begin; @@ -184,12 +247,38 @@ fn scoped_name(text: &str) -> Option { None } +/// The first element in `extensions` whose local name, after any prefix, is `name`: its text as a finite +/// decimal. This reads the Garmin `TrackPointExtension` v1 and v2 with any prefix, and a bare ``. +fn sensor(extensions: &str, name: &str) -> Option { + let rest = extensions.match_indices('<').map(|(at, _)| &extensions[at + 1..]).find(|rest| { + let tag = &rest[..rest.find(|c| matches!(c, '/' | '>') || whitespace(c)).unwrap_or(rest.len())]; + tag.rsplit(':').next() == Some(name) + })?; + let (head, text) = rest.split_once('>')?; + if head.ends_with('/') { + return None; + } + let value: f64 = text[..text.find('<').unwrap_or(text.len())].trim_matches(whitespace).parse().ok()?; + value.is_finite().then_some(value) +} + pub fn read(text: &str, fallback: &str) -> Result { let entries = elements(text, &["trkpt", "rtept"]); - let mut tracks = Vec::new(); - let mut routes = Vec::new(); + let trks = elements(text, &["trk"]); + // The openers of the tracks and their segments, in the order of the file. + let mut openers: Vec = trks.iter().chain(&elements(text, &["trkseg"])).map(|e| e.start).collect(); + openers.sort_unstable(); + let mut openers = openers.into_iter().peekable(); + let mut tracks: Vec = Vec::new(); + let mut routes: Vec = Vec::new(); let mut malformed = 0; + let mut segment_start = true; for entry in &entries { + if entry.kind == "trkpt" { + while openers.next_if(|&at| at < entry.start).is_some() { + segment_start = true; + } + } let Some(mut p) = point(entry.attributes) else { malformed += 1; continue; @@ -205,9 +294,22 @@ pub fn read(text: &str, fallback: &str) -> Result { break; } } + p.time = first_text(entry.body, "time").and_then(|t| time(&t)); + if let Some(extensions) = elements(entry.body, &["extensions"]).first() { + // No sensor gives a heart rate of 0 or a negative cadence or power: some apps write 0 without strap contact. + let value = |name, min: f64| sensor(extensions.body, name).filter(|v| *v >= min); + (p.hr_bpm, p.cadence_rpm, p.power_w, p.temperature_c) = ( + value("hr", f64::MIN_POSITIVE), + value("cad", 0.0), + value("power", 0.0), + sensor(extensions.body, "atemp"), + ); + } if entry.kind == "trkpt" { + p.segment_start = std::mem::take(&mut segment_start); tracks.push(p); } else { + p.segment_start = routes.is_empty(); routes.push(p); } } @@ -242,25 +344,12 @@ pub fn read(text: &str, fallback: &str) -> Result { } file.push_str(&text[at..]); let name = scoped.or_else(|| first_text(&file, "name")).unwrap_or_else(|| fallback.into()); - Ok(Import { name, points, waypoints }) -} - -pub fn parse(text: &str, fallback: &str) -> Result { - let Import { name, points, .. } = read(text, fallback)?; - let count = points.len().min(MAX_ROUTE_POINTS); - let step = (points.len() - 1) as f64 / (count - 1) as f64; - let points: Vec<_> = (0..count).map(|k| Point { ele: None, ..points[round(k as f64 * step) as usize] }).collect(); - let distance_km = points - .windows(2) - .map(|p| { - let cos = (((p[0].lat + p[1].lat) / 2.0) * std::f64::consts::PI / 180e6).cos(); - let dlat = (p[1].lat - p[0].lat) * 111_320.0 / 1e6; - let dlon = (p[1].lon - p[0].lon) * 111_320.0 * cos / 1e6; - dlat.hypot(dlon) - }) - .sum::() - / 1000.0; - Ok(Route { name, points, distance_km }) + // Only the head of the track: a point can have a `` too. + let kind = trks.first().and_then(|trk| { + let head = ["", 47.0 + i as f64 / 10_000.0)).collect(); - let full = read(&text, "fallback").unwrap(); - let route = parse(&text, "fallback").unwrap(); - assert_eq!(full.points.len(), 10_000); - assert_eq!(route.points.len(), MAX_ROUTE_POINTS); - let samples: Vec<_> = - [0, 1, 2, 3, 512, 1023, 1024, 2046, 2047].into_iter().map(|i| route.points[i].lat).collect(); - assert_eq!( - samples, - [ - 47_000_000.0, - 47_000_500.0, - 47_001_000.0, - 47_001_500.0, - 47_250_100.0, - 47_499_700.0, - 47_500_200.0, - 47_999_400.0, - 47_999_900.0 - ] - ); - assert!(route.points.iter().all(|point| point.ele.is_none())); + fn sensors_come_from_the_extensions_of_a_point_by_local_name() { + let sensors = |extensions: &str| { + let text = format!("{extensions}"); + let p = read(&text, "file").unwrap().points[0]; + (p.hr_bpm, p.cadence_rpm, p.power_w, p.temperature_c) + }; + let v1 = "21.514188250"; + assert_eq!(sensors(v1), (Some(141.0), Some(88.0), Some(250.0), Some(21.5))); + let v2 = " 150 90"; + assert_eq!(sensors(v2), (Some(150.0), Some(90.0), None, None)); + assert_eq!(sensors("312"), (None, None, Some(312.0), None)); + let none = "Climb


140]]>
0x8Cinf"; + assert_eq!(sensors(none), (None, None, None, None)); + let out_of_range = "0-1-5"; + assert_eq!(sensors(out_of_range), (None, None, None, None)); + let zero = "00"; + assert_eq!(sensors(zero), (None, Some(0.0), Some(0.0), None)); + assert_eq!(sensors(""), (None, None, None, None)); } } diff --git a/builder/wasm/src/lib.rs b/builder/wasm/src/lib.rs index 37f53dc2e9..af13ffb8ae 100644 --- a/builder/wasm/src/lib.rs +++ b/builder/wasm/src/lib.rs @@ -12,6 +12,9 @@ mod browser; #[cfg(target_arch = "wasm32")] mod client_web; +#[cfg(target_arch = "wasm32")] +mod fit; + pub use driver::*; pub use estimate::*; pub use preview::*; diff --git a/builder/web/package-lock.json b/builder/web/package-lock.json index 568ae6854c..ab829fbd19 100644 --- a/builder/web/package-lock.json +++ b/builder/web/package-lock.json @@ -11,7 +11,6 @@ "@mapbox/vector-tile": "^3.0.0", "@maplibre/maplibre-gl-leaflet": "^0.1.4", "@protomaps/basemaps": "^5.7.2", - "@tauri-apps/api": "^2.11.1", "earcut": "^3.2.4", "leaflet": "^1.9.4", "maplibre-contour": "^0.1.1", @@ -1042,16 +1041,6 @@ "vite": "^6.3.0 || ^7.0.0" } }, - "node_modules/@tauri-apps/api": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.11.1.tgz", - "integrity": "sha512-M2FPuYND2m+wh5hfW9ZpSdxMPdEJovPBWwoHJmwUpysTYNHaOkVFN419m/K0LIgjb/7KU2vBgsUepJWugQCvAA==", - "license": "Apache-2.0 OR MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/tauri" - } - }, "node_modules/@tsconfig/svelte": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-5.0.8.tgz", diff --git a/builder/web/package.json b/builder/web/package.json index d8673dd761..338d10b7ed 100644 --- a/builder/web/package.json +++ b/builder/web/package.json @@ -10,8 +10,7 @@ "build:data": "vite build --mode data", "build:trailview": "vite build --mode trailview", "build:web": "vite build --mode web", - "build:desktop": "vite build --mode desktop", - "build:all": "npm run build && npm run build:web && npm run build:desktop", + "build:all": "npm run build && npm run build:web", "build:wasm": "bash ../build-wasm-bridges.sh", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings", @@ -23,7 +22,6 @@ "@mapbox/vector-tile": "^3.0.0", "@maplibre/maplibre-gl-leaflet": "^0.1.4", "@protomaps/basemaps": "^5.7.2", - "@tauri-apps/api": "^2.11.1", "earcut": "^3.2.4", "leaflet": "^1.9.4", "maplibre-contour": "^0.1.1", diff --git a/builder/web/src/App.svelte b/builder/web/src/App.svelte index a18729aeee..253f9f5a22 100644 --- a/builder/web/src/App.svelte +++ b/builder/web/src/App.svelte @@ -2,13 +2,10 @@ import ConfirmDialog from "./components/ConfirmDialog.svelte"; import Header from "./components/Header.svelte"; import UpdatePrompt from "./components/UpdatePrompt.svelte"; - import Desktop from "./routes/Desktop.svelte"; import Home from "./routes/Home.svelte"; import { LINKS } from "./lib/constants"; import { platform, type StyleEditorModule } from "./lib/platform"; - import { DESKTOP_ADDS } from "./lib/platform/gating"; import { router } from "./lib/router.svelte"; - import { DESKTOP_ROUTE } from "./lib/routes"; // The advanced editor is maintainer tooling, reached through an `import()` // only the dev host declares — product hosts have no reference to the route @@ -20,28 +17,8 @@ let editor: Promise | undefined; const openEditor = load ? () => (editor ??= load()) : null; - // The device and rides pages reach the protocol codecs and the library — - // exactly the modules the entry chunk must not contain (platform/bundle.test.ts) - // — so both live behind memoized dynamic imports, the same shape the device - // surfaces already use. Gated on caps, not on a host name: a tier without - // the page treats its hash as home. - let devicePage: Promise | undefined; - const openDevice = platform.caps.deviceDashboard - ? () => (devicePage ??= import("./routes/Device.svelte")) - : null; - let ridesPage: Promise | undefined; - const openRides = platform.caps.rideLibrary - ? () => (ridesPage ??= import("./routes/Rides.svelte")) - : null; - const showEditor = $derived(router.route === "advanced" && openEditor !== null); - // Same shape as the editor's gate: a host that is missing nothing has - // nothing to read there, so #/desktop falls back to home rather than - // rendering a page that pitches the app you are already running. - const showDesktop = $derived(router.route === "desktop" && DESKTOP_ADDS.length > 0); - const showDevice = $derived(router.route === "device" && openDevice !== null); - const showRides = $derived(router.route === "rides" && openRides !== null); - const showHome = $derived(!showEditor && !showDesktop && !showDevice && !showRides); + const showHome = $derived(!showEditor); @@ -64,35 +41,18 @@ {/await} {/if} - {#if showDesktop} - - {/if} - {#if showDevice && openDevice} - {#await openDevice() then { default: Device }} - - {/await} - {/if} - {#if showRides && openRides} - {#await openRides() then { default: Rides }} - - {/await} - {/if} - + + + {/if} + {/each} + + {#if router.settings} + {#await import('./pages/Settings.svelte') then { default: Settings }} + + {:catch error} + router.closeSettings()}> +

{error instanceof Error ? error.message : String(error)}

+
+ {/await} + {/if} + + + + diff --git a/builder/web/src/components/ConfirmDialog.svelte b/builder/web/src/components/ConfirmDialog.svelte index e884d2579d..607f9df0a8 100644 --- a/builder/web/src/components/ConfirmDialog.svelte +++ b/builder/web/src/components/ConfirmDialog.svelte @@ -1,11 +1,9 @@ - -
- {#if active} - - sending {active.label}{#if active.total > 0} - · {active.pct}%{/if} - - {/if} - - {#if session?.status === "ready"} - - - - OBC - {#if session.info}{session.info.hardwareRevision}{/if} - - - - {:else if session?.status === "connecting"} - - - Connecting… - - {:else if session?.status === "unsupported"} - - - USB unavailable - - {:else} - - - No device - - - {/if} -
- - diff --git a/builder/web/src/components/Gated.svelte b/builder/web/src/components/Gated.svelte deleted file mode 100644 index 6e90efc05c..0000000000 --- a/builder/web/src/components/Gated.svelte +++ /dev/null @@ -1,98 +0,0 @@ - - - -{#if blocked} - {#if unavailable} -
{@render unavailable(reasonId)}
- {/if} -

- - {GATES[blocked].reason} - {DESKTOP_LINK.label} -

-{:else if children} - {@render children(value as T)} -{/if} - - diff --git a/builder/web/src/components/Header.svelte b/builder/web/src/components/Header.svelte index 107eef600b..6646efca68 100644 --- a/builder/web/src/components/Header.svelte +++ b/builder/web/src/components/Header.svelte @@ -4,37 +4,25 @@ import { setupSiteNavigation } from "../../../../docs/assets/site-navigation.js"; import { appearance, startTheme, toggleTheme } from "../lib/theme.svelte"; - import DeviceChip from "./DeviceChip.svelte"; import { platform } from "../lib/platform"; - import { available } from "../lib/platform/gating"; import { router, type Route } from "../lib/router.svelte"; - import { ADVANCED_ROUTE, DEVICE_ROUTE, RIDES_ROUTE } from "../lib/routes"; + import { ROUTES } from "../lib/routes"; let header: HTMLElement; onMount(startTheme); - onMount(() => siteNav ? setupSiteNavigation(header) : undefined); + onMount(() => setupSiteNavigation(header)); - // The header has two shapes, decided by capability rather than host name: - // an app with more than one place to be gets tabs; a single-page site keeps - // links. Each tab exists exactly where its route does (`App.svelte` gates - // the same way), so a tab can never point at a page that falls back home. + // A host with more than one place to be gets tabs under the site links. Each + // tab exists exactly where its route does (`App.svelte` gates the same way), + // so a tab can never point at a page that falls back home. const tabs: Array<{ route: Route; href: string; label: string }> = [ - { route: "home", href: "#/", label: "Maps" }, + { route: "home", href: ROUTES.home, label: "Maps" }, ...(platform.styleEditor - ? [{ route: "advanced" as const, href: ADVANCED_ROUTE, label: "Style editor" }] - : []), - ...(available("deviceDashboard") - ? [{ route: "device" as const, href: DEVICE_ROUTE, label: "Device" }] - : []), - ...(available("rideLibrary") - ? [{ route: "rides" as const, href: RIDES_ROUTE, label: "Ride library" }] + ? [{ route: "advanced" as const, href: ROUTES.advanced, label: "Style editor" }] : []), ]; const tabbed = tabs.length > 1; - // Links out of the app, present only where there is a site around it (the - // desktop app has none — `platform.siteNav` is absent there, and so are - // these). Orthogonal to the tabs: the dev server shows both. const siteNav = platform.siteNav; @@ -57,20 +45,15 @@
- {#if siteNav} - {@render brand()} - - - {:else} -
{@render brand()}
- {@render appTabs()} - {/if} + {@render brand()} + + - {#if available("deviceDashboard")} - - {/if}
- {#if siteNav && tabbed} + {#if tabbed}
{@render appTabs()}
@@ -103,7 +83,4 @@ .site-head:has(.tabs) :global(.name) { display: none; } .site-head:has(.tabs) :global(.short-name) { display: inline; } } - @media (max-width: 760px) { - .head-inner > .tabs { order: 3; width: 100%; } - } diff --git a/builder/web/src/components/TopBar.svelte b/builder/web/src/components/TopBar.svelte new file mode 100644 index 0000000000..25d07be5ee --- /dev/null +++ b/builder/web/src/components/TopBar.svelte @@ -0,0 +1,178 @@ + + +
+ OpenBikeComputer + + {#if device} + + {device.name} + + {#if device.sync === 'running'} + + {:else if device.sync === 'problem'} + + {/if} + {/if} + +
+ + diff --git a/builder/web/src/components/UpdatePrompt.svelte b/builder/web/src/components/UpdatePrompt.svelte index d7299492c9..b783348da6 100644 --- a/builder/web/src/components/UpdatePrompt.svelte +++ b/builder/web/src/components/UpdatePrompt.svelte @@ -17,9 +17,7 @@ import { jobRegistry } from "../lib/device/job.svelte"; import { deviceHolder } from "../lib/device/session.svelte"; import { firmwareCheck } from "../lib/firmware/check.svelte"; - import { platform } from "../lib/platform"; - import { router } from "../lib/router.svelte"; - import { DEVICE_ROUTE, FIRMWARE_ANCHOR } from "../lib/routes"; + import { FIRMWARE_ANCHOR } from "../lib/routes"; const session = $derived(deviceHolder.session); /** Non-null exactly while a device is connected and has said what it is. */ @@ -42,15 +40,11 @@ } /** - * Take the rider to the card. - * - * On a tier with a Device page that is a navigation, and the page arrives through a dynamic - * import — so the element does not exist yet at the moment of the click. Hence the short poll - * rather than one `scrollIntoView` into nothing; it gives up quietly after a second. + * Take the rider to the card. The device surfaces arrive through a dynamic import, so the card + * can be missing at the moment of the click: a short poll, which gives up quietly after a second. */ function show(release: { version: string }) { answer(release); - if (platform.caps.deviceDashboard && router.route !== "device") router.go("device"); let tries = 0; const settle = () => { const card = document.getElementById(FIRMWARE_ANCHOR); @@ -73,13 +67,7 @@ {/if}
- - {#if platform.caps.deviceDashboard} - show(release)}>View update - {:else} - - {/if} +
{/if} @@ -115,11 +103,4 @@ gap: 8px; margin-top: 6px; } - - /* The link-shaped primary: `.btn` is written for buttons, so undo the anchor's own colour rule - and keep the label from picking up an underline on hover. */ - a.btn.primary { - color: var(--parchment); - text-decoration: none; - } diff --git a/builder/web/src/components/coverage/CorridorPanel.svelte b/builder/web/src/components/coverage/CorridorPanel.svelte deleted file mode 100644 index 7be7e55b58..0000000000 --- a/builder/web/src/components/coverage/CorridorPanel.svelte +++ /dev/null @@ -1,594 +0,0 @@ - - - - - diff --git a/builder/web/src/components/coverage/CoverageHome.svelte b/builder/web/src/components/coverage/CoverageHome.svelte index aa6e98dff3..e41f18ddae 100644 --- a/builder/web/src/components/coverage/CoverageHome.svelte +++ b/builder/web/src/components/coverage/CoverageHome.svelte @@ -2,9 +2,7 @@ import { tick } from "svelte"; import type { CatalogClient } from "../../lib/catalog/client"; import { CoverageStore } from "../../lib/coverage/store.svelte"; - import { available } from "../../lib/platform/gating"; import DeviceStep from "../device/DeviceStep.svelte"; - import MapSendStep from "../device/MapSendStep.svelte"; import CoverageMap from "./CoverageMap.svelte"; import DownloadStep from "./DownloadStep.svelte"; import MapSummary from "./MapSummary.svelte"; @@ -115,11 +113,7 @@

Or send directly to device

- {#if available("deviceDashboard")} - - {:else} - - {/if} + diff --git a/builder/web/src/components/coverage/CoverageHome.svelte.test.ts b/builder/web/src/components/coverage/CoverageHome.svelte.test.ts index e122fa2a3f..6d74947135 100644 --- a/builder/web/src/components/coverage/CoverageHome.svelte.test.ts +++ b/builder/web/src/components/coverage/CoverageHome.svelte.test.ts @@ -14,8 +14,7 @@ vi.mock("./CoverageMap.svelte", async () => ({ default: (await import("../../../ vi.mock("./SkinStep.svelte", async () => ({ default: (await import("./ToolIcon.svelte")).default })); vi.mock("../device/DeviceStep.svelte", async () => ({ default: (await import("./ToolIcon.svelte")).default })); const host = vi.hoisted(() => ({ catalog: vi.fn(), catalogFetch: vi.fn(async () => new Response("gone", { status: 404 })) })); -vi.mock("../../lib/platform", () => ({ platform: { ...host, name: "web", caps: { deviceDashboard: false }, openMapOutput: null } })); -vi.mock("../../lib/platform/gating", () => ({ available: () => false })); +vi.mock("../../lib/platform", () => ({ platform: { ...host, name: "web" } })); const client = (body: string, url: string) => CatalogClient.fromBody(body, url, { fetchImpl: host.catalogFetch, attempts: 1 }); async function settle() { for (let n = 0; n < 20; n++) { await Promise.resolve(); await tick(); } } diff --git a/builder/web/src/components/coverage/CoverageMap.svelte b/builder/web/src/components/coverage/CoverageMap.svelte index f4215b6938..895d58b7ab 100644 --- a/builder/web/src/components/coverage/CoverageMap.svelte +++ b/builder/web/src/components/coverage/CoverageMap.svelte @@ -1,6 +1,6 @@ @@ -1264,35 +174,32 @@ stroke-width="1" /> {/each} - {#each proof.routes as d, k (k)} - - {/each}
{proofCaption(proof)}
{/if}
- {#if refusal} -

{refusal}

- {:else if estimateError} + {#if run.refusal} +

{run.refusal}

+ {:else if run.estimateError}

- Could not check memory requirements: {estimateError} -

- {:else if memoryCaution} -

{memoryCaution}

+ {:else if run.memoryCaution} +

{run.memoryCaution}

{/if}
- {#if phase === "idle" || phase === "cancelled" || phase === "error" || phase === "done"} + {#if run.phase === "idle" || run.phase === "cancelled" || run.phase === "error" || run.phase === "done"} - {:else}
- {#if phase !== "finalizing"} - + {#if run.phase !== "finalizing"} + {/if} - {#if phase === "downloading" && dlProgress} + {#if run.phase === "downloading" && run.dlProgress} - downloading cells — {dlProgress.completedCells}/{dlProgress.totalCells} · - {formatBytes(dlProgress.receivedBytes)} of {formatBytes(dlProgress.totalBytes)} - {#if cachedCells > 0}· {cachedCells} already on this computer ({formatBytes( - cachedBytes, + downloading cells — {run.dlProgress.completedCells}/{run.dlProgress.totalCells} · + {formatBytes(run.dlProgress.receivedBytes)} of {formatBytes(run.dlProgress.totalBytes)} + {#if run.cachedCells > 0}· {run.cachedCells} already on this computer ({formatBytes( + run.cachedBytes, )}){/if} - {:else if phase === "assembling"} + {:else if run.phase === "assembling"} - assembling — {ASM_PHASE_LABEL[asmPhase]} · {Math.round(asmFraction * 100)}%{#if readMode} - · cells {readMode}{/if} + assembling — {ASM_PHASE_LABEL[run.asmPhase]} · {Math.round(run.asmFraction * 100)}%{#if run.readMode} + · cells {run.readMode}{/if} - {:else if phase === "saving"} + {:else if run.phase === "saving"} - {output?.kind === "device" ? "sending the map" : "saving the map"}{#if runFileName} - — {runFileName}{/if} + {run.sendingToDevice ? "sending the map" : "saving the map"}{#if run.runFileName} + — {run.runFileName}{/if} - {:else if phase === "finalizing"} + {:else if run.phase === "finalizing"} finishing up — removing temporary map data {/if}
{/if} - {#if phase === "done"} + {#if run.phase === "done"}
- {#if lastRunKind === "device"} -

Assembled and sent {runFileName}.

+ {#if run.lastRunKind === "device"} +

Assembled and sent {run.runFileName}.

{:else} -

- {#if outputPath} - Saved {savedFile?.name} in - {outputPath}. - {:else} - Downloaded {savedFile?.name}. - {/if} -

+

Downloaded {run.savedFile?.name}.

{/if} - {#if savedFile} -

{formatBytes(savedFile.byteLength)}

+ {#if run.savedFile} +

{formatBytes(run.savedFile.byteLength)}

{/if} - {#if readMode} + {#if run.readMode}

- cells {readMode}{#if writeMode} - · map {writeMode}{/if}{#if cachedCells > 0} - · {cachedCells} reused from this computer ({formatBytes(cachedBytes)} not + cells {run.readMode}{#if run.writeMode} + · map {run.writeMode}{/if}{#if run.cachedCells > 0} + · {run.cachedCells} reused from this computer ({formatBytes(run.cachedBytes)} not downloaded){/if}

{/if} - {#each runWarnings as w, k (k)} + {#each run.runWarnings as w, k (k)}

{w}

{/each}
- {:else if phase === "error"} + {:else if run.phase === "error"}

- {#if incompleteFileRemains} - The map was not completed. Discard the file it left behind: {errorMessage} + {#if run.persisted} + The map was not completed. Discard the file it left behind: {run.errorMessage} {:else} - Nothing was saved: {errorMessage} + Nothing was saved: {run.errorMessage} {/if}

- {:else if phase === "cancelled"} + {:else if run.phase === "cancelled"}

- {#if incompleteFileRemains} + {#if run.persisted} Cancelled — discard the incomplete file it left behind. {:else} Cancelled — nothing was saved. diff --git a/builder/web/src/components/coverage/MapSummary.svelte.test.ts b/builder/web/src/components/coverage/MapSummary.svelte.test.ts index 6f62fef30d..009fbcb328 100644 --- a/builder/web/src/components/coverage/MapSummary.svelte.test.ts +++ b/builder/web/src/components/coverage/MapSummary.svelte.test.ts @@ -62,10 +62,8 @@ describe("MapSummary", () => { it.each([ { label: "a region border", kind: "region", drawnCells: ["border"], warns: false }, - ...["box", "lasso", "corridor"].flatMap((kind) => [ - { label: `a region and a fully covered ${kind}`, kind, drawnCells: ["full"], warns: false }, - { label: `a region and a partly covered ${kind}`, kind, drawnCells: ["full", "border"], warns: true }, - ]), + { label: "a region and a fully covered box", kind: "box", drawnCells: ["full"], warns: false }, + { label: "a region and a partly covered box", kind: "box", drawnCells: ["full", "border"], warns: true }, ])("discloses only affected drawn coverage for $label", async ({ kind, drawnCells, warns }) => { const region = { id: "region", kind: "region" }; const drawn = { id: "drawn", kind }; diff --git a/builder/web/src/components/coverage/PartsList.svelte b/builder/web/src/components/coverage/PartsList.svelte index 41381ba0b5..e0507e97a8 100644 --- a/builder/web/src/components/coverage/PartsList.svelte +++ b/builder/web/src/components/coverage/PartsList.svelte @@ -1,16 +1,10 @@ {#if parts.length === 0} @@ -28,7 +22,7 @@ }} > - {part.kind === "corridor" ? `Corridor — ${part.name}` : part.name} + {part.name} {#if regionError} {regionError} {#if part.kind === "region" && store.region(part.regionId)} @@ -47,27 +41,6 @@ {/each} - - {#if hasCorridor} -

-
- - ± {radiusKm} km -
- - store.setCorridorRadius(Number((e.currentTarget as HTMLInputElement).value) * 1000)} - /> -
- {/if} {/if} diff --git a/builder/web/src/components/coverage/SkinStep.svelte b/builder/web/src/components/coverage/SkinStep.svelte index fb5cf9df72..cfa9f245af 100644 --- a/builder/web/src/components/coverage/SkinStep.svelte +++ b/builder/web/src/components/coverage/SkinStep.svelte @@ -9,7 +9,8 @@ import { renderSkinPreviewFrames, type SkinPreviewFrame } from "../../lib/skin/preview"; import { confirmAction } from "../../lib/ui/confirm.svelte"; - let { store }: { store: CoverageStore } = $props(); + /** `plain`: only the choice, each skin with its name, with no note and no editor, for a window of the shell. */ + let { store, plain = false }: { store: CoverageStore; plain?: boolean } = $props(); let previewUrls = $state>({}); let customPreviewFrames = $state>({}); let editing = $state(null); @@ -44,7 +45,8 @@ }); $effect(() => { - const custom = store.skins.filter((skin) => isCustomSkinId(skin.id)); + // A catalog skin with no stored picture is drawn here, as a custom skin is. + const custom = store.skins.filter((skin) => isCustomSkinId(skin.id) || !skin.preview); const controller = new AbortController(); let live = true; if (custom.length === 0) { @@ -80,11 +82,11 @@
- - + +
-

Light and dark styles are included.

-
+{#if !plain}

Light and dark styles are included.

{/if} +
{#each visibleSkins as skin (skin.id)} {/each}
+{#if !plain}
{#if isCustomSkinId(selected.id)} @@ -134,6 +133,7 @@ {isCustomSkinId(selected.id) ? `Edit ${mode}` : `Customize ${mode}`}
+{/if} {#if editing} (editing = null)} /> @@ -146,6 +146,10 @@ gap: 10px; } + .cards.plain { + margin-top: 12px; + } + .theme-tabs { display: inline-flex; padding: 3px; diff --git a/builder/web/src/components/coverage/ToolIcon.svelte b/builder/web/src/components/coverage/ToolIcon.svelte index e5467a1e0f..90963e7e3b 100644 --- a/builder/web/src/components/coverage/ToolIcon.svelte +++ b/builder/web/src/components/coverage/ToolIcon.svelte @@ -1,11 +1,11 @@ - {:else if kind === "box"} + {:else} - {:else if kind === "corridor"} - - - - - {:else} - - - - {/if} diff --git a/builder/web/src/components/device/CardFormat.svelte b/builder/web/src/components/device/CardFormat.svelte index ead8f97fae..665000ba4c 100644 --- a/builder/web/src/components/device/CardFormat.svelte +++ b/builder/web/src/components/device/CardFormat.svelte @@ -1,6 +1,5 @@ - - {#snippet children()} - {#if deviceHolder.error} - - {:else if !session} -

Looking for a device…

- {:else if session.status === "unsupported"} -

{session.error}

- {:else if session.status === "ready" && session.client} -
-

- - Connected - {#if session.info}{session.info.hardwareRevision}{/if} -

- -
- - {#await loadSurfaces()} -

Loading…

- {:then { default: Surfaces }} - - {:catch} - - {/await} - {:else if session.status === "connecting"} -

Connecting…

- {:else} - {#if deviceHolder.interrupted} - - {/if} -
- -

Connect by USB, then choose your device.

-
- {#if session.status === "error" && session.error} - - {/if} - {/if} - {/snippet} - - {#snippet unavailable(reason)} - - {/snippet} -
+{#if deviceHolder.error} + +{:else if !session} +

Looking for a device…

+{:else if session.status === "unsupported"} +

{session.error}

+{:else if session.status === "ready" && session.client} +
+

+ + Connected + {#if session.info}{session.info.hardwareRevision}{/if} +

+ +
+ + {#await loadSurfaces()} +

Loading…

+ {:then { default: Surfaces }} + + {:catch} + + {/await} +{:else if session.status === "connecting"} +

Connecting…

+{:else} + {#if deviceHolder.interrupted} + + {/if} +
+ +

Connect by USB, then choose your device.

+
+ {#if session.status === "error" && session.error} + + {/if} +{/if} diff --git a/builder/web/src/components/device/PopMenu.svelte b/builder/web/src/components/device/PopMenu.svelte deleted file mode 100644 index 68e00e3156..0000000000 --- a/builder/web/src/components/device/PopMenu.svelte +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - diff --git a/builder/web/src/components/device/PreviewModal.svelte b/builder/web/src/components/device/PreviewModal.svelte deleted file mode 100644 index f29f99b7d2..0000000000 --- a/builder/web/src/components/device/PreviewModal.svelte +++ /dev/null @@ -1,932 +0,0 @@ - - - - - - - - diff --git a/builder/web/src/components/device/RideExport.svelte b/builder/web/src/components/device/RideExport.svelte index 0c4ba692b5..bca13b876a 100644 --- a/builder/web/src/components/device/RideExport.svelte +++ b/builder/web/src/components/device/RideExport.svelte @@ -23,7 +23,6 @@ --> - -
-
-

Ride library

- - {listed.length} ride{listed.length === 1 ? "" : "s"}{#if totalKm > 0} · {totalKm.toLocaleString()} km - total{/if} - - - - - {#if rides && scope} - - {:else} - Plug the device in to pull new rides. - {/if} - -
- -
-
- {#if error} - - {/if} - - {#if report && report.failed.length > 0} - - {/if} - {#if report && report.recording > 0} -

- {report.recording === 1 ? "One ride is" : `${report.recording} rides are`} still being - recorded on the device and could not be copied. Finish - {report.recording === 1 ? "it" : "them"} there, then pull again. -

- {/if} - - {#if listed.length === 0} -

- No rides here yet. Plug the device in and pull — each ride lands as a GPX file in the - folder above, where you can back it up or drag it into anything that reads GPX. -

- {:else} -
    - {#each listed as ride (ride.key)} - {@const path = trackPath(ride.track, PREVIEW.width, PREVIEW.height)} -
  • (hovered = { key: ride.key, from: "list" })} - onmouseleave={() => (hovered = null)} - > - - - -
  • - {/each} -
- - {#if missingArchive > 0} -

- {missingArchive} ride{missingArchive === 1 ? "" : "s"} listed here - {missingArchive === 1 ? "is" : "are"} no longer on this computer — pull from the - device to restore {missingArchive === 1 ? "it" : "them"}. -

- {/if} - {/if} - - -

- Copying a ride here does not tell the device anything — over the cable a ride is read and - nothing more, so the device still counts every ride as un-copied and keeps it under its own - rules. Check Settings → Rides on the device for how long it keeps one; the - app cannot read that setting. The copies in this folder are yours and are never deleted by - this app. -

- - -
- -
- (hovered = key ? { key, from: "map" } : null)} - onopen={openByKey} - /> -
-
-
- - diff --git a/builder/web/src/components/device/RideMap.svelte b/builder/web/src/components/device/RideMap.svelte deleted file mode 100644 index 4c755dcc2c..0000000000 --- a/builder/web/src/components/device/RideMap.svelte +++ /dev/null @@ -1,209 +0,0 @@ - - - -
- - diff --git a/builder/web/src/components/device/RideTiles.svelte b/builder/web/src/components/device/RideTiles.svelte deleted file mode 100644 index 794575b205..0000000000 --- a/builder/web/src/components/device/RideTiles.svelte +++ /dev/null @@ -1,160 +0,0 @@ - - - -
- {#each rides as ride (ride.objectId)} - {@const recording = isRecording(ride)} - {@const held = heldHere?.has(ride.objectId) ?? false} - onopen(ride)} - > - {#snippet thumb()} - {@const track = trackFor(ride.objectId)} - - - {#snippet tag()} - {#if recording} - recording - {:else if heldHere} - {#if held} - in library - {:else} - not backed up - {/if} - {/if} - {/snippet} - - {/snippet} - -

{nameOf(ride)}

- -

- {recording ? "still on the device" : formatBytes(Number(ride.payloadLength))} -

-
- {#if onpull} - - {/if} -
- {/each} -
- - diff --git a/builder/web/src/components/device/RouteTiles.svelte b/builder/web/src/components/device/RouteTiles.svelte deleted file mode 100644 index 46a243a8e0..0000000000 --- a/builder/web/src/components/device/RouteTiles.svelte +++ /dev/null @@ -1,152 +0,0 @@ - - - -
- {#each routes as route (route.objectId)} - onopen(route)}> - {#snippet thumb()} - {@const track = trackFor(route.objectId)} - - - {/snippet} - - {#if editing && editing.id === route.objectId} - - commitEdit(route)} - onkeydown={(e) => onEditKey(e, route)} - /> - {:else} -

{nameOf(route)}

- {/if} -

{formatBytes(Number(route.payloadLength))}

-
- - - {#each trips as trip (trip.objectId)} - - {/each} - - - -
- {/each} - {@render children?.()} -
- - diff --git a/builder/web/src/components/device/Tile.svelte b/builder/web/src/components/device/Tile.svelte deleted file mode 100644 index e585030211..0000000000 --- a/builder/web/src/components/device/Tile.svelte +++ /dev/null @@ -1,118 +0,0 @@ - - - -
- {@render thumb?.()} -
- {@render children?.()} -
-
- - diff --git a/builder/web/src/components/device/TrackThumb.svelte b/builder/web/src/components/device/TrackThumb.svelte deleted file mode 100644 index 6eeecc39cc..0000000000 --- a/builder/web/src/components/device/TrackThumb.svelte +++ /dev/null @@ -1,127 +0,0 @@ - - - -
- {#if drawn.length > 0} - - {/if} - {#if tag} - {@render tag()} - {/if} -
- - diff --git a/builder/web/src/components/device/TripBand.svelte b/builder/web/src/components/device/TripBand.svelte deleted file mode 100644 index c80edca10d..0000000000 --- a/builder/web/src/components/device/TripBand.svelte +++ /dev/null @@ -1,356 +0,0 @@ - - - -
- -
-
- {#if editing !== null} - - - {:else} -

{name}

- {/if} -

- {#if stageCount !== null}{stageCount} stage{stageCount === 1 ? "" : "s"}{/if} -

- - - - -
- {#if trip.detail === null} -

The trip's stage list could not be read.

- {:else} - {#each stages as stage, index (`${stage.id}-${index}`)} -
- - {#if stage.route} - {@const route = stage.route} - - {:else} - - Route {stage.id} - no longer on the device - - {/if} - - - - - -
- {/each} - {/if} -
-
- - diff --git a/builder/web/src/components/device/TripDropDialog.svelte b/builder/web/src/components/device/TripDropDialog.svelte deleted file mode 100644 index 353f5d7a30..0000000000 --- a/builder/web/src/components/device/TripDropDialog.svelte +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - - - diff --git a/builder/web/src/components/planner/CompareList.svelte b/builder/web/src/components/planner/CompareList.svelte index 76d7c99e04..f2315d9cf9 100644 --- a/builder/web/src/components/planner/CompareList.svelte +++ b/builder/web/src/components/planner/CompareList.svelte @@ -1,7 +1,9 @@ + + { if (open && !box?.contains(event.target as Node)) open = false; }} /> + +{#if credits.length} + +
+ {credits.join(' · ')} + +
+{/if} + + diff --git a/builder/web/src/components/planner/DayRow.svelte b/builder/web/src/components/planner/DayRow.svelte index f7d4925a3f..16cafaf897 100644 --- a/builder/web/src/components/planner/DayRow.svelte +++ b/builder/web/src/components/planner/DayRow.svelte @@ -7,6 +7,8 @@ import { kindLabel, sleepIcon } from '../../lib/planner/search/presentation'; import { dayStops, duration, planView, type ItineraryDay, type RoutePoint, type Trip, type Day } from '../../lib/planner/editor'; import type { RoutingLine } from '../../lib/planner/routing'; + import { distanceIn, heightIn, heightUnit } from '../../lib/settings/format'; + import { settings } from '../../lib/settings/settings.svelte'; let { trip, line, day, days, theme, scale, expanded, choosing, conflict, selectedId, revealId, hoveredId = null, onHover, calendar, @@ -79,9 +81,9 @@ {day.number} Day {day.number} - {duration(day.hours)} · ↑ {ascentKnown ? day.ascent : '—'} m · ↓ {ascentKnown ? day.descent : '—'} m{day.pinned?.placeKind ? ` · ${kindLabel(day.pinned.placeKind)}` : ''} + {duration(day.hours)} · ↑ {ascentKnown ? Math.round(heightIn(day.ascent)) : '—'} {heightUnit()} · ↓ {ascentKnown ? Math.round(heightIn(day.descent)) : '—'} {heightUnit()}{day.pinned?.placeKind ? ` · ${kindLabel(day.pinned.placeKind)}` : ''} - {day.distance.toFixed(1)}km + {distanceIn(day.distance * 1000).toFixed(1)}{settings.units}