Compare commits

...
Author SHA1 Message Date
Kevin Yue a6cf639887 fix(release): select desktop shell for update feed validation 2026-11-05 19:21:35 +08:00
Kevin Yue 197cd5748d fix(packaging): remove retired named tray icons
The desktop shells embed solid light and dark tray artwork. Remove the obsolete SVG payload and its Unix, binary-package, RPM, and asset-validation references, including the retired RPM directory entry.

Validated all 33 remaining RPM manifest entries against a staged install and checked sibling desktop assets.

Refs #690
2026-11-05 17:42:09 +08:00
Kevin Yue 907e161b12 fix(auth): open Okta Verify from embedded login
Forward com-okta-authenticator navigation to the desktop scheme handler on GTK platforms and cancel the WebView navigation. This lets FastPass hidden iframes launch Okta Verify.

Verified the failure and fix using an HTTPS iframe fixture in the Linux VM with a temporary URI handler. Linux gpauth build, 48 auth tests, and macOS auth compile check passed.

Fixes #692
2026-11-05 14:53:50 +08:00
Kevin Yue b26a416f45 feat: support system and explicit themes in GUI download helper 2026-11-05 14:24:02 +08:00
Kevin Yue 0212b7ff91 fix(packaging): declare Hogweed dependency at top level 2026-11-03 10:58:35 +08:00
Kevin Yue 9001b768c1 fix(packaging): record required library ABIs on Arch and OpenBSD 2026-11-03 00:02:24 +08:00
Kevin Yue a02dfd10ab fix: register desktop icons for authentication and downloader windows 2026-11-02 18:43:46 +08:00
Kevin Yue 6ebffad3c8 fix: align NSH build metadata and descriptor registration 2026-11-02 15:33:22 +08:00
Kevin Yue c84bfcc13a build(helper): update frontend dependencies and bundle 2026-11-02 15:00:07 +08:00
Kevin Yue aa92251d47 build: use resolver 3 and update MSRV-compatible dependencies 2026-11-02 14:51:37 +08:00
Kevin Yue b15bc2bfa5 docs: highlight Native Shell for Linux users 2026-11-02 14:51:37 +08:00
Kevin Yue d825e2b9c8 feat(gui): preflight NSH downloads and install Nix runtimes 2026-11-02 11:42:55 +08:00
Kevin Yue dcc74d805b build: remove unused OpenSSL dependencies 2026-11-02 11:42:49 +08:00
Kevin Yue 43eda033e5 refactor: align dependencies and centralize GUI activation 2026-11-01 23:35:59 +08:00
Kevin Yue 54b4d810d9 revert: remove Noto Sans license from Linux NSH artifacts
Reverts 3df556a alongside the desktop font rollback.
2026-11-01 23:35:59 +08:00
Kevin Yue e108ce50dc build: include Noto Sans license in Linux NSH artifacts 2026-11-01 23:35:59 +08:00
Kevin Yue 18ce000640 fix(certificates): report legacy key password length limit 2026-11-01 23:35:58 +08:00
Kevin Yue 14c4e24e0e refactor: replace OpenSSL transports and certificate imports 2026-11-01 23:35:58 +08:00
Kevin Yue 37c88c7adb fix(packaging): remove downloaded NSH binary on uninstall 2026-11-01 23:35:58 +08:00
Kevin Yue f2ec8c7770 feat(gui): require confirmation before interface downloads 2026-11-01 23:35:58 +08:00
Kevin Yue 1698397af3 ci(nsh): remove ICU4C build dependency 2026-11-01 23:35:58 +08:00
Kevin Yue eb8f919121 fix(packaging): map Linux desktop entry to GP Connect app ID 2026-11-01 23:35:58 +08:00
Kevin Yue b4529398b0 fix: align macOS default route detection across network setup 2026-11-01 23:35:57 +08:00
Kevin Yue c53911e7b8 ci(macos): cache validated public native libraries 2026-11-01 23:35:57 +08:00
Kevin Yue 580438e8eb refactor(api): scope GUI preference directories to desktop support 2026-11-01 23:35:57 +08:00
Kevin Yue 92943e0a9d ci: identify overdue Rust tests and last running target by hash 2026-11-01 23:35:57 +08:00
Kevin Yue 6f2f8e1265 ci: report hashed Rust panic locations without private paths 2026-11-01 23:35:57 +08:00
Kevin Yue f643180b59 ci: build the BSD desktop package with safe compiler diagnostics 2026-11-01 23:35:57 +08:00
Kevin Yue 3a643fe6ff ci: identify BSD build phases without exposing private output 2026-11-01 23:35:56 +08:00
Kevin Yue 66b1cf3c47 fix(packaging): require the FreeBSD LZ4 runtime library 2026-11-01 23:35:56 +08:00
Kevin Yue 472806ca73 ci: omit debug and incremental artifacts from private test builds 2026-11-01 23:35:56 +08:00
Kevin Yue d7de2df53b ci: install FreeBSD LZ4 and expose safe native test diagnostics 2026-11-01 23:35:56 +08:00
Kevin Yue 6ef2f0497d ci: report private Rust failure metadata without source output 2026-11-01 23:35:56 +08:00
Kevin Yue 0436a18e42 ci: embed the selected desktop source identity in native builds 2026-11-01 23:35:56 +08:00
Kevin Yue 56489a4e90 ci: install D-Bus development files for Native Shell 2026-11-01 23:35:55 +08:00
Kevin Yue 6316f8d68e chore(linux): identify selected GUI in launch diagnostics 2026-11-01 23:35:55 +08:00
Kevin Yue d9e00bc3c9 ci: retain ICU notices and verify portable NSH linkage 2026-11-01 23:35:55 +08:00
Kevin Yue e284840d89 feat(linux): switch desktop interfaces and preserve selection on upgrade 2026-11-01 23:35:55 +08:00
Kevin Yue 0df25fbd28 ci: publish Linux Native Shell alongside desktop assets 2026-11-01 23:35:55 +08:00
Kevin Yue 8e3bb8ff11 chore(desktop): verify shared tray asset location 2026-11-01 23:35:55 +08:00
Kevin Yue a7c571a2c1 refactor(auth): expose callback validation for desktop core 2026-11-01 23:35:55 +08:00
Kevin Yue 2b38de10f6 feat: select NSH by default for macOS artifacts 2026-11-01 23:35:54 +08:00
Kevin Yue 4aa7b66313 ci: verify and select the NSH macOS shell explicitly 2026-11-01 23:35:54 +08:00
Kevin Yue ce5a19c131 ci(macos): verify selected desktop shell before publication 2026-11-01 23:35:54 +08:00
Kevin Yue e7ddc2ca2a feat(gpapi): expose connection gateway choices 2026-11-01 23:35:54 +08:00
Kevin Yue 4635b1b4b8 feat(gpapi): expose pure prelogin response parsing 2026-11-01 23:35:54 +08:00
Kevin Yue 0cb246b0c5 fix: parse gateway addresses before IPv4 resolution 2026-11-01 23:35:54 +08:00
Kevin Yue fabc7d4461 fix: resolve gateway route using the parsed hostname 2026-11-01 23:35:53 +08:00
Kevin Yue d2fcf66be8 fix: restore globe rim and RGBA icon assets 2026-11-01 23:35:53 +08:00
Kevin Yue ae504dfbbe chore: update shipped app icons to hybrid artwork 2026-11-01 23:35:53 +08:00
Kevin Yue fca3076b64 refactor: remove unused iOS OpenConnect integration
Remove the iOS native-library build adapter and unused packet-endpoint builder and Rust/C FFI path. Keep the desktop build in build.rs with explicit macOS, Linux, FreeBSD and OpenBSD support.

Preserve desktop device and script-tunnel behavior, shared protocol profiles, certificate pin checks and the pinned native conformance reference.
2026-11-01 23:34:19 +08:00
Kevin Yue c29c57639a fix: preserve physical DNS while selecting VPN DNS on macOS 2026-11-01 23:34:19 +08:00
Kevin Yue da90bc80e3 feat: add portable GlobalProtect APIs and iOS tunnel support 2026-11-01 23:34:18 +08:00
236 changed files with 8369 additions and 4847 deletions

No files matched your search

@@ -0,0 +1,64 @@
name: Prepare cached macOS native dependencies
description: Cache only the completed public native-library prefix, without private source or app outputs.
inputs:
gpgui-directory:
description: Private checkout containing the native dependency builder
required: true
outputs:
prefix:
description: Validated native dependency installation prefix
value: ${{ steps.identity.outputs.path }}
cache-hit:
description: Whether the exact dependency cache was restored
value: ${{ steps.restore.outputs.cache-hit }}
runs:
using: composite
steps:
- name: Identify native dependency cache
id: identity
shell: bash
env:
GPGUI_DIRECTORY: ${{ inputs.gpgui-directory }}
GPGUI_MACOS_DEPS_CACHE_DIR: ${{ runner.tool_cache }}
run: |
set -euo pipefail
trap 'status=$?; if [ "$status" -ne 0 ]; then echo "::error::Native dependency cache identification failed; diagnostics suppressed."; fi' EXIT
metadata="$("$GPGUI_DIRECTORY/scripts/build-macos-native-deps.sh" --cache-info 2>/dev/null)"
key="$(printf '%s\n' "$metadata" | sed -n 's/^key=//p')"
prefix="$(printf '%s\n' "$metadata" | sed -n 's/^path=//p')"
# Emit only an opaque identity and one dependency directory outside the checkout.
if [[ "$key" =~ ^[0-9a-f]{64}$ ]] &&
[[ "$metadata" == "key=$key"$'\n'"path=$prefix" ]] &&
[[ "${prefix%/*}" == "$RUNNER_TOOL_CACHE/gpgui-macos-native-deps" ]] &&
[[ "${prefix##*/}" == macos-*-"$key" ]]; then
printf 'key=macos-native-deps-%s\npath=%s\n' "$key" "$prefix" >> "$GITHUB_OUTPUT"
else
exit 1
fi
- name: Restore public native libraries
id: restore
uses: actions/cache/restore@v5
with:
path: ${{ steps.identity.outputs.path }}
key: ${{ steps.identity.outputs.key }}
- name: Build or validate native libraries
shell: bash
env:
GPGUI_DIRECTORY: ${{ inputs.gpgui-directory }}
GPGUI_MACOS_DEPS_CACHE_DIR: ${{ runner.tool_cache }}
run: |
set -euo pipefail
trap 'status=$?; if [ "$status" -ne 0 ]; then echo "::error::Native dependency preparation failed; diagnostics suppressed."; fi' EXIT
started=$SECONDS
"$GPGUI_DIRECTORY/scripts/build-macos-native-deps.sh" >/dev/null 2>&1
echo "Native dependency preparation passed in $((SECONDS - started)) seconds."
# Save before any private application compilation or signing credential import.
- name: Save public native libraries
if: steps.restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ${{ steps.identity.outputs.path }}
key: ${{ steps.identity.outputs.key }}
@@ -0,0 +1,109 @@
name: Build Linux Native Shell
on:
workflow_call:
inputs:
gp_ref:
required: true
type: string
gpgui_ref:
required: true
type: string
channel:
required: true
type: string
secrets:
GH_PAT:
required: true
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
arch: x86_64
- runner: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.runner }}
name: build (${{ matrix.arch }})
timeout-minutes: 90
env:
CARGO_INCREMENTAL: '0'
CARGO_BUILD_JOBS: '2'
GPGUI_BUILD_VERSION: ${{ github.run_number }}.${{ github.run_attempt }}
GPGUI_GIT_COMMIT: ${{ inputs.gpgui_ref }}
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
steps:
- name: Checkout GlobalProtect-openconnect
uses: actions/checkout@v6
with:
ref: ${{ inputs.gp_ref }}
path: source/gp
submodules: recursive
persist-credentials: false
- name: Checkout CI helpers
uses: actions/checkout@v6
with:
path: .ci
persist-credentials: false
- name: Checkout gpgui
uses: ./.ci/.github/actions/checkout-private
with:
token: ${{ secrets.GH_PAT }}
ref: ${{ inputs.gpgui_ref }}
path: source/gpgui
- name: Install Ubuntu 24.04 dependencies
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake gettext libtool pkg-config \
clang libclang-dev libgtk-4-dev libxml2-dev \
libgnutls28-dev liblz4-dev libwayland-dev libxkbcommon-dev libdbus-1-dev
pkg-config --exists gtk4 gnutls dbus-1 wayland-client xkbcommon
- name: Install the NSH compiler
run: rustup toolchain install 1.97.0 --profile minimal
- name: Cache public crate downloads
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/cache
~/.cargo/registry/index
key: nsh-crates-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('source/gpgui/apps/desktop-nsh/Cargo.lock') }}
restore-keys: nsh-crates-${{ runner.os }}-${{ runner.arch }}-
- name: Build and package Native Shell
run: |
trap 'code=$?; if [ "$code" -ne 0 ]; then echo "::error::Native Shell build failed; diagnostics suppressed."; fi' EXIT
(
set -euo pipefail
cd source/gpgui
cargo +1.97.0 build --manifest-path apps/desktop-nsh/Cargo.toml --locked \
--release --bin gpgui-nsh --target-dir target
target/release/gpgui-nsh --version
version="$(cargo +1.97.0 metadata --manifest-path apps/desktop-nsh/Cargo.toml --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name == "gpgui-nsh") | .version')"
directory="gpgui-nsh_$version"
archive="gpgui-nsh_$(uname -m).bin.tar.xz"
mkdir -p ".build/package/$directory"
cp target/release/gpgui-nsh ".build/package/$directory/"
cp apps/desktop-nsh/ICU4X-LICENSE.txt ".build/package/$directory/ICU4X-LICENSE.txt"
if ldd target/release/gpgui-nsh | grep -q 'libicu'; then
echo "The release executable must not depend on ICU4C." >&2
exit 1
fi
tar -cJf ".build/package/$archive" -C .build/package "$directory"
sha256sum ".build/package/$archive" | cut -d ' ' -f 1 > ".build/package/$archive.sha256"
) >/dev/null 2>&1
echo "Native Shell build and version check passed."
- name: Upload Native Shell
uses: actions/upload-artifact@v7
with:
name: artifact-gpgui-nsh-${{ matrix.arch }}
if-no-files-found: error
path: |
source/gpgui/.build/package/*.bin.tar.xz
source/gpgui/.build/package/*.bin.tar.xz.sha256
+105 -9
View File
@@ -26,6 +26,12 @@ on:
required: true
default: false
type: boolean
macos_gui:
description: 'macOS shell to build; NSH also runs its separate macOS/Linux checks'
required: true
default: nsh
type: choice
options: [tauri, nsh]
build_bsd:
description: 'Build FreeBSD/OpenBSD packages for this run'
required: true
@@ -190,6 +196,16 @@ jobs:
timeout-minutes: 80
run: bash .ci/scripts/test-private-desktop.sh "$PWD/source"
check-nsh:
needs: validate-inputs
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_macos && inputs.macos_gui == 'nsh') || (startsWith(github.ref, 'refs/tags/') && vars.BUILD_MACOS_ON_TAG == 'true') }}
uses: ./.github/workflows/check-nsh.yaml
with:
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
tarball:
needs: validate-inputs
runs-on: ubuntu-latest
@@ -439,6 +455,16 @@ jobs:
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
build-gpgui-nsh:
needs: validate-inputs
uses: ./.github/workflows/build-gpgui-nsh-linux.yaml
with:
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
nix-source:
needs: [validate-inputs, build-gpgui-glibc]
strategy:
@@ -553,8 +579,14 @@ jobs:
build-macos:
name: build-macos
needs: [validate-inputs, test-gp, test-gpgui]
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_macos) || (startsWith(github.ref, 'refs/tags/') && vars.BUILD_MACOS_ON_TAG == 'true') }}
needs: [validate-inputs, test-gp, test-gpgui, check-nsh]
if: >-
${{ !cancelled() &&
needs.validate-inputs.result == 'success' &&
needs.test-gp.result == 'success' && needs.test-gpgui.result == 'success' &&
(needs.check-nsh.result == 'success' || needs.check-nsh.result == 'skipped') &&
((github.event_name == 'workflow_dispatch' && inputs.build_macos) ||
(startsWith(github.ref, 'refs/tags/') && vars.BUILD_MACOS_ON_TAG == 'true')) }}
permissions:
contents: read
concurrency:
@@ -563,6 +595,8 @@ jobs:
runs-on: ${{ vars.MACOS_RUNNER || 'macos-15' }}
environment: macos-release
timeout-minutes: 120
env:
MACOS_GUI: ${{ github.event_name == 'workflow_dispatch' && inputs.macos_gui || 'nsh' }}
steps:
- name: Verify runner architecture
run: test "$(uname -m)" = arm64
@@ -670,6 +704,12 @@ jobs:
ninja \
pkgconf \
python
rustup toolchain install 1.97.0 --profile minimal
- name: Prepare cached native dependencies
uses: ./.ci/.github/actions/macos-native-deps
with:
gpgui-directory: source/gpgui
- name: Import signing identity
env:
@@ -742,6 +782,7 @@ jobs:
- name: Build macOS release artifacts
env:
CHANNEL: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
GPGUI_GIT_COMMIT: ${{ needs.validate-inputs.outputs.gpgui_sha }}
SPARKLE_PUBLIC_KEY: ${{ vars.SPARKLE_PUBLIC_KEY }}
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
run: |
@@ -752,7 +793,7 @@ jobs:
if [[ "$CHANNEL" == "snapshot" ]]; then
export GPGUI_RELEASE_DEVTOOLS=1
fi
source/gpgui/scripts/build-macos.sh dmg release
source/gpgui/scripts/build-macos.sh dmg release --gui "$MACOS_GUI"
) 2>&1 | awk '
/^MACOS_STAGE: (Native dependencies|Components|Frontend|Application|Bundle|Bundle icons|Bundle metadata|Bundle licenses|Bundle libraries|Bundle frameworks|Bundle optimization|Signing|Validation|App notarization|Update archive|Disk image|Disk image notarization|Complete)$/ {
print "::notice::" $0
@@ -789,9 +830,15 @@ jobs:
BUILD_VERSION: ${{ format('{0}.{1}', github.run_number, github.run_attempt) }}
WORKFLOW_SHA: ${{ github.sha }}
run: |
set -euo pipefail
GP_REF="$(git -C source/gp rev-parse HEAD)"
GPGUI_REF="$(git -C source/gpgui rev-parse HEAD)"
export GP_REF GPGUI_REF
GUI="$(plutil -extract GPDesktopShell raw 'source/gpgui/target/release/bundle/macos/GP Connect.app/Contents/Info.plist')"
if [[ "$GUI" != "$MACOS_GUI" ]]; then
echo "Built desktop shell does not match the selected GUI" >&2
exit 1
fi
export GP_REF GPGUI_REF GUI
python3 - <<'PYTHON'
import hashlib
import json
@@ -799,7 +846,7 @@ jobs:
from pathlib import Path
directory = Path("release-assets")
metadata = {key.lower(): os.environ[key] for key in (
"CHANNEL", "RELEASE_TAG", "GP_REF", "GPGUI_REF", "REQUEST_ID", "BUILD_VERSION", "WORKFLOW_SHA")}
"CHANNEL", "RELEASE_TAG", "GP_REF", "GPGUI_REF", "REQUEST_ID", "BUILD_VERSION", "WORKFLOW_SHA", "GUI")}
metadata["artifact_version"] = os.environ["MACOS_ARTIFACT_VERSION"]
metadata["assets"] = {
file.name: hashlib.sha256(file.read_bytes()).hexdigest()
@@ -973,6 +1020,7 @@ jobs:
gmake \
pkgconf \
libxml2 \
liblz4 \
gnutls \
p11-kit \
nettle \
@@ -981,8 +1029,10 @@ jobs:
libayatana-appindicator \
polkit \
webkit2-gtk_41
pkgconf --exists libxml-2.0 liblz4 gnutls p11-kit-1 hogweed nettle gmp
run: |
set -eu
exec 3>&1
(
set -eu
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
@@ -990,12 +1040,33 @@ jobs:
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
cd "${{ matrix.workspace }}/gp"
cargo build --release --workspace
echo "BSD public components: started." >&3
cargo build --release --workspace >&3 2>&3
echo "BSD public components: passed." >&3
cd ../gpgui/apps/desktop/src-tauri
cargo build --release --workspace
echo "BSD desktop: started." >&3
diagnostics="$(mktemp)"
trap 'rm -f "$diagnostics" || true' EXIT
if cargo build --release -p gpgui >"$diagnostics" 2>&1; then
echo "BSD desktop: passed." >&3
else
status=$?
sed -n 's/.*\(error\[E[0-9][0-9][0-9][0-9]\]\).*/::error::BSD Rust diagnostic: \1/p' "$diagnostics" | sort -u >&3 || true
if grep -q 'No space left on device' "$diagnostics"; then
echo "::error::BSD desktop compilation: insufficient disk space." >&3
fi
if grep -Eq 'signal: 9, SIGKILL|ld terminated with signal 9|Killed signal terminated program' "$diagnostics"; then
echo "::error::BSD desktop compilation: compiler or linker killed by SIGKILL." >&3
fi
if grep -Eq 'undefined reference to|undefined symbol:' "$diagnostics"; then
echo "::error::BSD desktop compilation: unresolved linker symbols." >&3
fi
exit "$status"
fi
cd ../../../../gp
echo "BSD packaging: started." >&3
gmake "${{ matrix.package_target }}" GPGUI_BINARY=../gpgui/target/release/gpgui
pkg install -y ".build/${{ matrix.artifact_dir }}"/artifacts/*.pkg
gpclient --version
@@ -1003,6 +1074,7 @@ jobs:
gpgui --version
rm -rf target ../gpgui/target
find ".build/${{ matrix.artifact_dir }}" -mindepth 1 -maxdepth 1 ! -name artifacts -exec rm -rf {} +
echo "BSD packaging: passed." >&3
) >/dev/null 2>&1
echo "BSD build passed."
- name: Build on OpenBSD
@@ -1042,6 +1114,7 @@ jobs:
ln -sf /usr/local/bin/automake-1.17 /usr/local/bin/automake
run: |
set -eu
exec 3>&1
(
set -eu
export AUTOCONF_VERSION=2.72
@@ -1051,12 +1124,33 @@ jobs:
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
cd "${{ matrix.workspace }}/gp"
cargo build --release --workspace
echo "BSD public components: started." >&3
cargo build --release --workspace >&3 2>&3
echo "BSD public components: passed." >&3
cd ../gpgui/apps/desktop/src-tauri
cargo build --release --workspace
echo "BSD desktop: started." >&3
diagnostics="$(mktemp)"
trap 'rm -f "$diagnostics" || true' EXIT
if cargo build --release -p gpgui >"$diagnostics" 2>&1; then
echo "BSD desktop: passed." >&3
else
status=$?
sed -n 's/.*\(error\[E[0-9][0-9][0-9][0-9]\]\).*/::error::BSD Rust diagnostic: \1/p' "$diagnostics" | sort -u >&3 || true
if grep -q 'No space left on device' "$diagnostics"; then
echo "::error::BSD desktop compilation: insufficient disk space." >&3
fi
if grep -Eq 'signal: 9, SIGKILL|ld terminated with signal 9|Killed signal terminated program' "$diagnostics"; then
echo "::error::BSD desktop compilation: compiler or linker killed by SIGKILL." >&3
fi
if grep -Eq 'undefined reference to|undefined symbol:' "$diagnostics"; then
echo "::error::BSD desktop compilation: unresolved linker symbols." >&3
fi
exit "$status"
fi
cd ../../../../gp
echo "BSD packaging: started." >&3
gmake "${{ matrix.package_target }}" GPGUI_BINARY=../gpgui/target/release/gpgui
pkg_add -D unsigned ".build/${{ matrix.artifact_dir }}"/artifacts/*.tgz
gpclient --version
@@ -1064,6 +1158,7 @@ jobs:
gpgui --version
rm -rf target ../gpgui/target
find ".build/${{ matrix.artifact_dir }}" -mindepth 1 -maxdepth 1 ! -name artifacts -exec rm -rf {} +
echo "BSD packaging: passed." >&3
) >/dev/null 2>&1
echo "BSD build passed."
- name: Upload BSD package
@@ -1095,6 +1190,7 @@ jobs:
- build-docker-image
- build-gpgui-glibc
- build-gpgui-musl
- build-gpgui-nsh
- setup-bsd-matrix
- build-gpgui-frontend
- build-bsd
@@ -0,0 +1,67 @@
name: Check macOS native dependency cache
on:
workflow_dispatch:
inputs:
gpgui_ref:
description: Full gpgui commit SHA
required: true
type: string
workflow_call:
inputs:
gpgui_ref:
required: true
type: string
secrets:
GH_PAT:
required: true
permissions:
contents: read
jobs:
check:
runs-on: ${{ vars.MACOS_RUNNER || 'macos-15' }}
timeout-minutes: 30
steps:
- name: Require immutable source ref
env:
GPGUI_REF: ${{ inputs.gpgui_ref }}
run: test "${#GPGUI_REF}" -eq 40 && [[ "$GPGUI_REF" != *[!0-9a-f]* ]]
- uses: actions/checkout@v6
with:
path: .ci
persist-credentials: false
- name: Checkout gpgui quietly
uses: ./.ci/.github/actions/checkout-private
with:
token: ${{ secrets.GH_PAT }}
ref: ${{ inputs.gpgui_ref }}
path: source/gpgui
- name: Select release toolchain and install native build tools
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
run: |
test "$(uname -m)" = arm64
xcodebuild -version
echo "DEVELOPER_DIR=$DEVELOPER_DIR" >> "$GITHUB_ENV"
brew install autoconf automake gettext libtool meson ninja pkgconf
- name: Prepare cached native dependencies
id: native
uses: ./.ci/.github/actions/macos-native-deps
with:
gpgui-directory: source/gpgui
- name: Record cache result
env:
CACHE_HIT: ${{ steps.native.outputs.cache-hit }}
run: |
if [[ "$CACHE_HIT" == true ]]; then
echo "Validated an exact native dependency cache hit." >> "$GITHUB_STEP_SUMMARY"
else
echo "Built and validated native dependencies after a cache miss." >> "$GITHUB_STEP_SUMMARY"
fi
+139
View File
@@ -0,0 +1,139 @@
name: Check NSH
on:
workflow_dispatch:
inputs:
gp_ref:
description: 'Full GlobalProtect-openconnect commit SHA'
required: true
type: string
gpgui_ref:
description: 'Full gpgui commit SHA'
required: true
type: string
workflow_call:
inputs:
gp_ref:
required: true
type: string
gpgui_ref:
required: true
type: string
secrets:
GH_PAT:
required: true
permissions:
contents: read
jobs:
check:
name: NSH (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- platform: linux
runner: ubuntu-24.04
- platform: macos
runner: ${{ vars.MACOS_RUNNER || 'macos-15' }}
env:
CARGO_INCREMENTAL: '0'
CARGO_BUILD_JOBS: '2'
steps:
- name: Require immutable source refs
env:
GP_REF: ${{ inputs.gp_ref }}
GPGUI_REF: ${{ inputs.gpgui_ref }}
run: |
[[ "$GP_REF" =~ ^[0-9a-f]{40}$ && "$GPGUI_REF" =~ ^[0-9a-f]{40}$ ]] || {
echo "Both source refs must be full commit SHAs."
exit 1
}
- name: Checkout GlobalProtect-openconnect
uses: actions/checkout@v6
with:
ref: ${{ inputs.gp_ref }}
path: source/gp
submodules: recursive
persist-credentials: false
- name: Checkout CI helpers
uses: actions/checkout@v6
with:
path: .ci
persist-credentials: false
- name: Checkout gpgui
uses: ./.ci/.github/actions/checkout-private
with:
token: ${{ secrets.GH_PAT }}
ref: ${{ inputs.gpgui_ref }}
path: source/gpgui
- name: Install Linux dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake gettext libtool pkg-config \
clang libclang-dev libgtk-4-dev libxml2-dev \
libgnutls28-dev liblz4-dev libwayland-dev libxkbcommon-dev libdbus-1-dev
pkg-config --exists gtk4 gnutls dbus-1 wayland-client xkbcommon
- name: Install macOS dependencies
if: matrix.platform == 'macos'
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
run: |
xcodebuild -version
echo "DEVELOPER_DIR=$DEVELOPER_DIR" >> "$GITHUB_ENV"
brew install autoconf automake gettext libtool pkgconf gnutls libxml2 lz4
echo "$(brew --prefix gettext)/bin" >> "$GITHUB_PATH"
echo "ACLOCAL_PATH=$(brew --prefix gettext)/share/aclocal" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$(brew --prefix libxml2)/lib/pkgconfig:$(brew --prefix gnutls)/lib/pkgconfig" >> "$GITHUB_ENV"
- name: Install the NSH compiler
run: rustup toolchain install 1.97.0 --profile minimal
- name: Cache public crate downloads
uses: actions/cache@v5
with:
# Private source and build outputs stay out of the public cache.
path: |
~/.cargo/registry/cache
~/.cargo/registry/index
key: nsh-crates-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('source/gpgui/apps/desktop-nsh/Cargo.lock') }}
restore-keys: nsh-crates-${{ runner.os }}-${{ runner.arch }}-
- name: Check demo-free NSH production
timeout-minutes: 30
run: |
diagnostics="$(mktemp)"
trap 'code=$?; if [ "$code" -ne 0 ]; then echo "::error::NSH production check failed; diagnostics suppressed."; python3 .ci/scripts/private-ci-diagnostics.py compile "$diagnostics" || true; fi; rm -f "$diagnostics"' EXIT
(
set -euo pipefail
cd source/gpgui
cargo +1.97.0 check --manifest-path apps/desktop-nsh/Cargo.toml --locked --bin gpgui-nsh
) >"$diagnostics" 2>&1
echo "NSH production check passed."
- name: Compile NSH tests
timeout-minutes: 30
run: |
diagnostics="$(mktemp)"
trap 'code=$?; if [ "$code" -ne 0 ]; then echo "::error::NSH test compilation failed; diagnostics suppressed."; python3 .ci/scripts/private-ci-diagnostics.py compile "$diagnostics" || true; fi; rm -f "$diagnostics"' EXIT
(
set -euo pipefail
cd source/gpgui
cargo +1.97.0 test --manifest-path apps/desktop-nsh/Cargo.toml --locked --features demo --no-run
) >"$diagnostics" 2>&1
echo "NSH test compilation passed."
- name: Run NSH tests
timeout-minutes: 10
run: |
diagnostics="$(mktemp)"
trap 'code=$?; if [ "$code" -ne 0 ]; then echo "::error::NSH tests failed; diagnostics suppressed."; python3 .ci/scripts/private-ci-diagnostics.py tests "$diagnostics" || true; fi; rm -f "$diagnostics"' EXIT
(
set -euo pipefail
cd source/gpgui
cargo +1.97.0 test --manifest-path apps/desktop-nsh/Cargo.toml --locked --features demo -- --test-threads=1
) >"$diagnostics" 2>&1
echo "NSH tests passed."
-1
View File
@@ -63,7 +63,6 @@ jobs:
make \
namcap \
nettle \
openssl \
patch \
pkgconf \
librsvg \
+9 -1
View File
@@ -12,6 +12,13 @@ on:
required: true
type: string
expected_gui:
description: 'Expected macOS shell in the selected build artifact'
required: true
default: nsh
type: choice
options: [tauri, nsh]
concurrency:
group: publish-macos-assets
cancel-in-progress: false
@@ -66,10 +73,11 @@ jobs:
RELEASE_TAG: ${{ inputs.release_tag }}
WORKFLOW_COMMIT: ${{ steps.build.outputs.workflow_commit }}
ARTIFACT_NAME: ${{ steps.build.outputs.artifact }}
EXPECTED_GUI: ${{ inputs.expected_gui }}
run: |
set -euo pipefail
metadata="$(python3 scripts/validate-macos-release.py release-assets \
--release-tag "$RELEASE_TAG" --workflow-commit "$WORKFLOW_COMMIT")"
--release-tag "$RELEASE_TAG" --workflow-commit "$WORKFLOW_COMMIT" --gui "$EXPECTED_GUI")"
[[ "$ARTIFACT_NAME" == "macos-release-$(jq -r '.request_id' <<<"$metadata")" ]]
{
echo "gp_ref=$(jq -r '.gp_ref' <<<"$metadata")"
@@ -27,6 +27,10 @@ on:
gp_ref:
required: true
type: string
expected_gui:
required: false
default: nsh
type: string
highlights:
required: false
type: string
@@ -61,6 +65,12 @@ on:
required: true
default: main
type: string
expected_gui:
description: Expected macOS shell in the selected update archive
required: true
default: nsh
type: choice
options: [tauri, nsh]
highlights:
description: Stable release highlights, one per line
required: false
@@ -88,6 +98,7 @@ jobs:
REQUESTED_ARCHIVE: ${{ inputs.archive_name }}
FEED_URL: ${{ vars.SPARKLE_FEED_URL }}
EXPECTED_TEAM_ID: ${{ vars.MACOS_TEAM_ID }}
EXPECTED_GUI: ${{ inputs.expected_gui }}
UPDATES_WORKER_NAME: ${{ vars.UPDATES_WORKER_NAME || 'gp-updates' }}
SPARKLE_VERSION: 2.9.2
UPDATE_HIGHLIGHTS: ${{ inputs.highlights }}
@@ -106,6 +117,10 @@ jobs:
echo "channel must be stable or snapshot" >&2
exit 1
fi
if [[ "$EXPECTED_GUI" != "tauri" && "$EXPECTED_GUI" != "nsh" ]]; then
echo "expected_gui must be tauri or nsh" >&2
exit 1
fi
if [[ ! "$UNIX_PLATFORMS" =~ ^(linux|freebsd|openbsd)(,(linux|freebsd|openbsd))*$ ]]; then
echo "unix_platforms must list published Unix targets separated by commas" >&2
exit 1
@@ -285,6 +300,12 @@ jobs:
fi
file "$app/Contents/MacOS/gpgui" | grep -q 'arm64'
desktop_shell="$(plutil -extract GPDesktopShell raw "$app/Contents/Info.plist")"
if [[ "$desktop_shell" != "$EXPECTED_GUI" ]]; then
echo "Update archive desktop shell does not match the selected GUI" >&2
exit 1
fi
feed_url="$(plutil -extract SUFeedURL raw "$app/Contents/Info.plist")"
if [[ "$feed_url" != "$FEED_URL" ]]; then
echo "Unexpected Sparkle feed URL: $feed_url" >&2
Generated
+455 -216
View File
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -1,5 +1,5 @@
[workspace]
resolver = "2"
resolver = "3"
members = [
"crates/*",
@@ -32,7 +32,7 @@ is_executable = "1.0"
log = "0.4"
# RUST_LOG accepts user-supplied Unicode property filters through env_logger.
regex = { version = "1", default-features = false, features = ["std", "perf", "unicode"] }
reqwest = { version = "0.13", default-features = false, features = ["native-tls", "charset", "http2", "system-proxy", "json", "form", "query"] }
reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider", "charset", "http2", "system-proxy", "json", "form", "query"] }
openssl = "0.10"
pem = "4"
xmltree = { version = "0.12", features = ["attribute-order"] }
@@ -43,6 +43,7 @@ sysinfo = { version = "0.38.4", default-features = false, features = ["system"]
tempfile = "3.8"
tokio = { version = "1" }
tokio-util = "0.7"
tokio-tungstenite = "0.30"
url = "2.4"
urlencoding = "2.1.3"
axum = { version = "0.8", default-features = false, features = ["http1", "tokio"] }
@@ -57,7 +58,7 @@ md5 = "0.8"
sha2 = { version = "0.11", default-features = false }
which = "8"
uuid = "1"
netdev = "0.46.3"
netdev = "0.47"
humantime = "2"
snow = { version = "0.10", default-features = false, features = ["use-getrandom", "use-curve25519", "use-chacha20poly1305", "use-sha2"] }
zeroize = "1"
@@ -68,10 +69,10 @@ specta = "=2.0.0-rc.20"
proptest = "1"
[patch.crates-io]
# Restore BSD GTK resize hit testing until https://github.com/tauri-apps/tao/pull/1356 is released.
tao = { git = "https://github.com/yuezk/tao", rev = "1452ae7a42c9f134296ba199f91f514fc9077f61" }
# Restore BSD GTK resize hit testing and apply fixed-size windows before first configure.
tao = { git = "https://github.com/yuezk/tao", rev = "bba0f1c4e86d697b173c75280d1651f408b8023c" }
# Use one macro source for Tao and Wry so Cargo can vendor the workspace.
tao-macros = { git = "https://github.com/yuezk/tao", rev = "1452ae7a42c9f134296ba199f91f514fc9077f61" }
tao-macros = { git = "https://github.com/yuezk/tao", rev = "bba0f1c4e86d697b173c75280d1651f408b8023c" }
[profile.release]
opt-level = 'z' # Optimize for size
+10 -5
View File
@@ -190,8 +190,7 @@ install-unix: install-gpclient-unix
set -e; if [ -f "$(GPGUI_BINARY)" ]; then \
install -m 755 "$(GPGUI_BINARY)" "$(DESTDIR)$(PREFIX)/bin/gpgui"; \
fi
set -e; for file in packaging/files/usr/share/icons/hicolor/*/apps/gpgui.* \
packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-*.svg; do \
set -e; for file in packaging/files/usr/share/icons/hicolor/*/apps/gpgui.*; do \
destination="$(DESTDIR)$(PREFIX)/$${file#packaging/files/usr/}"; \
install -d "$$(dirname "$$destination")"; \
install -m 644 "$$file" "$$destination"; \
@@ -200,6 +199,8 @@ install-unix: install-gpclient-unix
install-linux: install-unix
@echo "Installing Linux integration under $(PREFIX)..."
set -e; for file in share/applications/gpgui.desktop \
share/applications/gpgui-helper.desktop \
share/applications/gpauth.desktop \
share/polkit-1/actions/com.yuezk.gpgui.policy \
lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down \
lib/NetworkManager/dispatcher.d/gpclient-nm-hook; do \
@@ -213,7 +214,7 @@ install-linux: install-unix
install-bsd: install-unix
@echo "Installing BSD integration under $(PREFIX)..."
install -d "$(DESTDIR)$(PREFIX)/share/applications" "$(DESTDIR)$(PREFIX)/share/polkit-1/actions"
install -m 644 packaging/bsd/gpgui.desktop "$(DESTDIR)$(PREFIX)/share/applications/"
install -m 644 packaging/bsd/gpgui.desktop packaging/bsd/gpgui-helper.desktop packaging/bsd/gpauth.desktop "$(DESTDIR)$(PREFIX)/share/applications/"
install -m 644 packaging/bsd/com.yuezk.gpgui.policy "$(DESTDIR)$(PREFIX)/share/polkit-1/actions/"
sh scripts/relocate-install-paths.sh "$(PREFIX)" /usr/local "$(DESTDIR)$(PREFIX)"
@@ -259,7 +260,9 @@ package-openbsd: clean-bsd-package
$(MAKE) install-bsd DESTDIR=$(CURDIR)/.build/openbsd/pkgroot PREFIX=$(PREFIX) GPGUI_BINARY="$(GPGUI_BINARY)"
cp packaging/bsd/openbsd/COMMENT .build/openbsd/+COMMENT
cp packaging/bsd/openbsd/DESC .build/openbsd/+DESC
sh scripts/openbsd-library-dependencies.sh .build/openbsd/pkgroot > .build/openbsd/WANTLIB
{ \
cat .build/openbsd/WANTLIB; \
echo '@unexec-delete /bin/rm -f /usr/local/libexec/gpclient/gpgui /var/db/gpclient/scripts/vpnc-script /var/db/gpclient/scripts/vpnc-script.metadata || echo "Warning: failed to remove gpclient runtime files" >&2'; \
echo '@unexec-delete /bin/rmdir /usr/local/libexec/gpclient 2>/dev/null || true'; \
echo '@unexec-delete /bin/rmdir /var/db/gpclient/scripts 2>/dev/null || true'; \
@@ -314,11 +317,12 @@ uninstall-unix:
set -e; for file in gp-hip-script-installer gp-vpnc-script-installer vpnc-script; do \
rm -f "$(DESTDIR)$(PREFIX)/libexec/gpclient/$$file"; \
done
set -e; for file in packaging/files/usr/share/icons/hicolor/*/apps/gpgui.* \
packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-*.svg; do \
set -e; for file in packaging/files/usr/share/icons/hicolor/*/apps/gpgui.*; do \
rm -f "$(DESTDIR)$(PREFIX)/$${file#packaging/files/usr/}"; \
done
rm -f "$(DESTDIR)$(PREFIX)/share/applications/gpgui.desktop" \
"$(DESTDIR)$(PREFIX)/share/applications/gpgui-helper.desktop" \
"$(DESTDIR)$(PREFIX)/share/applications/gpauth.desktop" \
"$(DESTDIR)$(PREFIX)/share/polkit-1/actions/com.yuezk.gpgui.policy"
rmdir "$(DESTDIR)$(PREFIX)/libexec/gpclient" 2>/dev/null || true
@@ -326,6 +330,7 @@ uninstall-linux: uninstall-unix
rm -f "$(DESTDIR)$(PREFIX)/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down" \
"$(DESTDIR)$(PREFIX)/lib/NetworkManager/dispatcher.d/gpclient-nm-hook"
rm -f "$(DESTDIR)/var/lib/gpclient/gpgui" \
"$(DESTDIR)/var/lib/gpclient/gpgui-nsh" \
"$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script" \
"$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata"
rmdir "$(DESTDIR)/var/lib/gpclient/scripts" "$(DESTDIR)/var/lib/gpclient" 2>/dev/null || true
+11 -2
View File
@@ -67,7 +67,6 @@ Commands:
help Print this message or the help of the given subcommand(s)
Options:
--fix-openssl Uses extended compatibility mode for OpenSSL operations to support a broader range of systems and formats.
--ignore-tls-errors Ignore the TLS errors
--lock-file <LOCK_FILE> Path to the gpclient PID lock file
--log-format <LOG_FORMAT> Log output format. JSON is intended for non-interactive consumers; interactive prompts remain text. [default: text] [possible values: text, json]
@@ -77,7 +76,6 @@ Options:
-V, --version Print version
```
The `--fix-openssl` option is available on Linux, FreeBSD, and OpenBSD. macOS uses native TLS and GnuTLS and does not accept this option.
> **Tip:** Use `gpclient help <command>` for detailed information on a specific command.
@@ -129,6 +127,9 @@ GP Connect provides a desktop interface for managing VPN connections. On macOS,
gpclient launch-gui
```
> [!TIP]
> **On Linux, try Native Shell for lower memory usage.** Switch to it in **Settings → General → Interface**.
> [!Note]
>
> The GUI version is partially open source. The background service ([gpservice](./apps/gpservice/)) is open source, while the GUI wrapper is proprietary.
@@ -354,6 +355,14 @@ nix build "git+file://$PWD?submodules=1#fromSource"
Local source builds require initialized Git submodules and a flake URL with `submodules=1`, as shown above. For a remote source flake, use a Git URL with submodules enabled, such as `git+https://github.com/yuezk/GlobalProtect-openconnect?submodules=1#fromSource`. The `prebuilt` package and NixOS module do not require Git submodules. Build output (`target`, `.build`, and `node_modules`) is excluded from the source input. Updating release asset hashes changes the prebuilt package, independently of source builds.
Source builds also support downloading either desktop interface on NixOS. The
downloader packages the verified Tauri or Native Shell archive with Nix, including
its runtime libraries. Each installed interface has a garbage-collection root
under `/var/lib/gpclient/nix-gui`, so its dependencies remain available after
system upgrades. No Rust compilation or NixOS rebuild is needed for GUI downloads.
Prebuilt packages gain this support when their release includes the updated
service; adding the flake installer alone does not change older service binaries.
### Official Docker Image
The [official Docker image](https://hub.docker.com/r/yuezk/globalprotect-openconnect) provides the CLI tools on Alpine Linux:
+3 -1
View File
@@ -21,7 +21,6 @@ clap.workspace = true
log.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread"] }
tempfile.workspace = true
compile-time.workspace = true
home = "0.5.12"
@@ -33,3 +32,6 @@ tauri = { workspace = true, optional = true }
default = ["webview-auth"]
webview-auth = ["auth/webview-auth", "dep:tauri", "dep:tauri-build"]
release-devtools = ["auth/release-devtools"]
[dev-dependencies]
tempfile.workspace = true
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 58 KiB

+12 -33
View File
@@ -6,8 +6,6 @@ use clap::Parser;
use clap::Subcommand;
#[cfg(feature = "webview-auth")]
use gpapi::auth::AuthWindowTheme;
#[cfg(not(target_os = "macos"))]
use gpapi::utils::openssl;
use gpapi::{
auth::{AuthenticationCancelled, SamlAuthData, SamlAuthResult},
clap::{Args, InfoLevelVerbosity, args::Os, handle_error},
@@ -20,8 +18,6 @@ use gpapi::{
use log::info;
use serde_json::json;
use std::net::IpAddr;
#[cfg(not(target_os = "macos"))]
use tempfile::NamedTempFile;
const VERSION: &str = concat!(
env!("CARGO_PKG_VERSION"),
@@ -89,7 +85,7 @@ struct Cli {
key_password: Option<String>,
#[cfg(not(target_os = "macos"))]
#[arg(long, help = "Get around the OpenSSL `unsafe legacy renegotiation` error")]
#[arg(long, hide = true)]
fix_openssl: bool,
#[arg(long, help = "Ignore TLS errors")]
@@ -149,11 +145,6 @@ enum CliCommand {
}
impl Args for Cli {
#[cfg(not(target_os = "macos"))]
fn fix_openssl(&self) -> bool {
self.fix_openssl
}
fn ignore_tls_errors(&self) -> bool {
self.ignore_tls_errors
}
@@ -164,19 +155,12 @@ impl Args for Cli {
}
impl Cli {
#[cfg(not(target_os = "macos"))]
fn prepare_openssl(&self) -> anyhow::Result<Option<NamedTempFile>> {
async fn run(&self) -> anyhow::Result<()> {
#[cfg(not(target_os = "macos"))]
if self.fix_openssl {
info!("Fixing OpenSSL environment");
let file = openssl::fix_openssl_env()?;
return Ok(Some(file));
log::warn!("--fix-openssl is deprecated and has no effect. It will be removed in a future release.");
}
Ok(None)
}
async fn run(&self) -> anyhow::Result<()> {
if self.browser_listen.is_some()
&& !matches!(self.browser.as_deref(), Some(browser) if browser.eq_ignore_ascii_case("manual") || browser.eq_ignore_ascii_case("remote"))
{
@@ -189,8 +173,6 @@ impl Cli {
#[cfg(feature = "webview-auth")]
gpapi::utils::env_utils::patch_gui_runtime_env(self.hidpi);
#[cfg(not(target_os = "macos"))]
let openssl_conf = self.prepare_openssl()?;
let server = normalize_server(self.server.as_deref().expect("server is required for authentication"))?;
let gp_params = self.build_gp_params();
@@ -230,8 +212,6 @@ impl Cli {
print_auth_result(auth_result, Some(&auth_host_id));
#[cfg(not(target_os = "macos"))]
drop(openssl_conf);
return Ok(());
}
@@ -243,8 +223,6 @@ impl Cli {
self.clean,
self.window_title.clone(),
self.window_theme,
#[cfg(not(target_os = "macos"))]
openssl_conf,
)
.await?;
@@ -263,13 +241,10 @@ impl Cli {
fn build_os_profile(&self) -> OsProfile {
let mut builder = OsProfile::builder(ClientOs::from(self.os));
if let Some(host_id) = self.host_id.as_deref() {
builder = builder.host_id_override(host_id);
}
if let Some(client_version) = self.client_version.as_deref() {
builder = builder.client_version(client_version);
}
builder.build()
gpapi::os_profile::desktop::collect_profile(builder, self.host_id.as_deref())
}
fn external_browser_requested(&self) -> bool {
@@ -341,9 +316,13 @@ mod tests {
use super::*;
#[test]
fn openssl_option_is_available_only_on_supported_platforms() {
fn deprecated_openssl_option_remains_supported_but_hidden() {
let result = Cli::try_parse_from(["gpauth", "portal.example.com", "--fix-openssl"]);
assert_eq!(result.is_ok(), !cfg!(target_os = "macos"));
for flag in ["-h", "--help"] {
let help = Cli::try_parse_from(["gpauth", flag]).err().unwrap().to_string();
assert!(!help.contains("--fix-openssl"));
}
}
#[test]
@@ -351,12 +330,12 @@ mod tests {
use gpapi::error::ServerTlsErrorKind;
let tls = ServerTlsError {
server: "https://vpn.example.com".into(),
kind: ServerTlsErrorKind::LegacyRenegotiation,
kind: ServerTlsErrorKind::Certificate,
};
let outcome = auth_outcome(Err(anyhow::Error::new(tls).context("retry failed")), None);
assert_eq!(
serde_json::to_value(outcome).unwrap(),
json!({"serverTlsError": {"server": "https://vpn.example.com", "kind": "legacyRenegotiation"}})
json!({"serverTlsError": {"server": "https://vpn.example.com", "kind": "certificate"}})
);
assert_eq!(
serde_json::to_value(auth_outcome(Err(anyhow::anyhow!("rejected")), None)).unwrap(),
+1 -17
View File
@@ -1,11 +1,5 @@
use auth::{WebviewAuthenticator, apply_auth_theme};
use gpapi::{auth::AuthWindowTheme, gp_params::GpParams};
#[cfg(not(target_os = "macos"))]
use log::info;
#[cfg(not(target_os = "macos"))]
use tauri::RunEvent;
#[cfg(not(target_os = "macos"))]
use tempfile::NamedTempFile;
use crate::cli::print_auth_result;
@@ -16,7 +10,6 @@ pub async fn authenticate(
clean: bool,
window_title: Option<String>,
window_theme: AuthWindowTheme,
#[cfg(not(target_os = "macos"))] mut openssl_conf: Option<NamedTempFile>,
) -> anyhow::Result<()> {
let auth_host_id = gp_params.os_profile().host_identity().host_id().to_string();
@@ -46,16 +39,7 @@ pub async fn authenticate(
Ok(())
})
.build(crate::tauri_context::get())?
.run(move |_app_handle, _event| {
#[cfg(not(target_os = "macos"))]
if let RunEvent::Exit = _event {
if let Some(file) = openssl_conf.take() {
if let Err(err) = file.close() {
info!("Error closing OpenSSL config file: {}", err);
}
}
}
});
.run(|_, _| {});
Ok(())
}
+40
View File
@@ -0,0 +1,40 @@
#![cfg(not(target_os = "macos"))]
use std::process::Command;
#[test]
fn deprecated_flag_warns_without_changing_auth_output_or_configuration() {
const WARNING: &str = "--fix-openssl is deprecated and has no effect. It will be removed in a future release.";
let directory = tempfile::tempdir().unwrap();
let configuration = directory.path().join("openssl.cnf");
std::fs::write(&configuration, "existing user configuration").unwrap();
for deprecated in [false, true] {
let mut command = Command::new(env!("CARGO_BIN_EXE_gpauth"));
command.arg("portal.example.com");
if deprecated {
command.arg("--fix-openssl");
}
// Reject invalid options before authentication, without making a network request.
let output = command
.args(["--browser-listen", "127.0.0.1", "--log-format", "json"])
.env("OPENSSL_CONF", &configuration)
.output()
.unwrap();
assert!(!output.status.success());
assert!(output.stdout.is_empty());
let logs = String::from_utf8(output.stderr).unwrap();
let records = logs
.lines()
.map(|line| serde_json::from_str::<serde_json::Value>(line).unwrap())
.collect::<Vec<_>>();
assert_eq!(
records.iter().filter(|record| record["message"] == WARNING).count(),
usize::from(deprecated)
);
assert!(logs.contains("requires '--browser manual'"));
assert_eq!(
std::fs::read_to_string(&configuration).unwrap(),
"existing user configuration"
);
}
}
+3 -2
View File
@@ -28,8 +28,6 @@ sysinfo.workspace = true
serde.workspace = true
serde_json.workspace = true
whoami.workspace = true
tempfile.workspace = true
reqwest.workspace = true
directories.workspace = true
compile-time.workspace = true
uzers.workspace = true
@@ -40,3 +38,6 @@ webview-auth = ["gpapi/webview-auth"]
[target.'cfg(target_os = "macos")'.dependencies]
gpvpnc = { path = "../../crates/gpvpnc" }
[dev-dependencies]
tempfile.workspace = true
+14 -33
View File
@@ -5,16 +5,12 @@ use std::{
use anyhow::bail;
use clap::{Parser, Subcommand};
#[cfg(not(target_os = "macos"))]
use gpapi::utils::openssl;
use gpapi::{
clap::{Args, InfoLevelVerbosity, handle_error},
log_format::{LogFormat, write_json_record},
};
use log::info;
use sysinfo::{Pid, System};
#[cfg(not(target_os = "macos"))]
use tempfile::NamedTempFile;
use tokio::fs;
use crate::{
@@ -36,8 +32,6 @@ const VERSION: &str = concat!(
);
pub(crate) struct SharedArgs<'a> {
#[cfg(not(target_os = "macos"))]
pub(crate) fix_openssl: bool,
pub(crate) ignore_tls_errors: bool,
pub(crate) lock_file: &'a Path,
pub(crate) verbose: &'a InfoLevelVerbosity,
@@ -96,10 +90,7 @@ struct Cli {
command: CliCommand,
#[cfg(not(target_os = "macos"))]
#[arg(
long,
help = "Uses extended compatibility mode for OpenSSL operations to support a broader range of systems and formats."
)]
#[arg(long, hide = true)]
fix_openssl: bool,
#[arg(long, help = "Ignore the TLS errors")]
ignore_tls_errors: bool,
@@ -127,11 +118,6 @@ struct Cli {
}
impl Args for Cli {
#[cfg(not(target_os = "macos"))]
fn fix_openssl(&self) -> bool {
self.fix_openssl
}
fn ignore_tls_errors(&self) -> bool {
self.ignore_tls_errors
}
@@ -169,17 +155,14 @@ impl Cli {
.unwrap_or(false)
}
#[cfg(not(target_os = "macos"))]
fn fix_openssl(&self) -> anyhow::Result<Option<NamedTempFile>> {
if self.fix_openssl {
let file = openssl::fix_openssl_env()?;
return Ok(Some(file));
async fn run(&self) -> anyhow::Result<()> {
#[cfg(not(target_os = "macos"))]
if self.fix_openssl
&& !(matches!(&self.command, CliCommand::Connect(args) if args.background) && self.background_worker_fd.is_none())
{
log::warn!("--fix-openssl is deprecated and has no effect. It will be removed in a future release.");
}
Ok(None)
}
async fn run(&self) -> anyhow::Result<()> {
if let CliCommand::Connect(args) = &self.command {
if args.dashboard {
crate::dashboard::validate(self.log_format)?;
@@ -214,13 +197,7 @@ impl Cli {
None
};
// The temp file will be dropped automatically when the file handle is dropped
// So, declare it here to ensure it's not dropped
#[cfg(not(target_os = "macos"))]
let _file = self.fix_openssl()?;
let shared_args = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: self.fix_openssl,
ignore_tls_errors: self.ignore_tls_errors,
lock_file: &self.lock_file,
verbose: &self.verbose,
@@ -243,7 +220,7 @@ impl Cli {
CliCommand::Hip(args) => HipHandler::new(args).handle().await,
CliCommand::Diagnostics(_) => unreachable!("diagnostics is dispatched before VPN setup"),
CliCommand::DetectInternalHost { address, hostname } => {
let internal = gpapi::session::network::native::detect_in_helper(*address, hostname)?;
let internal = gpapi::session::desktop::network::native::detect_in_helper(*address, hostname)?;
println!("{}", serde_json::to_string(&internal)?);
Ok(())
}
@@ -252,7 +229,7 @@ impl Cli {
port,
disable_ipv6,
} => {
let addresses = gpapi::session::network::native::lookup_in_helper(host, *port, *disable_ipv6)?;
let addresses = gpapi::session::desktop::network::native::lookup_in_helper(host, *port, *disable_ipv6)?;
println!("{}", serde_json::to_string(&addresses)?);
Ok(())
}
@@ -370,9 +347,13 @@ mod tests {
}
#[test]
fn openssl_option_is_available_only_on_supported_platforms() {
fn deprecated_openssl_option_remains_supported_but_hidden() {
let result = Cli::try_parse_from(["gpclient", "--fix-openssl", "diagnostics"]);
assert_eq!(result.is_ok(), !cfg!(target_os = "macos"));
for flag in ["-h", "--help"] {
let help = Cli::try_parse_from(["gpclient", flag]).err().unwrap().to_string();
assert!(!help.contains("--fix-openssl"));
}
}
#[test]
+4 -12
View File
@@ -203,10 +203,7 @@ pub(super) fn build_os_profile_with_host_id(args: &ConnectArgs, host_id: Option<
if let Some(local_hostname) = args.local_hostname.as_deref() {
builder = builder.computer_name_override(local_hostname.to_string());
}
if let Some(host_id) = host_id {
builder = builder.host_id_override(host_id);
}
builder.build()
gpapi::os_profile::desktop::collect_profile(builder, host_id)
}
pub(super) fn cookie_cache_path(args: &ConnectArgs) -> Option<PathBuf> {
@@ -489,14 +486,9 @@ mod tests {
("ipv4", GatewayIpPreference::Ipv4),
("ipv6", GatewayIpPreference::Ipv6),
] {
let cli = ConnectArgsTestCli::try_parse_from([
"test",
"portal.example.com",
"--ip-preference",
value,
"--disable-ipv6",
])
.unwrap();
let cli =
ConnectArgsTestCli::try_parse_from(["test", "portal.example.com", "--ip-preference", value, "--disable-ipv6"])
.unwrap();
assert_eq!(cli.args.ip_preference, expected);
assert!(cli.args.disable_ipv6);
}
-3
View File
@@ -138,9 +138,6 @@ impl ConnectHandler<'_> {
.log_format(self.shared_args.log_format)
.verbose(verbose);
#[cfg(not(target_os = "macos"))]
let auth_launcher = auth_launcher.fix_openssl(self.shared_args.fix_openssl);
#[cfg(feature = "webview-auth")]
let use_default_browser = external_browser_supported && self.args.default_browser;
#[cfg(feature = "webview-auth")]
-14
View File
@@ -98,8 +98,6 @@ async fn cached_tunnel_authentication_does_not_require_portal_discovery() {
let lock = directory.path().join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
@@ -144,8 +142,6 @@ async fn internal_tunnel_keeps_gateway_authentication_after_portal_cookie_reject
let lock = directory.path().join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
@@ -192,8 +188,6 @@ async fn rendering_recovery_fetches_new_prelogin_metadata_and_preserves_gateway_
let lock = directory.path().join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
@@ -227,8 +221,6 @@ async fn cancellation_during_recovery_prelogin_stops_request() {
let lock = directory.path().join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
@@ -295,8 +287,6 @@ async fn auth_crash_uses_fresh_saml_and_clean_once_with_shared_budget() {
let lock = directory.path().join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
@@ -355,8 +345,6 @@ async fn exhausted_auth_recovery_is_terminal_before_portal_gateway_fallback() {
let lock = directory.path().join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
@@ -503,8 +491,6 @@ printf '%s\n' '{"success":{"username":"alice","preloginCookie":"new-cookie"}}'
let lock = directory.join("client.pid");
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: false,
ignore_tls_errors: true,
lock_file: &lock,
verbose: &verbose,
+17 -13
View File
@@ -360,22 +360,26 @@ impl ConnectHandler<'_> {
match login {
GatewayLogin::Authenticated(authentication) => {
let descriptor = Gateway::new(gateway.to_string(), gateway.to_string());
client.register_session(
descriptor.clone(),
authentication.clone(),
&mut self.sessions.borrow_mut(),
);
self
.sessions
.borrow_mut()
.register_login(descriptor.clone(), authentication.clone(), &client);
self.check_cancelled()?;
if internal && authentication.mode() == SessionMode::NonTunnel && !self.args.cookie_only {
client
.bind_non_tunnel(self.args.disable_ipv6, None, &cancellation)
.await
.map_err(|error| error.context(gpapi::gateway::GatewayLoginProtocolError))?;
client.update_registered_session(&descriptor, &authentication, &mut self.sessions.borrow_mut());
}
let binding = if internal && authentication.mode() == SessionMode::NonTunnel && !self.args.cookie_only {
Some(
self
.sessions
.borrow_mut()
.bind_non_tunnel(&descriptor, &client, self.args.disable_ipv6, None, &cancellation)
.await
.map_err(|error| error.context(gpapi::gateway::GatewayLoginProtocolError))?,
)
} else {
None
};
return Ok(GatewayLoginSession {
authentication,
extension_auth: SessionExtensionAuth::new(cred.clone(), client),
extension_auth: SessionExtensionAuth::new(cred.clone(), client).with_binding(binding),
});
}
GatewayLogin::Mfa(message, input_str) => {
+3 -3
View File
@@ -2,14 +2,14 @@ use std::sync::Arc;
use anyhow::{Context, bail, ensure};
use gpapi::{
collection::CollectionControl,
credential::AuthCookieCredential,
gateway::{Gateway, GatewayLoginContext, GatewaySelection},
portal::PortalConfig,
process::collection::CollectionControl,
session::{
MaintenanceState, SessionEndReason, SessionMode,
network::PhysicalNetwork,
non_tunnel::{SessionCallbacks, SessionExit, maintain_non_tunnel_sessions},
desktop::network::PhysicalNetwork,
desktop::non_tunnel::{SessionCallbacks, SessionExit, maintain_non_tunnel_sessions},
},
};
use log::{info, warn};
+5 -5
View File
@@ -19,8 +19,8 @@ use gpapi::{
gateway::GatewaySelection,
gp_params::GpParams,
os_profile::OsProfile,
portal::{PreloginOptions, prelogin, retrieve_config},
session::GatewaySessions,
portal::{PreloginOptions, discovery::discover, prelogin},
session::desktop::GatewaySessions,
utils::request::RequestIdentityError,
};
use inquire::{Password, PasswordDisplayMode, Select};
@@ -185,11 +185,11 @@ impl<'a> ConnectHandler<'a> {
match identity_error {
RequestIdentityError::UnsupportedEncryption
| RequestIdentityError::LegacyKeyConversion(_)
| RequestIdentityError::UnsupportedKeyFormat
| RequestIdentityError::InvalidKey
| RequestIdentityError::InvalidCertificate
| RequestIdentityError::IncompletePkcs12
| RequestIdentityError::AmbiguousPkcs12
| RequestIdentityError::InvalidPkcs12(_) => return Err(err),
RequestIdentityError::NoKey => {
let format = self.shared_args.log_format;
@@ -282,7 +282,7 @@ impl<'a> ConnectHandler<'a> {
let cached = self.cached_portal_credential(portal);
let cached_config = match cached {
Some(cred) => match retrieve_config(portal, &cred, &gp_params, &self.cancellation).await {
Some(cred) => match discover(portal, &cred, &gp_params, &self.cancellation).await {
Ok(config) => Some((cred, config)),
Err(error) => {
self.check_cancelled()?;
@@ -301,7 +301,7 @@ impl<'a> ConnectHandler<'a> {
.await?;
prelogin = replacement;
self.check_cancelled()?;
let config = retrieve_config(portal, &cred, &gp_params, &self.cancellation).await?;
let config = discover(portal, &cred, &gp_params, &self.cancellation).await?;
(cred, config)
}
};
+4 -2
View File
@@ -1,6 +1,8 @@
//! Dashboard presentation only; connection ownership and sampling stay outside this module.
use crossterm::event::KeyCode;
use gpapi::session::tunnel::{TunnelList, TunnelPhase, TunnelState, TunnelStatisticsSnapshot, TunnelStatisticsState};
use gpapi::session::desktop::tunnel::{
TunnelList, TunnelPhase, TunnelState, TunnelStatisticsSnapshot, TunnelStatisticsState,
};
use ratatui::{
Frame,
buffer::Buffer,
@@ -338,7 +340,7 @@ pub(super) fn render_tunnel(
#[cfg(test)]
mod tests {
use gpapi::session::tunnel::{TunnelStatistics, TunnelStatisticsView, TunnelTransport};
use gpapi::session::desktop::tunnel::{TunnelStatistics, TunnelStatisticsView, TunnelTransport};
use ratatui::{Terminal, backend::TestBackend};
use super::*;
+3 -3
View File
@@ -15,7 +15,7 @@ use crossterm::{
execute,
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
};
use gpapi::session::tunnel::TunnelPhase;
use gpapi::session::desktop::tunnel::TunnelPhase;
use log::Level;
use nix::unistd::{getpgrp, tcgetpgrp};
use ratatui::{
@@ -317,7 +317,7 @@ fn footer_text(logs: bool, ending: &str, scrollable: bool, width: u16) -> Paragr
fn notice_for_status(
notice: Option<Notice>,
phase: TunnelPhase,
transport: gpapi::session::tunnel::TunnelTransport,
transport: gpapi::session::desktop::tunnel::TunnelTransport,
) -> Notice {
notice.unwrap_or_else(|| Notice {
level: Level::Info,
@@ -345,7 +345,7 @@ mod tests {
#[test]
fn status_transitions_cannot_overwrite_an_existing_warning() {
use gpapi::session::tunnel::TunnelTransport;
use gpapi::session::desktop::tunnel::TunnelTransport;
let warning = Notice {
level: Level::Warn,
message: "ESP unavailable; using SSL".into(),
+6 -5
View File
@@ -3,8 +3,8 @@ use std::time::Duration;
use clap::Args;
use gpapi::{
clap::args::Os,
collection::CollectionBudget,
os_profile::{ClientOs, OsProfileBuilder},
process::collection::CollectionBudget,
};
use gphip::{ReportContext, ReportInput, generate_report_with_control};
@@ -51,11 +51,12 @@ impl<'a> HipHandler<'a> {
if let Some(os_version) = self.args.os_version.as_deref() {
builder = builder.os_version(os_version);
}
if let Some(host_id) = self.args.host_id.as_deref() {
builder = builder.host_id_override(host_id);
}
let input = ReportInput {
profile: builder.build_with_control(&budget)?,
profile: gpapi::os_profile::desktop::collect_profile_with_control(
builder,
self.args.host_id.as_deref(),
&budget,
)?,
context: ReportContext::Connected {
cookie: self.args.cookie.clone(),
client_ip: self.args.client_ip.clone(),
+2 -14
View File
@@ -11,7 +11,7 @@ use clap::Args;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
use common::binary_paths;
use directories::ProjectDirs;
use gpapi::{process::desktop_launcher::DesktopLauncher, utils::endpoint::http_endpoint};
use gpapi::process::desktop_launcher::DesktopLauncher;
use log::info;
#[derive(Args)]
@@ -61,7 +61,7 @@ impl<'a> LaunchGuiHandler<'a> {
return forward_auth_callback(callback);
}
if try_active_gui().await.is_ok() {
if DesktopLauncher::activate_existing().await.is_ok() {
info!("The GUI is already running");
return Ok(());
}
@@ -115,18 +115,6 @@ fn parse_auth_callback(callback: &str) -> Result<String, String> {
.ok_or_else(|| "callback URL must use the globalprotectcallback scheme".to_owned())
}
async fn try_active_gui() -> anyhow::Result<()> {
let service_endpoint = http_endpoint().await?;
reqwest::Client::default()
.post(format!("{}/active-gui", service_endpoint))
.send()
.await?
.error_for_status()?;
Ok(())
}
fn get_log_file() -> anyhow::Result<PathBuf> {
let dirs = ProjectDirs::from("com.yuezk", "GlobalProtect-openconnect", "gpclient")
.ok_or_else(|| anyhow::anyhow!("Failed to get project dirs"))?;
+4 -3
View File
@@ -182,9 +182,10 @@ mod tests {
#[test]
fn builds_session_context_from_os_profile() {
let profile = OsProfile::builder(gpapi::os_profile::ClientOs::Mac)
.client_version("6.3.1-12".to_string())
.build();
let profile = gpapi::os_profile::desktop::collect_profile(
OsProfile::builder(gpapi::os_profile::ClientOs::Mac).client_version("6.3.1-12".to_string()),
None,
);
let expected_user_agent = profile.user_agent().to_string();
let ctx = build_session_context(SessionContextInput {
+38
View File
@@ -0,0 +1,38 @@
#![cfg(not(target_os = "macos"))]
use std::process::Command;
#[test]
fn background_worker_warns_once_for_the_deprecated_flag() {
const WARNING: &str = "--fix-openssl is deprecated and has no effect. It will be removed in a future release.";
let directory = tempfile::tempdir().unwrap();
for deprecated in [false, true] {
let log = directory.path().join(format!("background-{deprecated}.log"));
let mut command = Command::new(env!("CARGO_BIN_EXE_gpclient"));
if deprecated {
command.arg("--fix-openssl");
}
let output = command
.arg("--lock-file")
.arg(directory.path().join("client.pid"))
.args([
"--log-format",
"json",
"connect",
"vpn.example.test",
"--background",
"--certificate",
])
// Fail identity preparation before authentication or a network connection.
.arg(directory.path().join("missing.pem"))
.arg("--log-file")
.arg(&log)
.output()
.unwrap();
assert!(!output.status.success());
let mut records = String::from_utf8(output.stderr).unwrap();
records.push_str(&std::fs::read_to_string(log).unwrap());
assert!(records.contains("Failed to read client identity"), "{records}");
assert_eq!(records.matches(WARNING).count(), usize::from(deprecated), "{records}");
}
}
+7 -1
View File
@@ -73,5 +73,11 @@ async fn embedded_collector_reports_missing_helpers_without_recursing_or_exposin
report["fields"]["env.XDG_CURRENT_DESKTOP"]["value"],
"TestDesktop Injected: secret"
);
assert!(!String::from_utf8_lossy(&output.stderr).contains("Using 'UnsafeLegacyServerConnect'"));
#[cfg(not(target_os = "macos"))]
assert_eq!(
String::from_utf8_lossy(&output.stderr)
.matches("--fix-openssl is deprecated and has no effect. It will be removed in a future release.")
.count(),
1
);
}
+33 -4
View File
@@ -1,7 +1,36 @@
# Tauri + React + Typescript
# GP Connect download helper
This template should help get you started developing with Tauri, React and Typescript in Vite.
The desktop supervisor launches this window when the selected GUI is missing or
has an incompatible version. It downloads the selected Tauri or Native Shell
interface and requests installation through the service. Launches require the
existing service credential and lifetime channel on stdin.
## Recommended IDE Setup
## Appearance
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
`--theme system|light|dark` controls this window only. The default is `system`,
which follows system appearance and changes while the window is open. Explicit
`light` and `dark` modes override system appearance for that launch. Nothing is
saved by the helper.
Initial downloads follow the system. During Linux Tauri/Native Shell switches,
Desktop Core supplies the running app's saved theme choice to the supervisor,
which forwards it to the helper. There is no `--helper-theme` option on
`gpclient launch-gui`.
The native window and web content use the selected appearance before the window
is shown. Browser previews follow the system when no native mode is supplied.
## Development
```sh
pnpm build
pnpm test
```
The built `dist/` assets are tracked and must be rebuilt after frontend changes.
Run Rust checks and helper tests from the `gp` repository:
```sh
cargo check -p gpgui-helper
cargo test -p gpgui-helper --lib
```
-43
View File
@@ -1,43 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
<defs>
<linearGradient id="ocean" x1="245" y1="170" x2="770" y2="770" gradientUnits="userSpaceOnUse">
<stop stop-color="#579bc1"/>
<stop offset=".52" stop-color="#438fbd"/>
<stop offset="1" stop-color="#2f719e"/>
</linearGradient>
<linearGradient id="land" x1="260" y1="190" x2="750" y2="735" gradientUnits="userSpaceOnUse">
<stop stop-color="#56c78a"/>
<stop offset=".55" stop-color="#3bbf78"/>
<stop offset="1" stop-color="#279b5d"/>
</linearGradient>
<linearGradient id="lock" x1="385" y1="400" x2="650" y2="700" gradientUnits="userSpaceOnUse">
<stop stop-color="#f3b84c"/>
<stop offset=".55" stop-color="#e8a12f"/>
<stop offset="1" stop-color="#d4871e"/>
</linearGradient>
<clipPath id="globe-clip">
<circle cx="512" cy="455" r="315"/>
</clipPath>
</defs>
<g transform="translate(512 512) scale(1.3) translate(-512 -455)">
<circle cx="512" cy="455" r="315" fill="url(#ocean)"/>
<g clip-path="url(#globe-clip)" fill="url(#land)">
<path d="M177 326c74-121 177-185 302-190-13 51-49 84-105 98-4 45-32 79-86 101-37 17-75 14-111-9Z"/>
<path d="M564 135c129 18 229 103 273 220-69-3-121 15-157 54-51-14-83-50-95-107-38-36-45-92-21-167Z"/>
<path d="M189 467c63-39 125-34 187 16 57 25 73 73 48 144-45 90-108 146-189 166-58-88-73-197-46-326Z"/>
<path d="M612 572c78-38 157-18 238 59-45 89-122 144-231 164-20-67-22-122-7-165-22-17-22-36 0-58Z"/>
</g>
<circle cx="512" cy="455" r="308" fill="none" stroke="#9ccde2" stroke-width="11" stroke-opacity=".4"/>
<g transform="translate(512 490) scale(.82) translate(-512 -490)">
<path d="M405 429v-75c0-142 214-142 214 0v75" fill="none" stroke="#eef1f2" stroke-width="58" stroke-linecap="round"/>
<rect x="340" y="403" width="344" height="278" rx="62" fill="url(#lock)"/>
<rect x="346" y="409" width="332" height="266" rx="56" fill="none" stroke="#f7cb75" stroke-width="10" stroke-opacity=".45"/>
<g fill="#85500f" opacity=".85">
<path d="M501 538h22l16 69h-54Z"/>
<circle cx="512" cy="521" r="27"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

+44
View File
@@ -0,0 +1,44 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
<defs>
<linearGradient id="ocean" x1="210.49524" y1="190.80952" x2="802.16190" y2="867.00000" gradientUnits="userSpaceOnUse">
<stop stop-color="#579bc1"/>
<stop offset=".52" stop-color="#438fbd"/>
<stop offset="1" stop-color="#2f719e"/>
</linearGradient>
<linearGradient id="land" x1="227.40000" y1="213.34921" x2="779.62222" y2="827.55556" gradientUnits="userSpaceOnUse">
<stop stop-color="#56c78a"/>
<stop offset=".55" stop-color="#3bbf78"/>
<stop offset="1" stop-color="#279b5d"/>
</linearGradient>
<linearGradient id="shipped-lock" x1="385" y1="400" x2="650" y2="700" gradientUnits="userSpaceOnUse">
<stop stop-color="#f3b84c"/>
<stop offset=".55" stop-color="#e8a12f"/>
<stop offset="1" stop-color="#d4871e"/>
</linearGradient>
</defs>
<g transform="translate(512 512) scale(1.1535211267605634) translate(-511.4 -512)">
<g>
<circle cx="511.4" cy="512" r="355" fill="url(#ocean)"/>
<path d="m341.5 202.8c-83.71 44.8-148.5 123-170.9 210.4 10.88 28.67 32.13 48.77 54.14 63.49 13.18 8.96 18.94 19.84 17.15 31.87-3.84 26.5-46.85 37.89-50.3 71.3-2.688 27.78 17.54 52.74 46.46 67.71 21.76 11.39 35.2 25.73 41.34 44.29 13.44 39.17 32.64 82.56 68.99 105.5 30.08 18.94 46.85 12.67 41.09-1.92-6.144-15.36-26.37-32.13-26.24-53.63 0.128-27.39 26.5-41.98 31.49-62.72v-87.3c-18.69-0.896-30.59-9.216-40.19-19.71-16.51-17.41-37.76-29.44-55.68-36.86-10.37-4.352-12.67-12.8-13.7-22.66-0.896-11.39-6.144-20.74-15.1-28.16-12.8-10.62-19.97-22.53-18.3-34.82 1.92-15.62 17.28-26.5 36.74-29.44 37.25-6.144 70.53-34.69 74.11-63.49 1.792-14.46-5.504-24.32-2.816-33.66 4.864-21.12 34.18-38.14 65.02-51.71 24.83-10.88 45.7-20.61 45.95-39.81 0.256-20.22-20.74-32.9-60.03-33.41-22.53 0.128-46.08 2.56-69.25 4.736z" fill="url(#land)"/>
<path d="m663.7 191.5c-50.43 5.376-89.34 38.4-89.34 68.61 0 26.75 27.78 42.88 62.98 46.98 31.36 3.712 48.9 15.36 49.79 34.18 0.896 20.74-17.15 34.18-16.77 51.71 0.512 36.35 51.84 71.04 107.4 71.17 31.74 0.128 62.59-11.39 79.74-28.54-24.32-107.8-99.2-199.3-193.8-244.1z" fill="url(#land)"/>
<path d="m866.2 532c-19.46-9.216-42.62-13.7-66.18-13.7-57.47 0-102.1 34.05-102.1 60.8 0 11.9 6.144 19.97 13.06 26.75 11.52 11.52 17.66 25.73 17.66 42.24 0 29.18-22.53 45.06-22.53 73.34 0 26.88 18.69 47.36 39.04 57.73 71.42-61.31 117.6-154.6 121.1-247.2z" fill="url(#land)"/>
<circle cx="511.4" cy="512" r="347.111111" fill="none" stroke="#9ccde2" stroke-width="12.396825" stroke-opacity=".4"/>
</g>
</g>
<g transform="translate(512 512) scale(1.3) translate(-512 -455)">
<g transform="translate(512 490) scale(.82) translate(-512 -490)">
<path d="M405 429v-75c0-142 214-142 214 0v75" fill="none" stroke="#eef1f2" stroke-width="58" stroke-linecap="round"/>
<rect x="340" y="403" width="344" height="278" rx="62" fill="url(#shipped-lock)"/>
<rect x="346" y="409" width="332" height="266" rx="56" fill="none" stroke="#f7cb75" stroke-width="10" stroke-opacity=".3"/>
<g fill="#85500f" opacity=".78" transform="translate(512 550.5) scale(1.2) translate(-512 -550.5)">
<path d="M501 538h22l16 69h-54Z"/>
<circle cx="512" cy="521" r="27"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

@@ -1,9 +1,9 @@
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,x||(x=!0,ie());else{var t=n(l);t!==null&&se(ee,t.startTime-e)}}}var x=!1,te=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function C(){if(g=!1,x){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&se(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():x=!1}}}var ie;if(typeof y==`function`)ie=function(){y(C)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=C,ie=function(){oe.postMessage(null)}}else ie=function(){_(C,0)};function se(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,se(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x||(x=!0,ie()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){Line truncated
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,x||(x=!0,ie());else{var t=n(l);t!==null&&se(ee,t.startTime-e)}}}var x=!1,te=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function C(){if(g=!1,x){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&se(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():x=!1}}}var ie;if(typeof y==`function`)ie=function(){y(C)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=C,ie=function(){oe.postMessage(null)}}else ie=function(){_(C,0)};function se(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,se(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x||(x=!0,ie()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};functionLine truncated
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+ze+e+Be}var He=!1;function Ue(e,t){if(!e||He)return``;He=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
`),l=s.split(`
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{He=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ve(n):``}function We(e,t){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve(`Lazy`);case 13:return e.child!==t&&t!==null?Ve(`Suspense Fallback`):Ve(`Suspense`);case 19:return Ve(`SuspenseList`);case 0:case 15:return Ue(e.type,!1);case 11:return Ue(e.type.render,!1);case 1:return Ue(e.type,!0);case 31:return Ve(`Activity`);case 30:return Ve(`ViewTransition`);default:return``}}function Ge(e){try{var t=``,n=null;do t+=We(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
Error generating stack: `+e.message+`
`+e.stack}}var Ke=Object.prototype.hasOwnProperty,qe=t.unstable_scheduleCallback,Je=t.unstable_cancelCallback,Ye=t.unstable_shouldYield,Xe=t.unstable_requestPaint,Ze=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,$e=t.unstable_ImmediatePriority,et=t.unstable_UserBlockingPriority,tt=t.unstable_NormalPriority,nt=t.unstable_LowPriority,rt=t.unstable_IdlePriority,it=t.log,at=t.unstable_setDisableYieldValue,ot=null,st=null;function ct(e){if(typeof it==`function`&&at(e),st&&typeof st.setStrictMode==`function`)try{st.setStrictMode(ot,e)}catch{}}var lt=Math.clz32?Math.clz32:ft,ut=Math.log,dt=Math.LN2;function ft(e){return e>>>=0,e===0?32:31-(ut(e)/dt|0)|0}var pt=256,mt=262144,ht=4194304;function gt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _t(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=gt(n))):i=gt(o):i=gt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=gt(n))):i=gt(o)):i=gt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function vt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function yt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-lt(n),i=1<<r;t|=e[r],n&=~i}return t}function bt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xt(){var e=ht;return ht<<=1,!(ht&62914560)&&(ht=4194304),e}function St(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-lt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-lt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Et(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-lt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Dt(e,t){var n=t&-t;return n=n&42?1:Ot(n),(n&(e.suspendedLanes|t))===0?n:0}function Ot(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function kt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function At(){var e=E.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function jt(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var Mt=Math.random().toString(36).slice(2),Nt=`__reactFiber$`+Mt,Pt=`__reactProps$`+Mt,Ft=`__reactContainer$`+Mt,It=`__reactEvents$`+Mt,Lt=`__reactListeners$`+Mt,Rt=`__reactHandles$`+Mt,zt=`__reactResources$`+Mt,Bt=`__reactMarker$`+Mt,Vt=`__reactLoad$`+Mt;function Ht(e){delete e[Nt],delete e[Pt],delete e[Lt],delete e[Rt]}function Ut(e){var t;if(t=e[Nt])return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[Nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Nt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Wt(e){if(e=e[Nt]||e[Ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Kt(e){var t=e[zt];return t||=e[zt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function qt(e){e[Bt]=!0}function Jt(e){e[Vt]=void 0}var Yt=new Set,Xt={};function Zt(e,t){Qt(e,t),Qt(e+`Capture`,t)}function Qt(e,t){for(Xt[e]=t,e=0;e<t.le Line truncated
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&xn(e,``+r);else return;break;case`className`:on(e,`class`,r);break;case`tabIndex`:on(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:on(e,n,r);break;case`style`:wn(e,r,a);return;case`data`:if(t!==`object`){on(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=kn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=On(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),an(e,`popover`,r);break;case`xlinkActuate`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:an(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=En.get(n)||n,an(e,n,r);else return}O=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:wn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)xn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=kn);return;case`suppressContent Line truncated
`+e.stack}}var Ke=Object.prototype.hasOwnProperty,qe=t.unstable_scheduleCallback,Je=t.unstable_cancelCallback,Ye=t.unstable_shouldYield,Xe=t.unstable_requestPaint,Ze=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,$e=t.unstable_ImmediatePriority,et=t.unstable_UserBlockingPriority,tt=t.unstable_NormalPriority,nt=t.unstable_LowPriority,rt=t.unstable_IdlePriority,it=t.log,at=t.unstable_setDisableYieldValue,ot=null,st=null;function ct(e){if(typeof it==`function`&&at(e),st&&typeof st.setStrictMode==`function`)try{st.setStrictMode(ot,e)}catch{}}var lt=Math.clz32?Math.clz32:ft,ut=Math.log,dt=Math.LN2;function ft(e){return e>>>=0,e===0?32:31-(ut(e)/dt|0)|0}var pt=256,mt=262144,ht=4194304;function gt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _t(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=gt(n))):i=gt(o):i=gt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=gt(n))):i=gt(o)):i=gt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function vt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function yt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-lt(n),i=1<<r;t|=e[r],n&=~i}return t}function bt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xt(){var e=ht;return ht<<=1,!(ht&62914560)&&(ht=4194304),e}function St(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-lt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-lt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Et(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-lt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Dt(e,t){var n=t&-t;return n=n&42?1:Ot(n),(n&(e.suspendedLanes|t))===0?n:0}function Ot(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function kt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function At(){var e=E.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function jt(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var Mt=Math.random().toString(36).slice(2),Nt=`__reactFiber$`+Mt,Pt=`__reactProps$`+Mt,Ft=`__reactContainer$`+Mt,It=`__reactEvents$`+Mt,Lt=`__reactListeners$`+Mt,Rt=`__reactHandles$`+Mt,zt=`__reactResources$`+Mt,Bt=`__reactMarker$`+Mt,Vt=`__reactLoad$`+Mt;function Ht(e){delete e[Nt],delete e[Pt],delete e[Lt],delete e[Rt]}function Ut(e){var t;if(t=e[Nt])return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[Nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Nt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Wt(e){if(e=e[Nt]||e[Ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Kt(e){var t=e[zt];return t||=e[zt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function qt(e){e[Bt]=!0}function Jt(e){e[Vt]=void 0}var Yt=new Set,Xt={};function Zt(e,t){Qt(e,t),Qt(e+`Capture`,t)}function Qt(e,t){for(Xt[e]=t,e=0;e<t.le Line truncated
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&xn(e,``+r);else return;break;case`className`:on(e,`class`,r);break;case`tabIndex`:on(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:on(e,n,r);break;case`style`:wn(e,r,a);return;case`data`:if(t!==`object`){on(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=kn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=On(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),an(e,`popover`,r);break;case`xlinkActuate`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:an(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=En.get(n)||n,an(e,n,r);else return}O=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:wn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)xn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=kn);return;case`suppressContent Line truncated
+1
View File
@@ -0,0 +1 @@
:root{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--background:#f6f5f4;--foreground:#2e3436;--muted-foreground:#5e5c64;--progress-label:#3d3846;--progress-track:#d5d3d1;--progress-fill:#3584e4;--error:#9c2f2f;--button:#1c71d8;--button-hover:#1a5fb4;--button-active:#174a8b;--focus-ring:#1a5fb4}:root[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--background:#242424;--foreground:#fff;--muted-foreground:#c0bfbc;--progress-label:#deddda;--progress-track:#454545;--progress-fill:#78aeed;--error:#ffb4ab;--button:#1c71d8;--button-hover:#3584e4;--button-active:#1a5fb4;--focus-ring:#78aeed}html,body,#root{box-sizing:border-box;-webkit-user-select:none;user-select:none;cursor:default;height:100%;margin:0;padding:0;overflow:hidden}body{background:var(--background);color:var(--foreground);font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}button{font:inherit}.update-window{box-sizing:border-box;background:var(--background);align-items:center;gap:15px;width:100%;height:100%;padding:16px 18px;display:flex}.update-logo{flex:none;width:48px;height:48px}.update-content,.update-status{width:100%;min-width:0}.update-title{color:var(--foreground);letter-spacing:-.01em;margin:0;font-size:16px;font-weight:600;line-height:1.25}.update-description{color:var(--muted-foreground);margin:3px 0 0;font-size:12px;line-height:1.4}.progress-summary{justify-content:space-between;align-items:baseline;gap:12px;margin-top:3px;display:flex}.progress-summary .update-description{margin:0}.progress-bar{background-color:var(--progress-track);border-radius:3px;width:100%;height:6px;margin-top:9px;position:relative;overflow:hidden}.progress-fill{background:var(--progress-fill);border-radius:3px;height:100%;transition:width .18s ease-out}.progress-bar-indeterminate .progress-fill{width:35%;animation:1.4s ease-in-out infinite progress-indeterminate}@keyframes progress-indeterminate{0%{transform:translate(-110%)}to{transform:translate(300%)}}@media (prefers-reduced-motion:reduce){.progress-fill{transition:none}.progress-bar-indeterminate .progress-fill{animation:none;transform:translate(90%)}}.progress-label{color:var(--progress-label);font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;flex:none;font-size:12px;font-weight:500}.error-status{justify-content:space-between;align-items:center;gap:16px;display:flex}.error-status .update-title{color:var(--error)}.error-copy{min-width:0}.retry-button{background:var(--button);color:#fff;cursor:default;border:0;border-radius:8px;min-width:68px;padding:4px 14px;font-size:12px;font-weight:600;line-height:1.5}.retry-button:hover{background:var(--button-hover)}.retry-button:active{background:var(--button-active)}.retry-button:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px}
-1
View File
@@ -1 +0,0 @@
html,body,#root{box-sizing:border-box;-webkit-user-select:none;user-select:none;cursor:default;height:100%;margin:0;padding:0;overflow:hidden}body{color:#2e3436;background:#f6f5f4;font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}button{font:inherit}.update-window{box-sizing:border-box;background:#f6f5f4;align-items:center;gap:15px;width:100%;height:100%;padding:16px 18px;display:flex}.update-logo{flex:none;width:48px;height:48px}.update-content,.update-status{width:100%;min-width:0}.update-title{color:#2e3436;letter-spacing:-.01em;margin:0;font-size:16px;font-weight:600;line-height:1.25}.update-description{color:#5e5c64;margin:3px 0 0;font-size:12px;line-height:1.4}.progress-summary{justify-content:space-between;align-items:baseline;gap:12px;margin-top:3px;display:flex}.progress-summary .update-description{margin:0}.progress-bar{background-color:#d5d3d1;border-radius:3px;width:100%;height:6px;margin-top:9px;position:relative;overflow:hidden}.progress-fill{background:#3584e4;border-radius:3px;height:100%;transition:width .18s ease-out}.progress-bar-indeterminate .progress-fill{width:35%;animation:1.4s ease-in-out infinite progress-indeterminate}@keyframes progress-indeterminate{0%{transform:translate(-110%)}to{transform:translate(300%)}}@media (prefers-reduced-motion:reduce){.progress-fill{transition:none}.progress-bar-indeterminate .progress-fill{animation:none;transform:translate(90%)}}.progress-label{color:#3d3846;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;flex:none;font-size:12px;font-weight:500}.error-status{justify-content:space-between;align-items:center;gap:16px;display:flex}.error-status .update-title{color:#9c2f2f}.error-copy{min-width:0}.retry-button{color:#fff;cursor:pointer;background:#1c71d8;border:0;border-radius:8px;min-width:68px;padding:4px 14px;font-size:12px;font-weight:600;line-height:1.5}.retry-button:hover{background:#1a5fb4}.retry-button:active{background:#174a8b}.retry-button:focus-visible{outline-offset:2px;outline:2px solid #1a5fb4}
+13 -3
View File
@@ -2,11 +2,21 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/assets/icon-small-BO4dlTNl.svg" />
<script>
const theme = window.__GP_HELPER_THEME__ || "system";
const systemTheme = matchMedia("(prefers-color-scheme: dark)");
const applyTheme = () => {
document.documentElement.dataset.theme =
theme === "system" ? (systemTheme.matches ? "dark" : "light") : theme;
};
applyTheme();
if (theme === "system") systemTheme.addEventListener("change", applyTheme);
</script>
<link rel="icon" type="image/svg+xml" href="/assets/icon-small-DFuJkDph.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GPGUI Downloader</title>
<script type="module" crossorigin src="/assets/main-BU3mus1z.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-DiWGniCh.css">
<script type="module" crossorigin src="/assets/main-BJvLW_Ih.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-CVTp2z3I.css">
</head>
<body>
<script>
+10
View File
@@ -2,6 +2,16 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
const theme = window.__GP_HELPER_THEME__ || "system";
const systemTheme = matchMedia("(prefers-color-scheme: dark)");
const applyTheme = () => {
document.documentElement.dataset.theme =
theme === "system" ? (systemTheme.matches ? "dark" : "light") : theme;
};
applyTheme();
if (theme === "system") systemTheme.addEventListener("change", applyTheme);
</script>
<link rel="icon" type="image/svg+xml" href="/src/assets/icon-small.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GPGUI Downloader</title>
+9 -8
View File
@@ -5,21 +5,22 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"test": "node --test tests/*.test.mjs",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2.12.3",
"react": "^19.3.0",
"react-dom": "^19.3.0"
"@tauri-apps/api": "^2.12.4",
"react": "^19.3.1",
"react-dom": "^19.3.1"
},
"devDependencies": {
"@tauri-apps/cli": "^2.12.2",
"@types/node": "^26.6.5",
"@tauri-apps/cli": "^2.12.4",
"@types/node": "^26.6.6",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@typescript-eslint/eslint-plugin": "^8.71.2",
"@typescript-eslint/parser": "^8.71.2",
"@typescript-eslint/eslint-plugin": "^8.72.1",
"@typescript-eslint/parser": "^8.72.1",
"@vitejs/plugin-react": "^6.1.2",
"eslint": "^9.39.5",
"eslint-config-prettier": "^10.1.8",
@@ -27,7 +28,7 @@
"eslint-plugin-react-hooks": "^7.1.1",
"prettier": "3.9.10",
"typescript": "^6.0.3",
"vite": "^8.3.4"
"vite": "^8.3.5"
},
"packageManager": "[email protected]"
}
+216 -216
View File
@@ -9,21 +9,21 @@ importers:
.:
dependencies:
'@tauri-apps/api':
specifier: ^2.12.3
version: 2.12.3
specifier: ^2.12.4
version: 2.12.4
react:
specifier: ^19.3.0
version: 19.3.0
specifier: ^19.3.1
version: 19.3.1
react-dom:
specifier: ^19.3.0
version: 19.3.0([email protected].0)
specifier: ^19.3.1
version: 19.3.1([email protected].1)
devDependencies:
'@tauri-apps/cli':
specifier: ^2.12.2
version: 2.12.2
specifier: ^2.12.4
version: 2.12.4
'@types/node':
specifier: ^26.6.5
version: 26.6.5
specifier: ^26.6.6
version: 26.6.6
'@types/react':
specifier: ^19.3.0
version: 19.3.0
@@ -31,14 +31,14 @@ importers:
specifier: ^19.3.0
version: 19.3.0(@types/[email protected])
'@typescript-eslint/eslint-plugin':
specifier: ^8.71.2
version: 8.71.2(@typescript-eslint/[email protected]1.2([email protected])([email protected]))([email protected])([email protected])
specifier: ^8.72.1
version: 8.72.1(@typescript-eslint/[email protected]2.1([email protected])([email protected]))([email protected])([email protected])
'@typescript-eslint/parser':
specifier: ^8.71.2
version: 8.71.2([email protected])([email protected])
specifier: ^8.72.1
version: 8.72.1([email protected])([email protected])
'@vitejs/plugin-react':
specifier: ^6.1.2
version: 6.1.2([email protected].4(@types/[email protected].5)([email protected]))
version: 6.1.2([email protected].5(@types/[email protected].6)([email protected]))
eslint:
specifier: ^9.39.5
version: 9.39.5
@@ -58,8 +58,8 @@ importers:
specifier: ^6.0.3
version: 6.0.3
vite:
specifier: ^8.3.4
version: 8.3.4(@types/[email protected].5)([email protected])
specifier: ^8.3.5
version: 8.3.5(@types/[email protected].6)([email protected])
packages:
@@ -360,95 +360,95 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@oxc-project/[email protected]3.0':
resolution: {integrity: sha512-jSNrRIyvPVLL5E1z/tS5zLAprosGz/FuI1PWwEOz59j3E4TTTzSpqKb/RDGqJhhW0QHYISGXxq582wGx6T11Tw==}
'@oxc-project/[email protected]6.0':
resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==}
'@rolldown/[email protected]3':
resolution: {integrity: sha512-Vu/NICrgdRvUOeaJZIyB2FP63s6fO/4ud5l8dXmxDx9yDyn+mN0y+gsvsVviSli+T361Aqo0h46EuMoobrwawA==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [android]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-6LEoIrGy5vvCd2boNnv2soPSUZj/PRvhp8R/t9KlX+mIZxThIE/ZqxrGXxmuNX0FuvQFvLdZr7S4HrYpYBVhEQ==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [android]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-CaJSRzlQ6Q+zkDMVA9OkVxBjVoPRCDEE3v0FSJ9kIQBgRjFApA3Si4ijhbNVUji7ZJt+PfO0e46qy4nPInHUPA==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [darwin]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-e4r340I5hxSzJkD3YJBxgzq/rJ3wwxwdLLb2FPt1Zpyem20nrQPT11DDEEkazwxaHumH8wpglsp/Ozgj/wT6mw==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [darwin]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-hoBWDZ4/K/mJKVMbsgUd1jfpA2DiOrJ54mpegObU9TBHBBrtX4FLIXJJQRDPZ/2Dn91GvPob+Z2hwKJzf4E5SQ==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [freebsd]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-oF9fZu3vTWnTiVAkDFxU9PJLt1nh20K9RRpuHsR7ZnE2L7XookBbDBVLojCVSLGbvtSlxeUNnjAj6DbNsKyzbg==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-DTpb/+jMiqWMPgphn4ksW1zW+XLJ6dJJ9FMvnIk9I291LhCctMPhMYJrP5t9p6C9qa3KXadDdUEZHBaPh3kNxQ==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-xU+Kvv9N2A3SY35zFh1FWWNjxbadE/BKeqnkXe7vScU4GZsw757BlVmDLITZEq8DPpk6m7uoDYkK7P+x/uU5Ow==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-XMk/hnhh25oQ756Lclb1Q11h4ll0xC0Esa5w4Vzp+mAE2S3AGJgeM0SonrIgY8fHhjarb6hcoTuwoFG0VVP2ig==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-U1BoTHYmlywE2n3HUWjzZ+8EQsKr+OwpxYuDWaubx42tUL8QSL7nOqRz/NVHanibbFP3M1Rxuprz/wNcbMKjqw==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-J4cm80Pc6wEwV5AZ42o62sIQgDk+Y7R2s646jIwuvO+4V46QB58N4vVuMPWCBaNgursXLpmUWJV//WQAkPvHBQ==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-W0euZS40U4V6JkmEnVCIX9mcsL6cbXQ4X8c2w+MMOIjFg68TXUW+u3RT+2e1t1pv9mg/EP3pDtK3POXdQ7Rxyw==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-do/AF/4n9MRshia3a5aXoy8xM2c6mgfT6D7H/dY6my5z+hfCIR4ab7mk4IRj++nsEQpKy39kd0DQnDq+r692tw==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [openharmony]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-6FtUf2cJZobutJdxnGYX8z0vtbgqU0b2v8vfBhkXb9wp2MppMFtkunE+IaOntyi01rkIQoPW2GHABtfzsC0BRQ==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [win32]
'@rolldown/[email protected]3':
resolution: {integrity: sha512-UKhFaZTeTcbKrb3iU82m17jVcPEAoqDkCN5MBqgPyZSwp/cQmib21crTS0DdH7T1B7wZRWEI89YQAOJMet5yhg==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [win32]
@@ -456,77 +456,77 @@ packages:
'@rolldown/[email protected]':
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
'@tauri-apps/[email protected].3':
resolution: {integrity: sha512-9s0PKw0p4r3kFq92jhpivYSp+cSht15o0gXpZxuQd0+dV9KCexEVkNaLELVoLdJWyoH4KlfQo5h3W2LIM8siJg==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-pVmfis+4zT8H0Qhp3xPZx9Ju7kpzvA6rr/PSJPyuwfvucTQ8sVt61NYU9KMkK703UFlYadFmjKA4HhybOtN0gg==}
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-Lk3zaBTfzNvA7670Al5PNgo2M/95uaDPe1yp+ILJeDOmol87XiYuK5E5+FUbK5e6U6OORx9qpZdOo2U+5tETtQ==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-OxqKSckIkoJ6vX2AjifIJpTasFC0Hbdoo7gEiCmAjauABO3U8m2MRsLWe+QTiBwDx1mIrvgA+rvI7tvDnbnHVg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-2CyYjJ833JB3sKRz4B0W/Tv4oOVC16ws1bxdSCWj1XvrmanWwvZi99e5tNIoCHwHhcOm0jh+sh0PCGQyls6Z+w==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-fz76/77wMMJOaaUN6n3CybRG0P/MTEjjqYk81mGPyhi9m6Ue5T+LWBnJP/AkPooNatBPI2vtulGqomyMJ44lCQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-uvt2xbone4JftKarelssi86Kqnl7JiG1Smh5+Ae+nZmtM+JUhTGmqkcqfUPXRW8Ygwog92POZvd4oGDN9j8eXQ==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-K0w8Bof6Lt8QKLAYhRy0yy36ZH5iA/35VuSOvnxyjvCUZ+A3JKsUTlALviH/sVgAlisaPzzmeJSH8XOn4Q2HBA==}
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-DZlDJ24u3tlocKOYqzR+b2M+Qr+5WFcoMBZ7EfdhHN5j3ZXwBBpms4G4gyNvPCrak5vMzmdZ65ecBXPJcC+5sA==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-j5rOnjmRUwWrm1oosf0zBYl4D+fqydgUROFCk0hvKZxvbTT8SOERes0QB7rBV/XWNy+kM6pCKzb3oSm2sRglzg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-pb+RTZUYH/p0gR4j4ecCCq+FNfz3W3eKuUQvVEBn7MQZx6DzfLO7FaYzt2NyDKWpdNN3lP10mdzOvw3R5P5aAQ==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-aOue3Fy6Jb7+oWcfAVUsVHfeTybSCt2CZoU06aO4jv4d2Ks/KnaTPwMAK3CLEduGOvBLY1lbBBrIyomqLLH5Sg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-nidEvDUJyHYNbIv9MUk6KiEix8IXfRh4Wj2G2SA5g8nFmgbBCwazUNWYiG/LhNeNbfZpBMLerRBUtoQ5K0GidA==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-Fx6GShY/RvST+t6LMlTHAwd66+1tEaAAGrnU7cysVfaiRP1BKng5Vl6rVmO6rSLOA1Sp1dRzNYM4f0OWQGb7qA==}
engines: {node: '>= 10'}
cpu: [riscv64]
os: [linux]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-gkXyYn3w+Xfc8nz/DleEbkm1M7bBuU2cejqUXNmI98cA2P5kp+oPmS4ALTorb1FaNWjpsKoYZBWsbS9BXxYFkQ==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-tNzZSa79Z1nRpHxEpQ38lsAFpKlFlYvoXzjTV+lRRn/zSf3wrdUC3wnLcq2XEadchPu4ttK0zivhYzr+XGD19Q==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-MrjgoZ09s8Hsn99XvxSNvK8NQTZxi7XiyK3FxxytzfHgz2jb3qUT69CZtsokRkN/zdi9rCgrMtq+w9XNICjcfQ==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-jmZ1pr0xEqUhuEusWtt9Yt+GF6lCnGHUmIL+KIknpbjK/XQ2qkhDBhaxK/JMHM2A8dAacVXCxXJk2EXpwhQUfA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-BR+CYM7iF3lkfyTtVkwMQU/s9hwegLpj3UqDjaxKCPmixQCa1csBBPy3C75V+FhLtOjIXNna4Gt6Vm9oxbV+qA==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-fGo8pgEHZxdSYgZ/J98m1usJ7NHKmKbq7k6uT0x1rpOq6Bg2YVzzpaAblWk710f5LHYBJIL5QIFS5IrD+4gmTg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-zODJo9l3TbNBM+GrO/yPqGeELNMK5cjIc+QHh1WQc3l8tD+jDZGTQyYuAxViCsM6Uh5uWJ//RnCZG9LXrvsXww==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-ezl8sQIcjYsye3TUnTH5VcWmWzccZASlQm7hlZt0dYyj1XD0qpVW47u2xYVrIKui0F8uQv/7QGZixdWiClBsbg==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-cQXI2ZaZmwBDt0XATCqASVanYizxkEE3ceQVlVHXaQ51HzsQUWA04c9Nz7LrrY2lgAu3jFMyat+8Yz3Z2R2qBA==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-DJhDeCqjLDNMWYFy7ZS8cfeAHX2RK0RbQMLiA3bMVVkXRDJ4NBYiHriGqsUhsr9iG41aTb+dJGkFPmPw1gWwVw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
'@tauri-apps/[email protected].2':
resolution: {integrity: sha512-PMSppzAnlT+BvZtRKuidxjRSm2r5t8kDpJ/czmmQUa0AtDNTwrjLE8vApK3phCWGg7isfnYL46Dl1jB4ArI0hA==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-JI9bHfudSRJikGOrjbXEm6RjzzvmKuLc+JixB1NE8hNzQkNlCCIC3pTES3uypkR9lxHrsbxzcnSwhI2IxBQphw==}
engines: {node: '>= 10'}
hasBin: true
@@ -536,8 +536,8 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
'@types/[email protected].5':
resolution: {integrity: sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==}
'@types/[email protected].6':
resolution: {integrity: sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==}
'@types/[email protected]':
resolution: {integrity: sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==}
@@ -547,63 +547,63 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==}
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-K72/pvT7qpm8q3k8G5u93NCSN1RcLxX5h7Gw0bQpbMXviBHeY6Nx1WEwmk9wP+eKTSQ8ecxvcgt/ZX/rB938xQ==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
'@typescript-eslint/parser': ^8.71.2
'@typescript-eslint/parser': ^8.72.1
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-aTtmZjp/x3gsGHkDs04/1I8kNogBJkpQaeGaN0PfiG43NzDEmW2n+OP5im9wfsvyX0yP1UZWBrAGtDBfH9jEVw==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-Pd68GsLVh5ZXlcEccFPdhSOvtHZ/2WU0XsA8zmXOS3F158lVlcTLhfQ6qvtL1RzbMie0Kp8xtbVwAg4nejKPHw==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-YF4wgg5iUX5Obywoac27B56FhozMNFhdJSbh11H5GBAwmBtfyRhmgTQqW9tRNNmHDvsZ2CX6UGzoz+YfYn2Leg==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-jz49TAWokm/7yWD9/o837nYax9DyALxIPOImdImvVzo6canBCZYzin8zJyqNR5k1j9K1DE0bVvr0XYB+99uAdg==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-cC8UaalCViJkb3rH/xLIvidEwoFRtMZMUqDjjJMGEKaTFwYRHYBcoczlEGHuvkHEO8svRDrgZ0yQgOArFmwang==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-y5Ukl3oVp7e/VGxqIoEXoeb/Roj71PAJ4WG/N/RGj+eeDvKRLM15kGr9MijLbN0i03S52zxu31Z98E5gWChJKw==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-DgNOEsl4pdYzwSL+N/Cl33tX1Hlw3FvId73LnKXfq7jnrF2viOEn7X+P7RBkkSWCVm92gnWd28GIC5vJuLREeA==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-RyKa1G1M9rKHDhrk+HJtiF1MvLD5Ux2JW3TSkzw+02pRALdpJb+QzG1Y5em+LvCgzGwgg8H7mBRFKljNz7ImPw==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]1.2':
resolution: {integrity: sha512-zozlN0UA32bSG2zkKAgQyRYSbEISVoyU6vvkKYo2aSny74D8Jh4e+POkJ6Lk0dlezZi5x7TtD+88Xb06IB8nhg==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@vitejs/[email protected]':
@@ -1031,8 +1031,8 @@ packages:
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
engines: {node: '>= 4'}
[email protected]2:
resolution: {integrity: sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==}
[email protected]4:
resolution: {integrity: sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==}
engines: {node: '>= 4'}
[email protected]:
@@ -1378,8 +1378,8 @@ packages:
resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==}
engines: {node: '>= 0.4'}
[email protected]9:
resolution: {integrity: sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ==}
[email protected].32:
resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==}
engines: {node: ^10 || ^12 || >=14}
[email protected]:
@@ -1398,16 +1398,16 @@ packages:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
[email protected].0:
resolution: {integrity: sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==}
[email protected].1:
resolution: {integrity: sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==}
peerDependencies:
react: ^19.3.0
react: ^19.3.1
[email protected]:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
[email protected].0:
resolution: {integrity: sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==}
[email protected].1:
resolution: {integrity: sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==}
engines: {node: '>=0.10.0'}
[email protected]:
@@ -1427,8 +1427,8 @@ packages:
engines: {node: '>= 0.4'}
hasBin: true
[email protected]3:
resolution: {integrity: sha512-/5apOkwWxtACcQtZ5WlrAsKS4JwXVThQPJZ3RqIruRY9UG9M8e0VlXN068xum/JRKA4aIUoJ13ghe/kGCvidiQ==}
[email protected]6:
resolution: {integrity: sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
@@ -1582,13 +1582,13 @@ packages:
[email protected]:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
[email protected].4:
resolution: {integrity: sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==}
[email protected].5:
resolution: {integrity: sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
peerDependencies:
'@types/node': ^20.19.0 || >=22.12.0
'@vitejs/devtools': ^0.7.1
'@vitejs/devtools': ^0.7.1 || ^0.8.0
esbuild: ^0.27.0 || ^0.28.0
jiti: '>=1.21.0'
less: ^4.0.0
@@ -1927,109 +1927,109 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.6.0
'@oxc-project/[email protected]3.0': {}
'@oxc-project/[email protected]6.0': {}
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]3':
'@rolldown/[email protected]6':
optional: true
'@rolldown/[email protected]': {}
'@tauri-apps/[email protected].3': {}
'@tauri-apps/[email protected].4': {}
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optional: true
'@tauri-apps/[email protected].2':
'@tauri-apps/[email protected].4':
optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 2.12.2
'@tauri-apps/cli-darwin-x64': 2.12.2
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.2
'@tauri-apps/cli-linux-arm64-gnu': 2.12.2
'@tauri-apps/cli-linux-arm64-musl': 2.12.2
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.2
'@tauri-apps/cli-linux-x64-gnu': 2.12.2
'@tauri-apps/cli-linux-x64-musl': 2.12.2
'@tauri-apps/cli-win32-arm64-msvc': 2.12.2
'@tauri-apps/cli-win32-ia32-msvc': 2.12.2
'@tauri-apps/cli-win32-x64-msvc': 2.12.2
'@tauri-apps/cli-darwin-arm64': 2.12.4
'@tauri-apps/cli-darwin-x64': 2.12.4
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.4
'@tauri-apps/cli-linux-arm64-gnu': 2.12.4
'@tauri-apps/cli-linux-arm64-musl': 2.12.4
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.4
'@tauri-apps/cli-linux-x64-gnu': 2.12.4
'@tauri-apps/cli-linux-x64-musl': 2.12.4
'@tauri-apps/cli-win32-arm64-msvc': 2.12.4
'@tauri-apps/cli-win32-ia32-msvc': 2.12.4
'@tauri-apps/cli-win32-x64-msvc': 2.12.4
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected].5':
'@types/[email protected].6':
dependencies:
undici-types: 8.9.0
@@ -2041,57 +2041,57 @@ snapshots:
dependencies:
csstype: 3.2.3
'@typescript-eslint/[email protected]1.2(@typescript-eslint/[email protected]1.2([email protected])([email protected]))([email protected])([email protected])':
'@typescript-eslint/[email protected]2.1(@typescript-eslint/[email protected]2.1([email protected])([email protected]))([email protected])([email protected])':
dependencies:
'@eslint-community/regexpp': 4.12.2
'@typescript-eslint/parser': 8.71.2([email protected])([email protected])
'@typescript-eslint/scope-manager': 8.71.2
'@typescript-eslint/type-utils': 8.71.2([email protected])([email protected])
'@typescript-eslint/utils': 8.71.2([email protected])([email protected])
'@typescript-eslint/visitor-keys': 8.71.2
'@typescript-eslint/parser': 8.72.1([email protected])([email protected])
'@typescript-eslint/scope-manager': 8.72.1
'@typescript-eslint/type-utils': 8.72.1([email protected])([email protected])
'@typescript-eslint/utils': 8.72.1([email protected])([email protected])
'@typescript-eslint/visitor-keys': 8.72.1
eslint: 9.39.5
ignore: 7.0.12
ignore: 7.0.14
natural-compare: 1.4.0
ts-api-utils: 2.5.0([email protected])
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]1.2([email protected])([email protected])':
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
dependencies:
'@typescript-eslint/scope-manager': 8.71.2
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/typescript-estree': 8.71.2([email protected])
'@typescript-eslint/visitor-keys': 8.71.2
'@typescript-eslint/scope-manager': 8.72.1
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
'@typescript-eslint/visitor-keys': 8.72.1
debug: 4.4.3
eslint: 9.39.5
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]1.2([email protected])':
'@typescript-eslint/[email protected]2.1([email protected])':
dependencies:
'@typescript-eslint/tsconfig-utils': 8.71.2([email protected])
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/tsconfig-utils': 8.72.1([email protected])
'@typescript-eslint/types': 8.72.1
debug: 4.4.3
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]1.2':
'@typescript-eslint/[email protected]2.1':
dependencies:
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/visitor-keys': 8.71.2
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/visitor-keys': 8.72.1
'@typescript-eslint/[email protected]1.2([email protected])':
'@typescript-eslint/[email protected]2.1([email protected])':
dependencies:
typescript: 6.0.3
'@typescript-eslint/[email protected]1.2([email protected])([email protected])':
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
dependencies:
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/typescript-estree': 8.71.2([email protected])
'@typescript-eslint/utils': 8.71.2([email protected])([email protected])
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
'@typescript-eslint/utils': 8.72.1([email protected])([email protected])
debug: 4.4.3
eslint: 9.39.5
ts-api-utils: 2.5.0([email protected])
@@ -2099,14 +2099,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]1.2': {}
'@typescript-eslint/[email protected]2.1': {}
'@typescript-eslint/[email protected]1.2([email protected])':
'@typescript-eslint/[email protected]2.1([email protected])':
dependencies:
'@typescript-eslint/project-service': 8.71.2([email protected])
'@typescript-eslint/tsconfig-utils': 8.71.2([email protected])
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/visitor-keys': 8.71.2
'@typescript-eslint/project-service': 8.72.1([email protected])
'@typescript-eslint/tsconfig-utils': 8.72.1([email protected])
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/visitor-keys': 8.72.1
debug: 4.4.3
minimatch: 10.2.6
semver: 7.8.5
@@ -2116,26 +2116,26 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]1.2([email protected])([email protected])':
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
dependencies:
'@eslint-community/eslint-utils': 4.10.1([email protected])
'@typescript-eslint/scope-manager': 8.71.2
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/typescript-estree': 8.71.2([email protected])
'@typescript-eslint/scope-manager': 8.72.1
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
eslint: 9.39.5
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]1.2':
'@typescript-eslint/[email protected]2.1':
dependencies:
'@typescript-eslint/types': 8.71.2
'@typescript-eslint/types': 8.72.1
eslint-visitor-keys: 5.0.1
'@vitejs/[email protected]([email protected].4(@types/[email protected].5)([email protected]))':
'@vitejs/[email protected]([email protected].5(@types/[email protected].6)([email protected]))':
dependencies:
'@rolldown/pluginutils': 1.0.1
vite: 8.3.4(@types/[email protected].5)([email protected])
vite: 8.3.5(@types/[email protected].6)([email protected])
[email protected]([email protected]):
dependencies:
@@ -2706,7 +2706,7 @@ snapshots:
[email protected]: {}
[email protected]2: {}
[email protected]4: {}
[email protected]:
dependencies:
@@ -3040,7 +3040,7 @@ snapshots:
[email protected]: {}
[email protected]9:
[email protected].32:
dependencies:
nanoid: 3.3.20
picocolors: 1.1.1
@@ -3058,14 +3058,14 @@ snapshots:
[email protected]: {}
[email protected].0([email protected].0):
[email protected].1([email protected].1):
dependencies:
react: 19.3.0
react: 19.3.1
scheduler: 0.28.0
[email protected]: {}
[email protected].0: {}
[email protected].1: {}
[email protected]:
dependencies:
@@ -3098,26 +3098,26 @@ snapshots:
path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0
[email protected]3:
[email protected]6:
dependencies:
'@oxc-project/types': 0.153.0
'@oxc-project/types': 0.156.0
'@rolldown/pluginutils': 1.0.1
optionalDependencies:
'@rolldown/binding-android-arm-eabi': 1.2.13
'@rolldown/binding-android-arm64': 1.2.13
'@rolldown/binding-darwin-arm64': 1.2.13
'@rolldown/binding-darwin-x64': 1.2.13
'@rolldown/binding-freebsd-x64': 1.2.13
'@rolldown/binding-linux-arm-gnueabihf': 1.2.13
'@rolldown/binding-linux-arm64-gnu': 1.2.13
'@rolldown/binding-linux-arm64-musl': 1.2.13
'@rolldown/binding-linux-ppc64-gnu': 1.2.13
'@rolldown/binding-linux-s390x-gnu': 1.2.13
'@rolldown/binding-linux-x64-gnu': 1.2.13
'@rolldown/binding-linux-x64-musl': 1.2.13
'@rolldown/binding-openharmony-arm64': 1.2.13
'@rolldown/binding-win32-arm64-msvc': 1.2.13
'@rolldown/binding-win32-x64-msvc': 1.2.13
'@rolldown/binding-android-arm-eabi': 1.2.16
'@rolldown/binding-android-arm64': 1.2.16
'@rolldown/binding-darwin-arm64': 1.2.16
'@rolldown/binding-darwin-x64': 1.2.16
'@rolldown/binding-freebsd-x64': 1.2.16
'@rolldown/binding-linux-arm-gnueabihf': 1.2.16
'@rolldown/binding-linux-arm64-gnu': 1.2.16
'@rolldown/binding-linux-arm64-musl': 1.2.16
'@rolldown/binding-linux-ppc64-gnu': 1.2.16
'@rolldown/binding-linux-s390x-gnu': 1.2.16
'@rolldown/binding-linux-x64-gnu': 1.2.16
'@rolldown/binding-linux-x64-musl': 1.2.16
'@rolldown/binding-openharmony-arm64': 1.2.16
'@rolldown/binding-win32-arm64-msvc': 1.2.16
'@rolldown/binding-win32-x64-msvc': 1.2.16
[email protected]:
dependencies:
@@ -3326,15 +3326,15 @@ snapshots:
dependencies:
punycode: 2.3.1
[email protected].4(@types/[email protected].5)([email protected]):
[email protected].5(@types/[email protected].6)([email protected]):
dependencies:
lightningcss: 1.33.0
picomatch: 4.0.7
postcss: 8.5.29
rolldown: 1.2.13
postcss: 8.5.32
rolldown: 1.2.16
tinyglobby: 0.2.17
optionalDependencies:
'@types/node': 26.6.5
'@types/node': 26.6.6
esbuild: 0.27.2
fsevents: 2.3.3
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 58 KiB

+30 -34
View File
@@ -1,60 +1,56 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
<defs>
<linearGradient id="ocean" x1="245" y1="170" x2="770" y2="770" gradientUnits="userSpaceOnUse">
<defs>
<linearGradient id="ocean" x1="210.49524" y1="190.80952" x2="802.16190" y2="867.00000" gradientUnits="userSpaceOnUse">
<stop stop-color="#579bc1"/>
<stop offset=".52" stop-color="#438fbd"/>
<stop offset="1" stop-color="#2f719e"/>
</linearGradient>
<linearGradient id="land" x1="260" y1="190" x2="750" y2="735" gradientUnits="userSpaceOnUse">
<linearGradient id="land" x1="227.40000" y1="213.34921" x2="779.62222" y2="827.55556" gradientUnits="userSpaceOnUse">
<stop stop-color="#56c78a"/>
<stop offset=".55" stop-color="#3bbf78"/>
<stop offset="1" stop-color="#279b5d"/>
</linearGradient>
<linearGradient id="lock" x1="385" y1="400" x2="650" y2="700" gradientUnits="userSpaceOnUse">
<filter id="globe-shadow" x="-20%" y="-20%" width="140%" height="150%" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" stdDeviation="7" result="blur"/>
<feOffset in="blur" dy="6" result="offsetBlur"/>
<feFlood flood-color="#174D6F" flood-opacity="0.14" result="shadowColor"/>
<feComposite in="shadowColor" in2="offsetBlur" operator="in" result="shadow"/>
<feMerge><feMergeNode in="shadow"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
<linearGradient id="shipped-lock" x1="385" y1="400" x2="650" y2="700" gradientUnits="userSpaceOnUse">
<stop stop-color="#f3b84c"/>
<stop offset=".55" stop-color="#e8a12f"/>
<stop offset="1" stop-color="#d4871e"/>
</linearGradient>
<clipPath id="globe-clip">
<circle cx="512" cy="455" r="315"/>
</clipPath>
<!-- Use SVG 1.1 primitives: feDropShadow needs librsvg >= 2.55.91. -->
<filter id="globe-shadow" x="150" y="90" width="730" height="760" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" stdDeviation="12" result="blur"/>
<feOffset in="blur" dx="0" dy="8" result="offsetBlur"/>
<feFlood flood-color="#174d6f" flood-opacity=".14" result="shadowColor"/>
<feComposite in="shadowColor" in2="offsetBlur" operator="in" result="shadow"/>
<feMerge><feMergeNode in="shadow"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
<filter id="lock-shadow" x="280" y="210" width="470" height="540" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<filter id="shipped-lock-shadow" x="280" y="210" width="470" height="540" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" stdDeviation="18" result="blur"/>
<feOffset in="blur" dx="0" dy="18" result="offsetBlur"/>
<feFlood flood-color="#70430c" flood-opacity=".2" result="shadowColor"/>
<feComposite in="shadowColor" in2="offsetBlur" operator="in" result="shadow"/>
<feMerge><feMergeNode in="shadow"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
</defs>
</filter></defs>
<g transform="translate(512 512) scale(1.1535211267605634) translate(-511.4 -512)">
<g filter="url(#globe-shadow)">
<circle cx="511.4" cy="512" r="355" fill="url(#ocean)"/>
<path d="m341.5 202.8c-83.71 44.8-148.5 123-170.9 210.4 10.88 28.67 32.13 48.77 54.14 63.49 13.18 8.96 18.94 19.84 17.15 31.87-3.84 26.5-46.85 37.89-50.3 71.3-2.688 27.78 17.54 52.74 46.46 67.71 21.76 11.39 35.2 25.73 41.34 44.29 13.44 39.17 32.64 82.56 68.99 105.5 30.08 18.94 46.85 12.67 41.09-1.92-6.144-15.36-26.37-32.13-26.24-53.63 0.128-27.39 26.5-41.98 31.49-62.72v-87.3c-18.69-0.896-30.59-9.216-40.19-19.71-16.51-17.41-37.76-29.44-55.68-36.86-10.37-4.352-12.67-12.8-13.7-22.66-0.896-11.39-6.144-20.74-15.1-28.16-12.8-10.62-19.97-22.53-18.3-34.82 1.92-15.62 17.28-26.5 36.74-29.44 37.25-6.144 70.53-34.69 74.11-63.49 1.792-14.46-5.504-24.32-2.816-33.66 4.864-21.12 34.18-38.14 65.02-51.71 24.83-10.88 45.7-20.61 45.95-39.81 0.256-20.22-20.74-32.9-60.03-33.41-22.53 0.128-46.08 2.56-69.25 4.736z" fill="url(#land)"/>
<path d="m663.7 191.5c-50.43 5.376-89.34 38.4-89.34 68.61 0 26.75 27.78 42.88 62.98 46.98 31.36 3.712 48.9 15.36 49.79 34.18 0.896 20.74-17.15 34.18-16.77 51.71 0.512 36.35 51.84 71.04 107.4 71.17 31.74 0.128 62.59-11.39 79.74-28.54-24.32-107.8-99.2-199.3-193.8-244.1z" fill="url(#land)"/>
<path d="m866.2 532c-19.46-9.216-42.62-13.7-66.18-13.7-57.47 0-102.1 34.05-102.1 60.8 0 11.9 6.144 19.97 13.06 26.75 11.52 11.52 17.66 25.73 17.66 42.24 0 29.18-22.53 45.06-22.53 73.34 0 26.88 18.69 47.36 39.04 57.73 71.42-61.31 117.6-154.6 121.1-247.2z" fill="url(#land)"/>
<circle cx="511.4" cy="512" r="347.111111" fill="none" stroke="#9ccde2" stroke-width="12.396825" stroke-opacity=".24"/>
<g transform="translate(512 512) scale(1.3) translate(-512 -455)">
<g filter="url(#globe-shadow)">
<circle cx="512" cy="455" r="315" fill="url(#ocean)"/>
<g clip-path="url(#globe-clip)" fill="url(#land)">
<path d="M177 326c74-121 177-185 302-190-13 51-49 84-105 98-4 45-32 79-86 101-37 17-75 14-111-9Z"/>
<path d="M564 135c129 18 229 103 273 220-69-3-121 15-157 54-51-14-83-50-95-107-38-36-45-92-21-167Z"/>
<path d="M189 467c63-39 125-34 187 16 57 25 73 73 48 144-45 90-108 146-189 166-58-88-73-197-46-326Z"/>
<path d="M612 572c78-38 157-18 238 59-45 89-122 144-231 164-20-67-22-122-7-165-22-17-22-36 0-58Z"/>
</g>
<circle cx="512" cy="455" r="308" fill="none" stroke="#9ccde2" stroke-width="11" stroke-opacity=".24"/>
</g>
<g transform="translate(512 490) scale(.82) translate(-512 -490)" filter="url(#lock-shadow)">
</g>
</g>
<g transform="translate(512 512) scale(1.3) translate(-512 -455)">
<g transform="translate(512 490) scale(.82) translate(-512 -490)" filter="url(#shipped-lock-shadow)">
<path d="M405 429v-75c0-142 214-142 214 0v75" fill="none" stroke="#eef1f2" stroke-width="58" stroke-linecap="round"/>
<rect x="340" y="403" width="344" height="278" rx="62" fill="url(#lock)"/>
<rect x="340" y="403" width="344" height="278" rx="62" fill="url(#shipped-lock)"/>
<rect x="346" y="409" width="332" height="266" rx="56" fill="none" stroke="#f7cb75" stroke-width="10" stroke-opacity=".3"/>
<g fill="#85500f" opacity=".78">
<g fill="#85500f" opacity=".78" transform="translate(512 550.5) scale(1.2) translate(-512 -550.5)">
<path d="M501 538h22l16 69h-54Z"/>
<circle cx="512" cy="521" r="27"/>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

+51 -4
View File
@@ -1,6 +1,6 @@
use std::sync::Arc;
use gpapi::service::transport::SessionCredential;
use gpapi::{gui::GuiTheme, service::transport::SessionCredential};
use log::info;
use tauri::{Listener, Manager};
use tokio::sync::watch;
@@ -11,30 +11,68 @@ pub struct App {
credential: Arc<SessionCredential>,
credential_lease: watch::Receiver<bool>,
gui_version: String,
variant: gpapi::gui::GuiVariant,
theme: GuiTheme,
}
impl App {
pub fn new(credential: Arc<SessionCredential>, credential_lease: watch::Receiver<bool>, gui_version: &str) -> Self {
pub fn new(
credential: Arc<SessionCredential>,
credential_lease: watch::Receiver<bool>,
gui_version: &str,
variant: gpapi::gui::GuiVariant,
theme: GuiTheme,
) -> Self {
Self {
credential,
credential_lease,
gui_version: gui_version.to_string(),
variant,
theme,
}
}
pub fn run(&self) -> anyhow::Result<()> {
let gui_version = self.gui_version.clone();
let variant = self.variant;
let theme = self.theme;
let credential = Arc::clone(&self.credential);
let credential_lease = self.credential_lease.clone();
tauri::Builder::default()
.on_window_event(move |window, event| {
if theme == GuiTheme::System
&& let tauri::WindowEvent::ThemeChanged(theme) = event
&& let Some(win) = window.get_webview_window(window.label())
&& let Err(error) = win.set_background_color(Some(background_color(*theme)))
{
log::warn!("Could not update helper window background: {error}");
}
})
.setup(move |app| {
let win = app.get_webview_window("main").expect("no main window");
let native_theme = match theme {
GuiTheme::System => None,
GuiTheme::Light => Some(tauri::Theme::Light),
GuiTheme::Dark => Some(tauri::Theme::Dark),
};
let config = app
.config()
.app
.windows
.iter()
.find(|window| window.label == "main")
.expect("no main window");
let win = tauri::WebviewWindowBuilder::from_config(app, config)?
.theme(native_theme)
.initialization_script(format!("window.__GP_HELPER_THEME__ = {:?};", theme.as_str()))
.visible(false)
.build()?;
win.set_background_color(Some(background_color(win.theme()?)))?;
let _ = win.hide_menu();
let notifier = ProgressNotifier::new(win.clone());
let installer = Installer::new(credential, credential_lease.clone());
let updater = Arc::new(GuiUpdater::new(gui_version, notifier, installer));
let updater = Arc::new(GuiUpdater::new(gui_version, notifier, installer, variant));
let app_handle = app.handle().clone();
let mut app_credential_lease = credential_lease;
@@ -66,6 +104,8 @@ impl App {
tokio::spawn(async move { updater.update().await });
});
win.show()?;
Ok(())
})
.run(tauri::generate_context!())?;
@@ -73,3 +113,10 @@ impl App {
Ok(())
}
}
fn background_color(theme: tauri::Theme) -> tauri::window::Color {
match theme {
tauri::Theme::Dark => tauri::window::Color(36, 36, 36, 255),
_ => tauri::window::Color(246, 245, 244, 255),
}
}
+38 -1
View File
@@ -4,6 +4,7 @@ use std::{io::Read, sync::Arc};
use anyhow::{Context, bail};
use gpapi::{
clap::InfoLevelVerbosity,
gui::GuiTheme,
service::transport::{MAX_CREDENTIAL_FRAME, SessionCredential},
utils::env_utils,
};
@@ -29,6 +30,11 @@ struct Cli {
#[arg(long, default_value = env!("CARGO_PKG_VERSION"), help = "The version of the GUI")]
gui_version: String,
#[arg(long, default_value = "tauri", value_parser = ["tauri", "nsh"])]
gui_variant: String,
#[arg(long, value_enum, default_value = "system", help = "Window appearance")]
theme: GuiTheme,
#[command(flatten)]
verbose: InfoLevelVerbosity,
@@ -38,7 +44,22 @@ impl Cli {
fn run(&self) -> anyhow::Result<()> {
let credential = self.read_credential()?;
let credential_lease = monitor_credential_lease().context("Failed to monitor service credential lifetime")?;
let app = App::new(Arc::new(credential), credential_lease, &self.gui_version);
let variant = if self.gui_variant == "nsh" {
gpapi::gui::GuiVariant::Nsh
} else {
gpapi::gui::GuiVariant::Tauri
};
anyhow::ensure!(
variant != gpapi::gui::GuiVariant::Nsh || cfg!(target_os = "linux"),
"Native Shell is available only on Linux"
);
let app = App::new(
Arc::new(credential),
credential_lease,
&self.gui_version,
variant,
self.theme,
);
env_utils::patch_gui_runtime_env(false);
@@ -110,6 +131,22 @@ mod tests {
use super::*;
#[test]
fn theme_defaults_to_system_and_accepts_explicit_modes() {
assert_eq!(Cli::try_parse_from(["gpgui-helper"]).unwrap().theme, GuiTheme::System);
for (value, expected) in [
("system", GuiTheme::System),
("light", GuiTheme::Light),
("dark", GuiTheme::Dark),
] {
assert_eq!(
Cli::try_parse_from(["gpgui-helper", "--theme", value]).unwrap().theme,
expected
);
}
assert!(Cli::try_parse_from(["gpgui-helper", "--theme", "invalid"]).is_err());
}
#[test]
fn credential_lease_closes_at_eof() {
let (lease_tx, lease_rx) = watch::channel(true);
+12 -2
View File
@@ -33,7 +33,12 @@ impl<'a> FileDownloader<'a> {
}
pub async fn download(&self) -> anyhow::Result<NamedTempFile> {
let res = reqwest::get(self.url).await?.error_for_status()?;
let res = gpapi::utils::request::client_builder()
.build()?
.get(self.url)
.send()
.await?
.error_for_status()?;
let content_length = res.content_length().unwrap_or(0);
info!("Content length: {}", content_length);
@@ -79,7 +84,12 @@ impl<'a> ChecksumFetcher<'a> {
}
pub async fn fetch(&self) -> anyhow::Result<String> {
let res = reqwest::get(self.url).await?.error_for_status()?;
let res = gpapi::utils::request::client_builder()
.build()?
.get(self.url)
.send()
.await?
.error_for_status()?;
let checksum = res.text().await?.trim().to_string();
Ok(checksum)
+44 -13
View File
@@ -41,10 +41,20 @@ const GUI_LIBC_SUFFIX: &str = "-musl";
#[cfg(not(target_env = "musl"))]
const GUI_LIBC_SUFFIX: &str = "";
fn gui_asset_name() -> Option<String> {
fn gui_asset_name(variant: gpapi::gui::GuiVariant) -> Option<String> {
if variant == gpapi::gui::GuiVariant::Nsh {
return nsh_asset_name_for(std::env::consts::OS, std::env::consts::ARCH);
}
gui_asset_name_for(std::env::consts::OS, std::env::consts::ARCH, GUI_LIBC_SUFFIX)
}
fn nsh_asset_name_for(os: &str, arch: &str) -> Option<String> {
match (os, arch) {
("linux", "x86_64" | "aarch64") => Some(format!("gpgui-nsh_{arch}.bin.tar.xz")),
_ => None,
}
}
fn gui_asset_name_for(os: &str, arch: &str, libc_suffix: &str) -> Option<String> {
let name = match (os, arch) {
("linux", "x86_64" | "aarch64") => format!("gpgui_{arch}{libc_suffix}.bin.tar.xz"),
@@ -97,10 +107,11 @@ impl Installer {
Self { command_tx }
}
async fn install(&self, path: &str, checksum: &str) -> anyhow::Result<()> {
async fn install(&self, path: &str, checksum: &str, variant: gpapi::gui::GuiVariant) -> anyhow::Result<()> {
let request = UpdateGuiRequest {
path: path.to_string(),
checksum: checksum.to_string(),
variant,
};
let (reply, result) = oneshot::channel();
self
@@ -363,6 +374,7 @@ async fn receive_binary(socket: &mut Socket) -> anyhow::Result<Vec<u8>> {
pub struct GuiUpdater {
version: String,
variant: gpapi::gui::GuiVariant,
notifier: Arc<ProgressNotifier>,
installer: Installer,
in_progress: RwLock<bool>,
@@ -370,9 +382,15 @@ pub struct GuiUpdater {
}
impl GuiUpdater {
pub fn new(version: String, notifier: ProgressNotifier, installer: Installer) -> Self {
pub fn new(
version: String,
notifier: ProgressNotifier,
installer: Installer,
variant: gpapi::gui::GuiVariant,
) -> Self {
Self {
version,
variant,
notifier: Arc::new(notifier),
installer,
in_progress: Default::default(),
@@ -381,7 +399,7 @@ impl GuiUpdater {
}
pub async fn update(&self) {
let Some(asset_name) = gui_asset_name() else {
let Some(asset_name) = gui_asset_name(self.variant) else {
info!("GUI updates are not supported on this platform.");
return;
};
@@ -438,7 +456,7 @@ impl GuiUpdater {
info!("Checksum success");
if let Err(err) = self.installer.install(&file_path, &checksum).await {
if let Err(err) = self.installer.install(&file_path, &checksum, self.variant).await {
warn!("Install error: {}", err);
self.notify_error();
} else {
@@ -488,13 +506,10 @@ impl GuiUpdater {
#[cfg(test)]
mod tests {
use gpapi::{
os_profile::HostIdentity,
service::{
transport::{ClientPrelude, NoiseResponder},
vpn_env::{HostInfo, VpnEnv},
vpn_state::VpnState,
},
use gpapi::service::{
transport::{ClientPrelude, NoiseResponder},
vpn_env::{HostInfo, VpnEnv},
vpn_state::VpnState,
};
use tokio::net::TcpListener;
use tokio_tungstenite::accept_async;
@@ -522,6 +537,21 @@ mod tests {
assert_eq!(gui_asset_name_for("macos", "aarch64", ""), None);
}
#[test]
fn nsh_assets_are_linux_only_and_use_the_nsh_binary_archive() {
assert_eq!(
nsh_asset_name_for("linux", "x86_64"),
Some("gpgui-nsh_x86_64.bin.tar.xz".into())
);
assert_eq!(
nsh_asset_name_for("linux", "aarch64"),
Some("gpgui-nsh_aarch64.bin.tar.xz".into())
);
for os in ["freebsd", "openbsd", "macos"] {
assert_eq!(nsh_asset_name_for(os, "x86_64"), None);
}
}
#[tokio::test]
async fn pending_install_reconnects_with_a_fresh_handshake() {
let credential = Arc::new(SessionCredential::generate(Uuid::new_v4(), env!("CARGO_PKG_VERSION")).unwrap());
@@ -532,6 +562,7 @@ mod tests {
request: UpdateGuiRequest {
path: "/tmp/gpgui-update".to_owned(),
checksum: "checksum".to_owned(),
variant: gpapi::gui::GuiVariant::Tauri,
},
reply: reply_tx,
})
@@ -635,7 +666,7 @@ mod tests {
vpnc_script: None,
auth_executable: String::new(),
host_info: HostInfo {
host_identity: HostIdentity::collect(),
host_identity: gpapi::os_profile::desktop::collect_identity(),
},
},
};
@@ -25,6 +25,7 @@
"maxWidth": 460,
"maxHeight": 104,
"label": "main",
"create": false,
"decorations": false
}
]
+24 -23
View File
@@ -1,43 +1,44 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">
<defs>
<linearGradient id="ocean" x1="245" y1="170" x2="770" y2="770" gradientUnits="userSpaceOnUse">
<defs>
<linearGradient id="ocean" x1="210.49524" y1="190.80952" x2="802.16190" y2="867.00000" gradientUnits="userSpaceOnUse">
<stop stop-color="#579bc1"/>
<stop offset=".52" stop-color="#438fbd"/>
<stop offset="1" stop-color="#2f719e"/>
</linearGradient>
<linearGradient id="land" x1="260" y1="190" x2="750" y2="735" gradientUnits="userSpaceOnUse">
<linearGradient id="land" x1="227.40000" y1="213.34921" x2="779.62222" y2="827.55556" gradientUnits="userSpaceOnUse">
<stop stop-color="#56c78a"/>
<stop offset=".55" stop-color="#3bbf78"/>
<stop offset="1" stop-color="#279b5d"/>
</linearGradient>
<linearGradient id="lock" x1="385" y1="400" x2="650" y2="700" gradientUnits="userSpaceOnUse">
<linearGradient id="shipped-lock" x1="385" y1="400" x2="650" y2="700" gradientUnits="userSpaceOnUse">
<stop stop-color="#f3b84c"/>
<stop offset=".55" stop-color="#e8a12f"/>
<stop offset="1" stop-color="#d4871e"/>
</linearGradient>
<clipPath id="globe-clip">
<circle cx="512" cy="455" r="315"/>
</clipPath>
</defs>
</defs>
<g transform="translate(512 512) scale(1.1535211267605634) translate(-511.4 -512)">
<g>
<circle cx="511.4" cy="512" r="355" fill="url(#ocean)"/>
<path d="m341.5 202.8c-83.71 44.8-148.5 123-170.9 210.4 10.88 28.67 32.13 48.77 54.14 63.49 13.18 8.96 18.94 19.84 17.15 31.87-3.84 26.5-46.85 37.89-50.3 71.3-2.688 27.78 17.54 52.74 46.46 67.71 21.76 11.39 35.2 25.73 41.34 44.29 13.44 39.17 32.64 82.56 68.99 105.5 30.08 18.94 46.85 12.67 41.09-1.92-6.144-15.36-26.37-32.13-26.24-53.63 0.128-27.39 26.5-41.98 31.49-62.72v-87.3c-18.69-0.896-30.59-9.216-40.19-19.71-16.51-17.41-37.76-29.44-55.68-36.86-10.37-4.352-12.67-12.8-13.7-22.66-0.896-11.39-6.144-20.74-15.1-28.16-12.8-10.62-19.97-22.53-18.3-34.82 1.92-15.62 17.28-26.5 36.74-29.44 37.25-6.144 70.53-34.69 74.11-63.49 1.792-14.46-5.504-24.32-2.816-33.66 4.864-21.12 34.18-38.14 65.02-51.71 24.83-10.88 45.7-20.61 45.95-39.81 0.256-20.22-20.74-32.9-60.03-33.41-22.53 0.128-46.08 2.56-69.25 4.736z" fill="url(#land)"/>
<path d="m663.7 191.5c-50.43 5.376-89.34 38.4-89.34 68.61 0 26.75 27.78 42.88 62.98 46.98 31.36 3.712 48.9 15.36 49.79 34.18 0.896 20.74-17.15 34.18-16.77 51.71 0.512 36.35 51.84 71.04 107.4 71.17 31.74 0.128 62.59-11.39 79.74-28.54-24.32-107.8-99.2-199.3-193.8-244.1z" fill="url(#land)"/>
<path d="m866.2 532c-19.46-9.216-42.62-13.7-66.18-13.7-57.47 0-102.1 34.05-102.1 60.8 0 11.9 6.144 19.97 13.06 26.75 11.52 11.52 17.66 25.73 17.66 42.24 0 29.18-22.53 45.06-22.53 73.34 0 26.88 18.69 47.36 39.04 57.73 71.42-61.31 117.6-154.6 121.1-247.2z" fill="url(#land)"/>
<circle cx="511.4" cy="512" r="347.111111" fill="none" stroke="#9ccde2" stroke-width="12.396825" stroke-opacity=".4"/>
<g transform="translate(512 512) scale(1.3) translate(-512 -455)">
<circle cx="512" cy="455" r="315" fill="url(#ocean)"/>
<g clip-path="url(#globe-clip)" fill="url(#land)">
<path d="M177 326c74-121 177-185 302-190-13 51-49 84-105 98-4 45-32 79-86 101-37 17-75 14-111-9Z"/>
<path d="M564 135c129 18 229 103 273 220-69-3-121 15-157 54-51-14-83-50-95-107-38-36-45-92-21-167Z"/>
<path d="M189 467c63-39 125-34 187 16 57 25 73 73 48 144-45 90-108 146-189 166-58-88-73-197-46-326Z"/>
<path d="M612 572c78-38 157-18 238 59-45 89-122 144-231 164-20-67-22-122-7-165-22-17-22-36 0-58Z"/>
</g>
<circle cx="512" cy="455" r="308" fill="none" stroke="#9ccde2" stroke-width="11" stroke-opacity=".4"/>
<g transform="translate(512 490) scale(.82) translate(-512 -490)">
</g>
</g>
<g transform="translate(512 512) scale(1.3) translate(-512 -455)">
<g transform="translate(512 490) scale(.82) translate(-512 -490)">
<path d="M405 429v-75c0-142 214-142 214 0v75" fill="none" stroke="#eef1f2" stroke-width="58" stroke-linecap="round"/>
<rect x="340" y="403" width="344" height="278" rx="62" fill="url(#lock)"/>
<rect x="346" y="409" width="332" height="266" rx="56" fill="none" stroke="#f7cb75" stroke-width="10" stroke-opacity=".45"/>
<g fill="#85500f" opacity=".85">
<rect x="340" y="403" width="344" height="278" rx="62" fill="url(#shipped-lock)"/>
<rect x="346" y="409" width="332" height="266" rx="56" fill="none" stroke="#f7cb75" stroke-width="10" stroke-opacity=".3"/>
<g fill="#85500f" opacity=".78" transform="translate(512 550.5) scale(1.2) translate(-512 -550.5)">
<path d="M501 538h22l16 69h-54Z"/>
<circle cx="512" cy="521" r="27"/>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

+44 -14
View File
@@ -1,3 +1,33 @@
:root {
color-scheme: light;
--background: #f6f5f4;
--foreground: #2e3436;
--muted-foreground: #5e5c64;
--progress-label: #3d3846;
--progress-track: #d5d3d1;
--progress-fill: #3584e4;
--error: #9c2f2f;
--button: #1c71d8;
--button-hover: #1a5fb4;
--button-active: #174a8b;
--focus-ring: #1a5fb4;
}
:root[data-theme="dark"] {
color-scheme: dark;
--background: #242424;
--foreground: #ffffff;
--muted-foreground: #c0bfbc;
--progress-label: #deddda;
--progress-track: #454545;
--progress-fill: #78aeed;
--error: #ffb4ab;
--button: #1c71d8;
--button-hover: #3584e4;
--button-active: #1a5fb4;
--focus-ring: #78aeed;
}
html,
body,
#root {
@@ -12,8 +42,8 @@ body,
}
body {
background: #f6f5f4;
color: #2e3436;
background: var(--background);
color: var(--foreground);
font-family:
Inter,
ui-sans-serif,
@@ -35,7 +65,7 @@ button {
height: 100%;
padding: 16px 18px;
gap: 15px;
background: #f6f5f4;
background: var(--background);
}
.update-logo {
@@ -52,7 +82,7 @@ button {
.update-title {
margin: 0;
color: #2e3436;
color: var(--foreground);
font-size: 16px;
font-weight: 600;
line-height: 1.25;
@@ -61,7 +91,7 @@ button {
.update-description {
margin: 3px 0 0;
color: #5e5c64;
color: var(--muted-foreground);
font-size: 12px;
line-height: 1.4;
}
@@ -85,13 +115,13 @@ button {
margin-top: 9px;
overflow: hidden;
border-radius: 3px;
background-color: #d5d3d1;
background-color: var(--progress-track);
}
.progress-fill {
height: 100%;
border-radius: 3px;
background: #3584e4;
background: var(--progress-fill);
transition: width 180ms ease-out;
}
@@ -123,7 +153,7 @@ button {
.progress-label {
flex: 0 0 auto;
color: #3d3846;
color: var(--progress-label);
font-size: 12px;
font-variant-numeric: tabular-nums;
font-weight: 500;
@@ -139,7 +169,7 @@ button {
}
.error-status .update-title {
color: #9c2f2f;
color: var(--error);
}
.error-copy {
@@ -151,23 +181,23 @@ button {
padding: 4px 14px;
border: 0;
border-radius: 8px;
background: #1c71d8;
background: var(--button);
color: #ffffff;
cursor: pointer;
cursor: default;
font-size: 12px;
font-weight: 600;
line-height: 1.5;
}
.retry-button:hover {
background: #1a5fb4;
background: var(--button-hover);
}
.retry-button:active {
background: #174a8b;
background: var(--button-active);
}
.retry-button:focus-visible {
outline: 2px solid #1a5fb4;
outline: 2px solid var(--focus-ring);
outline-offset: 2px;
}
+48
View File
@@ -0,0 +1,48 @@
import { readFileSync } from "node:fs";
import { runInNewContext } from "node:vm";
import { test } from "node:test";
import assert from "node:assert/strict";
const html = readFileSync(new URL("../index.html", import.meta.url), "utf8");
const script = html.match(/<script>([\s\S]*?)<\/script>/)[1];
function load(theme, dark) {
const root = { dataset: {} };
let changed;
const media = {
matches: dark,
addEventListener(event, listener) {
assert.equal(event, "change");
changed = listener;
},
};
runInNewContext(script, {
window: { __GP_HELPER_THEME__: theme },
document: { documentElement: root },
matchMedia(query) {
assert.equal(query, "(prefers-color-scheme: dark)");
return media;
},
});
return { root, change(dark) { media.matches = dark; changed?.(); } };
}
test("default and explicit system modes follow system changes before React starts", () => {
for (const theme of [undefined, "system"]) {
for (const dark of [false, true]) {
const page = load(theme, dark);
assert.equal(page.root.dataset.theme, dark ? "dark" : "light");
page.change(!dark);
assert.equal(page.root.dataset.theme, dark ? "light" : "dark");
}
}
});
test("explicit modes override opposite system appearance and ignore system changes", () => {
for (const theme of ["light", "dark"]) {
const page = load(theme, theme !== "dark");
assert.equal(page.root.dataset.theme, theme);
page.change(theme === "dark");
assert.equal(page.root.dataset.theme, theme);
}
});
+2 -1
View File
@@ -2,6 +2,7 @@
name = "gpservice"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
[dependencies]
@@ -36,7 +37,7 @@ nix = { version = "0.31", features = ["fs", "socket", "user"] }
[dev-dependencies]
openssl.workspace = true
tokio-tungstenite = "0.29"
tokio-tungstenite.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
gpvpnc = { path = "../../crates/gpvpnc" }
+86 -8
View File
@@ -17,7 +17,10 @@ use tokio::io::unix::AsyncFd;
use tokio_util::sync::CancellationToken;
use crate::session_registry::SessionRegistry;
use gpapi::service::transport::{DESKTOP_GUI_EXITED, DESKTOP_RENDERING_RETRY};
use gpapi::service::transport::{
DESKTOP_GUI_EXITED, DESKTOP_GUI_INSTALLER, DESKTOP_RENDERING_RETRY, DESKTOP_SWITCH_BEGIN, DESKTOP_SWITCH_CANCEL,
DESKTOP_SWITCH_COMMIT,
};
/// Private parent/service pipes; credentials never pass through argv, environment or files.
pub(crate) struct DesktopClient {
@@ -44,7 +47,8 @@ impl DesktopClient {
fcntl(&fd, FcntlArg::F_SETFD(FdFlag::FD_CLOEXEC))?;
let flags = OFlag::from_bits_truncate(fcntl(&fd, FcntlArg::F_GETFL)?);
fcntl(&fd, FcntlArg::F_SETFL(flags | OFlag::O_NONBLOCK))?;
Ok(AsyncFd::new(fd)?)
// SAFETY: OwnedFd keeps this descriptor open and unchanged until AsyncFd drops it.
Ok(unsafe { AsyncFd::register(fd) }?)
}
Ok(Self {
input: pipe(input)?,
@@ -62,15 +66,41 @@ impl DesktopClient {
let mut rendering_renewed = false;
loop {
let credential = registry.issue(env!("CARGO_PKG_VERSION"), Some(uid))?;
let session_id = credential.session_id();
let mut session_id = credential.session_id();
let mut pending = None;
let result = tokio::select! {
_ = cancel.cancelled() => Ok(None),
result = async {
self.write_frame(&credential.encode_frame()?).await?;
self.gui_exited().await
self.write_all(&credential.encode_frame()?).await?;
loop {
match self.read_control().await? {
Some(DESKTOP_GUI_INSTALLER) => {
self.write_all(&[u8::from(crate::request_dispatcher::gui_installer().is_some())]).await?;
}
Some(DESKTOP_SWITCH_BEGIN) => {
ensure!(pending.is_none(), "A GUI switch is already pending");
let credential = registry.issue(env!("CARGO_PKG_VERSION"), Some(uid))?;
pending = Some(credential.session_id());
self.write_all(&credential.encode_frame()?).await?;
}
Some(DESKTOP_SWITCH_COMMIT) => {
let replacement = pending.take().context("No GUI switch is pending")?;
registry.revoke(session_id);
session_id = replacement;
}
Some(DESKTOP_SWITCH_CANCEL) => {
let replacement = pending.take().context("No GUI switch is pending")?;
registry.revoke(replacement);
}
message => break Ok(message),
}
}
} => result,
};
registry.revoke(session_id);
if let Some(session_id) = pending {
registry.revoke(session_id);
}
let requested = restart.swap(false, Ordering::SeqCst);
match result? {
None => return Ok(()),
@@ -85,7 +115,7 @@ impl DesktopClient {
}
}
async fn write_frame(&self, mut bytes: &[u8]) -> anyhow::Result<()> {
async fn write_all(&self, mut bytes: &[u8]) -> anyhow::Result<()> {
while !bytes.is_empty() {
let mut ready = self.output.writable().await?;
match ready.try_io(|fd| write(fd.get_ref(), bytes).map_err(io::Error::from)) {
@@ -100,7 +130,7 @@ impl DesktopClient {
Ok(())
}
async fn gui_exited(&self) -> anyhow::Result<Option<u8>> {
async fn read_control(&self) -> anyhow::Result<Option<u8>> {
loop {
let mut ready = self.input.readable().await?;
let mut byte = [0];
@@ -145,7 +175,7 @@ mod tests {
.unwrap()
.success()
);
channel.write_frame(b"PRIVATE_FRAME").await.unwrap();
channel.write_all(b"PRIVATE_FRAME").await.unwrap();
}
use gpapi::service::transport::SessionCredential;
use nix::unistd::pipe;
@@ -253,6 +283,54 @@ mod tests {
assert!(registry.last_successful_hip_report(issued.session_id()).is_err());
}
#[tokio::test]
async fn switch_cancel_preserves_current_session_and_commit_replaces_it() {
let (channel, control, reader) = pipes();
let registry = Arc::new(SessionRegistry::for_tests(uuid::Uuid::new_v4()));
let task = tokio::spawn(channel.serve(
registry.clone(),
1000,
Arc::new(AtomicBool::new(false)),
CancellationToken::new(),
));
let (reader, first) = credential(reader).await;
write(&control, &[DESKTOP_GUI_INSTALLER]).unwrap();
let reader = tokio::task::spawn_blocking(move || {
let mut reader = reader;
let mut capability = [0];
reader.read_exact(&mut capability).unwrap();
assert_eq!(
capability[0],
u8::from(crate::request_dispatcher::gui_installer().is_some())
);
reader
})
.await
.unwrap();
// A capability query leaves the current session intact and the next frame readable.
assert!(registry.last_successful_hip_report(first.session_id()).is_ok());
write(&control, &[DESKTOP_SWITCH_BEGIN]).unwrap();
let (reader, cancelled) = credential(reader).await;
assert_ne!(first.session_id(), cancelled.session_id());
assert!(registry.last_successful_hip_report(first.session_id()).is_ok());
write(&control, &[DESKTOP_SWITCH_CANCEL, DESKTOP_SWITCH_BEGIN]).unwrap();
let (reader, replacement) = credential(reader).await;
assert!(registry.last_successful_hip_report(cancelled.session_id()).is_err());
assert!(registry.last_successful_hip_report(first.session_id()).is_ok());
write(&control, &[DESKTOP_SWITCH_COMMIT, DESKTOP_SWITCH_BEGIN]).unwrap();
let (_, pending) = credential(reader).await;
assert!(registry.last_successful_hip_report(first.session_id()).is_err());
assert!(registry.last_successful_hip_report(replacement.session_id()).is_ok());
drop(control);
tokio::time::timeout(Duration::from_secs(1), task)
.await
.unwrap()
.unwrap()
.unwrap();
assert!(registry.last_successful_hip_report(replacement.session_id()).is_err());
assert!(registry.last_successful_hip_report(pending.session_id()).is_err());
}
#[tokio::test]
async fn desktop_channel_rejects_invalid_control_messages_and_revokes() {
let (channel, control, reader) = pipes();
+4 -4
View File
@@ -87,14 +87,14 @@ pub fn install(request: InstallRequest, approving_uid: u32) -> anyhow::Result<Ap
}
pub fn resolve(approval_id: &str, desktop_uid: u32) -> anyhow::Result<ApprovedScript> {
let budget = gpapi::process::collection::CollectionBudget::new(std::time::Duration::from_secs(60));
let budget = gpapi::collection::CollectionBudget::new(std::time::Duration::from_secs(60));
resolve_with_control(approval_id, desktop_uid, &budget)
}
pub fn resolve_with_control(
approval_id: &str,
desktop_uid: u32,
control: &dyn gpapi::process::collection::CollectionControl,
control: &dyn gpapi::collection::CollectionControl,
) -> anyhow::Result<ApprovedScript> {
control.check()?;
ensure!(desktop_uid != 0, "Root is not a desktop HIP approval owner");
@@ -199,7 +199,7 @@ fn install_at(
}
fn resolve_at(base: &Path, approval_id: &str, desktop_uid: u32, file_owner: u32) -> anyhow::Result<ApprovedScript> {
let budget = gpapi::process::collection::CollectionBudget::new(std::time::Duration::from_secs(60));
let budget = gpapi::collection::CollectionBudget::new(std::time::Duration::from_secs(60));
resolve_at_with_control(base, approval_id, desktop_uid, file_owner, &budget)
}
@@ -208,7 +208,7 @@ fn resolve_at_with_control(
approval_id: &str,
desktop_uid: u32,
file_owner: u32,
control: &dyn gpapi::process::collection::CollectionControl,
control: &dyn gpapi::collection::CollectionControl,
) -> anyhow::Result<ApprovedScript> {
control.check()?;
let info = read_metadata_at(base, approval_id, desktop_uid, file_owner)?;
+3 -3
View File
@@ -158,12 +158,12 @@ fn generate(
request.host_id.as_ref().is_none_or(|id| id.len() <= 256),
"Invalid HIP host ID"
);
let budget = gpapi::process::collection::CollectionBudget::new(PREVIEW_TIMEOUT);
let budget = gpapi::collection::CollectionBudget::new(PREVIEW_TIMEOUT);
let check = || {
if cancellation.is_cancelled() {
return Err(io::Error::new(io::ErrorKind::Interrupted, "HIP preview cancelled"));
}
gpapi::process::collection::CollectionControl::check(&budget)
gpapi::collection::CollectionControl::check(&budget)
};
check()?;
let profile = crate::hip_source::profile(
@@ -227,7 +227,7 @@ mod tests {
},
edited_report: None,
desktop_uid: None,
identity: HostIdentity::from_parts(
identity: gpapi::os_profile::desktop::identity_from_parts(
"device".into(),
"host".into(),
"serial".into(),
+8 -8
View File
@@ -125,7 +125,7 @@ pub(crate) fn generate(
profile: &OsProfile,
edited: Option<&str>,
request: &HipRequest,
control: &dyn gpapi::process::collection::CollectionControl,
control: &dyn gpapi::collection::CollectionControl,
preview: bool,
) -> anyhow::Result<String> {
control.check()?;
@@ -177,9 +177,9 @@ pub(crate) fn profile(
os_version: Option<String>,
host_id: Option<String>,
hostname: Option<String>,
control: &dyn gpapi::process::collection::CollectionControl,
control: &dyn gpapi::collection::CollectionControl,
) -> io::Result<OsProfile> {
let identity = HostIdentity::from_parts(
let identity = gpapi::os_profile::desktop::identity_from_parts(
hostname.unwrap_or_else(|| identity.computer().into()),
host_id.unwrap_or_else(|| identity.host_id().into()),
identity.serialno().into(),
@@ -192,7 +192,7 @@ pub(crate) fn profile(
if let Some(os_version) = os_version {
builder = builder.os_version(os_version);
}
builder.build_with_control(control)
gpapi::os_profile::desktop::collect_profile_with_control(builder, None, control)
}
fn generation_error(error: anyhow::Error) -> io::Error {
@@ -209,7 +209,7 @@ mod tests {
fn fixture_profile() -> OsProfile {
profile(
&HostIdentity::from_parts(
&gpapi::os_profile::desktop::identity_from_parts(
"device".into(),
"host".into(),
"serial".into(),
@@ -220,7 +220,7 @@ mod tests {
Some("negotiated-version".into()),
None,
None,
&gpapi::process::collection::CollectionBudget::new(std::time::Duration::from_secs(60)),
&gpapi::collection::CollectionBudget::new(std::time::Duration::from_secs(60)),
)
.unwrap()
}
@@ -235,7 +235,7 @@ mod tests {
#[test]
fn profile_retains_negotiated_identity_and_os_version() {
let identity = HostIdentity::from_parts(
let identity = gpapi::os_profile::desktop::identity_from_parts(
"original".into(),
"original-id".into(),
"serial".into(),
@@ -248,7 +248,7 @@ mod tests {
Some("negotiated-os".into()),
Some("negotiated-host".into()),
Some("negotiated-name".into()),
&gpapi::process::collection::CollectionBudget::new(std::time::Duration::from_secs(60)),
&gpapi::collection::CollectionBudget::new(std::time::Duration::from_secs(60)),
)
.unwrap();
assert_eq!(profile.os_version(), "negotiated-os");
+122 -11
View File
@@ -6,7 +6,6 @@ use std::{
sync::{Arc, atomic::AtomicBool},
};
use common::binary_paths;
use gpapi::{
service::{
request::{UpdateGuiRequest, UpdateLogLevelRequest, WsRequest},
@@ -299,10 +298,17 @@ impl RequestDispatcher {
}
async fn update_gui(&self, request: UpdateGuiRequest) -> ServiceResult {
if request.variant == gpapi::gui::GuiVariant::Nsh && !cfg!(target_os = "linux") {
return ServiceResult::rejected(
ServiceErrorCode::InvalidRequest,
"Native Shell is available only on Linux",
);
}
let _install = self.install_lock.lock().await;
let path = request.path;
let checksum = request.checksum;
let installed = tokio::task::spawn_blocking(move || install_gui(&path, &checksum)).await;
let target = request.variant.update_target();
let installed = tokio::task::spawn_blocking(move || install_gui_at(Path::new(&path), &checksum, &target)).await;
match installed {
Ok(Ok(())) => ServiceResult::Accepted,
Ok(Err(GuiInstallError::Checksum(err))) => {
@@ -327,11 +333,29 @@ enum GuiInstallError {
Install(anyhow::Error),
}
fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
install_gui_at(Path::new(src), checksum, &binary_paths::gpgui_update_target())
pub(crate) fn gui_installer() -> Option<std::path::PathBuf> {
std::env::current_exe()
.ok()
.and_then(|executable| {
executable
.parent()?
.parent()
.map(|prefix| prefix.join("libexec/gpclient/gp-gui-installer"))
})
.filter(|path| path.is_file())
}
fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiInstallError> {
let installer = gui_installer();
install_gui_with_installer(src, checksum, target, installer.as_deref())
}
fn install_gui_with_installer(
src: &Path,
checksum: &str,
target: &Path,
installer: Option<&Path>,
) -> Result<(), GuiInstallError> {
let Some(dir) = target.parent() else {
return Err(GuiInstallError::Install(anyhow::anyhow!(
"Failed to get parent directory of GUI binary"
@@ -343,6 +367,26 @@ fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiIn
let archive_path = staged_archive.path().to_string_lossy();
verify_checksum(&archive_path, checksum).map_err(GuiInstallError::Checksum)?;
// A package may need to prepare downloaded executables for its runtime.
// Resolve this helper beside the running service, never from the request or PATH.
if let Some(installer) = installer {
let status = std::process::Command::new(installer)
.arg(staged_archive.path())
.arg(checksum)
.arg(target)
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::null())
.status()
.map_err(|err| GuiInstallError::Install(err.into()))?;
return if status.success() {
Ok(())
} else {
Err(GuiInstallError::Install(anyhow::anyhow!(
"GUI package installation failed: {status}"
)))
};
}
let tar = XzDecoder::new(BufReader::new(
staged_archive
.reopen()
@@ -350,7 +394,8 @@ fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiIn
))
.take(MAX_GUI_ARCHIVE_CONTENT_SIZE);
let mut archive = Archive::new(tar);
let file = extract_gui_binary(&mut archive, dir)?;
let binary_name = target.file_name().and_then(|name| name.to_str()).unwrap_or("gpgui");
let file = extract_gui_binary(&mut archive, dir, binary_name)?;
file
.as_file()
.set_permissions(Permissions::from_mode(0o755))
@@ -398,14 +443,18 @@ fn stage_gui_archive(src: &Path, dir: &Path) -> Result<NamedTempFile, GuiInstall
Ok(staged)
}
fn extract_gui_binary<R: Read>(archive: &mut Archive<R>, dir: &Path) -> Result<NamedTempFile, GuiInstallError> {
fn extract_gui_binary<R: Read>(
archive: &mut Archive<R>,
dir: &Path,
binary_name: &str,
) -> Result<NamedTempFile, GuiInstallError> {
for entry in archive.entries().map_err(|err| GuiInstallError::Install(err.into()))? {
let mut entry = entry.map_err(|err| GuiInstallError::Install(err.into()))?;
let is_gui = entry
.path()
.map_err(|err| GuiInstallError::Install(err.into()))?
.file_name()
.is_some_and(|name| name == "gpgui");
.is_some_and(|name| name == binary_name);
if is_gui && entry.header().entry_type().is_file() {
let declared_size = entry.size();
if declared_size == 0 || declared_size > MAX_GUI_BINARY_SIZE {
@@ -425,7 +474,7 @@ fn extract_gui_binary<R: Read>(archive: &mut Archive<R>, dir: &Path) -> Result<N
}
}
Err(GuiInstallError::Install(anyhow::anyhow!(
"GUI update archive does not contain a non-empty regular gpgui file"
"GUI update archive does not contain a non-empty regular {binary_name} file"
)))
}
@@ -475,7 +524,7 @@ mod tests {
for (entry_type, contents) in [(EntryType::Directory, &[][..]), (EntryType::Regular, &[][..])] {
let data = archive_with_entry(entry_type, contents);
let mut archive = Archive::new(Cursor::new(data));
assert!(extract_gui_binary(&mut archive, output.path()).is_err());
assert!(extract_gui_binary(&mut archive, output.path(), "gpgui").is_err());
}
}
@@ -484,7 +533,7 @@ mod tests {
let output = tempfile::tempdir().unwrap();
let data = archive_with_entry(EntryType::Regular, b"gui binary");
let mut archive = Archive::new(Cursor::new(data));
let extracted = extract_gui_binary(&mut archive, output.path()).unwrap();
let extracted = extract_gui_binary(&mut archive, output.path(), "gpgui").unwrap();
let contents = std::fs::read(extracted.path()).unwrap();
assert_eq!(contents, b"gui binary");
}
@@ -515,7 +564,7 @@ mod tests {
data.resize(512 * 3, 0);
let mut archive = Archive::new(Cursor::new(data));
assert!(extract_gui_binary(&mut archive, output.path()).is_err());
assert!(extract_gui_binary(&mut archive, output.path(), "gpgui").is_err());
}
#[test]
@@ -531,6 +580,33 @@ mod tests {
assert_eq!(std::fs::metadata(&target).unwrap().permissions().mode() & 0o777, 0o755);
}
#[test]
fn installs_nsh_beside_tauri_without_replacing_it() {
let output = tempfile::tempdir().unwrap();
let tauri = output.path().join("gpgui");
std::fs::write(&tauri, b"tauri").unwrap();
let mut encoder = XzEncoder::new(Vec::new(), 1);
{
let mut archive = Builder::new(&mut encoder);
let mut header = Header::new_gnu();
header.set_size(3);
header.set_mode(0o755);
header.set_cksum();
archive
.append_data(&mut header, "gpgui-nsh_3.2.0/gpgui-nsh", &b"nsh"[..])
.unwrap();
archive.finish().unwrap();
}
let mut archive = NamedTempFile::new().unwrap();
archive.write_all(&encoder.finish().unwrap()).unwrap();
archive.flush().unwrap();
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
let nsh = output.path().join("gpgui-nsh");
install_gui_at(archive.path(), &checksum, &nsh).unwrap();
assert_eq!(std::fs::read(nsh).unwrap(), b"nsh");
assert_eq!(std::fs::read(tauri).unwrap(), b"tauri");
}
#[test]
fn checksum_failure_preserves_the_existing_gui() {
let archive = compressed_gui_archive(b"replacement");
@@ -543,6 +619,41 @@ mod tests {
assert_eq!(std::fs::read(target).unwrap(), b"existing");
}
#[test]
fn package_installer_receives_a_verified_staged_archive() {
let archive = compressed_gui_archive(b"gui binary");
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
let output = tempfile::tempdir().unwrap();
let target = output.path().join("gpgui-nsh");
let installer = output.path().join("installer");
std::fs::write(
&installer,
"#!/bin/sh\nset -eu\ntest -f \"$1\"\nprintf '%s' \"$2\" > \"$3\"\n",
)
.unwrap();
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
assert!(install_gui_with_installer(archive.path(), "invalid", &target, Some(&installer)).is_err());
assert!(!target.exists());
install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).unwrap();
assert_eq!(std::fs::read_to_string(target).unwrap(), checksum);
}
#[test]
fn package_installation_failure_preserves_the_existing_gui() {
let archive = compressed_gui_archive(b"replacement");
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
let output = tempfile::tempdir().unwrap();
let target = output.path().join("gpgui");
std::fs::write(&target, b"existing").unwrap();
let installer = output.path().join("installer");
std::fs::write(&installer, "#!/bin/sh\nexit 1\n").unwrap();
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
assert!(install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).is_err());
assert_eq!(std::fs::read(target).unwrap(), b"existing");
}
#[tokio::test]
async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() {
let dispatcher = RequestDispatcher::new(
+4 -1
View File
@@ -833,7 +833,10 @@ mod tests {
}
let valid = gphip::generate_report(&gphip::ReportInput {
profile: gpapi::os_profile::OsProfile::builder(gpapi::os_profile::ClientOs::Linux).build(),
profile: gpapi::os_profile::desktop::collect_profile(
gpapi::os_profile::OsProfile::builder(gpapi::os_profile::ClientOs::Linux),
None,
),
context: gphip::ReportContext::Preview,
})
.unwrap();
+6 -6
View File
@@ -420,7 +420,7 @@ enum LifecycleEvent {
MembersChanged {
attempt: u64,
members: Vec<gpapi::session::GatewaySessionSummary>,
failures: Vec<gpapi::session::GatewayFailureSummary>,
failures: Vec<gpapi::session::desktop::GatewayFailureSummary>,
},
Ended {
attempt: u64,
@@ -679,7 +679,7 @@ impl VpnTask {
&self,
attempt: u64,
members: Vec<gpapi::session::GatewaySessionSummary>,
failures: Vec<gpapi::session::GatewayFailureSummary>,
failures: Vec<gpapi::session::desktop::GatewayFailureSummary>,
) {
let Some(active) = &self.active else {
return;
@@ -855,12 +855,12 @@ pub(crate) fn test_connect_request(info: ConnectInfo) -> ConnectRequest {
} else {
"fixture"
};
let binding = gpapi::session::network::GatewayBinding::new(
let binding = gpapi::session::desktop::network::GatewayBinding::new(
endpoint,
std::net::SocketAddr::new(source, 0),
interface.into(),
1,
gpapi::session::ClientAddresses {
gpapi::session::desktop::ClientAddresses {
ipv4: match source {
std::net::IpAddr::V4(ip) => Some(ip),
_ => None,
@@ -873,8 +873,8 @@ pub(crate) fn test_connect_request(info: ConnectInfo) -> ConnectRequest {
"0".repeat(64),
)
.unwrap();
let plan = gpapi::session::ConnectionPlan::new(
vec![gpapi::session::AuthenticatedGateway {
let plan = gpapi::session::desktop::ConnectionPlan::new(
vec![gpapi::session::desktop::AuthenticatedGateway {
gateway: info.gateway().clone(),
binding: Some(binding),
authentication: gpapi::session::GatewayAuthentication::new("authcookie=token&user=user".into(), "tunnel".into())
+2 -2
View File
@@ -1,10 +1,10 @@
use std::{sync::Arc, time::Duration};
use anyhow::Context;
use gpapi::process::collection::CollectionControl;
use gpapi::collection::CollectionControl;
use gpapi::session::{
GatewaySessionSummary, MaintenanceState, SessionEndReason,
non_tunnel::{SessionCallbacks, SessionExit, maintain_non_tunnel_sessions},
desktop::non_tunnel::{SessionCallbacks, SessionExit, maintain_non_tunnel_sessions},
};
use log::warn;
use tokio::sync::{mpsc, watch};
@@ -11,7 +11,10 @@ use gpapi::{
transport::ServiceResult,
vpn_state::{ConnectInfo, VpnState},
},
session::{ClientAddresses, GatewayAuthentication, GatewaySession, GatewaySessions, transport::GatewayTransport},
session::{
GatewayAuthentication, desktop::ClientAddresses, desktop::GatewaySession, desktop::GatewaySessions,
transport::GatewayTransport,
},
};
use openssl::{
asn1::Asn1Time,
@@ -70,7 +73,7 @@ async fn cancelled_pending_owner_logs_out_and_releases_admission_after_response(
let mut member = fixture.plan().members()[0].clone();
member.authentication =
GatewayAuthentication::new("authcookie=fixture&user=fixture".into(), "internal".into()).unwrap();
let plan = gpapi::session::ConnectionPlan::new(vec![member], vec![], fixture.plan().policy()).unwrap();
let plan = gpapi::session::desktop::ConnectionPlan::new(vec![member], vec![], fixture.plan().policy()).unwrap();
let request = gpapi::service::request::ConnectRequest::new(fixture.info().clone(), plan);
let mut prepared = PreparedConnection::lifecycle_fixture(request);
let mut params = GpParams::builder(prepared.resources.profile.clone());
+26 -18
View File
@@ -2,11 +2,13 @@ use std::{sync::Arc, time::Duration};
use anyhow::Context;
use gpapi::{
collection::{CollectionBudget, CollectionControl},
gp_params::GpParams,
os_profile::OsProfile,
process::collection::{CollectionBudget, CollectionControl},
service::request::ConnectRequest,
session::{GatewaySession, GatewaySessions, network::PhysicalNetwork, transport::GatewayTransport},
session::{
desktop::GatewaySession, desktop::GatewaySessions, desktop::network::PhysicalNetwork, transport::GatewayTransport,
},
};
use tokio_util::sync::CancellationToken;
@@ -149,14 +151,17 @@ impl PreparedConnection {
/// Lifecycle-only fixtures own no issued server sessions. Protocol ownership
/// checks use actual gateway transports rather than this actor-state fixture.
pub(crate) fn lifecycle_fixture(request: ConnectRequest) -> Self {
let profile = OsProfile::builder(gpapi::os_profile::ClientOs::Linux)
.host_identity(gpapi::os_profile::HostIdentity::from_parts(
"fixture".into(),
"fixture-host".into(),
"fixture-serial".into(),
"02:00:00:00:00:01".into(),
))
.build();
let profile = gpapi::os_profile::desktop::collect_profile(
OsProfile::builder(gpapi::os_profile::ClientOs::Linux).host_identity(
gpapi::os_profile::desktop::identity_from_parts(
"fixture".into(),
"fixture-host".into(),
"fixture-serial".into(),
"02:00:00:00:00:01".into(),
),
),
None,
);
Self {
request,
resources: Arc::new(ConnectionResources {
@@ -217,14 +222,17 @@ mod tests {
#[tokio::test]
async fn ordinary_tunnel_preparation_needs_no_physical_binding_or_resolver() {
let gateway = Gateway::new("fixture".into(), "does-not-resolve.invalid".into());
let profile = OsProfile::builder(gpapi::os_profile::ClientOs::Linux)
.host_identity(gpapi::os_profile::HostIdentity::from_parts(
"fixture".into(),
"fixture-host".into(),
"fixture-serial".into(),
"02:00:00:00:00:01".into(),
))
.build();
let profile = gpapi::os_profile::desktop::collect_profile(
OsProfile::builder(gpapi::os_profile::ClientOs::Linux).host_identity(
gpapi::os_profile::desktop::identity_from_parts(
"fixture".into(),
"fixture-host".into(),
"fixture-serial".into(),
"02:00:00:00:00:01".into(),
),
),
None,
);
let request = super::super::test_connect_request(ConnectInfo::new("portal.example.com".into(), gateway, vec![]))
.with_os_profile(&profile)
.with_disable_ipv6(true);
+4 -4
View File
@@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration};
use anyhow::{Context, ensure};
use gpapi::{
process::collection::{CollectionBudget, CollectionControl},
collection::{CollectionBudget, CollectionControl},
service::request::ConnectRequest,
session::SessionMode,
};
@@ -77,8 +77,8 @@ pub(super) fn spawn(
.all(|member| member.authentication.mode() == SessionMode::NonTunnel)
{
match super::non_tunnel::run(&mut input, source, guard, cancellation.clone(), events.clone()).await {
Ok(gpapi::session::non_tunnel::SessionExit::Disconnected) => {}
Ok(gpapi::session::non_tunnel::SessionExit::Failed(reason)) => {
Ok(gpapi::session::desktop::non_tunnel::SessionExit::Disconnected) => {}
Ok(gpapi::session::desktop::non_tunnel::SessionExit::Failed(reason)) => {
let message = match reason {
gpapi::session::SessionEndReason::InvalidCookie => {
"Internal gateway authentication expired; connect again"
@@ -312,7 +312,7 @@ async fn run_tunnel(
prepared: &PreparedTunnel,
approval: &crate::hip_source::HipApproval,
lifecycle: &LifecycleHandle,
sessions: &mut gpapi::session::GatewaySessions,
sessions: &mut gpapi::session::desktop::GatewaySessions,
cancellation: CancellationToken,
events: mpsc::Sender<LifecycleEvent>,
) {
+3 -3
View File
@@ -60,7 +60,7 @@ pub(super) async fn run(
events: mpsc::Sender<LifecycleEvent>,
session_id: uuid::Uuid,
registry: Arc<crate::session_registry::SessionRegistry>,
sessions: &mut gpapi::session::GatewaySessions,
sessions: &mut gpapi::session::desktop::GatewaySessions,
) -> anyhow::Result<()> {
let attempt = identity.attempt;
let (native_tx, native) = mpsc::channel(64);
@@ -219,12 +219,12 @@ async fn supervise(
fn observed_network(
config: openconnect::tunnel::Configuration,
) -> anyhow::Result<gpapi::session::tunnel::NegotiatedNetwork> {
) -> anyhow::Result<gpapi::session::desktop::tunnel::NegotiatedNetwork> {
ensure!(
!config.truncated && !config.dns.truncated && !config.search_domains.truncated,
"VPN configuration is truncated"
);
Ok(gpapi::session::tunnel::NegotiatedNetwork {
Ok(gpapi::session::desktop::tunnel::NegotiatedNetwork {
addresses: [config.ipv4, config.ipv6.or(config.netmask6)]
.into_iter()
.flatten()
+7 -4
View File
@@ -41,7 +41,7 @@ pub(crate) struct ConnectionControl {
connection_id: Uuid,
tx: mpsc::Sender<ConnectionCommand>,
close_tx: watch::Sender<Option<CloseReason>>,
statistics: watch::Sender<Option<gpapi::session::tunnel::TunnelStatisticsSnapshot>>,
statistics: watch::Sender<Option<gpapi::session::desktop::tunnel::TunnelStatisticsSnapshot>>,
statistics_enabled: Arc<AtomicBool>,
committed: Arc<AtomicBool>,
}
@@ -102,13 +102,15 @@ impl ConnectionControl {
self.statistics.send_replace(None);
}
pub fn publish_statistics(&self, snapshot: gpapi::session::tunnel::TunnelStatisticsSnapshot) {
pub fn publish_statistics(&self, snapshot: gpapi::session::desktop::tunnel::TunnelStatisticsSnapshot) {
if self.statistics_enabled() && !self.is_closed() {
self.statistics.send_replace(Some(snapshot));
}
}
pub fn subscribe_statistics(&self) -> watch::Receiver<Option<gpapi::session::tunnel::TunnelStatisticsSnapshot>> {
pub fn subscribe_statistics(
&self,
) -> watch::Receiver<Option<gpapi::session::desktop::tunnel::TunnelStatisticsSnapshot>> {
self.statistics.subscribe()
}
@@ -750,7 +752,7 @@ mod tests {
.unwrap();
assert!(matches!(reply, ServerMessage::Reply {
id,
result: ServiceResult::TunnelStatisticsSnapshot(gpapi::session::tunnel::TunnelStatisticsSnapshot::Unavailable { reason: gpapi::session::tunnel::TunnelUnavailableReason::NoTunnel }),
result: ServiceResult::TunnelStatisticsSnapshot(gpapi::session::desktop::tunnel::TunnelStatisticsSnapshot::Unavailable { reason: gpapi::session::desktop::tunnel::TunnelUnavailableReason::NoTunnel }),
} if id == statistics_id));
let update_id = Uuid::new_v4();
@@ -761,6 +763,7 @@ mod tests {
request: WsRequest::UpdateGui(UpdateGuiRequest {
path: update_file.path().to_string_lossy().into_owned(),
checksum: "invalid".to_owned(),
variant: gpapi::gui::GuiVariant::Tauri,
}),
};
socket
+4 -4
View File
@@ -9,7 +9,7 @@ use gpapi::{
vpn_env::{HostInfo, VpnEnv},
vpn_state::VpnState,
},
session::tunnel::{TunnelStatisticsSnapshot, TunnelUnavailableReason},
session::desktop::tunnel::{TunnelStatisticsSnapshot, TunnelUnavailableReason},
utils::lock_file::LockFile,
};
use log::{info, warn};
@@ -397,7 +397,7 @@ fn build_snapshot(vpn_state: VpnState) -> VpnEnv {
vpnc_script: find_vpnc_script(),
auth_executable: binary_paths::gpauth().to_string_lossy().into_owned(),
host_info: HostInfo {
host_identity: HostIdentity::collect(),
host_identity: gpapi::os_profile::desktop::collect_identity(),
},
}
}
@@ -488,7 +488,7 @@ mod tests {
#[tokio::test]
async fn statistics_demand_is_per_attachment_and_does_not_consume_revisions() {
use gpapi::service::transport::ServiceResult;
use gpapi::session::tunnel::TunnelStatisticsState;
use gpapi::session::desktop::tunnel::TunnelStatisticsState;
let (context, registry) = context();
let (a, a_session, a_generation, _a_rx) = attach(&context, &registry).await;
let (b, b_session, b_generation, _b_rx) = attach(&context, &registry).await;
@@ -564,7 +564,7 @@ mod tests {
#[test]
fn snapshot_budget_trims_observation_without_changing_existing_metadata() {
use gpapi::session::tunnel::{TunnelConfiguration, TunnelPhase, TunnelState, TunnelTransport};
use gpapi::session::desktop::tunnel::{TunnelConfiguration, TunnelPhase, TunnelState, TunnelTransport};
let mut snapshot = build_snapshot(VpnState::Disconnected);
let mut configuration = TunnelConfiguration::default();
configuration.included_routes.items = vec!["r".repeat(1000); 15];
+8 -8
View File
@@ -98,7 +98,7 @@ impl Drop for AuthCallbackReceiver {
}
pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
validate_callback(callback)?;
validate_auth_callback(callback)?;
forward_auth_callback_to(callback, &callback_socket_path()).await
}
@@ -121,7 +121,7 @@ pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
}
async fn forward_auth_callback_to(callback: &str, socket_path: &Path) -> anyhow::Result<()> {
validate_callback(callback)?;
validate_auth_callback(callback)?;
let (version, status) = timeout(IO_TIMEOUT, async {
let mut stream = UnixStream::connect(socket_path)
@@ -232,7 +232,7 @@ fn remove_stale_socket(socket_path: &Path) -> anyhow::Result<()> {
Ok(())
}
fn validate_callback(callback: &str) -> anyhow::Result<()> {
pub fn validate_auth_callback(callback: &str) -> anyhow::Result<()> {
if callback.len() > MAX_CALLBACK_SIZE {
bail!("Authentication callback exceeds the maximum supported size");
}
@@ -276,7 +276,7 @@ async fn read_callback(stream: &mut UnixStream) -> Result<String, CallbackReadEr
.await
.map_err(|_| CallbackReadError::Io)?;
let callback = String::from_utf8(payload).map_err(|_| CallbackReadError::Invalid)?;
validate_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
validate_auth_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
Ok(callback)
}
@@ -296,10 +296,10 @@ mod tests {
#[test]
fn validates_supported_callback_scheme() {
assert!(validate_callback(VALID_CALLBACK).is_ok());
assert!(validate_callback("https://example.com").is_err());
assert!(validate_callback("globalprotectcallback:").is_err());
assert!(validate_callback(&format!("globalprotectcallback:{}", "x".repeat(MAX_CALLBACK_SIZE))).is_err());
assert!(validate_auth_callback(VALID_CALLBACK).is_ok());
assert!(validate_auth_callback("https://example.com").is_err());
assert!(validate_auth_callback("globalprotectcallback:").is_err());
assert!(validate_auth_callback(&format!("globalprotectcallback:{}", "x".repeat(MAX_CALLBACK_SIZE))).is_err());
}
#[tokio::test]
+13
View File
@@ -21,6 +21,19 @@ mod recovery_row;
#[path = "gtk_tls.rs"]
mod tls;
pub(super) fn open_okta_verify(url: &tauri::Url) -> bool {
if url.scheme() != "com-okta-authenticator" {
return true;
}
// FastPass loads this URI in a hidden iframe. Hand it to the desktop instead of WebKitGTK.
info!("Opening Okta Verify");
if let Err(error) = gtk::gio::AppInfo::launch_default_for_uri(url.as_str(), None::<&gtk::gio::AppLaunchContext>) {
warn!("Failed to open Okta Verify: {error}");
}
false
}
fn action_button(label: &str) -> anyhow::Result<gtk::Button> {
let button = gtk::Button::with_label(label);
let spacing = gtk::CssProvider::new();
+2
View File
@@ -129,6 +129,8 @@ impl<'a> WebviewAuthenticator<'a> {
.title(self.window_title)
.theme(native_theme(self.window_theme))
.devtools(cfg!(any(debug_assertions, feature = "release-devtools")));
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
let auth_window_builder = auth_window_builder.on_navigation(super::platform_impl::open_okta_verify);
let auth_window = auth_window_builder
.inner_size(900.0, 650.0 + get_title_bar_height() + TOOLBAR_HEIGHT)
.min_inner_size(400.0, 300.0)
+26 -17
View File
@@ -6,14 +6,18 @@ edition.workspace = true
license = "MIT"
[dependencies]
nix = { version = "0.31", features = ["fs", "signal", "process"] }
nix = { version = "0.31", features = ["fs", "signal", "process"], optional = true }
common = { path = "../common" }
directories = { workspace = true, optional = true }
anyhow.workspace = true
base64.workspace = true
dns-lookup.workspace = true
dns-lookup = { workspace = true, optional = true }
log.workspace = true
reqwest.workspace = true
native-tls = "0.2"
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
rustls-pemfile = "2"
p12-keystore = "0.4.1"
sec1 = { version = "0.8.1", default-features = false, features = ["der"] }
pem.workspace = true
pkcs8 = { version = "0.11", features = ["pem", "encryption", "sha1-insecure", "3des", "des-insecure"] }
x509-cert = { version = "0.3", default-features = false }
@@ -21,25 +25,25 @@ xmltree.workspace = true
serde.workspace = true
specta = { workspace = true, features = ["derive", "uuid"] }
urlencoding.workspace = true
tokio = { workspace = true, features = ["fs", "process", "signal", "macros"] }
tokio = { workspace = true, features = ["fs", "macros", "rt", "time"] }
tokio-util.workspace = true
serde_json.workspace = true
whoami.workspace = true
whoami = { workspace = true, optional = true }
tempfile.workspace = true
thiserror.workspace = true
chacha20poly1305 = { version = "0.11", features = ["zeroize"] }
url.workspace = true
regex.workspace = true
uzers.workspace = true
uzers = { workspace = true, optional = true }
serde_urlencoded.workspace = true
md5.workspace = true
sha2.workspace = true
uuid = { workspace = true, features = ["v4", "v5", "serde"] }
chrono.workspace = true
humantime.workspace = true
netdev.workspace = true
socket2 = { version = "0.6", features = ["all"] }
os_info = { version = "3", default-features = false }
netdev = { workspace = true, optional = true }
socket2 = { version = "0.6", features = ["all"], optional = true }
os_info = { version = "3", default-features = false, optional = true }
snow.workspace = true
zeroize = { workspace = true, features = ["serde"] }
getrandom = "0.4"
@@ -52,25 +56,30 @@ clap-verbosity-flag = { workspace = true, optional = true }
env_logger = { workspace = true, optional = true }
log-reload = { version = "0.1", optional = true }
[target.'cfg(target_os="macos")'.dependencies]
security-framework = "3"
[target.'cfg(any(target_os="macos", target_os="ios"))'.dependencies]
oslog = { version = "0.2", default-features = false, optional = true }
# Dependencies for Linux and other OSes only
[target.'cfg(not(any(target_os="macos", target_os="windows")))'.dependencies]
gtk = { version = "0.18", optional = true }
[target.'cfg(not(target_os = "macos"))'.dependencies]
openssl.workspace = true
version-compare = "0.2"
[target.'cfg(target_os="linux")'.dependencies]
libloading = { version = "0.9", optional = true }
[build-dependencies]
cc = "1"
pkg-config = "0.3"
[dev-dependencies]
openssl.workspace = true
libloading = "0.9"
proptest.workspace = true
tokio = { workspace = true, features = ["test-util"] }
[features]
tauri = ["dep:tauri", "dep:gtk"]
clap = ["dep:clap", "dep:clap-verbosity-flag"]
default = ["desktop"]
desktop = ["tokio/process", "tokio/signal", "dep:directories", "dep:nix", "dep:uzers", "dep:netdev", "dep:os_info", "dep:whoami", "dep:dns-lookup", "dep:socket2", "dep:libloading"]
tauri = ["desktop", "dep:tauri", "dep:gtk"]
clap = ["desktop", "dep:clap", "dep:clap-verbosity-flag"]
webview-auth = []
logger = ["dep:env_logger", "dep:log-reload", "dep:oslog"]
logger = ["desktop", "dep:env_logger", "dep:log-reload", "dep:oslog"]
+23
View File
@@ -0,0 +1,23 @@
fn main() {
println!("cargo:rerun-if-changed=src/utils/certificate/gnutls.c");
let target = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
if !matches!(target.as_str(), "macos" | "linux" | "freebsd" | "openbsd") {
return;
}
let mut package = pkg_config::Config::new();
package.atleast_version("3.6").cargo_metadata(false);
let library = package
.probe("gnutls")
.expect("GnuTLS development files are required for desktop certificate import");
let mut build = cc::Build::new();
build.file("src/utils/certificate/gnutls.c");
for include in library.include_paths {
build.include(include);
}
build.compile("gp_certificate_import");
// GNU linkers must see the shim before its GnuTLS dependency (--as-needed).
package
.cargo_metadata(true)
.probe("gnutls")
.expect("GnuTLS was probed above");
}
+38 -14
View File
@@ -12,6 +12,16 @@ use crate::{error::AuthDataParseError, utils::base64::decode_to_string};
pub type AuthDataParseResult = anyhow::Result<SamlAuthData, AuthDataParseError>;
/// Validates an explicit GlobalProtect SAML completion status.
/// A missing status means the page has not supplied an authentication result.
pub fn validate_saml_auth_status(status: Option<&str>) -> Result<(), AuthDataParseError> {
match status {
Some("1") => Ok(()),
Some(status) => Err(AuthDataParseError::AuthenticationFailed(status.to_owned())),
None => Err(AuthDataParseError::NotFound),
}
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
pub enum AuthWindowTheme {
@@ -121,21 +131,15 @@ impl SamlAuthData {
}
pub fn from_html(html: &str) -> AuthDataParseResult {
match parse_xml_tag(html, "saml-auth-status") {
Some(status) if status == "1" => {
let username = parse_xml_tag(html, "saml-username");
let prelogin_cookie = parse_xml_tag(html, "prelogin-cookie");
let portal_userauthcookie = parse_xml_tag(html, "portal-userauthcookie");
validate_saml_auth_status(parse_xml_tag(html, "saml-auth-status").as_deref())?;
let username = parse_xml_tag(html, "saml-username");
let prelogin_cookie = parse_xml_tag(html, "prelogin-cookie");
let portal_userauthcookie = parse_xml_tag(html, "portal-userauthcookie");
let auth_data =
SamlAuthData::new(username, prelogin_cookie, portal_userauthcookie).map_err(AuthDataParseError::Invalid)?;
auth_data.log_summary("html");
Ok(auth_data)
}
Some(status) => Err(AuthDataParseError::AuthenticationFailed(status)),
None => Err(AuthDataParseError::NotFound),
}
let auth_data =
SamlAuthData::new(username, prelogin_cookie, portal_userauthcookie).map_err(AuthDataParseError::Invalid)?;
auth_data.log_summary("html");
Ok(auth_data)
}
pub fn from_gpcallback(data: &str) -> anyhow::Result<SamlAuthData, AuthDataParseError> {
@@ -217,6 +221,26 @@ fn parse_xml_tag(html: &str, tag: &str) -> Option<String> {
mod tests {
use super::*;
#[test]
fn saml_status_distinguishes_rejection_from_an_unfinished_page() {
assert!(validate_saml_auth_status(Some("1")).is_ok());
assert!(matches!(
validate_saml_auth_status(None),
Err(AuthDataParseError::NotFound)
));
for status in ["0", "2", "", "unknown"] {
assert!(matches!(
validate_saml_auth_status(Some(status)),
Err(AuthDataParseError::AuthenticationFailed(_))
));
let html = format!("<saml-auth-status>{status}</saml-auth-status>");
assert!(matches!(
SamlAuthData::from_html(&html),
Err(AuthDataParseError::AuthenticationFailed(_))
));
}
}
#[test]
fn auth_data_from_gpcallback_cas() {
let auth_data = "globalprotectcallback:cas-as=1&[email protected]&token=very_long_string";
+2 -1
View File
@@ -2,7 +2,7 @@ use clap::{ValueEnum, builder::PossibleValue};
use crate::{
gp_params::CscMode,
os_profile::{ClientOs, runtime_client_os},
os_profile::{ClientOs, desktop::runtime_client_os},
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
@@ -31,6 +31,7 @@ impl Default for Os {
ClientOs::Linux => Os::Linux,
ClientOs::Windows => Os::Windows,
ClientOs::Mac => Os::Mac,
ClientOs::Ios => unreachable!("The desktop CLI is not available on iOS"),
}
}
}
+3 -39
View File
@@ -11,8 +11,6 @@ use crate::{
pub mod args;
pub trait Args {
#[cfg(not(target_os = "macos"))]
fn fix_openssl(&self) -> bool;
fn ignore_tls_errors(&self) -> bool;
/// How this program renders its logs.
@@ -43,14 +41,6 @@ fn retry_hints(err: &anyhow::Error, args: &impl Args) -> Vec<String> {
// users already see; keep it exactly.
let mut hints = Vec::new();
#[cfg(not(target_os = "macos"))]
if kind == ServerTlsErrorKind::LegacyRenegotiation && !args.fix_openssl() {
let (program, rest) = command_line();
hints.push(format!(
"Re-run it with the `--fix-openssl` option to work around this issue, e.g.:\n\n{program} --fix-openssl {rest}"
));
}
if kind == ServerTlsErrorKind::Certificate && !args.ignore_tls_errors() {
let (program, rest) = command_line();
hints.push(format!(
@@ -204,18 +194,11 @@ mod tests {
#[derive(Default)]
struct TestArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: bool,
ignore_tls_errors: bool,
log_format: LogFormat,
}
impl Args for TestArgs {
#[cfg(not(target_os = "macos"))]
fn fix_openssl(&self) -> bool {
self.fix_openssl
}
fn ignore_tls_errors(&self) -> bool {
self.ignore_tls_errors
}
@@ -260,31 +243,12 @@ mod tests {
}
#[test]
fn hints_distinguish_legacy_and_unknown_tls_and_respect_both_flags() {
let legacy = ServerTlsError {
server: "https://vpn.example.com".into(),
kind: ServerTlsErrorKind::LegacyRenegotiation,
};
let hints = retry_hints(&anyhow!(legacy.clone()), &TestArgs::default());
if cfg!(target_os = "macos") {
assert!(hints.is_empty());
} else {
assert_eq!(hints.len(), 1);
assert!(hints[0].contains("--fix-openssl"));
}
let args = TestArgs {
#[cfg(not(target_os = "macos"))]
fix_openssl: true,
ignore_tls_errors: true,
..Default::default()
};
assert!(retry_hints(&anyhow!(legacy), &args).is_empty());
assert!(retry_hints(&anyhow!(certificate_error()), &args).is_empty());
let other = ServerTlsError {
fn unknown_tls_failure_does_not_suggest_bypassing_certificate_validation() {
let error = ServerTlsError {
server: "https://vpn.example.com".into(),
kind: ServerTlsErrorKind::Other,
};
assert!(retry_hints(&anyhow!(other), &TestArgs::default()).is_empty());
assert!(retry_hints(&anyhow!(error), &TestArgs::default()).is_empty());
}
/// Suggesting an option the user already passed is noise, and in JSON mode it
+41
View File
@@ -0,0 +1,41 @@
use std::{
io,
time::{Duration, Instant},
};
/// Invocation control borrowed by collection; interruption must never be treated
/// as an unavailable optional product.
pub trait CollectionControl {
fn check(&self) -> io::Result<()>;
}
impl<F: Fn() -> io::Result<()>> CollectionControl for F {
fn check(&self) -> io::Result<()> {
self()
}
}
pub struct CollectionBudget {
deadline: Instant,
}
impl CollectionBudget {
pub fn new(timeout: Duration) -> Self {
Self {
deadline: Instant::now() + timeout,
}
}
}
impl CollectionControl for CollectionBudget {
fn check(&self) -> io::Result<()> {
if Instant::now() >= self.deadline {
Err(io::Error::new(
io::ErrorKind::TimedOut,
"Device information collection timed out",
))
} else {
Ok(())
}
}
}
+5
View File
@@ -3,6 +3,11 @@ use thiserror::Error;
mod server_tls;
pub use server_tls::{ServerTlsError, ServerTlsErrorKind};
/// An explicit server rejection, distinct from transport, TLS, and parsing failures.
#[derive(Error, Debug)]
#[error("Authentication was rejected")]
pub struct AuthenticationRejected;
#[derive(Error, Debug)]
pub enum PortalError {
#[error("Prelogin error: {0}")]
+112 -176
View File
@@ -4,13 +4,6 @@ use serde::{Deserialize, Serialize};
use super::PortalError;
#[cfg(target_os = "macos")]
#[path = "server_tls/macos.rs"]
mod backend;
#[cfg(not(target_os = "macos"))]
#[path = "server_tls/openssl.rs"]
mod backend;
/// A VPN HTTP TLS failure. The server identifies the configured VPN origin,
/// not necessarily the peer that failed after an HTTP redirect.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
@@ -25,7 +18,6 @@ pub struct ServerTlsError {
pub enum ServerTlsErrorKind {
Certificate,
ClientCertificateRequired,
LegacyRenegotiation,
Other,
}
@@ -43,7 +35,6 @@ impl fmt::Display for ServerTlsError {
let message = match self.kind {
ServerTlsErrorKind::Certificate => "The server's certificate could not be verified",
ServerTlsErrorKind::ClientCertificateRequired => "The server requires a client certificate",
ServerTlsErrorKind::LegacyRenegotiation => "The server requires unsafe legacy TLS renegotiation",
ServerTlsErrorKind::Other => "A secure connection to the server could not be established",
};
write!(f, "{message}: {}", self.server)
@@ -70,122 +61,25 @@ impl ServerTlsErrorKind {
pub(super) fn classify(error: &(dyn Error + 'static)) -> Option<ServerTlsErrorKind> {
let mut source = Some(error);
let mut fallback = None;
while let Some(error) = source {
if let Some(tls) = error.downcast_ref::<ServerTlsError>() {
return Some(tls.kind);
}
if let Some(kind) = backend::classify(error) {
return Some(kind);
}
if let Some(tls) = error.downcast_ref::<native_tls::Error>() {
let kind = classify_native(tls);
if kind != ServerTlsErrorKind::Other {
return Some(kind);
}
fallback = Some(kind);
if let Some(tls) = error.downcast_ref::<rustls::Error>() {
return Some(match tls {
rustls::Error::InvalidCertificate(_) => ServerTlsErrorKind::Certificate,
rustls::Error::AlertReceived(rustls::AlertDescription::CertificateRequired) => {
ServerTlsErrorKind::ClientCertificateRequired
}
_ => ServerTlsErrorKind::Other,
});
}
source = error
.downcast_ref::<std::io::Error>()
.and_then(|error| error.get_ref().map(|inner| inner as &(dyn Error + 'static)))
.or_else(|| error.source());
}
fallback
}
fn classify_native(error: &native_tls::Error) -> ServerTlsErrorKind {
// native-tls hides some backend reason codes and verification results. Keep
// backend text matching here, scoped to a confirmed native TLS error.
let detail = format!("{error:?}").to_ascii_lowercase();
classify_native_detail(&detail)
}
fn classify_native_detail(detail: &str) -> ServerTlsErrorKind {
// native-tls forwards Security.framework's Debug representation, but hides
// its OSStatus from the public error chain. Prefer that status to localized
// text, including for peer alerts that can mention a rejected client cert.
if let Some(code) = detail
.strip_prefix("error { code: ")
.and_then(|detail| detail.split_once(','))
.and_then(|(code, _)| code.parse::<i32>().ok())
{
return classify_macos_status(code);
}
if detail.contains("unsafe legacy renegotiation") {
return ServerTlsErrorKind::LegacyRenegotiation;
}
if detail.contains("alert certificate required") {
return ServerTlsErrorKind::ClientCertificateRequired;
}
let certificate = [
"certificate verify failed",
"certificate verification failed",
"certificate was not trusted",
"certificate is not trusted",
"self signed certificate",
"hostname mismatch",
"certificate has expired",
"certificate is not yet valid",
"certificate has been revoked",
]
.iter()
.any(|reason| detail.contains(reason));
if certificate {
ServerTlsErrorKind::Certificate
} else {
ServerTlsErrorKind::Other
}
}
fn classify_macos_status(code: i32) -> ServerTlsErrorKind {
if code == -9863 {
return ServerTlsErrorKind::ClientCertificateRequired;
}
// Local server-certificate validation failures from Security/SecBase.h.
// Peer alerts (errSSLPeer*) reject our client certificate; protocol/cipher,
// keychain, and internal errors also cannot be fixed by skipping server trust.
let certificate = matches!(
code,
-9807 // errSSLXCertChainInvalid
| -9812 // errSSLUnknownRootCert
| -9813 // errSSLNoRootCert
| -9814 // errSSLCertExpired
| -9815 // errSSLCertNotYetValid
| -9843 // errSSLHostNameMismatch
| -9884 // errSSLATSLeafCertificateHashAlgorithmViolation
| -9885 // errSSLATSCertificateHashAlgorithmViolation
| -9886 // errSSLATSCertificateTrustViolation
| -67602 // errSecHostNameMismatch
| -67603 // errSecUnknownCriticalExtensionFlag
| -67604 // errSecNoBasicConstraints
| -67605 // errSecNoBasicConstraintsCA
| -67606 // errSecInvalidAuthorityKeyID
| -67607 // errSecInvalidSubjectKeyID
| -67608 // errSecInvalidKeyUsageForPolicy
| -67609 // errSecInvalidExtendedKeyUsage
| -67610 // errSecInvalidIDLinkage
| -67611 // errSecPathLengthConstraintExceeded
| -67612 // errSecInvalidRoot
| -67629 // errSecSSLBadExtendedKeyUsage
| -67654 // errSecTrustSettingDeny
| -67818 // errSecCertificateExpired
| -67819 // errSecCertificateNotValidYet
| -67820 // errSecCertificateRevoked
| -67821 // errSecCertificateSuspended
| -67826 // errSecInvalidCertAuthority
| -67843 // errSecNotTrusted
| -67899 // errSecCertificatePolicyNotAllowed
| -67900 // errSecCertificateNameNotAllowed
| -67901 // errSecCertificateValidityPeriodTooLong
| -67902 // errSecCertificateIsCA
| -67903 // errSecCertificateDuplicateExtension
| -67904 // errSecMissingQualifiedCertStatement
);
if certificate {
ServerTlsErrorKind::Certificate
} else {
ServerTlsErrorKind::Other
}
None
}
#[cfg(test)]
@@ -207,39 +101,26 @@ mod tests {
};
#[test]
fn explicit_client_certificate_requirement_has_a_distinct_kind() {
let kind = classify_native_detail("error { code: -9863, message: \"localized message\" }");
assert_eq!(serde_json::to_value(kind).unwrap(), "clientCertificateRequired");
assert_eq!(
classify_native_detail("error { code: -9842, message: \"client cert requested\" }"),
ServerTlsErrorKind::Other
);
}
#[test]
fn macos_certificate_statuses_do_not_depend_on_the_error_message() {
for code in [-67818, -67819, -67820, -67843, -67602, -67629, -67899, -67901] {
let detail = format!("error {{ code: {code}, message: \"localized message\" }}");
fn typed_tls_causes_distinguish_local_trust_from_peer_alerts() {
for reason in [
rustls::CertificateError::Expired,
rustls::CertificateError::UnknownIssuer,
] {
let error = std::io::Error::other(std::io::Error::other(rustls::Error::InvalidCertificate(reason)));
assert_eq!(classify(&error), Some(ServerTlsErrorKind::Certificate));
}
for alert in [
rustls::AlertDescription::UnknownCA,
rustls::AlertDescription::BadCertificate,
] {
assert_eq!(
classify_native_detail(&detail),
ServerTlsErrorKind::Certificate,
"{code}"
classify(&rustls::Error::AlertReceived(alert)),
Some(ServerTlsErrorKind::Other)
);
}
}
#[test]
fn macos_peer_alerts_and_handshake_errors_are_not_certificate_validation_failures() {
for (code, message) in [
(-9800, "SSL protocol error"),
(-9801, "Cipher Suite negotiation failure"),
(-9828, "peer certificate has expired"),
(-9831, "unknown certificate authority"),
(-9850, "weak ephemeral DH key"),
] {
let detail = format!("error {{ code: {code}, message: \"{message}\" }}").to_ascii_lowercase();
assert_eq!(classify_native_detail(&detail), ServerTlsErrorKind::Other, "{code}");
}
let required = rustls::Error::AlertReceived(rustls::AlertDescription::CertificateRequired);
assert_eq!(classify(&required), Some(ServerTlsErrorKind::ClientCertificateRequired));
assert_eq!(classify(&std::io::Error::other("certificate verify failed")), None);
}
fn server(tls: bool) -> (String, thread::JoinHandle<()>) {
@@ -303,7 +184,7 @@ mod tests {
portal::{PreloginOptions, prelogin},
};
let (address, worker) = server(true);
let profile = OsProfile::builder(ClientOs::Linux).build();
let profile = OsProfile::builder(ClientOs::Linux).build(crate::os_profile::test_snapshot());
let params = GpParams::builder(profile).build();
let error = prelogin(&address, &params, PreloginOptions::default())
.await
@@ -324,7 +205,7 @@ mod tests {
portal::{PreloginOptions, prelogin},
};
let (address, worker) = server(true);
let params = GpParams::builder(OsProfile::builder(ClientOs::Linux).build())
let params = GpParams::builder(OsProfile::builder(ClientOs::Linux).build(crate::os_profile::test_snapshot()))
.ignore_tls_errors(true)
.build();
let result = prelogin(&address, &params, PreloginOptions::default()).await;
@@ -335,7 +216,7 @@ mod tests {
#[tokio::test]
async fn incompatible_tls_is_not_a_certificate_error_even_with_bypass() {
let (address, worker) = server(false);
let error = reqwest::Client::builder()
let error = crate::utils::request::client_builder()
.no_proxy()
.danger_accept_invalid_certs(true)
.build()
@@ -354,7 +235,7 @@ mod tests {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let address = format!("https://{}", listener.local_addr().unwrap());
drop(listener);
let error = reqwest::Client::builder()
let error = crate::utils::request::client_builder()
.no_proxy()
.build()
.unwrap()
@@ -365,17 +246,7 @@ mod tests {
assert_eq!(classify(&error), None);
}
#[cfg(target_os = "macos")]
#[test]
fn wrapped_macos_io_status_retains_the_client_certificate_requirement() {
let error = std::io::Error::other(std::io::Error::other(security_framework::base::Error::from(-9863)));
let server = url::Url::parse("https://vpn.example.com/login?token=secret").unwrap();
let tls = ServerTlsError::from_request(&server, &error).unwrap();
assert_eq!(tls.kind, ServerTlsErrorKind::ClientCertificateRequired);
assert_eq!(tls.server, "https://vpn.example.com");
assert_eq!(classify(&std::io::Error::other("alert certificate required")), None);
}
#[cfg(feature = "desktop")]
#[test]
fn rendering_recovery_retains_client_certificate_requirement() {
use crate::process::rendering_recovery::{RecoveryState, RenderingCrash};
@@ -409,7 +280,7 @@ mod tests {
os_profile::{ClientOs, OsProfile},
portal::{PreloginOptions, prelogin},
};
let params = GpParams::builder(OsProfile::builder(ClientOs::Linux).build())
let params = GpParams::builder(OsProfile::builder(ClientOs::Linux).build(crate::os_profile::test_snapshot()))
.ignore_tls_errors(true)
.build();
let credential = crate::credential::PasswordCredential::new("alice", "password").into();
@@ -435,19 +306,11 @@ mod tests {
worker.join().unwrap();
let kind =
ServerTlsErrorKind::from_error(&error).unwrap_or_else(|| panic!("{operation}: unclassified: {error:?}"));
// Secure Transport's TLS 1.2 handshake can return only a generic peer alert.
if cfg!(target_os = "macos") {
assert!(matches!(
kind,
ServerTlsErrorKind::ClientCertificateRequired | ServerTlsErrorKind::Other
));
} else {
assert_eq!(
kind,
ServerTlsErrorKind::ClientCertificateRequired,
"{operation}: {error:?}"
);
}
assert_eq!(
kind,
ServerTlsErrorKind::ClientCertificateRequired,
"{operation}: {error:?}"
);
}
}
@@ -465,7 +328,8 @@ mod tests {
SslVerifyMode::PEER
};
let (address, worker) = server_with_client_auth(true, verify);
let mut builder = GpParams::builder(OsProfile::builder(ClientOs::Linux).build());
let mut builder =
GpParams::builder(OsProfile::builder(ClientOs::Linux).build(crate::os_profile::test_snapshot()));
builder.ignore_tls_errors(true);
if required {
builder
@@ -482,6 +346,78 @@ mod tests {
}
}
#[tokio::test]
async fn imported_identity_formats_complete_mutual_tls_prelogin() {
use crate::{
gp_params::GpParams,
os_profile::{ClientOs, OsProfile},
portal::{PreloginOptions, prelogin},
};
let fixture = |name: &str| format!("{}/tests/files/client-identity/{name}", env!("CARGO_MANIFEST_DIR"));
for (certificate, key, password) in [
(
"rsa-cert.pem",
Some("rsa-traditional-aes256.pem"),
Some("fixture-password"),
),
("ec-cert.pem", Some("ec-traditional-des3.pem"), Some("fixture-password")),
("rsa-cert.pem", Some("rsa-pbes1-3des.pem"), Some("fixture-password")),
("rsa-cert.pem", Some("rsa-pbes2-scrypt.pem"), Some("fixture-password")),
("ec-cert.pem", Some("ec-sec1.pem"), None),
("modern.p12", None, Some("fixture-password")),
("legacy-rc2.p12", None, Some("fixture-password")),
("empty-password.p12", None, None),
("no-bag-ids.p12", None, None),
] {
let (address, worker) = server_with_client_auth(true, SslVerifyMode::PEER | SslVerifyMode::FAIL_IF_NO_PEER_CERT);
let mut builder =
GpParams::builder(OsProfile::builder(ClientOs::Linux).build(crate::os_profile::test_snapshot()));
builder
.ignore_tls_errors(true)
.certificate(Some(fixture(certificate)))
.sslkey(key.map(fixture))
.key_password(password.map(str::to_owned));
let mut params = builder.build();
params
.prepare_client_identity()
.unwrap_or_else(|error| panic!("{certificate}/{key:?}: {error:?}"));
let result = prelogin(&address, &params, PreloginOptions::default()).await;
worker.join().unwrap();
assert!(matches!(
result.unwrap_or_else(|error| panic!("{certificate}/{key:?}: {error:?}")),
crate::portal::Prelogin::Saml(_)
));
}
}
/// Point at the GnuTLS fixture configured without RFC 5746, with a trusted test root.
#[tokio::test]
#[ignore = "requires GP_TLS_TEST_SERVER and GP_TLS_TEST_CA for the external GnuTLS fixture"]
async fn tls12_peer_without_renegotiation_extension_uses_default_policy() {
let server = std::env::var("GP_TLS_TEST_SERVER").unwrap();
let root = std::fs::read(std::env::var("GP_TLS_TEST_CA").unwrap()).unwrap();
let client = crate::utils::request::client_builder()
.no_proxy()
.add_root_certificate(reqwest::Certificate::from_pem(&root).unwrap())
.build()
.unwrap();
assert!(client.get(&server).send().await.unwrap().status().is_success());
let error = crate::utils::request::client_builder()
.no_proxy()
.build()
.unwrap()
.get(&server)
.send()
.await
.unwrap_err();
assert_eq!(
ServerTlsError::from_request(&url::Url::parse(&server).unwrap(), &error)
.unwrap()
.kind,
ServerTlsErrorKind::Certificate
);
}
#[tokio::test]
async fn failed_response_reads_preserve_the_transport_cause() {
for status in [200, 403] {
@@ -498,7 +434,7 @@ mod tests {
)
.unwrap();
});
let response = reqwest::Client::builder()
let response = crate::utils::request::client_builder()
.no_proxy()
.build()
.unwrap()
@@ -1,9 +0,0 @@
use std::error::Error;
use super::{ServerTlsErrorKind, classify_macos_status};
pub(super) fn classify(error: &(dyn Error + 'static)) -> Option<ServerTlsErrorKind> {
error
.downcast_ref::<security_framework::base::Error>()
.map(|error| classify_macos_status(error.code()))
}
@@ -1,17 +0,0 @@
use std::error::Error;
use super::ServerTlsErrorKind;
pub(super) fn classify(error: &(dyn Error + 'static)) -> Option<ServerTlsErrorKind> {
let stack = error.downcast_ref::<openssl::error::ErrorStack>().or_else(|| {
error
.downcast_ref::<openssl::ssl::Error>()
.and_then(openssl::ssl::Error::ssl_error)
})?;
// ERR_LIB_SSL and SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED from sslerr.h.
stack
.errors()
.iter()
.any(|error| error.library_code() == 20 && error.reason_code() == 1116)
.then_some(ServerTlsErrorKind::ClientCertificateRequired)
}
+44 -95
View File
@@ -17,11 +17,7 @@ use crate::{
gateway::GatewayLoginContext,
gp_params::GpParams,
params::gateway_login::{self, GatewayLoginInput},
session::{
GatewayAuthentication,
network::GatewayBinding,
transport::{bound_client, gateway_origin},
},
session::GatewayAuthentication,
utils::{normalize_server, parse_gp_response, remove_url_scheme, xml::ElementExt},
};
@@ -41,29 +37,12 @@ pub struct GatewayLoginClient {
origin: reqwest::Url,
client: Client,
params: GpParams,
binding: Option<GatewayBinding>,
login_endpoint: Option<SocketAddr>,
login_url: Option<reqwest::Url>,
maintenance_client: Option<Client>,
peer_certificate: Option<Vec<u8>>,
}
impl GatewayLoginClient {
pub fn register_session(
&self,
gateway: crate::gateway::Gateway,
authentication: GatewayAuthentication,
sessions: &mut crate::session::GatewaySessions,
) {
sessions.register(crate::session::GatewaySession {
gateway,
transport: self.authenticated_transport(authentication),
addresses: self
.binding
.as_ref()
.map(|binding| binding.addresses())
.unwrap_or_default(),
});
}
pub fn new(gateway: &str, params: GpParams) -> anyhow::Result<Self> {
let origin = reqwest::Url::parse(&normalize_server(gateway)?)?;
let client = Client::try_from(&params)?;
@@ -71,78 +50,19 @@ impl GatewayLoginClient {
origin,
client,
params,
binding: None,
login_endpoint: None,
login_url: None,
maintenance_client: None,
peer_certificate: None,
})
}
/// Only called after an authenticated non-tunnel response and registration in
/// the caller's cleanup ledger. Tunnel login never inspects physical routing.
pub async fn bind_non_tunnel(
&mut self,
disable_ipv6: bool,
detection: Option<&crate::session::network::InternalHostDetection>,
cancellation: &tokio_util::sync::CancellationToken,
) -> anyhow::Result<()> {
let origin = gateway_origin(self.origin.as_str())?;
let response_url = self
.login_url
.as_ref()
.ok_or_else(|| anyhow::anyhow!("Authenticated response endpoint is unavailable"))?;
anyhow::ensure!(
response_url.origin() == origin.origin(),
"Redirected non-tunnel authentication is unsupported"
);
let endpoint = self
.login_endpoint
.ok_or_else(|| anyhow::anyhow!("Non-tunnel authentication has no direct peer address"))?;
let network = crate::session::network::PhysicalNetwork::capture_controlled(cancellation).await?;
let binding = network
.bind_authenticated_endpoint(origin.as_str(), endpoint, disable_ipv6, cancellation)
.await?;
network
.validate_internal_binding(&binding, detection, cancellation)
.await?;
let client = bound_client(origin.as_str(), &self.params, &binding)?;
self.binding = Some(binding);
self.maintenance_client = Some(client);
Ok(())
pub(crate) fn login_endpoint(&self) -> Option<SocketAddr> {
self.login_endpoint
}
pub(crate) fn params(&self) -> &GpParams {
&self.params
}
pub fn update_registered_session(
&self,
gateway: &crate::gateway::Gateway,
authentication: &GatewayAuthentication,
sessions: &mut crate::session::GatewaySessions,
) {
sessions.update(crate::session::GatewaySession {
gateway: gateway.clone(),
transport: self.authenticated_transport(authentication.clone()),
addresses: self
.binding
.as_ref()
.map(|binding| binding.addresses())
.unwrap_or_default(),
});
}
pub fn authenticated_transport(
&self,
authentication: GatewayAuthentication,
) -> crate::session::transport::GatewayTransport {
crate::session::transport::GatewayTransport::from_authenticated_login(
self.maintenance_client.as_ref().unwrap_or(&self.client).clone(),
self.origin.clone(),
authentication,
self.params.os_profile().clone(),
)
}
pub fn binding(&self) -> Option<&GatewayBinding> {
self.binding.as_ref()
}
pub fn client_identity(&self) -> Option<&crate::utils::request::ClientIdentity> {
self.params.client_identity()
}
@@ -153,6 +73,16 @@ impl GatewayLoginClient {
&self.origin
}
/// DER certificate from the TLS connection that returned the login response.
/// Callers must retain normal certificate verification when using it as a pin.
pub fn authenticated_url(&self) -> Option<&reqwest::Url> {
self.login_url.as_ref()
}
pub fn peer_certificate(&self) -> Option<&[u8]> {
self.peer_certificate.as_deref()
}
pub fn respond_mfa(&mut self, input: &str, otp: &str) {
self.params.set_input_str(input);
self.params.set_otp(otp);
@@ -171,7 +101,7 @@ impl GatewayLoginClient {
context
.client_ip()
.map(str::to_owned)
.or_else(|| detect_local_ipv4(context.host()))
.or_else(|| self.origin.host_str().and_then(detect_local_ipv4))
});
let request = receive_gateway_login(
&self.origin,
@@ -190,6 +120,7 @@ impl GatewayLoginClient {
// Once the full response is available, retain issued authentication or finish
// cleanup-only logout before the caller observes cancellation.
let response = parse_login_response(response, &self.client, &self.origin, &self.params).await?;
self.peer_certificate = response.peer_certificate;
self.login_endpoint = response.endpoint;
self.login_url = Some(response.url);
Ok(response.login)
@@ -206,12 +137,14 @@ impl GatewayLoginClient {
}
struct LoginResponse {
peer_certificate: Option<Vec<u8>>,
login: GatewayLogin,
endpoint: Option<SocketAddr>,
url: reqwest::Url,
}
struct ReceivedLogin {
peer_certificate: Option<Vec<u8>>,
body: String,
endpoint: Option<SocketAddr>,
url: reqwest::Url,
@@ -260,17 +193,26 @@ async fn receive_gateway_login(
}
})?;
let peer_certificate = res
.extensions()
.get::<reqwest::tls::TlsInfo>()
.and_then(|info| info.peer_certificate())
.map(<[u8]>::to_vec);
let endpoint = res.remote_addr();
let url = res.url().clone();
let res = parse_gp_response(res).await.map_err(|err| {
if let Some(tls) = crate::error::ServerTlsError::from_request(origin, &err) {
return anyhow::anyhow!(tls);
}
if gp_params.os_profile().client_os() == crate::os_profile::ClientOs::Ios && err.is_authentication_rejection() {
return anyhow::anyhow!(crate::error::AuthenticationRejected);
}
warn!("Gateway login response failed: {}", err.reason);
anyhow::anyhow!("Gateway login error: {}", err.reason)
})?;
Ok(ReceivedLogin {
peer_certificate,
body: res,
endpoint,
url,
@@ -284,6 +226,7 @@ async fn parse_login_response(
gp_params: &GpParams,
) -> anyhow::Result<LoginResponse> {
let ReceivedLogin {
peer_certificate,
body: res,
endpoint,
url,
@@ -302,6 +245,7 @@ async fn parse_login_response(
};
return Ok(LoginResponse {
peer_certificate,
login: GatewayLogin::Mfa(message, input_str),
endpoint,
url,
@@ -335,6 +279,7 @@ async fn parse_login_response(
};
debug!("Gateway login succeeded, mode: {:?}", authentication.mode());
Ok(LoginResponse {
peer_certificate,
login: GatewayLogin::Authenticated(authentication),
endpoint,
url,
@@ -477,7 +422,11 @@ mod tests {
}
fn test_params() -> GpParams {
GpParams::builder(crate::os_profile::OsProfile::builder(crate::os_profile::ClientOs::Linux).build()).build()
GpParams::builder(
crate::os_profile::OsProfile::builder(crate::os_profile::ClientOs::Linux)
.build(crate::os_profile::test_snapshot()),
)
.build()
}
#[tokio::test]
@@ -578,7 +527,6 @@ mod tests {
assert!(
matches!(client.login(&credential, None, &CancellationToken::new()).await.unwrap(), GatewayLogin::Authenticated(authentication) if authentication.mode() == crate::session::SessionMode::Tunnel)
);
assert!(client.binding().is_none());
assert!(matches!(
client.extend_lifetime(&credential).await.unwrap(),
GatewayLogin::Authenticated(_)
@@ -619,7 +567,6 @@ mod tests {
.unwrap(),
GatewayLogin::Authenticated(_)
));
assert!(client.binding().is_none());
assert_eq!(server.await.unwrap().len(), 1);
}
@@ -642,7 +589,6 @@ mod tests {
.unwrap(),
GatewayLogin::Authenticated(_)
));
assert!(client.binding().is_none());
assert_eq!(
server.await.unwrap()[0].0,
"http://unresolvable.invalid/ssl-vpn/login.esp"
@@ -660,8 +606,11 @@ mod tests {
response("<response status='success'/>"),
])
.await;
let params =
GpParams::builder(crate::os_profile::OsProfile::builder(crate::os_profile::ClientOs::Linux).build()).build();
let params = GpParams::builder(
crate::os_profile::OsProfile::builder(crate::os_profile::ClientOs::Linux)
.build(crate::os_profile::test_snapshot()),
)
.build();
let credential = crate::credential::PasswordCredential::new("alice", "password").into();
let mut client = GatewayLoginClient {
client,
+4
View File
@@ -1,9 +1,11 @@
mod login;
mod parse_gateways;
#[cfg(feature = "desktop")]
pub mod session;
pub use login::*;
pub(crate) use parse_gateways::*;
#[cfg(feature = "desktop")]
pub use session::*;
use serde::{Deserialize, Serialize};
@@ -24,7 +26,9 @@ pub struct Gateway {
pub(crate) address: String,
#[serde(default)]
pub(crate) kind: GatewayKind,
#[serde(default)]
pub(crate) priority: u32,
#[serde(default)]
pub(crate) priority_rules: Vec<PriorityRule>,
}
+14 -5
View File
@@ -21,17 +21,26 @@ const EXTEND_SESSION_COMMENT: &str = "User extends the login lifetime";
pub struct SessionExtensionAuth {
credential: Credential,
client: GatewayLoginClient,
binding: Option<crate::session::desktop::network::GatewayBinding>,
}
impl SessionExtensionAuth {
pub fn new(credential: Credential, client: GatewayLoginClient) -> Self {
Self { credential, client }
Self {
credential,
client,
binding: None,
}
}
pub fn with_binding(mut self, binding: Option<crate::session::desktop::network::GatewayBinding>) -> Self {
self.binding = binding;
self
}
pub fn client_identity(&self) -> Option<&crate::utils::request::ClientIdentity> {
self.client.client_identity()
}
pub fn binding(&self) -> Option<&crate::session::network::GatewayBinding> {
self.client.binding()
pub fn binding(&self) -> Option<&crate::session::desktop::network::GatewayBinding> {
self.binding.as_ref()
}
}
@@ -170,14 +179,14 @@ mod tests {
fn build_session_args() -> SessionRequestArgs {
let profile = OsProfile::builder(ClientOs::Mac)
.host_identity(HostIdentity::new(
.host_identity(HostIdentity::from_parts(
"test-mac".to_string(),
"host-id".to_string(),
"serial".to_string(),
"aa:bb:cc:dd:ee:ff".to_string(),
))
.client_version("6.3.1-12".to_string())
.build();
.build(crate::os_profile::test_snapshot());
SessionRequestArgs::new("authcookie=AUTH&portal=vpn.example.com&user=alice&preferred-ip=10.0.0.10".to_string())
.with_user_agent(profile.user_agent().to_string())
.with_disable_ipv6(true)
+43 -28
View File
@@ -161,7 +161,8 @@ impl GpParams {
}
pub(crate) fn client_builder(&self) -> anyhow::Result<ClientBuilder> {
let mut builder = Client::builder()
let mut builder = crate::utils::request::client_builder()
.tls_info(true)
.danger_accept_invalid_certs(self.ignore_tls_errors)
.user_agent(self.user_agent());
if let Some(identity) = &self.prepared_identity {
@@ -322,10 +323,9 @@ mod tests {
assert!(params.client_identity().is_none());
assert!(params.certificate.is_none());
}
use crate::os_profile::runtime_client_os;
fn profile(client_os: ClientOs) -> OsProfile {
OsProfile::builder(client_os).build()
OsProfile::builder(client_os).build(crate::os_profile::test_snapshot())
}
#[test]
@@ -346,7 +346,7 @@ mod tests {
fn builder_keeps_explicit_client_version() {
let profile = OsProfile::builder(ClientOs::Mac)
.client_version("6.2.9-1".to_string())
.build();
.build(crate::os_profile::test_snapshot());
let params = GpParams::builder(profile).build();
assert_eq!(params.client_version(), Some("6.2.9-1"));
@@ -355,7 +355,7 @@ mod tests {
#[test]
fn builder_uses_os_profile_version_when_unspecified() {
let params = GpParams::builder(profile(ClientOs::Mac)).build();
let default_os_version = ClientOs::Mac.default_os_version();
let default_os_version = crate::os_profile::defaults::os_version(ClientOs::Mac);
assert_eq!(params.os_version(), Some(default_os_version.as_str()));
}
@@ -370,13 +370,18 @@ mod tests {
#[test]
fn delegates_identity_to_os_profile() {
let identity = HostIdentity::new(
let identity = HostIdentity::from_parts(
"test-computer".to_string(),
"test-host-id".to_string(),
"test-serial".to_string(),
"aa:bb:cc:dd:ee:ff".to_string(),
);
let params = GpParams::builder(OsProfile::builder(ClientOs::Linux).host_identity(identity).build()).build();
let params = GpParams::builder(
OsProfile::builder(ClientOs::Linux)
.host_identity(identity)
.build(crate::os_profile::test_snapshot()),
)
.build();
assert!(!params.host_id().is_empty());
assert_eq!(params.host_identity().host_id(), "test-host-id");
@@ -388,7 +393,7 @@ mod tests {
fn builder_accepts_pre_built_os_profile() {
let profile = OsProfile::builder(ClientOs::Mac)
.computer_name_override("MyMac")
.build();
.build(crate::os_profile::test_snapshot());
let expected_os_version = profile.os_version().to_string();
let params = GpParams::builder(profile).build();
@@ -404,7 +409,7 @@ mod tests {
fn delegates_computer_to_os_profile() {
let profile = OsProfile::builder(ClientOs::Mac)
.computer_name_override("MyComputer")
.build();
.build(crate::os_profile::test_snapshot());
let params = GpParams::builder(profile).build();
assert_eq!(params.computer(), "MyComputer");
@@ -421,7 +426,7 @@ mod tests {
#[test]
fn delegates_host_identity_to_os_profile() {
let identity = HostIdentity::new(
let identity = HostIdentity::from_parts(
"delegated-computer".to_string(),
"delegated-host".to_string(),
"delegated-serial".to_string(),
@@ -430,7 +435,7 @@ mod tests {
let params = GpParams::builder(
OsProfile::builder(ClientOs::Linux)
.host_identity(identity.clone())
.build(),
.build(crate::os_profile::test_snapshot()),
)
.build();
@@ -445,7 +450,7 @@ mod tests {
#[test]
fn builder_uses_provided_os_profile() {
let identity = HostIdentity::new(
let identity = HostIdentity::from_parts(
"identity-host".to_string(),
"host-7".to_string(),
"serial-7".to_string(),
@@ -455,13 +460,16 @@ mod tests {
.computer_name_override("linux-host")
.client_version("6.0.0-1".to_string())
.host_identity(identity)
.build();
.build(crate::os_profile::test_snapshot());
let params = GpParams::builder(profile).build();
let profile = params.os_profile();
assert_eq!(profile.client_os(), ClientOs::Linux);
assert_eq!(profile.computer(), "linux-host");
assert_eq!(profile.os_version(), ClientOs::Linux.default_os_version());
assert_eq!(
profile.os_version(),
crate::os_profile::defaults::os_version(ClientOs::Linux)
);
assert_eq!(profile.client_version(), "6.0.0-1");
assert_eq!(profile.host_identity().host_id(), "host-7");
assert_eq!(profile.host_identity().serialno(), "serial-7");
@@ -475,7 +483,7 @@ mod tests {
#[test]
fn try_from_gp_params_constructs_reqwest_client() {
let params = GpParams::builder(profile(runtime_client_os())).build();
let params = GpParams::builder(profile(ClientOs::Mac)).build();
let client = Client::try_from(&params);
assert!(client.is_ok(), "Client construction should succeed with default params");
@@ -483,7 +491,7 @@ mod tests {
#[test]
fn try_from_gp_params_with_ignore_tls_errors() {
let params = GpParams::builder(profile(runtime_client_os()))
let params = GpParams::builder(profile(ClientOs::Mac))
.ignore_tls_errors(true)
.build();
let client = Client::try_from(&params);
@@ -497,9 +505,9 @@ mod tests {
#[test]
fn try_from_gp_params_with_custom_user_agent() {
let params = GpParams::builder(
OsProfile::builder(runtime_client_os())
OsProfile::builder(ClientOs::Mac)
.user_agent("custom-agent/1.0")
.build(),
.build(crate::os_profile::test_snapshot()),
)
.build();
let client = Client::try_from(&params);
@@ -511,7 +519,7 @@ mod tests {
fn try_from_gp_params_with_invalid_certificate_returns_error() {
// When a certificate path is provided but the file does not exist or is malformed,
// Client construction should fail rather than silently succeed.
let params = GpParams::builder(profile(runtime_client_os()))
let params = GpParams::builder(profile(ClientOs::Mac))
.certificate("/nonexistent/path/to/cert.pem".to_string())
.build();
let client = Client::try_from(&params);
@@ -526,7 +534,7 @@ mod tests {
#[test]
fn user_agent_delegates_to_os_profile_for_default_build() {
let params = GpParams::builder(profile(runtime_client_os())).build();
let params = GpParams::builder(profile(ClientOs::Mac)).build();
assert_eq!(
params.user_agent(),
@@ -537,14 +545,21 @@ mod tests {
#[test]
fn builder_uses_profile_user_agent() {
let params = GpParams::builder(OsProfile::builder(runtime_client_os()).user_agent("custom").build()).build();
let params = GpParams::builder(
OsProfile::builder(ClientOs::Mac)
.user_agent("custom")
.build(crate::os_profile::test_snapshot()),
)
.build();
assert_eq!(params.user_agent(), "custom");
}
#[test]
fn builder_os_profile_without_user_agent_delegates_to_profile() {
let profile = OsProfile::builder(ClientOs::Mac).client_version("6.1.0").build();
let profile = OsProfile::builder(ClientOs::Mac)
.client_version("6.1.0")
.build(crate::os_profile::test_snapshot());
let expected_ua = profile.user_agent().to_string();
let params = GpParams::builder(profile).build();
@@ -557,7 +572,7 @@ mod tests {
let profile = OsProfile::builder(ClientOs::Mac)
.client_version("6.1.0")
.user_agent("override")
.build();
.build(crate::os_profile::test_snapshot());
let params = GpParams::builder(profile).build();
assert_eq!(params.user_agent(), "override");
@@ -566,9 +581,9 @@ mod tests {
#[test]
fn try_from_gp_params_succeeds_with_delegated_user_agent() {
let params = GpParams::builder(
OsProfile::builder(runtime_client_os())
OsProfile::builder(ClientOs::Mac)
.user_agent("delegated-agent/2.0")
.build(),
.build(crate::os_profile::test_snapshot()),
)
.build();
let client = Client::try_from(&params);
@@ -602,7 +617,7 @@ mod tests {
client_os in arb_client_os(),
user_agent_override in proptest::option::of("[a-zA-Z0-9/_.-]{1,30}"),
) {
let identity = HostIdentity::new(
let identity = HostIdentity::from_parts(
"prop-computer".to_string(),
"prop-host".to_string(),
"prop-serial".to_string(),
@@ -616,7 +631,7 @@ mod tests {
if let Some(ref ua) = user_agent_override {
profile_builder = profile_builder.user_agent(ua);
}
let params = GpParams::builder(profile_builder.build()).build();
let params = GpParams::builder(profile_builder.build(crate::os_profile::test_snapshot())).build();
prop_assert_eq!(
params.user_agent(),
@@ -634,7 +649,7 @@ mod tests {
proptest! {
#[test]
fn builder_uses_profile_user_agent(ua in "[^\\s]{1,50}") {
let profile = OsProfile::builder(runtime_client_os()).user_agent(&ua).build();
let profile = OsProfile::builder(ClientOs::Mac).user_agent(&ua).build(crate::os_profile::test_snapshot());
let params = GpParams::builder(profile).build();
prop_assert_eq!(params.user_agent(), ua.as_str());
+124
View File
@@ -0,0 +1,124 @@
//! Desktop GUI selection shared by launchers, installers and settings.
use serde::{Deserialize, Serialize};
use specta::Type;
use std::path::PathBuf;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
#[serde(rename_all = "kebab-case")]
pub enum GuiVariant {
#[default]
Tauri,
Nsh,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
#[serde(rename_all = "kebab-case")]
pub enum GuiTheme {
#[default]
System,
Light,
Dark,
}
impl GuiTheme {
pub fn as_str(self) -> &'static str {
match self {
Self::System => "system",
Self::Light => "light",
Self::Dark => "dark",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct GuiSwitchRequest {
pub variant: GuiVariant,
/// Permit a download only after the user accepts the confirmation dialog.
pub allow_download: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
#[serde(rename_all = "kebab-case")]
pub enum GuiSwitchOutcome {
Switched,
DownloadRequired,
}
impl GuiVariant {
pub fn binary_name(self) -> &'static str {
match self {
Self::Tauri => "gpgui",
Self::Nsh => "gpgui-nsh",
}
}
pub fn update_target(self) -> PathBuf {
let target = common::binary_paths::gpgui_update_target();
match self {
Self::Tauri => target,
Self::Nsh => target.with_file_name(self.binary_name()),
}
}
pub fn primary(self) -> PathBuf {
match self {
Self::Tauri => common::binary_paths::gpgui(),
Self::Nsh => common::binary_paths::gpgui().with_file_name(self.binary_name()),
}
}
}
#[cfg(target_os = "linux")]
fn preference_path() -> anyhow::Result<PathBuf> {
let dirs = directories::ProjectDirs::from("com.yuezk", "GlobalProtect-openconnect", "gpclient")
.ok_or_else(|| anyhow::anyhow!("Failed to locate GUI preference directory"))?;
Ok(dirs.config_dir().join("gui"))
}
pub fn preferred() -> anyhow::Result<GuiVariant> {
#[cfg(target_os = "linux")]
{
match std::fs::read_to_string(preference_path()?) {
Ok(value) => match value.trim() {
"gpgui" => Ok(GuiVariant::Tauri),
"gpgui-nsh" => Ok(GuiVariant::Nsh),
_ => anyhow::bail!("Invalid GUI preference"),
},
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(GuiVariant::Tauri),
Err(error) => Err(error.into()),
}
}
#[cfg(not(target_os = "linux"))]
Ok(GuiVariant::Tauri)
}
#[cfg(target_os = "linux")]
pub fn save_preference(variant: GuiVariant) -> anyhow::Result<()> {
use std::io::Write;
let path = preference_path()?;
let directory = path.parent().unwrap();
std::fs::create_dir_all(directory)?;
let mut file = tempfile::NamedTempFile::new_in(directory)?;
writeln!(file, "{}", variant.binary_name())?;
file.persist(path)?;
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn nsh_selection_keeps_both_launch_and_upgrade_paths_on_nsh() {
let variant = GuiVariant::Nsh;
assert_eq!(variant.primary().file_name().unwrap(), "gpgui-nsh");
assert_eq!(variant.update_target().file_name().unwrap(), "gpgui-nsh");
assert_eq!(
variant.update_target().parent(),
GuiVariant::Tauri.update_target().parent()
);
assert_eq!(serde_json::to_string(&variant).unwrap(), "\"nsh\"");
}
}
+9
View File
@@ -1,16 +1,24 @@
pub mod auth;
pub mod collection;
#[cfg(feature = "desktop")]
pub mod cookie_store;
pub mod credential;
#[cfg(feature = "desktop")]
pub mod device_anchor;
pub mod error;
pub mod gateway;
pub mod gp_params;
#[cfg(feature = "desktop")]
pub mod gui;
#[cfg(feature = "desktop")]
pub mod hip;
pub mod log_format;
pub mod os_profile;
pub mod params;
pub mod portal;
#[cfg(feature = "desktop")]
pub mod process;
#[cfg(feature = "desktop")]
pub mod service;
pub mod session;
pub mod utils;
@@ -21,4 +29,5 @@ pub mod logger;
#[cfg(feature = "clap")]
pub mod clap;
#[cfg(feature = "desktop")]
pub mod script_tun;
+163
View File
@@ -0,0 +1,163 @@
use super::*;
// ─── ClientOs ────────────────────────────────────────────────────────────────
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Type)]
pub enum ClientOs {
Linux,
Windows,
Mac,
Ios,
}
impl From<&str> for ClientOs {
fn from(os: &str) -> Self {
match os {
"Linux" => ClientOs::Linux,
"Windows" => ClientOs::Windows,
"Mac" => ClientOs::Mac,
"iOS" => ClientOs::Ios,
_ => ClientOs::Linux,
}
}
}
impl ClientOs {
pub fn as_str(&self) -> &'static str {
match self {
ClientOs::Linux => "Linux",
ClientOs::Windows => "Windows",
ClientOs::Mac => "Mac",
ClientOs::Ios => "iOS",
}
}
pub fn to_openconnect_os(&self) -> &str {
match self {
ClientOs::Linux => "linux",
ClientOs::Windows => "win",
ClientOs::Mac => "mac-intel",
ClientOs::Ios => "apple-ios",
}
}
pub fn default_client_version(&self) -> &'static str {
match self {
ClientOs::Linux => GP_CLIENT_VERSION_LINUX,
ClientOs::Windows => GP_CLIENT_VERSION_WINDOWS,
ClientOs::Mac => GP_CLIENT_VERSION_MACOS,
ClientOs::Ios => "6.3.5-28",
}
}
pub(crate) fn default_csc_support(&self) -> bool {
match self {
ClientOs::Linux | ClientOs::Ios => false,
ClientOs::Mac | ClientOs::Windows => true,
}
}
}
// ─── PreloginParamLocation ───────────────────────────────────────────────────
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum PreloginParamLocation {
Body,
Query,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PreloginBrowserMode {
Embedded,
External,
}
// ─── WebviewUserAgent ───────────────────────────────────────────────────────
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum WebviewUserAgent {
Native {
prefix: String,
transform: WebviewUserAgentTransform,
},
Projected {
prefix: String,
default_user_agent: String,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WebviewUserAgentTransform {
None,
LinuxPanGpuiVersion,
}
// ─── Target behavior ────────────────────────────────────────────────────────
pub(super) mod target {
use super::*;
pub(in crate::os_profile) fn prelogin_param_location(client_os: ClientOs) -> PreloginParamLocation {
match client_os {
ClientOs::Linux | ClientOs::Mac | ClientOs::Ios => PreloginParamLocation::Body,
ClientOs::Windows => PreloginParamLocation::Query,
}
}
pub(in crate::os_profile) fn saml_password(client_os: ClientOs) -> &'static str {
match client_os {
ClientOs::Linux => "SAMLPASS",
ClientOs::Mac | ClientOs::Windows | ClientOs::Ios => "",
}
}
pub(in crate::os_profile) fn external_browser_os_value(client_os: ClientOs) -> &'static str {
match client_os {
ClientOs::Linux => "4",
ClientOs::Mac => "3",
ClientOs::Windows => "2",
ClientOs::Ios => "0",
}
}
pub(in crate::os_profile) fn supports_macos_plist_csc(client_os: ClientOs) -> bool {
matches!(client_os, ClientOs::Mac)
}
pub(in crate::os_profile) fn supports_linux_process_csc(client_os: ClientOs) -> bool {
matches!(client_os, ClientOs::Linux)
}
pub(in crate::os_profile) fn supports_windows_registry_csc(client_os: ClientOs) -> bool {
matches!(client_os, ClientOs::Windows)
}
pub(in crate::os_profile) fn kerberos_support_in_query(client_os: ClientOs) -> bool {
match client_os {
ClientOs::Linux | ClientOs::Ios => false,
ClientOs::Mac | ClientOs::Windows => true,
}
}
pub(in crate::os_profile) fn os_vendor(client_os: ClientOs) -> &'static str {
match client_os {
ClientOs::Linux => "Linux",
ClientOs::Mac | ClientOs::Ios => "Apple",
ClientOs::Windows => "Microsoft",
}
}
pub(in crate::os_profile) fn webview_user_agent_default(client_os: ClientOs) -> &'static str {
match client_os {
ClientOs::Linux => DEFAULT_LINUX_WEBVIEW_USER_AGENT,
ClientOs::Mac | ClientOs::Ios => DEFAULT_MACOS_WEBVIEW_USER_AGENT,
ClientOs::Windows => DEFAULT_WINDOWS_WEBVIEW_USER_AGENT,
}
}
pub(in crate::os_profile) fn webview_user_agent_transform(client_os: ClientOs) -> WebviewUserAgentTransform {
match client_os {
ClientOs::Linux => WebviewUserAgentTransform::LinuxPanGpuiVersion,
ClientOs::Mac | ClientOs::Windows | ClientOs::Ios => WebviewUserAgentTransform::None,
}
}
}
+26
View File
@@ -0,0 +1,26 @@
use super::ClientOs;
pub(super) const DEFAULT_MACOS_VERSION: &str = "13.4.0";
pub(super) const DEFAULT_LINUX_DISTRO: &str = "Ubuntu 24.04.3 LTS";
pub(super) const DEFAULT_WINDOWS_DISTRO: &str = "Windows 11 Pro";
pub(super) const DEFAULT_WINDOWS_VERSION: &str = "10.0.22631.0";
pub(super) const DEFAULT_LINUX_WEBVIEW_USER_AGENT: &str =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/602.1 (KHTML, like Gecko) PanGPUI Version/10.0 Safari/602.1";
pub(super) const DEFAULT_MACOS_WEBVIEW_USER_AGENT: &str =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)";
pub(super) const DEFAULT_WINDOWS_WEBVIEW_USER_AGENT: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0";
pub(crate) fn os_version(os: ClientOs) -> String {
match os {
ClientOs::Linux => format!("Linux {DEFAULT_LINUX_DISTRO}"),
ClientOs::Mac => format!("Apple Mac OS X {DEFAULT_MACOS_VERSION}"),
ClientOs::Windows => format!("Microsoft {DEFAULT_WINDOWS_DISTRO} , 64-bit"),
ClientOs::Ios => "Apple iOS".into(),
}
}
pub(crate) fn software_version(os: ClientOs) -> String {
match os {
ClientOs::Mac => DEFAULT_MACOS_VERSION.into(),
ClientOs::Windows => DEFAULT_WINDOWS_VERSION.into(),
ClientOs::Linux | ClientOs::Ios => String::new(),
}
}
@@ -0,0 +1,136 @@
use super::{
ClientOs, NativeHostIdentitySnapshot, derive_mac_address, fallback_hostname, normalize_mac_colon, primary_mac_colon,
resolve_host_id,
};
use crate::collection::CollectionControl;
use crate::process::collection::CollectorCommands;
use std::io;
pub(super) struct RuntimeNativeHostIdentity;
impl RuntimeNativeHostIdentity {
pub(super) fn runtime_os() -> ClientOs {
ClientOs::Mac
}
pub(super) fn collect_with_control(
host_id_override: Option<&str>,
control: &dyn CollectionControl,
) -> io::Result<NativeHostIdentitySnapshot> {
let commands = CollectorCommands::new(control);
let native_mac = macos_builtin_mac(&commands)?.or_else(primary_mac_colon);
control.check()?;
let host_id = resolve_host_id(host_id_override, || {
native_mac
.clone()
.unwrap_or_else(|| derive_mac_address(&fallback_hostname()))
});
let computer = macos_computer_name(&commands)?.unwrap_or_else(fallback_hostname);
let serial_number = collect_macos_serial_number(&commands)?;
control.check()?;
Ok(NativeHostIdentitySnapshot {
host_id,
computer,
serial_number,
mac_address: native_mac,
})
}
}
fn output(commands: &CollectorCommands<'_>, program: &str, args: &[&str]) -> io::Result<Option<String>> {
Ok(
commands
.run(program, args)?
.filter(|output| output.status.success())
.and_then(|output| String::from_utf8(output.stdout).ok()),
)
}
fn macos_computer_name(commands: &CollectorCommands<'_>) -> io::Result<Option<String>> {
for name in ["ComputerName", "LocalHostName"] {
if let Some(value) = output(commands, "scutil", &["--get", name])?
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty())
{
return Ok(Some(value));
}
}
Ok(None)
}
fn macos_builtin_mac(commands: &CollectorCommands<'_>) -> io::Result<Option<String>> {
if let Some(stdout) = output(commands, "networksetup", &["-listallhardwareports"])? {
for name in ["Wi-Fi", "AirPort"] {
if let Some(mac) = parse_hardware_port_mac(&stdout, name) {
return Ok(Some(mac));
}
}
}
macos_system_profiler_wifi_mac(commands)
}
fn parse_hardware_port_mac(stdout: &str, name: &str) -> Option<String> {
let mut in_port = false;
for line in stdout.lines() {
if let Some(port) = line.strip_prefix("Hardware Port: ") {
in_port = port == name;
continue;
}
if in_port && let Some(mac) = line.strip_prefix("Ethernet Address: ") {
return normalize_mac_colon(mac);
}
}
None
}
fn macos_system_profiler_wifi_mac(commands: &CollectorCommands<'_>) -> io::Result<Option<String>> {
let Some(stdout) = output(commands, "system_profiler", &["SPNetworkDataType"])? else {
return Ok(None);
};
let mut in_wifi = false;
for line in stdout.lines() {
let trimmed = line.trim();
if trimmed.ends_with(':') && !trimmed.starts_with("MAC Address:") {
in_wifi = trimmed == "Wi-Fi:" || trimmed == "AirPort:";
continue;
}
if in_wifi && let Some(mac) = trimmed.strip_prefix("MAC Address: ") {
return Ok(normalize_mac_colon(mac));
}
}
Ok(None)
}
fn collect_macos_serial_number(commands: &CollectorCommands<'_>) -> io::Result<Option<String>> {
let Some(stdout) = output(commands, "ioreg", &["-rd1", "-c", "IOPlatformExpertDevice"])? else {
return Ok(None);
};
Ok(stdout.lines().find_map(|line| {
line
.split_once("IOPlatformSerialNumber")
.and_then(|(_, value)| value.split_once('='))
.map(|(_, value)| value.trim().trim_matches('"').to_string())
.filter(|value| !value.is_empty())
}))
}
impl RuntimeNativeHostIdentity {
pub(super) fn versions(control: &dyn super::CollectionControl) -> super::io::Result<(String, String)> {
let commands = crate::process::collection::CollectorCommands::new(control);
let version = commands
.run("sw_vers", &["-productVersion"])?
.filter(|output| output.status.success())
.and_then(|output| String::from_utf8(output.stdout).ok())
.map(|version| version.trim().to_string())
.filter(|version| !version.is_empty())
.unwrap_or_else(|| super::DEFAULT_MACOS_VERSION.into());
control.check()?;
Ok((format!("Apple Mac OS X {version}"), version))
}
pub(super) fn fallback_versions() -> (String, String) {
(
super::defaults::os_version(ClientOs::Mac),
super::defaults::software_version(ClientOs::Mac),
)
}
}
+242
View File
@@ -0,0 +1,242 @@
use super::*;
use crate::collection::{CollectionBudget, CollectionControl};
use std::{io, time::Duration};
#[cfg(target_os = "macos")]
mod macos;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
mod unix;
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "macos")]
use macos::RuntimeNativeHostIdentity;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use unix::RuntimeNativeHostIdentity;
#[cfg(target_os = "windows")]
use windows::RuntimeNativeHostIdentity;
#[cfg(not(any(
target_os = "macos",
target_os = "windows",
target_os = "linux",
target_os = "freebsd",
target_os = "openbsd"
)))]
compile_error!("gpapi desktop collection is unsupported on this target; disable the desktop feature");
pub fn collect_identity() -> HostIdentity {
collect_with_host_id(None)
}
pub fn collect_identity_with_control(control: &dyn CollectionControl) -> io::Result<HostIdentity> {
collect_with_host_id_and_control(None, control)
}
pub(super) fn collect_with_host_id(host_id: Option<&str>) -> HostIdentity {
match collect_with_host_id_and_control(host_id, &CollectionBudget::new(Duration::from_secs(60))) {
Ok(identity) => identity,
Err(error) => {
log::warn!("Host identity collection was unavailable: {error}");
default_with_host_id(host_id)
}
}
}
/// Best-effort convenience callers retain the established derived identity
/// when native collection is unavailable. Controlled HIP callers get errors.
pub(super) fn default_with_host_id(host_id: Option<&str>) -> HostIdentity {
identity_from_parts(
fallback_hostname(),
resolve_host_id(host_id, fallback_host_id),
String::new(),
primary_mac_colon().unwrap_or_default(),
)
}
pub(super) fn collect_with_host_id_and_control(
host_id: Option<&str>,
control: &dyn CollectionControl,
) -> io::Result<HostIdentity> {
control.check()?;
let identity = RuntimeNativeHostIdentity::collect_with_control(host_id, control)?.into_host_identity();
control.check()?;
Ok(identity)
}
pub fn identity_from_parts(computer: String, host_id: String, serialno: String, mac_addr: String) -> HostIdentity {
let host_id = non_empty(host_id, fallback_host_id());
let computer = non_empty(computer, fallback_hostname());
let serial_number = non_empty(serialno, derive_serial_number(&host_id));
let mac_address = normalize_mac_colon(&mac_addr).unwrap_or_else(|| derive_mac_address(&host_id));
HostIdentity::from_parts(computer, host_id, serial_number, mac_address)
}
pub(super) fn fallback_hostname() -> String {
whoami::hostname().unwrap_or_else(|_| String::from("localhost"))
}
#[derive(Debug, Clone)]
struct NativeHostIdentitySnapshot {
host_id: String,
computer: String,
serial_number: Option<String>,
mac_address: Option<String>,
}
impl NativeHostIdentitySnapshot {
fn into_host_identity(self) -> HostIdentity {
let host_id = non_empty(self.host_id, fallback_host_id());
identity_from_parts(
self.computer,
host_id.clone(),
self.serial_number.unwrap_or_else(|| derive_serial_number(&host_id)),
self.mac_address.unwrap_or_else(|| derive_mac_address(&host_id)),
)
}
}
fn non_empty(value: String, fallback: String) -> String {
if value.trim().is_empty() { fallback } else { value }
}
fn fallback_host_id() -> String {
derive_uuid_from_seed(&fallback_hostname(), &["runtime-host-id"])
}
fn resolve_host_id(host_id_override: Option<&str>, collect: impl FnOnce() -> String) -> String {
host_id_override
.filter(|value| !value.trim().is_empty())
.map(str::to_string)
.unwrap_or_else(collect)
}
fn derive_serial_number(host_id: &str) -> String {
serial_number::vmware_from_uuid(host_id).unwrap_or_else(|| {
let uuid = derive_uuid_from_seed(host_id, &["runtime-serialno"]);
serial_number::vmware_from_uuid(&uuid).expect("derived UUID should format as VMware serial")
})
}
fn derive_mac_address(host_id: &str) -> String {
let uuid = derive_uuid_from_seed(host_id, &["runtime-mac"]);
let compact = uuid.replace('-', "");
let bytes = compact
.as_bytes()
.chunks(2)
.take(6)
.map(|chunk| std::str::from_utf8(chunk).unwrap_or("00").to_lowercase())
.collect::<Vec<_>>();
bytes.join(":")
}
fn normalize_mac_colon(value: &str) -> Option<String> {
let compact = value
.trim()
.replace('-', ":")
.split(':')
.map(|part| part.to_lowercase())
.collect::<Vec<_>>();
let valid = compact.len() == 6
&& compact
.iter()
.all(|part| part.len() == 2 && part.chars().all(|ch| ch.is_ascii_hexdigit()));
valid.then(|| compact.join(":"))
}
fn primary_mac_colon() -> Option<String> {
netdev::get_default_interface()
.ok()
.and_then(|iface| iface.mac_addr.map(|mac| mac.address()))
.and_then(|mac| normalize_mac_colon(&mac))
}
fn derive_uuid_from_seed(seed: &str, parts: &[&str]) -> String {
use uuid::Uuid;
let namespace = Uuid::NAMESPACE_DNS;
let name = format!("{}-{}", seed, parts.join("-"));
Uuid::new_v5(&namespace, name.as_bytes()).hyphenated().to_string()
}
pub fn runtime_client_os() -> ClientOs {
RuntimeNativeHostIdentity::runtime_os()
}
/// Strict native collection, followed by deterministic profile projection.
pub fn collect_profile_with_control(
builder: OsProfileBuilder,
host_id_override: Option<&str>,
control: &dyn CollectionControl,
) -> io::Result<OsProfile> {
control.check()?;
let identity = match &builder.host_identity {
Some(identity) => identity.clone(),
None => collect_with_host_id_and_control(host_id_override, control)?,
};
let runtime_os = runtime_client_os();
// Preserve the old behavior: only probe the native version when reporting it.
let (os_version, software_version) = if builder.client_os == runtime_os {
RuntimeNativeHostIdentity::versions(control)?
} else {
(defaults::os_version(runtime_os), defaults::software_version(runtime_os))
};
control.check()?;
Ok(builder.build(HostSnapshot {
runtime_os,
identity,
os_version,
software_version,
}))
}
/// Existing desktop best-effort policy; strict HIP callers use the controlled entry point.
pub fn collect_profile(builder: OsProfileBuilder, host_id_override: Option<&str>) -> OsProfile {
match collect_profile_with_control(
builder.clone(),
host_id_override,
&CollectionBudget::new(Duration::from_secs(60)),
) {
Ok(profile) => profile,
Err(error) => {
log::warn!("OS profile collection was unavailable: {error}");
let identity = builder
.host_identity
.clone()
.unwrap_or_else(|| default_with_host_id(host_id_override));
let runtime_os = runtime_client_os();
let (os_version, software_version) = RuntimeNativeHostIdentity::fallback_versions();
builder.build(HostSnapshot {
runtime_os,
identity,
os_version,
software_version,
})
}
}
}
pub fn default_computer_name(client_os: &ClientOs) -> String {
projection::project(runtime_client_os(), *client_os, &collect_identity(), None)
.computer()
.into()
}
pub fn default_os_version(client_os: &ClientOs) -> String {
if *client_os == runtime_client_os() {
RuntimeNativeHostIdentity::versions(&CollectionBudget::new(Duration::from_secs(60)))
.unwrap_or_else(|_| RuntimeNativeHostIdentity::fallback_versions())
.0
} else {
defaults::os_version(*client_os)
}
}
pub fn default_software_version(client_os: &ClientOs) -> String {
if *client_os == runtime_client_os() {
RuntimeNativeHostIdentity::versions(&CollectionBudget::new(Duration::from_secs(60)))
.unwrap_or_else(|_| RuntimeNativeHostIdentity::fallback_versions())
.1
} else {
defaults::software_version(*client_os)
}
}
#[cfg(test)]
mod tests;
Loaded 100 of 236 files, more files were not shown because too many files have changed in this diff. Show more