Let a Windows release, a Linux or Windows cable, and a future Developer ID join the desktop build.
The installer job was waiting on a commented matrix row, USB stayed on Image Capture, face detection could not read the Windows CPU, and notarisation had nowhere to put an Apple account.
This commit is contained in:
1 parent
2a612a6f9a
commit
e6b5f2e390
13 files changed
+1358
-97
No files matched your search
@@ -1,8 +1,9 @@
|
|||||||
name: desktop-release
|
name: desktop-release
|
||||||
# Tag `desktop-vX.Y.Z` builds the desktop installers and attaches them to a Gitea release.
|
# Tag `desktop-vX.Y.Z` builds the desktop installers and attaches them to a Gitea release.
|
||||||
# Linux builds on the standard runner. macOS (.dmg) builds on a Mac registered as a runner with the label "macos"
|
# Linux builds on the standard runner. macOS (.dmg) builds on a Mac registered as a runner with the label "macos"
|
||||||
# (infra/desktop/macos-runner.sh, once); a release made while that Mac is off waits for it. Windows (.msi) needs a
|
# (infra/desktop/macos-runner.sh, once); a release made while that Mac is off waits for it. Windows (.msi) builds
|
||||||
# runner labelled "windows": register one, then uncomment its entry.
|
# on a runner labelled "windows" (Git bash, plus the WebView2 step). No Windows runner is registered yet, so a
|
||||||
|
# tag waits on that job until one is online. Notarisation runs only when the Apple secrets below are set.
|
||||||
#
|
#
|
||||||
# Self-updates (apps/desktop/src-tauri/src/updater.rs): with the secret TAURI_SIGNING_PRIVATE_KEY (and
|
# Self-updates (apps/desktop/src-tauri/src/updater.rs): with the secret TAURI_SIGNING_PRIVATE_KEY (and
|
||||||
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD) and the variable TAURI_UPDATER_PUBKEY set (`tauri signer generate`), each job
|
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD) and the variable TAURI_UPDATER_PUBKEY set (`tauri signer generate`), each job
|
||||||
@@ -14,6 +15,10 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
# Windows runners default to PowerShell. Git bash is what the rest of this job is written for.
|
||||||
|
shell: bash
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -25,9 +30,10 @@ jobs:
|
|||||||
bundles: dmg,app
|
bundles: dmg,app
|
||||||
platform: darwin-universal
|
platform: darwin-universal
|
||||||
args: --target universal-apple-darwin
|
args: --target universal-apple-darwin
|
||||||
# - runner: windows
|
- runner: windows
|
||||||
# bundles: msi
|
bundles: msi
|
||||||
# platform: windows-x86_64
|
platform: windows-x86_64
|
||||||
|
args: ""
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
env:
|
env:
|
||||||
VITE_API_URL: https://api.next.photoreport.pt
|
VITE_API_URL: https://api.next.photoreport.pt
|
||||||
@@ -35,13 +41,23 @@ jobs:
|
|||||||
PHOTOREPORT_UPDATER_PUBKEY: ${{ vars.TAURI_UPDATER_PUBKEY }}
|
PHOTOREPORT_UPDATER_PUBKEY: ${{ vars.TAURI_UPDATER_PUBKEY }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||||
|
# Empty until a Developer ID and an app-specific password (or an App Store Connect API key) are stored.
|
||||||
|
# Tauri notarises only when a full set is present; the install step drops blank values so a missing
|
||||||
|
# secret does not turn into a failed notarisation.
|
||||||
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||||||
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
|
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
|
||||||
|
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
||||||
|
APPLE_API_KEY_PATH: ${{ secrets.APPLE_API_KEY_PATH }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: System libraries (Linux)
|
- name: System libraries (Linux)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libsecret-1-dev
|
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libsecret-1-dev libgphoto2-dev pkg-config
|
||||||
- uses: pnpm/action-setup@v4
|
- uses: pnpm/action-setup@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
@@ -68,6 +84,10 @@ jobs:
|
|||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
test "$ok" = 1
|
test "$ok" = 1
|
||||||
|
- name: WebView2 runtime (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: powershell
|
||||||
|
run: powershell -NoProfile -ExecutionPolicy Bypass -File infra/desktop/windows-webview2.ps1
|
||||||
- name: Both Mac processors (universal app)
|
- name: Both Mac processors (universal app)
|
||||||
if: runner.os == 'macOS'
|
if: runner.os == 'macOS'
|
||||||
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
|
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
|
||||||
@@ -82,11 +102,32 @@ jobs:
|
|||||||
- name: Installers
|
- name: Installers
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
# Blank Apple secrets must not look "set", or Tauri tries to notarise with an empty account.
|
||||||
|
for name in APPLE_SIGNING_IDENTITY APPLE_ID APPLE_PASSWORD APPLE_TEAM_ID APPLE_API_ISSUER APPLE_API_KEY APPLE_API_KEY_PATH; do
|
||||||
|
if [[ -z "${!name:-}" ]]; then
|
||||||
|
unset "$name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
extra=()
|
extra=()
|
||||||
# Signed updater artifacts only when the release key is there (a build without it still works).
|
# Updater artifacts when the release key is there. A Developer ID also turns on the hardened
|
||||||
# The bundler checks each signature against plugins.updater.pubkey, so the public key goes into the config too.
|
# runtime with the entitlements the bundled ONNX library needs, which is what notarisation requires.
|
||||||
if [[ -n "$TAURI_SIGNING_PRIVATE_KEY" ]]; then
|
config="$(node -e '
|
||||||
extra=(--config "$(node -e 'console.log(JSON.stringify({bundle:{createUpdaterArtifacts:true},plugins:{updater:{pubkey:process.env.PHOTOREPORT_UPDATER_PUBKEY}}}))')")
|
const bundle = {};
|
||||||
|
const plugins = {};
|
||||||
|
if (process.env.TAURI_SIGNING_PRIVATE_KEY) {
|
||||||
|
bundle.createUpdaterArtifacts = true;
|
||||||
|
plugins.updater = { pubkey: process.env.PHOTOREPORT_UPDATER_PUBKEY };
|
||||||
|
}
|
||||||
|
if (process.platform === "darwin" && process.env.APPLE_SIGNING_IDENTITY) {
|
||||||
|
bundle.macOS = { hardenedRuntime: true, entitlements: "entitlements.plist" };
|
||||||
|
}
|
||||||
|
const cfg = {};
|
||||||
|
if (Object.keys(bundle).length) cfg.bundle = bundle;
|
||||||
|
if (Object.keys(plugins).length) cfg.plugins = plugins;
|
||||||
|
if (Object.keys(cfg).length) process.stdout.write(JSON.stringify(cfg));
|
||||||
|
')"
|
||||||
|
if [[ -n "$config" ]]; then
|
||||||
|
extra=(--config "$config")
|
||||||
fi
|
fi
|
||||||
pnpm --filter @photoreport/desktop exec tauri build --bundles ${{ matrix.bundles }} ${{ matrix.args }} "${extra[@]}"
|
pnpm --filter @photoreport/desktop exec tauri build --bundles ${{ matrix.bundles }} ${{ matrix.args }} "${extra[@]}"
|
||||||
- name: Update manifest
|
- name: Update manifest
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ What the shell adds today:
|
|||||||
- Refresh token in the OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service).
|
- Refresh token in the OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service).
|
||||||
Without a keychain the session stays in memory and ends when the app closes.
|
Without a keychain the session stays in memory and ends when the app closes.
|
||||||
- Local FTP server for cameras (`src/ftp.rs`, Library → **FTP local**). See below.
|
- Local FTP server for cameras (`src/ftp.rs`, Library → **FTP local**). See below.
|
||||||
- USB tether (`src/camera.rs` + `camera_mac.m`, Library → **USB**): pulses the PTP session so the body stays
|
- USB tether (Library → **USB**): a short PTP session lists the card and downloads what was asked, then
|
||||||
shootable (no permanent computer/busy screen), pulls new shots to the open event, syncs the clock. EOS Utility
|
closes so the body can shoot. macOS uses Image Capture (`camera_mac.m`). Linux uses libgphoto2. Windows uses
|
||||||
must not hold the cable.
|
the portable-device API. EOS Utility must not hold the cable. The Mac build is the one that sets the camera clock.
|
||||||
- Local catalogue (`src/catalog.rs`, Preferências → **Catálogo local**). See below.
|
- Local catalogue (`src/catalog.rs`, Preferências → **Catálogo local**). See below.
|
||||||
- Works without network: when the server can't be reached at start-up, the window opens the copy of the web app
|
- Works without network: when the server can't be reached at start-up, the window opens the copy of the web app
|
||||||
bundled in the installer (photo engine included), so the catalogue, local FTP and editing originals on disk go on;
|
bundled in the installer (photo engine included), so the catalogue, local FTP and editing originals on disk go on;
|
||||||
|
|||||||
Generated
+282
-58
@@ -283,7 +283,7 @@ dependencies = [
|
|||||||
"futures-lite",
|
"futures-lite",
|
||||||
"parking",
|
"parking",
|
||||||
"polling",
|
"polling",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"slab",
|
"slab",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
@@ -314,7 +314,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"event-listener",
|
"event-listener",
|
||||||
"futures-lite",
|
"futures-lite",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -340,7 +340,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"signal-hook-registry",
|
"signal-hook-registry",
|
||||||
"slab",
|
"slab",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
@@ -465,6 +465,29 @@ version = "1.8.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bindgen"
|
||||||
|
version = "0.65.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"cexpr",
|
||||||
|
"clang-sys",
|
||||||
|
"lazy_static",
|
||||||
|
"lazycell",
|
||||||
|
"log",
|
||||||
|
"peeking_take_while",
|
||||||
|
"prettyplease",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"regex",
|
||||||
|
"rustc-hash 1.1.0",
|
||||||
|
"shlex 1.3.0",
|
||||||
|
"syn 2.0.119",
|
||||||
|
"which",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-set"
|
name = "bit-set"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
@@ -722,7 +745,7 @@ dependencies = [
|
|||||||
"io-lifetimes 3.0.1",
|
"io-lifetimes 3.0.1",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"maybe-owned",
|
"maybe-owned",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"rustix-linux-procfs",
|
"rustix-linux-procfs",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
"winx",
|
"winx",
|
||||||
@@ -737,7 +760,7 @@ dependencies = [
|
|||||||
"cap-primitives",
|
"cap-primitives",
|
||||||
"io-extras",
|
"io-extras",
|
||||||
"io-lifetimes 3.0.1",
|
"io-lifetimes 3.0.1",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -792,7 +815,7 @@ dependencies = [
|
|||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
"shlex",
|
"shlex 2.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -801,6 +824,15 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cexpr"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
||||||
|
dependencies = [
|
||||||
|
"nom 7.1.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfb"
|
name = "cfb"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@@ -867,7 +899,7 @@ dependencies = [
|
|||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -881,6 +913,17 @@ dependencies = [
|
|||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clang-sys"
|
||||||
|
version = "1.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
|
||||||
|
dependencies = [
|
||||||
|
"glob",
|
||||||
|
"libc",
|
||||||
|
"libloading 0.8.9",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "codespan-reporting"
|
name = "codespan-reporting"
|
||||||
version = "0.13.1"
|
version = "0.13.1"
|
||||||
@@ -1921,7 +1964,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a"
|
checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"io-lifetimes 2.0.4",
|
"io-lifetimes 2.0.4",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2298,6 +2341,18 @@ dependencies = [
|
|||||||
"system-deps",
|
"system-deps",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gphoto2"
|
||||||
|
version = "3.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "86aa5aa5f28a0915023d155f7ccc62ffc1f6ae1db888b281fae4e84228766442"
|
||||||
|
dependencies = [
|
||||||
|
"crossbeam-channel",
|
||||||
|
"libc",
|
||||||
|
"libgphoto2_sys",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-allocator"
|
name = "gpu-allocator"
|
||||||
version = "0.28.0"
|
version = "0.28.0"
|
||||||
@@ -2309,7 +2364,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"presser",
|
"presser",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2479,6 +2534,15 @@ version = "1.1.15"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1ad320b3b96fb2a455a0726d16efe0a5afdbd34b71dea5bc53b05ea057714d4e"
|
checksum = "1ad320b3b96fb2a455a0726d16efe0a5afdbd34b71dea5bc53b05ea057714d4e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "home"
|
||||||
|
version = "0.5.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "html5ever"
|
name = "html5ever"
|
||||||
version = "0.39.0"
|
version = "0.39.0"
|
||||||
@@ -2620,7 +2684,7 @@ dependencies = [
|
|||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2938,7 +3002,7 @@ dependencies = [
|
|||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"portable-atomic-util",
|
"portable-atomic-util",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2954,7 +3018,7 @@ dependencies = [
|
|||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"portable-atomic-util",
|
"portable-atomic-util",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3065,7 +3129,7 @@ dependencies = [
|
|||||||
"simd_cesu8",
|
"simd_cesu8",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3378,6 +3442,12 @@ dependencies = [
|
|||||||
"spin",
|
"spin",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazycell"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libappindicator"
|
name = "libappindicator"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@@ -3427,6 +3497,16 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libgphoto2_sys"
|
||||||
|
version = "1.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "63434be819e4b8933a4df944b3033a1799259f1e37b219a4fb11f2fc01123a9e"
|
||||||
|
dependencies = [
|
||||||
|
"bindgen",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libloading"
|
name = "libloading"
|
||||||
version = "0.7.4"
|
version = "0.7.4"
|
||||||
@@ -3444,7 +3524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3810,6 +3890,12 @@ version = "0.19.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c"
|
checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.4.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -4160,7 +4246,7 @@ dependencies = [
|
|||||||
"derive_builder",
|
"derive_builder",
|
||||||
"getset",
|
"getset",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys 0.12.1",
|
||||||
"log",
|
"log",
|
||||||
"neli-proc-macros",
|
"neli-proc-macros",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
@@ -4829,7 +4915,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4844,6 +4930,12 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
|
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "peeking_take_while"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pem-rfc7468"
|
name = "pem-rfc7468"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -4982,6 +5074,7 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
"chrono",
|
"chrono",
|
||||||
"dirs 6.0.0",
|
"dirs 6.0.0",
|
||||||
|
"gphoto2",
|
||||||
"image",
|
"image",
|
||||||
"keyring",
|
"keyring",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -5004,6 +5097,7 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
"unftp-core",
|
"unftp-core",
|
||||||
"unftp-sbe-fs",
|
"unftp-sbe-fs",
|
||||||
|
"windows 0.61.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5128,7 +5222,7 @@ dependencies = [
|
|||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5212,6 +5306,16 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
|
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prettyplease"
|
||||||
|
version = "0.2.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"syn 2.0.119",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "primeorder"
|
name = "primeorder"
|
||||||
version = "0.13.6"
|
version = "0.13.6"
|
||||||
@@ -5743,6 +5847,19 @@ dependencies = [
|
|||||||
"nom 7.1.3",
|
"nom 7.1.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.38.44"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.13.2",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys 0.4.15",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "1.1.6"
|
version = "1.1.6"
|
||||||
@@ -5752,7 +5869,7 @@ dependencies = [
|
|||||||
"bitflags 2.13.2",
|
"bitflags 2.13.2",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys 0.12.1",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5763,7 +5880,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056"
|
checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6279,6 +6396,12 @@ dependencies = [
|
|||||||
"digest 0.11.3",
|
"digest 0.11.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shlex"
|
name = "shlex"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
@@ -6697,8 +6820,8 @@ dependencies = [
|
|||||||
"tao-macros",
|
"tao-macros",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"url",
|
"url",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
"windows-version",
|
"windows-version",
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
]
|
]
|
||||||
@@ -6779,7 +6902,7 @@ dependencies = [
|
|||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
"window-vibrancy",
|
"window-vibrancy",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6922,7 +7045,7 @@ dependencies = [
|
|||||||
"tauri-plugin",
|
"tauri-plugin",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
"url",
|
"url",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"zbus 5.19.0",
|
"zbus 5.19.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -6982,7 +7105,7 @@ dependencies = [
|
|||||||
"url",
|
"url",
|
||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7006,7 +7129,7 @@ dependencies = [
|
|||||||
"url",
|
"url",
|
||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"wry",
|
"wry",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -7068,7 +7191,7 @@ dependencies = [
|
|||||||
"fastrand",
|
"fastrand",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -7904,8 +8027,8 @@ checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"webview2-com-macros",
|
"webview2-com-macros",
|
||||||
"webview2-com-sys",
|
"webview2-com-sys",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7926,8 +8049,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"
|
checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8059,8 +8182,8 @@ dependencies = [
|
|||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
"wgpu-naga-bridge",
|
"wgpu-naga-bridge",
|
||||||
"wgpu-types",
|
"wgpu-types",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8089,6 +8212,18 @@ dependencies = [
|
|||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "which"
|
||||||
|
version = "4.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
"home",
|
||||||
|
"once_cell",
|
||||||
|
"rustix 0.38.44",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@@ -8136,16 +8271,38 @@ dependencies = [
|
|||||||
"windows-version",
|
"windows-version",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows"
|
||||||
|
version = "0.61.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
|
||||||
|
dependencies = [
|
||||||
|
"windows-collections 0.2.0",
|
||||||
|
"windows-core 0.61.2",
|
||||||
|
"windows-future 0.2.1",
|
||||||
|
"windows-link 0.1.3",
|
||||||
|
"windows-numerics 0.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows"
|
name = "windows"
|
||||||
version = "0.62.2"
|
version = "0.62.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
|
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-collections",
|
"windows-collections 0.3.2",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
"windows-future",
|
"windows-future 0.3.2",
|
||||||
"windows-numerics",
|
"windows-numerics 0.3.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
@@ -8154,7 +8311,20 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
|
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core",
|
"windows-core 0.62.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]]
|
[[package]]
|
||||||
@@ -8165,9 +8335,20 @@ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement",
|
"windows-implement",
|
||||||
"windows-interface",
|
"windows-interface",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
"windows-result",
|
"windows-result 0.4.1",
|
||||||
"windows-strings",
|
"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 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8176,9 +8357,9 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
|
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
"windows-threading",
|
"windows-threading 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8203,20 +8384,36 @@ dependencies = [
|
|||||||
"syn 2.0.119",
|
"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]]
|
[[package]]
|
||||||
name = "windows-link"
|
name = "windows-link"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
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]]
|
[[package]]
|
||||||
name = "windows-numerics"
|
name = "windows-numerics"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
|
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8225,9 +8422,18 @@ version = "0.6.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
|
checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
"windows-result",
|
"windows-result 0.4.1",
|
||||||
"windows-strings",
|
"windows-strings 0.5.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
@@ -8236,7 +8442,16 @@ version = "0.4.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"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]]
|
[[package]]
|
||||||
@@ -8245,7 +8460,7 @@ version = "0.5.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8290,7 +8505,7 @@ version = "0.61.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8330,7 +8545,7 @@ version = "0.53.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
|
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
"windows_aarch64_gnullvm 0.53.1",
|
"windows_aarch64_gnullvm 0.53.1",
|
||||||
"windows_aarch64_msvc 0.53.1",
|
"windows_aarch64_msvc 0.53.1",
|
||||||
"windows_i686_gnu 0.53.1",
|
"windows_i686_gnu 0.53.1",
|
||||||
@@ -8341,13 +8556,22 @@ dependencies = [
|
|||||||
"windows_x86_64_msvc 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]]
|
[[package]]
|
||||||
name = "windows-threading"
|
name = "windows-threading"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
|
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8356,7 +8580,7 @@ version = "0.1.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631"
|
checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8584,8 +8808,8 @@ dependencies = [
|
|||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webkit2gtk-sys",
|
"webkit2gtk-sys",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
"windows",
|
"windows 0.62.2",
|
||||||
"windows-core",
|
"windows-core 0.62.2",
|
||||||
"windows-version",
|
"windows-version",
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
]
|
]
|
||||||
@@ -8646,7 +8870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08"
|
checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8742,7 +8966,7 @@ dependencies = [
|
|||||||
"hex",
|
"hex",
|
||||||
"libc",
|
"libc",
|
||||||
"ordered-stream",
|
"ordered-stream",
|
||||||
"rustix",
|
"rustix 1.1.6",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
"tracing",
|
"tracing",
|
||||||
|
|||||||
@@ -51,6 +51,21 @@ rustls = { version = "0.23", default-features = false, features = ["ring"] }
|
|||||||
[target.'cfg(all(target_os = "macos", target_arch = "aarch64"))'.dependencies]
|
[target.'cfg(all(target_os = "macos", target_arch = "aarch64"))'.dependencies]
|
||||||
ort = { version = "=2.0.0-rc.14", default-features = false, features = ["std", "download-binaries", "copy-dylibs", "api-31", "tls-native", "coreml"] }
|
ort = { version = "=2.0.0-rc.14", default-features = false, features = ["std", "download-binaries", "copy-dylibs", "api-31", "tls-native", "coreml"] }
|
||||||
|
|
||||||
|
# Linux USB: libgphoto2 (PTP). The Mac build keeps Image Capture and does not link this.
|
||||||
|
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
|
||||||
|
gphoto2 = "=3.4.1"
|
||||||
|
|
||||||
|
# Windows USB: the portable-device API, which speaks PTP through the driver Windows already loaded.
|
||||||
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
|
windows = { version = "0.61", features = [
|
||||||
|
"Win32_Devices_PortableDevices",
|
||||||
|
"Win32_Foundation",
|
||||||
|
"Win32_System_Com",
|
||||||
|
"Win32_System_Com_StructuredStorage",
|
||||||
|
"Win32_System_Ole",
|
||||||
|
"Win32_System_Variant",
|
||||||
|
] }
|
||||||
|
|
||||||
# Release builds: no symbols or debug info, whole-program optimisation, no unwinding tables. The binary only tells
|
# Release builds: no symbols or debug info, whole-program optimisation, no unwinding tables. The binary only tells
|
||||||
# a disassembler what machine code does, not what the functions were called.
|
# a disassembler what machine code does, not what the functions were called.
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<!-- The bundled ONNX runtime is not an Apple-signed library. Notarisation requires the hardened runtime, and that runtime refuses the library unless this is set. -->
|
||||||
|
<key>com.apple.security.cs.disable-library-validation</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.allow-jit</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
//! USB tether (macOS). A Canon (or any PTP body) does not show up as a disk; ImageCaptureCore
|
//! USB tether. A PTP body does not show up as a disk.
|
||||||
//! (`camera_mac.m`) briefly opens a PTP session to list/download, then closes it so the body can
|
//! macOS uses Image Capture (`camera_mac.m`): a short session lists and downloads, then closes so
|
||||||
//! shoot (a held session + `requestEnableTethering` put many cameras on the computer/busy screen).
|
//! the body can shoot. Linux uses libgphoto2 and Windows the portable-device API (`camera_link`),
|
||||||
//! The session stays off until the photographer turns the cable on. Nothing is copied until they
|
//! with the same open-then-close rhythm. Nothing is copied until the photographer picks files
|
||||||
//! pick files (`camera_import`) or auto-ingest asks. Chosen files land in `<ingest>/.usb` and the
|
//! (`camera_import`) or auto-ingest asks. Chosen files land in `<ingest>/.usb`.
|
||||||
//! web app polls `camera_take` to file them like a local-FTP photo.
|
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::{Mutex, OnceLock};
|
use std::sync::{Mutex, OnceLock};
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
#[path = "camera_link.rs"]
|
||||||
|
mod link;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::ftp::{FtpState, IncomingFile};
|
use crate::ftp::{FtpState, IncomingFile};
|
||||||
@@ -51,7 +55,7 @@ pub struct CameraFile {
|
|||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CameraStatus {
|
pub struct CameraStatus {
|
||||||
/// False on systems without ImageCaptureCore (the button stays hidden).
|
/// False only when this build has no USB backend (the button stays hidden).
|
||||||
pub supported: bool,
|
pub supported: bool,
|
||||||
pub tether: bool,
|
pub tether: bool,
|
||||||
pub devices: Vec<CameraDevice>,
|
pub devices: Vec<CameraDevice>,
|
||||||
@@ -115,6 +119,47 @@ fn queue() -> &'static Mutex<Vec<String>> {
|
|||||||
Q.get_or_init(|| Mutex::new(Vec::new()))
|
Q.get_or_init(|| Mutex::new(Vec::new()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(target_os = "macos", allow(dead_code))]
|
||||||
|
pub(crate) fn enqueue_line(line: String) {
|
||||||
|
if let Ok(mut q) = queue().lock() {
|
||||||
|
q.push(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One still on the card, before it is marked new or already fetched.
|
||||||
|
pub(crate) struct ListedShot {
|
||||||
|
pub name: String,
|
||||||
|
pub size: u64,
|
||||||
|
pub created_ms: Option<i64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The first listing of a tether session is the baseline (nothing is "new"). Later listings mark
|
||||||
|
/// names that were not on that baseline. `fetched` is what this computer already copied.
|
||||||
|
pub(crate) fn files_on_card(
|
||||||
|
shots: &[ListedShot],
|
||||||
|
known: &HashSet<String>,
|
||||||
|
fetched: &HashSet<String>,
|
||||||
|
listing_is_live: bool,
|
||||||
|
) -> Vec<CameraFile> {
|
||||||
|
let mut files = Vec::new();
|
||||||
|
for shot in shots {
|
||||||
|
let is_new = if listing_is_live {
|
||||||
|
!known.contains(&shot.name)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
let imported = fetched.contains(&shot.name);
|
||||||
|
files.push(CameraFile {
|
||||||
|
name: shot.name.clone(),
|
||||||
|
size: shot.size,
|
||||||
|
created_ms: shot.created_ms,
|
||||||
|
is_new,
|
||||||
|
imported,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
files
|
||||||
|
}
|
||||||
|
|
||||||
impl CameraState {
|
impl CameraState {
|
||||||
fn drain(&self) {
|
fn drain(&self) {
|
||||||
let pending = match queue().lock() {
|
let pending = match queue().lock() {
|
||||||
@@ -230,16 +275,10 @@ fn apply_event(inner: &mut Inner, line: &str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
fn supported() -> bool {
|
fn supported() -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
fn supported() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
unsafe extern "C" fn on_camera_json(json: *const std::ffi::c_char) {
|
unsafe extern "C" fn on_camera_json(json: *const std::ffi::c_char) {
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
@@ -273,7 +312,9 @@ fn set_download_dir(dir: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
fn set_download_dir(_dir: &str) {}
|
fn set_download_dir(dir: &str) {
|
||||||
|
link::set_dir(dir);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn set_tether_native(on: bool) {
|
fn set_tether_native(on: bool) {
|
||||||
@@ -281,7 +322,9 @@ fn set_tether_native(on: bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
fn set_tether_native(_on: bool) {}
|
fn set_tether_native(on: bool) {
|
||||||
|
link::set_tether(on);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn sync_native() {
|
fn sync_native() {
|
||||||
@@ -289,7 +332,9 @@ fn sync_native() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
fn sync_native() {}
|
fn sync_native() {
|
||||||
|
link::request_sync();
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn import_native(names_json: &str) {
|
fn import_native(names_json: &str) {
|
||||||
@@ -300,7 +345,9 @@ fn import_native(names_json: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
fn import_native(_names_json: &str) {}
|
fn import_native(names_json: &str) {
|
||||||
|
link::import_json(names_json);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn refresh_catalog_native() {
|
fn refresh_catalog_native() {
|
||||||
@@ -308,7 +355,9 @@ fn refresh_catalog_native() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
fn refresh_catalog_native() {}
|
fn refresh_catalog_native() {
|
||||||
|
link::refresh();
|
||||||
|
}
|
||||||
|
|
||||||
/// Starts the browser once. Safe to call at launch; callbacks only enqueue a string.
|
/// Starts the browser once. Safe to call at launch; callbacks only enqueue a string.
|
||||||
pub fn start(ftp: &FtpState) {
|
pub fn start(ftp: &FtpState) {
|
||||||
@@ -320,6 +369,8 @@ pub fn start(ftp: &FtpState) {
|
|||||||
}
|
}
|
||||||
unsafe { pr_camera_start(on_camera_json) }
|
unsafe { pr_camera_start(on_camera_json) }
|
||||||
}
|
}
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
link::start();
|
||||||
let dir = ftp.ingest_dir();
|
let dir = ftp.ingest_dir();
|
||||||
let _ = std::fs::create_dir_all(dir.join(".usb"));
|
let _ = std::fs::create_dir_all(dir.join(".usb"));
|
||||||
set_download_dir(&dir.join(".usb").to_string_lossy());
|
set_download_dir(&dir.join(".usb").to_string_lossy());
|
||||||
@@ -371,6 +422,33 @@ pub fn camera_refresh(cam: tauri::State<'_, CameraState>) -> CameraStatus {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn the_first_listing_is_not_a_new_shot_and_a_later_one_is() {
|
||||||
|
let shots = vec![
|
||||||
|
ListedShot {
|
||||||
|
name: "old.JPG".into(),
|
||||||
|
size: 10,
|
||||||
|
created_ms: Some(1),
|
||||||
|
},
|
||||||
|
ListedShot {
|
||||||
|
name: "new.JPG".into(),
|
||||||
|
size: 20,
|
||||||
|
created_ms: Some(2),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
let mut known = HashSet::new();
|
||||||
|
known.insert("old.JPG".to_string());
|
||||||
|
let mut fetched = HashSet::new();
|
||||||
|
fetched.insert("old.JPG".to_string());
|
||||||
|
let first = files_on_card(&shots[..1], &known, &fetched, false);
|
||||||
|
assert!(!first[0].is_new);
|
||||||
|
assert!(first[0].imported);
|
||||||
|
let live = files_on_card(&shots, &known, &fetched, true);
|
||||||
|
assert!(!live[0].is_new);
|
||||||
|
assert!(live[1].is_new);
|
||||||
|
assert!(!live[1].imported);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_chosen_shot_queues_the_jpeg_and_the_raw() {
|
fn a_chosen_shot_queues_the_jpeg_and_the_raw() {
|
||||||
let mut inner = Inner {
|
let mut inner = Inner {
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
//! Linux USB via libgphoto2. The camera is opened for this pass only and dropped before we return,
|
||||||
|
//! which closes the PTP session.
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub struct Shot {
|
||||||
|
pub folder: String,
|
||||||
|
pub name: String,
|
||||||
|
pub size: u64,
|
||||||
|
pub created_ms: Option<i64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Report {
|
||||||
|
pub model: Option<String>,
|
||||||
|
pub id: String,
|
||||||
|
pub error: Option<String>,
|
||||||
|
pub shots: Vec<Shot>,
|
||||||
|
pub downloaded: Vec<(String, u64)>,
|
||||||
|
pub clock: Option<String>,
|
||||||
|
pub clock_unsupported: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pulse(dir: &Path, wanted: &[String], _sync_clock: bool) -> Result<Report, String> {
|
||||||
|
let context = gphoto2::Context::new().map_err(|err| err.to_string())?;
|
||||||
|
let mut listed = context
|
||||||
|
.list_cameras()
|
||||||
|
.wait()
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let Some(desc) = listed.next() else {
|
||||||
|
return Ok(empty());
|
||||||
|
};
|
||||||
|
let camera = context
|
||||||
|
.get_camera(&desc)
|
||||||
|
.wait()
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let model = camera.abilities().model().to_string();
|
||||||
|
let roots = card_roots(&camera);
|
||||||
|
let fs = camera.fs();
|
||||||
|
let mut shots = Vec::new();
|
||||||
|
for root in roots {
|
||||||
|
walk(&fs, &root, 0, &mut shots)?;
|
||||||
|
}
|
||||||
|
let mut downloaded = Vec::new();
|
||||||
|
let mut error = None;
|
||||||
|
for shot in &shots {
|
||||||
|
let asked = wanted.iter().any(|name| name == &shot.name);
|
||||||
|
if !asked {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
match copy_one(&fs, dir, shot) {
|
||||||
|
Ok(size) => downloaded.push((shot.name.clone(), size)),
|
||||||
|
Err(err) => error = Some(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Dropping `camera` closes the session before the caller waits.
|
||||||
|
drop(fs);
|
||||||
|
drop(camera);
|
||||||
|
Ok(Report {
|
||||||
|
model: Some(model),
|
||||||
|
id: "gphoto".into(),
|
||||||
|
error,
|
||||||
|
shots,
|
||||||
|
downloaded,
|
||||||
|
clock: None,
|
||||||
|
// libgphoto2 clock widgets differ per body; the panel says the clock was not set.
|
||||||
|
clock_unsupported: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn empty() -> Report {
|
||||||
|
Report {
|
||||||
|
model: None,
|
||||||
|
id: "gphoto".into(),
|
||||||
|
error: None,
|
||||||
|
shots: Vec::new(),
|
||||||
|
downloaded: Vec::new(),
|
||||||
|
clock: None,
|
||||||
|
clock_unsupported: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn card_roots(camera: &gphoto2::Camera) -> Vec<String> {
|
||||||
|
let mut roots = Vec::new();
|
||||||
|
if let Ok(storages) = camera.storages().wait() {
|
||||||
|
for storage in storages {
|
||||||
|
let Some(base) = storage.base_directory() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let text = base.to_string();
|
||||||
|
if text.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !roots.iter().any(|have| have == &text) {
|
||||||
|
roots.push(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if roots.is_empty() {
|
||||||
|
roots.push("/".to_string());
|
||||||
|
}
|
||||||
|
roots
|
||||||
|
}
|
||||||
|
|
||||||
|
fn walk(
|
||||||
|
fs: &gphoto2::filesys::CameraFS<'_>,
|
||||||
|
folder: &str,
|
||||||
|
depth: u32,
|
||||||
|
shots: &mut Vec<Shot>,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
if depth > 12 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let files = match fs.list_files(folder).wait() {
|
||||||
|
Ok(files) => files,
|
||||||
|
Err(err) if folder != "/" => {
|
||||||
|
let _ = err;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
Err(err) => return Err(err.to_string()),
|
||||||
|
};
|
||||||
|
for name in files {
|
||||||
|
if !is_still(&name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let info = fs.file_info(folder, &name).wait().ok();
|
||||||
|
let size = info
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|info| info.file().size())
|
||||||
|
.unwrap_or(0);
|
||||||
|
let created_ms = info
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|info| info.file().mtime())
|
||||||
|
.map(|mtime| {
|
||||||
|
let seconds = mtime as i64;
|
||||||
|
seconds.saturating_mul(1000)
|
||||||
|
});
|
||||||
|
shots.push(Shot {
|
||||||
|
folder: folder.to_string(),
|
||||||
|
name,
|
||||||
|
size,
|
||||||
|
created_ms,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let folders = match fs.list_folders(folder).wait() {
|
||||||
|
Ok(folders) => folders,
|
||||||
|
Err(_) => return Ok(()),
|
||||||
|
};
|
||||||
|
for name in folders {
|
||||||
|
let child = child_folder(folder, &name);
|
||||||
|
walk(fs, &child, depth + 1, shots)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn copy_one(fs: &gphoto2::filesys::CameraFS<'_>, dir: &Path, shot: &Shot) -> Result<u64, String> {
|
||||||
|
let dest = dir.join(&shot.name);
|
||||||
|
if let Ok(meta) = std::fs::metadata(&dest) {
|
||||||
|
if meta.len() > 0 {
|
||||||
|
return Ok(meta.len());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let _ = std::fs::create_dir_all(dir);
|
||||||
|
fs.download_to(&shot.folder, &shot.name, &dest)
|
||||||
|
.wait()
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let meta = std::fs::metadata(&dest).map_err(|err| err.to_string())?;
|
||||||
|
Ok(meta.len())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn child_folder(parent: &str, name: &str) -> String {
|
||||||
|
if name.starts_with('/') {
|
||||||
|
return name.to_string();
|
||||||
|
}
|
||||||
|
if parent == "/" {
|
||||||
|
return format!("/{name}");
|
||||||
|
}
|
||||||
|
format!("{parent}/{name}")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_still(name: &str) -> bool {
|
||||||
|
crate::ftp::is_jpeg_name(name) || crate::ftp::is_raw_name(name)
|
||||||
|
}
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
//! USB on Linux (libgphoto2) and Windows (portable devices). Same rhythm as the Mac: open, list,
|
||||||
|
//! download what was asked, drop the session so the shutter is free, then wait before the next open.
|
||||||
|
//! The Mac path stays in `camera_mac.m` and is not used here.
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
use std::sync::{Mutex, OnceLock};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use super::{CameraDevice, ListedShot, enqueue_line, files_on_card};
|
||||||
|
|
||||||
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
|
#[path = "camera_gphoto.rs"]
|
||||||
|
mod backend;
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
#[path = "camera_wpd.rs"]
|
||||||
|
mod backend;
|
||||||
|
|
||||||
|
/// How long the body stays free between card reads. Matches the Mac poll.
|
||||||
|
const FREE_MS: u64 = 2500;
|
||||||
|
const STEP_MS: u64 = 200;
|
||||||
|
|
||||||
|
struct Link {
|
||||||
|
tether: AtomicBool,
|
||||||
|
sync: AtomicBool,
|
||||||
|
refresh: AtomicBool,
|
||||||
|
dir: Mutex<String>,
|
||||||
|
pending: Mutex<Vec<String>>,
|
||||||
|
/// Names on the card the first time this tether session listed it. `None` until that pass.
|
||||||
|
known: Mutex<Option<HashSet<String>>>,
|
||||||
|
fetched: Mutex<HashSet<String>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn link() -> &'static Link {
|
||||||
|
static LINK: OnceLock<Link> = OnceLock::new();
|
||||||
|
LINK.get_or_init(|| Link {
|
||||||
|
tether: AtomicBool::new(false),
|
||||||
|
sync: AtomicBool::new(false),
|
||||||
|
refresh: AtomicBool::new(false),
|
||||||
|
dir: Mutex::new(String::new()),
|
||||||
|
pending: Mutex::new(Vec::new()),
|
||||||
|
known: Mutex::new(None),
|
||||||
|
fetched: Mutex::new(HashSet::new()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn start() {
|
||||||
|
static STARTED: AtomicBool = AtomicBool::new(false);
|
||||||
|
if STARTED.swap(true, Ordering::SeqCst) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::thread::Builder::new()
|
||||||
|
.name("photoreport-usb".into())
|
||||||
|
.spawn(|| {
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
backend::init_thread();
|
||||||
|
loop {
|
||||||
|
if !link().tether.load(Ordering::SeqCst) {
|
||||||
|
std::thread::sleep(Duration::from_millis(STEP_MS));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pulse_once();
|
||||||
|
let mut waited = 0u64;
|
||||||
|
while waited < FREE_MS && link().tether.load(Ordering::SeqCst) {
|
||||||
|
if link().refresh.swap(false, Ordering::SeqCst) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let waiting = link()
|
||||||
|
.pending
|
||||||
|
.lock()
|
||||||
|
.map(|p| !p.is_empty())
|
||||||
|
.unwrap_or(false);
|
||||||
|
if waiting {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::thread::sleep(Duration::from_millis(STEP_MS));
|
||||||
|
waited += STEP_MS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_dir(dir: &str) {
|
||||||
|
if let Ok(mut slot) = link().dir.lock() {
|
||||||
|
*slot = dir.to_string();
|
||||||
|
}
|
||||||
|
load_fetched(Path::new(dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_tether(on: bool) {
|
||||||
|
link().tether.store(on, Ordering::SeqCst);
|
||||||
|
if !on {
|
||||||
|
if let Ok(mut known) = link().known.lock() {
|
||||||
|
*known = None;
|
||||||
|
}
|
||||||
|
publish_idle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
link().refresh.store(true, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn request_sync() {
|
||||||
|
link().sync.store(true, Ordering::SeqCst);
|
||||||
|
link().refresh.store(true, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn refresh() {
|
||||||
|
link().refresh.store(true, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn import_json(names_json: &str) {
|
||||||
|
let Ok(names) = serde_json::from_str::<Vec<String>>(names_json) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
if let Ok(mut pending) = link().pending.lock() {
|
||||||
|
for name in names {
|
||||||
|
if !pending.iter().any(|have| have == &name) {
|
||||||
|
pending.push(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
link().refresh.store(true, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pulse_once() {
|
||||||
|
let dir = link().dir.lock().map(|d| d.clone()).unwrap_or_default();
|
||||||
|
if dir.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let wanted = link().pending.lock().map(|p| p.clone()).unwrap_or_default();
|
||||||
|
let sync = link().sync.swap(false, Ordering::SeqCst);
|
||||||
|
let report = backend::pulse(Path::new(&dir), &wanted, sync);
|
||||||
|
match report {
|
||||||
|
Ok(report) => apply_report(&dir, report),
|
||||||
|
Err(err) => publish_busy(&err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn apply_report(dir: &str, report: backend::Report) {
|
||||||
|
let Some(model) = report.model else {
|
||||||
|
publish_devices(Vec::new());
|
||||||
|
publish_files("usb", Vec::new());
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let shots: Vec<ListedShot> = report
|
||||||
|
.shots
|
||||||
|
.iter()
|
||||||
|
.map(|shot| ListedShot {
|
||||||
|
name: shot.name.clone(),
|
||||||
|
size: shot.size,
|
||||||
|
created_ms: shot.created_ms,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let listing_is_live = {
|
||||||
|
let Ok(mut known) = link().known.lock() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
if known.is_none() {
|
||||||
|
let mut names = HashSet::new();
|
||||||
|
for shot in &shots {
|
||||||
|
names.insert(shot.name.clone());
|
||||||
|
}
|
||||||
|
*known = Some(names);
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let known = link()
|
||||||
|
.known
|
||||||
|
.lock()
|
||||||
|
.ok()
|
||||||
|
.and_then(|k| k.clone())
|
||||||
|
.unwrap_or_default();
|
||||||
|
let fetched = link().fetched.lock().map(|f| f.clone()).unwrap_or_default();
|
||||||
|
let files = files_on_card(&shots, &known, &fetched, listing_is_live);
|
||||||
|
let mut clock = report.clock;
|
||||||
|
if clock.is_none() && report.clock_unsupported {
|
||||||
|
clock = Some("unsupported".to_string());
|
||||||
|
}
|
||||||
|
let id = report.id.clone();
|
||||||
|
publish_devices(vec![CameraDevice {
|
||||||
|
id: id.clone(),
|
||||||
|
name: model,
|
||||||
|
vendor_id: 0,
|
||||||
|
product_id: 0,
|
||||||
|
state: "tethered".to_string(),
|
||||||
|
error: report.error,
|
||||||
|
clock,
|
||||||
|
clock_offset: None,
|
||||||
|
catalog_ready: true,
|
||||||
|
}]);
|
||||||
|
publish_files(&id, files);
|
||||||
|
remember_downloaded(dir, &report.downloaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remember_downloaded(dir: &str, downloaded: &[(String, u64)]) {
|
||||||
|
if downloaded.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let Ok(mut fetched) = link().fetched.lock() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Ok(mut pending) = link().pending.lock() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for (name, size) in downloaded {
|
||||||
|
if *size == 0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fetched.insert(name.clone());
|
||||||
|
pending.retain(|want| want != name);
|
||||||
|
let path = PathBuf::from(dir).join(name);
|
||||||
|
let line = serde_json::json!({
|
||||||
|
"kind": "file",
|
||||||
|
"path": path,
|
||||||
|
"name": name,
|
||||||
|
"size": size,
|
||||||
|
});
|
||||||
|
enqueue_line(line.to_string());
|
||||||
|
}
|
||||||
|
write_fetched(Path::new(dir), &fetched);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn publish_idle() {
|
||||||
|
publish_devices(Vec::new());
|
||||||
|
publish_files("usb", Vec::new());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn publish_busy(err: &str) {
|
||||||
|
publish_devices(vec![CameraDevice {
|
||||||
|
id: "usb".into(),
|
||||||
|
name: "USB".into(),
|
||||||
|
vendor_id: 0,
|
||||||
|
product_id: 0,
|
||||||
|
state: "busy".into(),
|
||||||
|
error: Some(err.to_string()),
|
||||||
|
clock: None,
|
||||||
|
clock_offset: None,
|
||||||
|
catalog_ready: false,
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn publish_devices(devices: Vec<CameraDevice>) {
|
||||||
|
let line = serde_json::json!({ "kind": "devices", "devices": devices });
|
||||||
|
enqueue_line(line.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn publish_files(camera_id: &str, files: Vec<super::CameraFile>) {
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
struct Catalog<'a> {
|
||||||
|
kind: &'static str,
|
||||||
|
camera_id: &'a str,
|
||||||
|
files: &'a [super::CameraFile],
|
||||||
|
}
|
||||||
|
let line = serde_json::to_string(&Catalog {
|
||||||
|
kind: "catalog",
|
||||||
|
camera_id,
|
||||||
|
files: &files,
|
||||||
|
});
|
||||||
|
if let Ok(line) = line {
|
||||||
|
enqueue_line(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fetched_path(dir: &Path) -> PathBuf {
|
||||||
|
dir.join(".fetched")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_fetched(dir: &Path) {
|
||||||
|
let text = std::fs::read_to_string(fetched_path(dir)).unwrap_or_default();
|
||||||
|
let Ok(mut fetched) = link().fetched.lock() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
fetched.clear();
|
||||||
|
for line in text.lines() {
|
||||||
|
if !line.is_empty() {
|
||||||
|
fetched.insert(line.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_fetched(dir: &Path, fetched: &HashSet<String>) {
|
||||||
|
let mut names: Vec<&String> = fetched.iter().collect();
|
||||||
|
names.sort();
|
||||||
|
let mut text = String::new();
|
||||||
|
for name in names {
|
||||||
|
text.push_str(name);
|
||||||
|
text.push('\n');
|
||||||
|
}
|
||||||
|
let _ = std::fs::write(fetched_path(dir), text);
|
||||||
|
}
|
||||||
@@ -0,0 +1,325 @@
|
|||||||
|
//! Windows USB via the portable-device API (the PTP driver Windows already owns). The device is
|
||||||
|
//! opened for this pass and released before we return, so the body is not left on the computer screen.
|
||||||
|
|
||||||
|
// The whole module is COM. Edition 2024 does not treat an `unsafe fn` body as an unsafe block.
|
||||||
|
#![allow(unsafe_op_in_unsafe_fn)]
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use windows::{
|
||||||
|
Win32::{
|
||||||
|
Devices::PortableDevices::{
|
||||||
|
IEnumPortableDeviceObjectIDs, IPortableDevice, IPortableDeviceContent,
|
||||||
|
IPortableDeviceKeyCollection, IPortableDeviceManager, IPortableDeviceValues,
|
||||||
|
PortableDevice, PortableDeviceKeyCollection, PortableDeviceManager,
|
||||||
|
PortableDeviceValues, WPD_CLIENT_MAJOR_VERSION, WPD_CLIENT_MINOR_VERSION,
|
||||||
|
WPD_CLIENT_NAME, WPD_CLIENT_REVISION, WPD_DEVICE_OBJECT_ID, WPD_OBJECT_DATE_CREATED,
|
||||||
|
WPD_OBJECT_ORIGINAL_FILE_NAME, WPD_OBJECT_SIZE, WPD_RESOURCE_DEFAULT,
|
||||||
|
},
|
||||||
|
System::Com::{
|
||||||
|
CLSCTX_INPROC_SERVER, COINIT_MULTITHREADED, CoCreateInstance, CoInitializeEx,
|
||||||
|
CoTaskMemFree, IStream, STGM_READ,
|
||||||
|
StructuredStorage::{PROPVARIANT, PropVariantClear},
|
||||||
|
},
|
||||||
|
System::Variant::VT_FILETIME,
|
||||||
|
},
|
||||||
|
core::{PCWSTR, PWSTR, w},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct Shot {
|
||||||
|
pub name: String,
|
||||||
|
pub size: u64,
|
||||||
|
pub created_ms: Option<i64>,
|
||||||
|
object_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Report {
|
||||||
|
pub model: Option<String>,
|
||||||
|
pub id: String,
|
||||||
|
pub error: Option<String>,
|
||||||
|
pub shots: Vec<Shot>,
|
||||||
|
pub downloaded: Vec<(String, u64)>,
|
||||||
|
pub clock: Option<String>,
|
||||||
|
pub clock_unsupported: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init_thread() {
|
||||||
|
unsafe {
|
||||||
|
let _ = CoInitializeEx(None, COINIT_MULTITHREADED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pulse(dir: &Path, wanted: &[String], _sync_clock: bool) -> Result<Report, String> {
|
||||||
|
unsafe { read_card(dir, wanted) }
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn read_card(dir: &Path, wanted: &[String]) -> Result<Report, String> {
|
||||||
|
let manager: IPortableDeviceManager =
|
||||||
|
CoCreateInstance(&PortableDeviceManager, None, CLSCTX_INPROC_SERVER)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let mut count = 0u32;
|
||||||
|
manager
|
||||||
|
.GetDevices(std::ptr::null_mut(), &mut count)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
if count == 0 {
|
||||||
|
return Ok(empty());
|
||||||
|
}
|
||||||
|
let mut ids = vec![PWSTR::null(); count as usize];
|
||||||
|
manager
|
||||||
|
.GetDevices(ids.as_mut_ptr(), &mut count)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let device_id = ids.first().copied().unwrap_or(PWSTR::null());
|
||||||
|
let id_text = if device_id.is_null() {
|
||||||
|
String::new()
|
||||||
|
} else {
|
||||||
|
device_id.to_string().unwrap_or_default()
|
||||||
|
};
|
||||||
|
for id in &ids {
|
||||||
|
if !id.is_null() && id.0 != device_id.0 {
|
||||||
|
CoTaskMemFree(Some(id.0 as *const _));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if id_text.is_empty() {
|
||||||
|
return Ok(empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
let device: IPortableDevice = CoCreateInstance(&PortableDevice, None, CLSCTX_INPROC_SERVER)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let client: IPortableDeviceValues =
|
||||||
|
CoCreateInstance(&PortableDeviceValues, None, CLSCTX_INPROC_SERVER)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
client
|
||||||
|
.SetStringValue(&WPD_CLIENT_NAME, w!("PhotoReport"))
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
client
|
||||||
|
.SetUnsignedIntegerValue(&WPD_CLIENT_MAJOR_VERSION, 1)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
client
|
||||||
|
.SetUnsignedIntegerValue(&WPD_CLIENT_MINOR_VERSION, 0)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
client
|
||||||
|
.SetUnsignedIntegerValue(&WPD_CLIENT_REVISION, 0)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let wide_id = wide(&id_text);
|
||||||
|
let device_name = friendly_name(&manager, PCWSTR(wide_id.as_ptr()));
|
||||||
|
device
|
||||||
|
.Open(PCWSTR(wide_id.as_ptr()), &client)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let content = device.Content().map_err(|err| err.to_string())?;
|
||||||
|
let mut shots = Vec::new();
|
||||||
|
collect(&content, WPD_DEVICE_OBJECT_ID, 0, &mut shots).map_err(|err| err.to_string())?;
|
||||||
|
|
||||||
|
let mut downloaded = Vec::new();
|
||||||
|
let mut error = None;
|
||||||
|
for shot in &shots {
|
||||||
|
let asked = wanted.iter().any(|name| name == &shot.name);
|
||||||
|
if !asked {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
match copy_one(&content, dir, shot) {
|
||||||
|
Ok(size) => downloaded.push((shot.name.clone(), size)),
|
||||||
|
Err(err) => error = Some(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !device_id.is_null() {
|
||||||
|
CoTaskMemFree(Some(device_id.0 as *const _));
|
||||||
|
}
|
||||||
|
// `device` drops here, which closes the PTP session.
|
||||||
|
Ok(Report {
|
||||||
|
model: Some(device_name),
|
||||||
|
id: "wpd".into(),
|
||||||
|
error,
|
||||||
|
shots,
|
||||||
|
downloaded,
|
||||||
|
clock: None,
|
||||||
|
clock_unsupported: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn empty() -> Report {
|
||||||
|
Report {
|
||||||
|
model: None,
|
||||||
|
id: "wpd".into(),
|
||||||
|
error: None,
|
||||||
|
shots: Vec::new(),
|
||||||
|
downloaded: Vec::new(),
|
||||||
|
clock: None,
|
||||||
|
clock_unsupported: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn friendly_name(manager: &IPortableDeviceManager, id: PCWSTR) -> String {
|
||||||
|
let mut chars = 0u32;
|
||||||
|
if manager
|
||||||
|
.GetDeviceFriendlyName(id, PWSTR::null(), &mut chars)
|
||||||
|
.is_err()
|
||||||
|
|| chars <= 1
|
||||||
|
{
|
||||||
|
return "USB camera".to_string();
|
||||||
|
}
|
||||||
|
let mut buf = vec![0u16; chars as usize];
|
||||||
|
if manager
|
||||||
|
.GetDeviceFriendlyName(id, PWSTR(buf.as_mut_ptr()), &mut chars)
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
|
return "USB camera".to_string();
|
||||||
|
}
|
||||||
|
let end = (chars as usize).saturating_sub(1).min(buf.len());
|
||||||
|
let name = String::from_utf16_lossy(&buf[..end]);
|
||||||
|
if name.is_empty() {
|
||||||
|
return "USB camera".to_string();
|
||||||
|
}
|
||||||
|
name
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn collect(
|
||||||
|
content: &IPortableDeviceContent,
|
||||||
|
parent: PCWSTR,
|
||||||
|
depth: u32,
|
||||||
|
shots: &mut Vec<Shot>,
|
||||||
|
) -> windows::core::Result<()> {
|
||||||
|
if depth > 12 {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let enumerator: IEnumPortableDeviceObjectIDs = content.EnumObjects(0, parent, None)?;
|
||||||
|
loop {
|
||||||
|
let mut batch = [PWSTR::null(); 32];
|
||||||
|
let mut fetched = 0u32;
|
||||||
|
let hr = enumerator.Next(&mut batch, &mut fetched);
|
||||||
|
if hr.is_err() || fetched == 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for id in batch.iter().take(fetched as usize) {
|
||||||
|
if id.is_null() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let object_id = id.to_string().unwrap_or_default();
|
||||||
|
CoTaskMemFree(Some(id.0 as *const _));
|
||||||
|
if object_id.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if let Some(shot) = shot_of(content, &object_id)? {
|
||||||
|
shots.push(shot);
|
||||||
|
}
|
||||||
|
let child = wide(&object_id);
|
||||||
|
collect(content, PCWSTR(child.as_ptr()), depth + 1, shots)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn shot_of(
|
||||||
|
content: &IPortableDeviceContent,
|
||||||
|
object_id: &str,
|
||||||
|
) -> windows::core::Result<Option<Shot>> {
|
||||||
|
let keys: IPortableDeviceKeyCollection =
|
||||||
|
CoCreateInstance(&PortableDeviceKeyCollection, None, CLSCTX_INPROC_SERVER)?;
|
||||||
|
keys.Add(&WPD_OBJECT_ORIGINAL_FILE_NAME)?;
|
||||||
|
keys.Add(&WPD_OBJECT_SIZE)?;
|
||||||
|
keys.Add(&WPD_OBJECT_DATE_CREATED)?;
|
||||||
|
let properties = content.Properties()?;
|
||||||
|
let object_wide = wide(object_id);
|
||||||
|
let values = properties.GetValues(PCWSTR(object_wide.as_ptr()), &keys)?;
|
||||||
|
let name_ptr = values
|
||||||
|
.GetStringValue(&WPD_OBJECT_ORIGINAL_FILE_NAME)
|
||||||
|
.unwrap_or(PWSTR::null());
|
||||||
|
if name_ptr.is_null() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let name = name_ptr.to_string().unwrap_or_default();
|
||||||
|
CoTaskMemFree(Some(name_ptr.0 as *const _));
|
||||||
|
if !is_still(&name) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let size = values
|
||||||
|
.GetUnsignedLargeIntegerValue(&WPD_OBJECT_SIZE)
|
||||||
|
.unwrap_or(0);
|
||||||
|
let created_ms = filetime_ms(&values);
|
||||||
|
Ok(Some(Shot {
|
||||||
|
name,
|
||||||
|
size,
|
||||||
|
created_ms,
|
||||||
|
object_id: object_id.to_string(),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn filetime_ms(values: &IPortableDeviceValues) -> Option<i64> {
|
||||||
|
let mut variant = values.GetValue(&WPD_OBJECT_DATE_CREATED).ok()?;
|
||||||
|
let ms = filetime_of(&variant);
|
||||||
|
let _ = PropVariantClear(&mut variant);
|
||||||
|
ms
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 100-nanosecond ticks since 1601-01-01, which is how a portable device stores a capture time.
|
||||||
|
unsafe fn filetime_of(variant: &PROPVARIANT) -> Option<i64> {
|
||||||
|
let header = &variant.Anonymous.Anonymous;
|
||||||
|
if header.vt != VT_FILETIME {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let filetime = header.Anonymous.filetime;
|
||||||
|
let ticks = (u64::from(filetime.dwHighDateTime) << 32) | u64::from(filetime.dwLowDateTime);
|
||||||
|
const EPOCH_DIFF: u64 = 116_444_736_000_000_000;
|
||||||
|
if ticks < EPOCH_DIFF {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let unix_100ns = ticks - EPOCH_DIFF;
|
||||||
|
Some((unix_100ns / 10_000) as i64)
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn copy_one(
|
||||||
|
content: &IPortableDeviceContent,
|
||||||
|
dir: &Path,
|
||||||
|
shot: &Shot,
|
||||||
|
) -> Result<u64, String> {
|
||||||
|
let dest = dir.join(&shot.name);
|
||||||
|
if let Ok(meta) = std::fs::metadata(&dest) {
|
||||||
|
if meta.len() > 0 {
|
||||||
|
return Ok(meta.len());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::fs::create_dir_all(dir).map_err(|err| err.to_string())?;
|
||||||
|
let resources = content.Transfer().map_err(|err| err.to_string())?;
|
||||||
|
let object_wide = wide(&shot.object_id);
|
||||||
|
let mut stream: Option<IStream> = None;
|
||||||
|
let mut optimal = 0u32;
|
||||||
|
resources
|
||||||
|
.GetStream(
|
||||||
|
PCWSTR(object_wide.as_ptr()),
|
||||||
|
&WPD_RESOURCE_DEFAULT,
|
||||||
|
STGM_READ.0 as u32,
|
||||||
|
&mut optimal,
|
||||||
|
&mut stream,
|
||||||
|
)
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
let stream = stream.ok_or("no_stream")?;
|
||||||
|
let mut file = std::fs::File::create(&dest).map_err(|err| err.to_string())?;
|
||||||
|
let mut buffer = vec![0u8; 1024 * 256];
|
||||||
|
loop {
|
||||||
|
let mut read = 0u32;
|
||||||
|
let hr = stream.Read(
|
||||||
|
buffer.as_mut_ptr() as *mut _,
|
||||||
|
buffer.len() as u32,
|
||||||
|
Some(&mut read),
|
||||||
|
);
|
||||||
|
if hr.is_err() {
|
||||||
|
let _ = std::fs::remove_file(&dest);
|
||||||
|
return Err(hr.to_string());
|
||||||
|
}
|
||||||
|
if read == 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
use std::io::Write;
|
||||||
|
file.write_all(&buffer[..read as usize])
|
||||||
|
.map_err(|err| err.to_string())?;
|
||||||
|
}
|
||||||
|
let meta = std::fs::metadata(&dest).map_err(|err| err.to_string())?;
|
||||||
|
Ok(meta.len())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_still(name: &str) -> bool {
|
||||||
|
crate::ftp::is_jpeg_name(name) || crate::ftp::is_raw_name(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn wide(text: &str) -> Vec<u16> {
|
||||||
|
text.encode_utf16().chain(std::iter::once(0)).collect()
|
||||||
|
}
|
||||||
@@ -266,6 +266,7 @@ fn jpeg_paths(dir: &Path, out: &mut Vec<PathBuf>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
fn memory_gb() -> f64 {
|
fn memory_gb() -> f64 {
|
||||||
let pages = unsafe { libc::sysconf(libc::_SC_PHYS_PAGES) };
|
let pages = unsafe { libc::sysconf(libc::_SC_PHYS_PAGES) };
|
||||||
let size = unsafe { libc::sysconf(libc::_SC_PAGESIZE) };
|
let size = unsafe { libc::sysconf(libc::_SC_PAGESIZE) };
|
||||||
@@ -275,6 +276,34 @@ fn memory_gb() -> f64 {
|
|||||||
(pages as f64) * (size as f64) / 1e9
|
(pages as f64) * (size as f64) / 1e9
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn memory_gb() -> f64 {
|
||||||
|
#[repr(C)]
|
||||||
|
struct MemoryStatus {
|
||||||
|
length: u32,
|
||||||
|
memory_load: u32,
|
||||||
|
total_phys: u64,
|
||||||
|
avail_phys: u64,
|
||||||
|
total_page: u64,
|
||||||
|
avail_page: u64,
|
||||||
|
total_virtual: u64,
|
||||||
|
avail_virtual: u64,
|
||||||
|
avail_extended_virtual: u64,
|
||||||
|
}
|
||||||
|
#[link(name = "kernel32")]
|
||||||
|
unsafe extern "system" {
|
||||||
|
fn GlobalMemoryStatusEx(status: *mut MemoryStatus) -> i32;
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let mut status = std::mem::zeroed::<MemoryStatus>();
|
||||||
|
status.length = std::mem::size_of::<MemoryStatus>() as u32;
|
||||||
|
if GlobalMemoryStatusEx(&mut status) == 0 || status.total_phys == 0 {
|
||||||
|
return 8.0;
|
||||||
|
}
|
||||||
|
status.total_phys as f64 / 1e9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// One engine per core, and only as many as memory can hold (each copy of the model is large).
|
/// One engine per core, and only as many as memory can hold (each copy of the model is large).
|
||||||
/// `extra_gb` is RAM already taken by the accelerator, so the CPU copies leave room for it.
|
/// `extra_gb` is RAM already taken by the accelerator, so the CPU copies leave room for it.
|
||||||
fn engine_cap(extra_gb: f64) -> usize {
|
fn engine_cap(extra_gb: f64) -> usize {
|
||||||
@@ -334,21 +363,47 @@ fn cpu_ticks() -> Option<(u64, u64)> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
/// `GetSystemTimes`: kernel time already includes idle, so the total is kernel plus user.
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn cpu_ticks() -> Option<(u64, u64)> {
|
||||||
|
#[link(name = "kernel32")]
|
||||||
|
unsafe extern "system" {
|
||||||
|
fn GetSystemTimes(idle: *mut u64, kernel: *mut u64, user: *mut u64) -> i32;
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let mut idle = 0u64;
|
||||||
|
let mut kernel = 0u64;
|
||||||
|
let mut user = 0u64;
|
||||||
|
if GetSystemTimes(&mut idle, &mut kernel, &mut user) == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let total = kernel.saturating_add(user);
|
||||||
|
if total == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some((idle, total))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
|
||||||
fn cpu_ticks() -> Option<(u64, u64)> {
|
fn cpu_ticks() -> Option<(u64, u64)> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Share of the CPU that was busy between two samples. `idle` is included in `total`.
|
||||||
|
fn cpu_fraction(idle_delta: u64, total_delta: u64) -> Option<f64> {
|
||||||
|
if total_delta == 0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(1.0 - (idle_delta as f64) / (total_delta as f64))
|
||||||
|
}
|
||||||
|
|
||||||
fn cpu_used(prev: &mut Option<(u64, u64)>) -> Option<f64> {
|
fn cpu_used(prev: &mut Option<(u64, u64)>) -> Option<f64> {
|
||||||
let now = cpu_ticks()?;
|
let now = cpu_ticks()?;
|
||||||
let used = prev.and_then(|(idle, total)| {
|
let used = prev.and_then(|(idle, total)| {
|
||||||
let idle_d = now.0.saturating_sub(idle);
|
let idle_delta = now.0.saturating_sub(idle);
|
||||||
let total_d = now.1.saturating_sub(total);
|
let total_delta = now.1.saturating_sub(total);
|
||||||
if total_d == 0 {
|
cpu_fraction(idle_delta, total_delta)
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(1.0 - (idle_d as f64) / (total_d as f64))
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
*prev = Some(now);
|
*prev = Some(now);
|
||||||
used
|
used
|
||||||
@@ -747,6 +802,13 @@ pub fn faces_read(path: String) -> Result<tauri::ipc::Response, String> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cpu_fraction_counts_idle_inside_the_total() {
|
||||||
|
let busy = cpu_fraction(25, 100);
|
||||||
|
assert_eq!(busy, Some(0.75));
|
||||||
|
assert_eq!(cpu_fraction(0, 0), None);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn base64_round_trip_of_a_short_buffer() {
|
fn base64_round_trip_of_a_short_buffer() {
|
||||||
let raw = b"faces";
|
let raw = b"faces";
|
||||||
|
|||||||
@@ -136,6 +136,15 @@ public key (`updater-pubkey.txt`, or `TAURI_UPDATER_PUBKEY` when CI sets it), so
|
|||||||
from the next signed `desktop-v*` release. A debug build without the variable never does. A release made while the
|
from the next signed `desktop-v*` release. A debug build without the variable never does. A release made while the
|
||||||
Mac is off waits for it.
|
Mac is off waits for it.
|
||||||
|
|
||||||
|
Windows `.msi` builds on a runner labelled `windows` (Git bash, and the WebView2 step in the workflow). None is
|
||||||
|
registered yet, so a `desktop-v*` tag waits for that job until one is online. Linux installs `libgphoto2-dev`
|
||||||
|
for the USB camera.
|
||||||
|
|
||||||
|
Notarisation uses a Developer ID in `APPLE_SIGNING_IDENTITY` plus either `APPLE_ID`, `APPLE_PASSWORD` and
|
||||||
|
`APPLE_TEAM_ID`, or `APPLE_API_ISSUER`, `APPLE_API_KEY` and `APPLE_API_KEY_PATH`. Those secrets are not on this
|
||||||
|
Gitea yet, so Mac builds stay signed without notarisation. When the identity is set, the hardened runtime is on
|
||||||
|
and `apps/desktop/src-tauri/entitlements.plist` lets the bundled ONNX library load.
|
||||||
|
|
||||||
## Importing the old app.photoreport.pt
|
## Importing the old app.photoreport.pt
|
||||||
|
|
||||||
`apps/api/scripts/import-legacy.ts` reads the old MySQL database, read-only. It brings over accounts, squads, events,
|
`apps/api/scripts/import-legacy.ts` reads the old MySQL database, read-only. It brings over accounts, squads, events,
|
||||||
|
|||||||
@@ -84,6 +84,10 @@ CFG
|
|||||||
export APPLE_SIGNING_IDENTITY="$local_id"
|
export APPLE_SIGNING_IDENTITY="$local_id"
|
||||||
# Not a Developer ID: no notarisation, so no hardened runtime (it would refuse the bundled ONNX library).
|
# Not a Developer ID: no notarisation, so no hardened runtime (it would refuse the bundled ONNX library).
|
||||||
extra+=(--config '{"bundle":{"macOS":{"hardenedRuntime":false}}}')
|
extra+=(--config '{"bundle":{"macOS":{"hardenedRuntime":false}}}')
|
||||||
|
else
|
||||||
|
# Developer ID. Notarisation (when APPLE_ID / APPLE_PASSWORD / APPLE_TEAM_ID, or the API key, are set)
|
||||||
|
# requires the hardened runtime. The entitlements let the bundled ONNX library load.
|
||||||
|
extra+=(--config '{"bundle":{"macOS":{"hardenedRuntime":true,"entitlements":"entitlements.plist"}}}')
|
||||||
fi
|
fi
|
||||||
echo "Signing as: $APPLE_SIGNING_IDENTITY"
|
echo "Signing as: $APPLE_SIGNING_IDENTITY"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# WebView2 is the window engine of the Windows installer. Windows 11 already has it.
|
||||||
|
# A desktop-v tag on a Windows runner installs the evergreen runtime when this key is missing.
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$key = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"
|
||||||
|
if (Test-Path $key) {
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
$dest = Join-Path $env:TEMP "webview2-bootstrapper.exe"
|
||||||
|
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile $dest
|
||||||
|
Start-Process $dest -ArgumentList "/silent", "/install" -Wait
|
||||||
Reference in new issue
Block a user