Compare commits

...
Author SHA1 Message Date
github-actions[bot] 5ebe61de62 chore: update flake hashes for v2.6.5 from snapshot 2026-08-30 11:36:02 +00:00
Kevin Yue dbab0150fe Merge branch 'main' into feat/auth-callback-handler
# Conflicts:
#	apps/gpauth/src/cli.rs
#	apps/gpclient/src/cli.rs
#	apps/gpclient/src/connect/credential.rs
#	apps/gpclient/src/connect/gateway.rs
#	crates/gpapi/src/process/auth_launcher.rs
2026-08-21 01:36:08 +08:00
Kevin Yue 1c9bef6e63 Merge remote-tracking branch 'origin/main' 2026-08-20 23:32:48 +08:00
Ronald HötschlandKevin Yue f9f9dd8abe feat: add --log-format json to gpclient and gpauth (#644)
Co-authored-by: Kevin Yue <[email protected]>
2026-08-20 23:28:01 +08:00
JD F 2283d4a076 fix: apply nixpkgs.follows to flake inputs (#646) 2026-08-20 22:17:03 +08:00
Kevin Yue 59102edfb5 ci: update gpgui desktop paths 2026-08-12 16:25:56 +08:00
Kevin Yue aa41998e58 fix: improve browser launcher detection 2026-08-09 18:54:43 +08:00
Kevin Yue a3397e81a7 fix: report missing LXQt browser SSO support 2026-08-09 16:35:33 +08:00
Kevin Yue 2910870371 fix: expose display compositor availability 2026-08-09 15:37:38 +08:00
Kevin Yue fb82bb4b8d fix: mark authentication windows as dialogs 2026-08-09 14:54:54 +08:00
Kevin Yue 630e8ec0de fix: detect native Firefox desktop launcher 2026-08-09 12:46:30 +08:00
Kevin Yue 890daea78f ci: use run number for GUI builds 2026-08-09 09:38:29 +08:00
Kevin Yue 8e57f5723b feat: refine GUI setup progress 2026-08-08 22:47:50 +08:00
Kevin Yue bfb27a279f ci: dispatch paired macOS workflow ref 2026-08-08 00:31:51 +08:00
Kevin Yue b33701a83f build: use OpenSSL for OpenConnect on macOS 2026-08-08 00:28:56 +08:00
Kevin Yue 193dfc247f fix: restore resizable helper window 2026-08-08 00:10:03 +08:00
Kevin Yue 08389271f0 fix: constrain gpgui helper window size 2026-08-07 23:57:59 +08:00
Kevin Yue 842df3201b refactor: remove mui from gpgui helper 2026-08-07 23:34:22 +08:00
Kevin Yue cd8eb1d9eb feat: refresh gpgui helper download UI 2026-08-07 23:11:09 +08:00
Kevin Yue 32cd228c02 ci: embed shared update build metadata 2026-08-07 19:14:11 +08:00
Kevin Yue 8b4821948d test: model pkexec origin in CI 2026-08-07 17:33:46 +08:00
Kevin Yue 79b7837189 test: configure non-root CI origin 2026-08-07 17:29:12 +08:00
Kevin Yue b62db0e9a1 test: allow non-root GUI launcher fixtures 2026-08-07 17:19:32 +08:00
Kevin Yue 581710a770 fix: restore GUI callback desktop handler 2026-08-07 17:11:29 +08:00
Kevin Yue c92bdaed1d fix: separate packaged and runtime GUI binaries 2026-08-07 16:38:03 +08:00
Kevin Yue 58738f6fd7 Merge branch 'main' into feat/auth-callback-handler 2026-08-07 09:50:19 +08:00
Kevin Yue ada320044b ci: publish OBS and COPR packages 2026-08-07 09:50:06 +08:00
Kevin Yue fb35e6ee1c Merge branch 'main' into feat/auth-callback-handler 2026-08-06 23:53:42 +08:00
Kevin Yue d75e422c1d ci: split AUR publishing into retryable job 2026-08-06 22:58:25 +08:00
Kevin Yue 4cfa9a9b5b fix: claim external auth callback handler 2026-08-06 22:29:07 +08:00
Kevin Yue d1d9f0c6fc feat(auth): add remote browser listen address 2026-08-06 22:19:50 +08:00
Kevin Yue cc4d35c228 ci: install xdg-utils for OpenBSD builds 2026-08-06 12:37:17 +08:00
Kevin Yue 17d1555155 fix: refine macOS authentication app lifecycle 2026-08-06 10:59:56 +08:00
Kevin Yue 588790f2d5 feat: add macOS auth callback app mode 2026-08-05 21:09:27 +08:00
Kevin Yue 918abeb9bc feat: add standalone auth callback transport 2026-08-05 20:07:28 +08:00
69 changed files with 2941 additions and 1130 deletions

No files matched your search

+21 -9
View File
@@ -60,6 +60,7 @@ jobs:
--user root \ --user root \
-e COREPACK_INTEGRITY_KEYS=0 \ -e COREPACK_INTEGRITY_KEYS=0 \
-e LIBXML2_STATIC=1 \ -e LIBXML2_STATIC=1 \
-e PKEXEC_UID=1000 \
-v "$(pwd):/workspace" \ -v "$(pwd):/workspace" \
-w /workspace \ -w /workspace \
yuezk/gpdev:binary-builder-tauri2 \ yuezk/gpdev:binary-builder-tauri2 \
@@ -315,6 +316,8 @@ jobs:
run: | run: |
docker run --rm \ docker run --rm \
-e COREPACK_INTEGRITY_KEYS=0 \ -e COREPACK_INTEGRITY_KEYS=0 \
-e GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }} \
-e GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }} \
-v $(pwd)/gpgui-source:/workspace yuezk/gpdev:${{ matrix.libc.builder }} -v $(pwd)/gpgui-source:/workspace yuezk/gpdev:${{ matrix.libc.builder }}
- name: Install gpgui in Docker - name: Install gpgui in Docker
run: | run: |
@@ -352,6 +355,7 @@ jobs:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || github.ref_name }} RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || github.ref_name }}
GP_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref_name }} GP_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref_name }}
GPGUI_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }} GPGUI_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
BUILD_VERSION: ${{ github.run_number }}.${{ github.run_attempt }}
REQUEST_ID: ${{ github.run_id }}.${{ github.run_attempt }}.macos REQUEST_ID: ${{ github.run_id }}.${{ github.run_attempt }}.macos
run: | run: |
set -euo pipefail set -euo pipefail
@@ -373,15 +377,18 @@ jobs:
expected_title="macOS $CHANNEL $RELEASE_TAG ($REQUEST_ID)" expected_title="macOS $CHANNEL $RELEASE_TAG ($REQUEST_ID)"
jq -n \ jq -n \
--arg workflow_ref "$GPGUI_REF" \
--arg request_id "$REQUEST_ID" \ --arg request_id "$REQUEST_ID" \
--arg build_version "$BUILD_VERSION" \
--arg channel "$CHANNEL" \ --arg channel "$CHANNEL" \
--arg release_tag "$RELEASE_TAG" \ --arg release_tag "$RELEASE_TAG" \
--arg gp_ref "$gp_sha" \ --arg gp_ref "$gp_sha" \
--arg gpgui_ref "$gpgui_sha" \ --arg gpgui_ref "$gpgui_sha" \
'{ '{
ref: "main", ref: $workflow_ref,
inputs: { inputs: {
request_id: $request_id, request_id: $request_id,
build_version: $build_version,
channel: $channel, channel: $channel,
release_tag: $release_tag, release_tag: $release_tag,
gp_ref: $gp_ref, gp_ref: $gp_ref,
@@ -486,7 +493,7 @@ jobs:
path: gpgui-frontend/gpgui path: gpgui-frontend/gpgui
- name: Build gpgui frontend - name: Build gpgui frontend
run: | run: |
cd gpgui-frontend/gpgui/app cd gpgui-frontend/gpgui/apps/desktop
pnpm install --frozen-lockfile pnpm install --frozen-lockfile
pnpm build pnpm build
- name: Upload gpgui frontend - name: Upload gpgui frontend
@@ -494,7 +501,7 @@ jobs:
with: with:
name: bsd-gpgui-frontend name: bsd-gpgui-frontend
if-no-files-found: error if-no-files-found: error
path: gpgui-frontend/gpgui/app/dist/** path: gpgui-frontend/gpgui/apps/desktop/dist/**
build-bsd: build-bsd:
needs: needs:
@@ -528,7 +535,7 @@ jobs:
uses: actions/download-artifact@v8 uses: actions/download-artifact@v8
with: with:
name: bsd-gpgui-frontend name: bsd-gpgui-frontend
path: ${{ matrix.workspace }}/gpgui/app/dist path: ${{ matrix.workspace }}/gpgui/apps/desktop/dist
- name: Build on FreeBSD - name: Build on FreeBSD
if: ${{ matrix.os == 'freebsd' }} if: ${{ matrix.os == 'freebsd' }}
uses: vmactions/freebsd-vm@v1 uses: vmactions/freebsd-vm@v1
@@ -559,14 +566,16 @@ jobs:
webkit2-gtk_41 webkit2-gtk_41
run: | run: |
set -eu set -eu
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
export GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }}
cd "${{ matrix.workspace }}/gp" cd "${{ matrix.workspace }}/gp"
cargo build --release --workspace cargo build --release --workspace
cd ../gpgui/app/src-tauri cd ../gpgui/apps/desktop/src-tauri
cargo build --release --workspace cargo build --release --workspace
cd ../../../gp cd ../../../../gp
gmake "${{ matrix.package_target }}" GPGUI_BINARY=../gpgui/target/release/gpgui gmake "${{ matrix.package_target }}" GPGUI_BINARY=../gpgui/target/release/gpgui
pkg install -y ".build/${{ matrix.artifact_dir }}"/artifacts/*.pkg pkg install -y ".build/${{ matrix.artifact_dir }}"/artifacts/*.pkg
gpclient --version gpclient --version
@@ -600,7 +609,8 @@ jobs:
gmp \ gmp \
gnome-keyring \ gnome-keyring \
polkit \ polkit \
webkitgtk41 webkitgtk41 \
xdg-utils
ln -sf /usr/local/bin/autoreconf-2.72 /usr/local/bin/autoreconf ln -sf /usr/local/bin/autoreconf-2.72 /usr/local/bin/autoreconf
ln -sf /usr/local/bin/autoconf-2.72 /usr/local/bin/autoconf ln -sf /usr/local/bin/autoconf-2.72 /usr/local/bin/autoconf
ln -sf /usr/local/bin/autoheader-2.72 /usr/local/bin/autoheader ln -sf /usr/local/bin/autoheader-2.72 /usr/local/bin/autoheader
@@ -611,14 +621,16 @@ jobs:
set -eu set -eu
export AUTOCONF_VERSION=2.72 export AUTOCONF_VERSION=2.72
export AUTOMAKE_VERSION=1.17 export AUTOMAKE_VERSION=1.17
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
export GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }}
cd "${{ matrix.workspace }}/gp" cd "${{ matrix.workspace }}/gp"
cargo build --release --workspace cargo build --release --workspace
cd ../gpgui/app/src-tauri cd ../gpgui/apps/desktop/src-tauri
cargo build --release --workspace cargo build --release --workspace
cd ../../../gp cd ../../../../gp
gmake "${{ matrix.package_target }}" GPGUI_BINARY=../gpgui/target/release/gpgui gmake "${{ matrix.package_target }}" GPGUI_BINARY=../gpgui/target/release/gpgui
pkg_add -D unsigned ".build/${{ matrix.artifact_dir }}"/artifacts/*.tgz pkg_add -D unsigned ".build/${{ matrix.artifact_dir }}"/artifacts/*.tgz
gpclient --version gpclient --version
+37 -4
View File
@@ -24,7 +24,8 @@ permissions:
contents: read contents: read
jobs: jobs:
aur: validate:
name: Validate AUR package
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: archlinux:base-devel container: archlinux:base-devel
defaults: defaults:
@@ -32,7 +33,6 @@ jobs:
shell: bash shell: bash
env: env:
AUR_PACKAGE_DIR: packaging/aur/globalprotect-openconnect-git AUR_PACKAGE_DIR: packaging/aur/globalprotect-openconnect-git
AUR_REPO: ssh://[email protected]/globalprotect-openconnect-git.git
steps: steps:
- name: Install checkout tools - name: Install checkout tools
run: pacman -Syu --noconfirm --needed git openssh run: pacman -Syu --noconfirm --needed git openssh
@@ -102,8 +102,42 @@ jobs:
cd "$AUR_PACKAGE_DIR" cd "$AUR_PACKAGE_DIR"
runuser -u builder -- makepkg --noconfirm --clean --cleanbuild runuser -u builder -- makepkg --noconfirm --clean --cleanbuild
- name: Configure SSH - name: Upload AUR package metadata
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }} if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }}
uses: actions/upload-artifact@v7
with:
name: aur-package-metadata
path: |
${{ env.AUR_PACKAGE_DIR }}/PKGBUILD
${{ env.AUR_PACKAGE_DIR }}/.SRCINFO
${{ env.AUR_PACKAGE_DIR }}/gp.install
if-no-files-found: error
include-hidden-files: true
overwrite: true
publish:
name: Publish to AUR
needs: validate
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }}
runs-on: ubuntu-latest
container: archlinux:base-devel
defaults:
run:
shell: bash
env:
AUR_PACKAGE_DIR: /tmp/aur-package
AUR_REPO: ssh://[email protected]/globalprotect-openconnect-git.git
steps:
- name: Install publish tools
run: pacman -Syu --noconfirm --needed git openssh
- name: Download AUR package metadata
uses: actions/download-artifact@v8
with:
name: aur-package-metadata
path: ${{ env.AUR_PACKAGE_DIR }}
- name: Configure SSH
env: env:
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
run: | run: |
@@ -118,7 +152,6 @@ jobs:
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org > ~/.ssh/known_hosts ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org > ~/.ssh/known_hosts
- name: Publish to AUR - name: Publish to AUR
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }}
env: env:
GIT_SSH_COMMAND: ssh -i /github/home/.ssh/aur -o UserKnownHostsFile=/github/home/.ssh/known_hosts -o StrictHostKeyChecking=yes GIT_SSH_COMMAND: ssh -i /github/home/.ssh/aur -o UserKnownHostsFile=/github/home/.ssh/known_hosts -o StrictHostKeyChecking=yes
run: | run: |
+80
View File
@@ -0,0 +1,80 @@
name: Publish COPR
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish'
required: true
revision:
description: 'Package revision'
type: string
required: true
default: "1"
permissions:
contents: read
jobs:
publish-copr:
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Install tools
run: dnf install -y copr-cli gh
- name: Check inputs
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
REVISION: ${{ inputs.revision }}
run: |
if [[ ! "$REVISION" =~ ^[1-9][0-9]*$ ]]; then
echo "Revision must be a positive integer" >&2
exit 1
fi
gh api "repos/${{ github.repository }}/git/ref/tags/$TAG" >/dev/null
- name: Download published spec
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
mkdir -p publish-copr
gh release download "$TAG" \
--repo "${{ github.repository }}" \
--pattern globalprotect-openconnect.spec \
--dir publish-copr
- name: Set package revision
env:
REVISION: ${{ inputs.revision }}
run: |
spec=publish-copr/globalprotect-openconnect.spec
if [[ "$(grep -c '^Release:' "$spec")" -ne 1 ]]; then
echo "Expected exactly one Release field in $spec" >&2
exit 1
fi
sed -Ei \
"s/^Release:[[:space:]]+.*/Release: ${REVISION}%{?dist}/" \
"$spec"
grep '^Release:' "$spec"
- name: Configure COPR authentication
env:
COPR_CONFIG: ${{ secrets.COPR_CONFIG }}
run: |
install -d -m 700 "$HOME/.config"
printf '%s\n' "$COPR_CONFIG" > "$HOME/.config/copr"
chmod 600 "$HOME/.config/copr"
- name: Build and publish COPR package
run: |
copr-cli build \
yuezk/globalprotect-openconnect \
publish-copr/globalprotect-openconnect.spec
+72
View File
@@ -0,0 +1,72 @@
name: Publish OBS
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish'
required: true
revision:
description: 'Package revision'
type: string
required: true
default: "1"
permissions:
contents: read
jobs:
publish-obs:
runs-on: ubuntu-latest
steps:
- name: Check inputs
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
REVISION: ${{ inputs.revision }}
run: |
if [[ ! "$REVISION" =~ ^[1-9][0-9]*$ ]]; then
echo "Revision must be a positive integer" >&2
exit 1
fi
gh api "repos/${{ github.repository }}/git/ref/tags/$TAG" >/dev/null
- name: Prepare OBS package
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
REVISION: ${{ inputs.revision }}
run: |
version="${TAG#v}"
archive="globalprotect-openconnect-${version}.offline.tar.gz"
source_dir="publish-obs/source/globalprotect-openconnect-${version}"
mkdir -p publish-obs/files publish-obs/source
gh release download "$TAG" \
--repo "${{ github.repository }}" \
--pattern "$archive" \
--dir publish-obs
tar -xzf "publish-obs/$archive" -C publish-obs/source
make -C "$source_dir" init-rpm \
REVISION="$REVISION" \
RPM_SOURCE='%{name}.tar.gz'
mv "publish-obs/$archive" \
publish-obs/files/globalprotect-openconnect.tar.gz
cp "$source_dir/.build/rpm/globalprotect-openconnect.spec" \
"$source_dir/.build/rpm/globalprotect-openconnect.changes" \
publish-obs/files/
- name: Publish OBS package
uses: yuezk/publish-obs-package@main
with:
project: home:yuezk
package: globalprotect-openconnect
username: yuezk
password: ${{ secrets.OBS_PASSWORD }}
files: ./publish-obs/files/*
commit_message: 'Release ${{ inputs.tag }}-${{ inputs.revision }}'
Generated
+4 -1
View File
@@ -219,19 +219,21 @@ dependencies = [
"anyhow", "anyhow",
"block2", "block2",
"browser-launcher", "browser-launcher",
"common",
"gpapi", "gpapi",
"html-escape", "html-escape",
"log", "log",
"objc2", "objc2",
"objc2-app-kit",
"objc2-foundation", "objc2-foundation",
"objc2-web-kit", "objc2-web-kit",
"regex", "regex",
"tauri", "tauri",
"tempfile",
"tiny_http", "tiny_http",
"tokio", "tokio",
"tokio-util", "tokio-util",
"uuid", "uuid",
"uzers",
"webkit2gtk", "webkit2gtk",
] ]
@@ -1964,6 +1966,7 @@ dependencies = [
"openconnect", "openconnect",
"serde", "serde",
"serde_json", "serde_json",
"sha256",
"tar", "tar",
"tempfile", "tempfile",
"thiserror 2.0.18", "thiserror 2.0.18",
+9 -5
View File
@@ -164,7 +164,6 @@ install:
install -Dm755 packaging/files/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook install -Dm755 packaging/files/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook
install -Dm644 packaging/files/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop install -Dm644 packaging/files/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop
install -Dm644 packaging/files/usr/share/applications/gpauth.desktop $(DESTDIR)/usr/share/applications/gpauth.desktop
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
install -Dm644 packaging/files/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png install -Dm644 packaging/files/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
install -Dm644 packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png install -Dm644 packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
@@ -251,8 +250,10 @@ package-openbsd: clean-bsd-package
cp packaging/bsd/openbsd/COMMENT .build/openbsd/+COMMENT cp packaging/bsd/openbsd/COMMENT .build/openbsd/+COMMENT
cp packaging/bsd/openbsd/DESC .build/openbsd/+DESC cp packaging/bsd/openbsd/DESC .build/openbsd/+DESC
{ \ { \
echo '@unexec-delete /bin/rm -f /var/db/gpclient/scripts/vpnc-script /var/db/gpclient/scripts/vpnc-script.metadata || echo "Warning: failed to remove the installed VPN script" >&2'; \ 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'; \ echo '@unexec-delete /bin/rmdir /var/db/gpclient/scripts 2>/dev/null || true'; \
echo '@unexec-delete /bin/rmdir /var/db/gpclient 2>/dev/null || true'; \
find .build/openbsd/pkgroot$(PREFIX) -type f -print | sed 's|^.build/openbsd/pkgroot$(PREFIX)/||' | sort; \ find .build/openbsd/pkgroot$(PREFIX) -type f -print | sed 's|^.build/openbsd/pkgroot$(PREFIX)/||' | sort; \
} > .build/openbsd/PLIST } > .build/openbsd/PLIST
comment=$$(cat .build/openbsd/+COMMENT); \ comment=$$(cat .build/openbsd/+COMMENT); \
@@ -260,6 +261,7 @@ package-openbsd: clean-bsd-package
gnome_keyring_pkg=$$(pkg_info -e 'gnome-keyring-*' | sed 's/^inst://' | head -n 1); \ gnome_keyring_pkg=$$(pkg_info -e 'gnome-keyring-*' | sed 's/^inst://' | head -n 1); \
polkit_pkg=$$(pkg_info -e 'polkit-*' | sed 's/^inst://' | head -n 1); \ polkit_pkg=$$(pkg_info -e 'polkit-*' | sed 's/^inst://' | head -n 1); \
webkitgtk_pkg=$$(pkg_info -e 'webkitgtk41-*' | sed 's/^inst://' | head -n 1); \ webkitgtk_pkg=$$(pkg_info -e 'webkitgtk41-*' | sed 's/^inst://' | head -n 1); \
xdg_utils_pkg=$$(pkg_info -e 'xdg-utils-*' | sed 's/^inst://' | head -n 1); \
pkg_create \ pkg_create \
-B .build/openbsd/pkgroot \ -B .build/openbsd/pkgroot \
-D COMMENT="$$comment" \ -D COMMENT="$$comment" \
@@ -269,6 +271,7 @@ package-openbsd: clean-bsd-package
-P x11/gnome/keyring:gnome-keyring-*:$$gnome_keyring_pkg \ -P x11/gnome/keyring:gnome-keyring-*:$$gnome_keyring_pkg \
-P sysutils/polkit:polkit-*:$$polkit_pkg \ -P sysutils/polkit:polkit-*:$$polkit_pkg \
-P www/webkitgtk4,webkitgtk41:webkitgtk41-*:$$webkitgtk_pkg \ -P www/webkitgtk4,webkitgtk41:webkitgtk41-*:$$webkitgtk_pkg \
-P devel/xdg-utils:xdg-utils-*:$$xdg_utils_pkg \
.build/openbsd/artifacts/$(PKG_NAME)-$(VERSION)-openbsd-$$openbsd_arch.tgz .build/openbsd/artifacts/$(PKG_NAME)-$(VERSION)-openbsd-$$openbsd_arch.tgz
$(MAKE) bsd-gpgui-tarball BSD_FLAVOR=openbsd GPGUI_BINARY="$(GPGUI_BINARY)" $(MAKE) bsd-gpgui-tarball BSD_FLAVOR=openbsd GPGUI_BINARY="$(GPGUI_BINARY)"
@@ -289,7 +292,6 @@ uninstall:
rm -f $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook rm -f $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook
rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop
rm -f $(DESTDIR)/usr/share/applications/gpauth.desktop
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
rm -f $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
@@ -297,10 +299,12 @@ uninstall:
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \ rm -f $(DESTDIR)/var/lib/gpclient/gpgui \
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \ $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true
rmdir $(DESTDIR)/var/lib/gpclient 2>/dev/null || true
clean-debian: clean-debian:
rm -rf .build/deb rm -rf .build/deb
+13 -3
View File
@@ -56,12 +56,16 @@ Commands:
connect Connect to a portal server connect Connect to a portal server
disconnect Disconnect from the server disconnect Disconnect from the server
launch-gui Launch the GUI launch-gui Launch the GUI
hip Generate HIP report
help Print this message or the help of the given subcommand(s) help Print this message or the help of the given subcommand(s)
Options: Options:
--fix-openssl Get around the OpenSSL 'unsafe legacy renegotiation' error --fix-openssl Uses extended compatibility mode for OpenSSL operations to support a broader range of systems and formats.
--ignore-tls-errors Ignore TLS errors --ignore-tls-errors Ignore the TLS errors
-h, --help Print help --log-format <LOG_FORMAT> Log output format. JSON is intended for non-interactive consumers; interactive prompts remain text. [default: text] [possible values: text, json]
-v, --verbose... Enable verbose output, -v for debug, -vv for trace
-q, --quiet... Decrease logging verbosity, -q for warnings, -qq for errors
-h, --help Print help (see more with '--help')
-V, --version Print version -V, --version Print version
``` ```
@@ -313,6 +317,12 @@ docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \
connect <portal> --browser remote connect <portal> --browser remote
``` ```
On a host with multiple network interfaces, use `--browser-listen` to select the IP address reachable from the browser machine:
```bash
gpclient connect <portal> --browser remote --browser-listen 192.168.107.15
```
On a Linux host, add host networking if the VPN routes should affect the host network namespace: On a Linux host, add host networking if the VPN routes should affect the host network namespace:
```bash ```bash
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSUIElement</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>GlobalProtect authentication callback</string>
<key>CFBundleURLSchemes</key>
<array>
<string>globalprotectcallback</string>
</array>
</dict>
</array>
</dict>
</plist>
+58
View File
@@ -0,0 +1,58 @@
use std::{
sync::{
Arc,
atomic::{AtomicBool, Ordering},
},
time::Duration,
};
use tauri::RunEvent;
pub fn run() -> anyhow::Result<()> {
let handled = Arc::new(AtomicBool::new(false));
let timeout_handled = Arc::clone(&handled);
let app = tauri::Builder::default()
.setup(move |app| {
#[cfg(target_os = "macos")]
app.set_activation_policy(tauri::ActivationPolicy::Accessory);
let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
tokio::time::sleep(Duration::from_secs(10)).await;
if !timeout_handled.swap(true, Ordering::AcqRel) {
app_handle.exit(1);
}
});
Ok(())
})
.build(crate::tauri_context::get())?;
app.run(move |app_handle, event| {
let RunEvent::Opened { urls } = event else {
return;
};
let Some(callback) = urls
.into_iter()
.find(|url| url.scheme().eq_ignore_ascii_case("globalprotectcallback"))
else {
return;
};
if handled.swap(true, Ordering::AcqRel) {
return;
}
let app_handle = app_handle.clone();
tauri::async_runtime::spawn(async move {
let exit_code = match auth::forward_auth_callback(callback.as_str()).await {
Ok(()) => 0,
Err(err) => {
eprintln!("Failed to forward authentication callback: {err}");
1
}
};
app_handle.exit(exit_code);
});
});
Ok(())
}
+112 -9
View File
@@ -1,16 +1,22 @@
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use auth::forward_auth_callback;
use auth::{BrowserAuthenticator, auth_prelogin}; use auth::{BrowserAuthenticator, auth_prelogin};
use clap::Parser; use clap::Parser;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use clap::Subcommand;
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
use gpapi::auth::AuthWindowTheme; use gpapi::auth::AuthWindowTheme;
use gpapi::{ use gpapi::{
auth::{AuthenticationCancelled, SamlAuthData, SamlAuthResult}, auth::{AuthenticationCancelled, SamlAuthData, SamlAuthResult},
clap::{Args, InfoLevelVerbosity, args::Os, handle_error}, clap::{Args, InfoLevelVerbosity, args::Os, handle_error},
gp_params::GpParams, gp_params::GpParams,
log_format::LogFormat,
os_profile::{ClientOs, OsProfile}, os_profile::{ClientOs, OsProfile},
utils::{normalize_server, openssl}, utils::{normalize_server, openssl},
}; };
use log::info; use log::info;
use serde_json::json; use serde_json::json;
use std::net::IpAddr;
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
const VERSION: &str = concat!( const VERSION: &str = concat!(
@@ -27,6 +33,8 @@ const VERSION: &str = concat!(
version = VERSION, version = VERSION,
author, author,
about = "The authentication component for the GlobalProtect VPN client, supports the SSO authentication method.", about = "The authentication component for the GlobalProtect VPN client, supports the SSO authentication method.",
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true,
help_template = "\ help_template = "\
{before-help}{name} {version} {before-help}{name} {version}
{author} {author}
@@ -41,8 +49,12 @@ See 'gpauth -h' for more information.
" "
)] )]
struct Cli { struct Cli {
#[arg(help = "The portal server to authenticate")] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
server: String, #[command(subcommand)]
command: Option<CliCommand>,
#[arg(required = true, help = "The portal server to authenticate")]
server: Option<String>,
#[arg(long, help = "Treating the server as a gateway")] #[arg(long, help = "Treating the server as a gateway")]
gateway: bool, gateway: bool,
@@ -78,18 +90,29 @@ struct Cli {
#[arg(long, help = "Ignore TLS errors")] #[arg(long, help = "Ignore TLS errors")]
ignore_tls_errors: bool, ignore_tls_errors: bool,
#[arg(
long,
value_enum,
default_value_t = LogFormat::Text,
help = "Log output format. JSON is intended for non-interactive consumers; interactive prompts remain text."
)]
log_format: LogFormat,
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
#[arg(long, help = "Use the default browser for authentication")] #[arg(long, help = "Use the default browser for authentication")]
default_browser: bool, default_browser: bool,
#[arg( #[arg(
long, long,
help = "Use external browser authentication. With no value, auto-select Chrome, Firefox, then system default. Use `default` for the system default browser.", help = "Use external browser authentication. With no value, auto-select Chrome, Firefox, then system default. Use `default` for the system default browser or `remote` for headless servers.",
default_missing_value = "auto", default_missing_value = "auto",
num_args=0..=1 num_args=0..=1
)] )]
browser: Option<String>, browser: Option<String>,
#[arg(long, help = "Listen on this IP address when using '--browser remote'")]
browser_listen: Option<IpAddr>,
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
#[arg(long, help = "The HiDPI mode, useful for high-resolution screens")] #[arg(long, help = "The HiDPI mode, useful for high-resolution screens")]
hidpi: bool, hidpi: bool,
@@ -110,6 +133,16 @@ struct Cli {
verbose: InfoLevelVerbosity, verbose: InfoLevelVerbosity,
} }
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
#[derive(Subcommand)]
enum CliCommand {
#[command(hide = true)]
AuthCallback {
#[arg(help = "The globalprotectcallback URL to forward")]
callback: String,
},
}
impl Args for Cli { impl Args for Cli {
fn fix_openssl(&self) -> bool { fn fix_openssl(&self) -> bool {
self.fix_openssl self.fix_openssl
@@ -118,6 +151,10 @@ impl Args for Cli {
fn ignore_tls_errors(&self) -> bool { fn ignore_tls_errors(&self) -> bool {
self.ignore_tls_errors self.ignore_tls_errors
} }
fn log_format(&self) -> LogFormat {
self.log_format
}
} }
impl Cli { impl Cli {
@@ -136,13 +173,19 @@ impl Cli {
} }
async fn run(&self) -> anyhow::Result<()> { 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("remote"))
{
anyhow::bail!("The '--browser-listen' option requires '--browser remote'");
}
if self.ignore_tls_errors { if self.ignore_tls_errors {
info!("TLS errors will be ignored"); info!("TLS errors will be ignored");
} }
let openssl_conf = self.prepare_env()?; let openssl_conf = self.prepare_env()?;
let server = normalize_server(&self.server)?; let server = normalize_server(self.server.as_deref().expect("server is required for authentication"))?;
let gp_params = self.build_gp_params(); let gp_params = self.build_gp_params();
info!( info!(
"gpauth auth host-id: {}", "gpauth auth host-id: {}",
@@ -165,7 +208,7 @@ impl Cli {
if let Some(browser) = browser { if let Some(browser) = browser {
let auth_host_id = gp_params.os_profile().host_identity().host_id().to_string(); let auth_host_id = gp_params.os_profile().host_identity().host_id().to_string();
let authenticator = BrowserAuthenticator::new(&auth_request, browser); let authenticator = BrowserAuthenticator::new(&auth_request, browser, self.browser_listen);
let auth_result = authenticator.authenticate().await; let auth_result = authenticator.authenticate().await;
print_auth_result(auth_result, Some(&auth_host_id)); print_auth_result(auth_result, Some(&auth_host_id));
@@ -225,16 +268,26 @@ impl Cli {
} }
fn init_logger(cli: &Cli) { fn init_logger(cli: &Cli) {
if let Some(level) = cli.verbose.log_level_filter().to_level() { let Some(level) = cli.verbose.log_level_filter().to_level() else {
gpapi::logger::init(level, "com.yuezk.gpgui", "gpauth");
} else {
log::set_max_level(log::LevelFilter::Off); log::set_max_level(log::LevelFilter::Off);
} return;
};
gpapi::logger::init(level, "com.yuezk.gpgui", "gpauth", cli.log_format);
} }
pub async fn run() { pub async fn run() {
let cli = Cli::parse(); let cli = Cli::parse();
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
if let Some(CliCommand::AuthCallback { callback }) = &cli.command {
if let Err(err) = forward_auth_callback(callback).await {
eprintln!("Failed to forward authentication callback: {err}");
std::process::exit(1);
}
return;
}
init_logger(&cli); init_logger(&cli);
info!("gpauth started: {}", VERSION); info!("gpauth started: {}", VERSION);
@@ -264,6 +317,24 @@ pub fn print_auth_result(auth_result: anyhow::Result<SamlAuthData>, host_id: Opt
mod tests { mod tests {
use super::*; use super::*;
/// gpauth's own result already goes to stdout as JSON; this makes its *logs*
/// readable the same way, so a caller driving it does not have to parse prose
/// on stderr to find out why an attempt failed.
#[test]
fn log_format_defaults_to_text() {
let cli = Cli::try_parse_from(["gpauth", "portal.example.com"]).expect("gpauth args should parse");
assert_eq!(cli.log_format, LogFormat::Text);
}
#[test]
fn log_format_accepts_json() {
let cli =
Cli::try_parse_from(["gpauth", "portal.example.com", "--log-format", "json"]).expect("gpauth args should parse");
assert_eq!(cli.log_format, LogFormat::Json);
}
#[test] #[test]
fn os_defaults_to_runtime_os() { fn os_defaults_to_runtime_os() {
let cli = Cli::try_parse_from(["gpauth", "portal.example.com"]).expect("gpauth args should parse"); let cli = Cli::try_parse_from(["gpauth", "portal.example.com"]).expect("gpauth args should parse");
@@ -271,6 +342,23 @@ mod tests {
assert_eq!(cli.os, Os::default()); assert_eq!(cli.os, Os::default());
} }
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn callback_arguments_parse_separately() {
let cli = Cli::try_parse_from([
"gpauth",
"auth-callback",
"globalprotectcallback:cas-as=1&[email protected]&token=token",
])
.unwrap();
assert!(matches!(
cli.command,
Some(CliCommand::AuthCallback { callback }) if callback.starts_with("globalprotectcallback:")
));
assert!(cli.server.is_none());
}
#[test] #[test]
fn host_id_arg_sets_profile_host_id_seed() { fn host_id_arg_sets_profile_host_id_seed() {
let cli = Cli::try_parse_from(["gpauth", "portal.example.com", "--host-id", "host-seed"]) let cli = Cli::try_parse_from(["gpauth", "portal.example.com", "--host-id", "host-seed"])
@@ -305,6 +393,21 @@ mod tests {
assert!(cli.external_browser_requested()); assert!(cli.external_browser_requested());
} }
#[test]
fn browser_listen_accepts_ip_address() {
let cli = Cli::try_parse_from([
"gpauth",
"portal.example.com",
"--browser",
"remote",
"--browser-listen",
"192.168.107.15",
])
.expect("gpauth args should parse");
assert_eq!(cli.browser_listen, Some("192.168.107.15".parse().unwrap()));
}
#[test] #[test]
fn client_version_arg_sets_profile_client_version() { fn client_version_arg_sets_profile_client_version() {
let cli = Cli::try_parse_from(["gpauth", "portal.example.com", "--client-version", "legacy-client"]) let cli = Cli::try_parse_from(["gpauth", "portal.example.com", "--client-version", "legacy-client"])
+24
View File
@@ -2,10 +2,34 @@
mod cli; mod cli;
#[cfg(all(target_os = "macos", feature = "webview-auth"))]
mod callback_app;
#[cfg(feature = "webview-auth")]
mod tauri_context;
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
mod webview_auth; mod webview_auth;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
#[cfg(all(target_os = "macos", feature = "webview-auth"))]
if is_callback_app_launch() {
if let Err(err) = callback_app::run() {
eprintln!("Failed to handle authentication callback: {err}");
}
return;
}
cli::run().await; cli::run().await;
} }
#[cfg(all(target_os = "macos", feature = "webview-auth"))]
fn is_callback_app_launch() -> bool {
std::env::args_os().len() == 1
&& std::env::current_exe().is_ok_and(|executable| {
executable
.ancestors()
.any(|path| path.extension().is_some_and(|extension| extension == "app"))
})
}
+3
View File
@@ -0,0 +1,3 @@
pub fn get() -> tauri::Context<tauri::Wry> {
tauri::generate_context!()
}
+4 -1
View File
@@ -19,6 +19,9 @@ pub async fn authenticate(
tauri::Builder::default() tauri::Builder::default()
.setup(move |app| { .setup(move |app| {
#[cfg(target_os = "macos")]
app.set_activation_policy(tauri::ActivationPolicy::Accessory);
apply_auth_theme(app.handle(), window_theme); apply_auth_theme(app.handle(), window_theme);
let app_handle = app.handle().clone(); let app_handle = app.handle().clone();
@@ -39,7 +42,7 @@ pub async fn authenticate(
Ok(()) Ok(())
}) })
.build(tauri::generate_context!())? .build(crate::tauri_context::get())?
.run(move |_app_handle, event| { .run(move |_app_handle, event| {
if let RunEvent::Exit = event { if let RunEvent::Exit = event {
if let Some(file) = openssl_conf.take() { if let Some(file) = openssl_conf.take() {
+168 -15
View File
@@ -1,6 +1,4 @@
use std::{ use std::{
env::temp_dir,
fs::File,
path::{Path, PathBuf}, path::{Path, PathBuf},
str::FromStr, str::FromStr,
}; };
@@ -9,6 +7,7 @@ use anyhow::bail;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use gpapi::{ use gpapi::{
clap::{Args, InfoLevelVerbosity, handle_error}, clap::{Args, InfoLevelVerbosity, handle_error},
log_format::{LogFormat, write_json_record},
utils::openssl, utils::openssl,
}; };
use log::info; use log::info;
@@ -38,6 +37,7 @@ pub(crate) struct SharedArgs<'a> {
pub(crate) ignore_tls_errors: bool, pub(crate) ignore_tls_errors: bool,
pub(crate) lock_file: &'a Path, pub(crate) lock_file: &'a Path,
pub(crate) verbose: &'a InfoLevelVerbosity, pub(crate) verbose: &'a InfoLevelVerbosity,
pub(crate) log_format: LogFormat,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
@@ -89,6 +89,14 @@ struct Cli {
)] )]
lock_file: PathBuf, lock_file: PathBuf,
#[arg(
long,
value_enum,
default_value_t = LogFormat::Text,
help = "Log output format. JSON is intended for non-interactive consumers; interactive prompts remain text."
)]
log_format: LogFormat,
#[command(flatten)] #[command(flatten)]
verbose: InfoLevelVerbosity, verbose: InfoLevelVerbosity,
} }
@@ -101,9 +109,21 @@ impl Args for Cli {
fn ignore_tls_errors(&self) -> bool { fn ignore_tls_errors(&self) -> bool {
self.ignore_tls_errors self.ignore_tls_errors
} }
fn log_format(&self) -> LogFormat {
self.log_format
}
} }
impl Cli { impl Cli {
fn can_run_alongside_client(&self) -> bool {
match &self.command {
CliCommand::Disconnect(_) => true,
CliCommand::LaunchGui(args) => args.is_auth_callback(),
_ => false,
}
}
async fn is_running(&self) -> bool { async fn is_running(&self) -> bool {
let Ok(c) = fs::read_to_string(&self.lock_file).await else { let Ok(c) = fs::read_to_string(&self.lock_file).await else {
return false; return false;
@@ -134,7 +154,7 @@ impl Cli {
async fn run(&self) -> anyhow::Result<()> { async fn run(&self) -> anyhow::Result<()> {
// check if an instance is running // check if an instance is running
if !matches!(self.command, CliCommand::Disconnect(_)) && self.is_running().await { if !self.can_run_alongside_client() && self.is_running().await {
bail!("Another instance of the client is already running"); bail!("Another instance of the client is already running");
} }
@@ -146,6 +166,7 @@ impl Cli {
ignore_tls_errors: self.ignore_tls_errors, ignore_tls_errors: self.ignore_tls_errors,
lock_file: &self.lock_file, lock_file: &self.lock_file,
verbose: &self.verbose, verbose: &self.verbose,
log_format: self.log_format,
}; };
if self.ignore_tls_errors { if self.ignore_tls_errors {
@@ -161,28 +182,23 @@ impl Cli {
} }
} }
fn init_logger(cli: &Cli) { fn build_logger(cli: &Cli) -> env_logger::Builder {
let mut builder = env_logger::builder(); let mut builder = env_logger::builder();
builder.filter_level(cli.verbose.log_level_filter()); builder.filter_level(cli.verbose.log_level_filter());
// Output the log messages to a file if the command is the auth callback // Text is env_logger's own format, so leave it untouched rather than
if let CliCommand::LaunchGui(args) = &cli.command { // reimplementing it.
let auth_data = args.auth_data.as_deref().unwrap_or_default(); if cli.log_format == LogFormat::Json {
if !auth_data.is_empty() builder.format(write_json_record);
&& let Ok(log_file) = File::create(temp_dir().join("gpcallback.log"))
{
let target = Box::new(log_file);
builder.target(env_logger::Target::Pipe(target));
}
} }
builder.init(); builder
} }
pub(crate) async fn run() { pub(crate) async fn run() {
let cli = Cli::parse(); let cli = Cli::parse();
init_logger(&cli); build_logger(&cli).init();
info!("gpclient started: {}", VERSION); info!("gpclient started: {}", VERSION);
@@ -194,6 +210,13 @@ pub(crate) async fn run() {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::{
io::Write,
sync::{Arc, Mutex},
};
use log::Log;
use super::*; use super::*;
#[test] #[test]
@@ -216,4 +239,134 @@ mod tests {
assert_eq!(cli.lock_file, PathBuf::from("/tmp/gpclient-portal.lock")); assert_eq!(cli.lock_file, PathBuf::from("/tmp/gpclient-portal.lock"));
} }
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn launch_gui_accepts_auth_callback() {
let cli = Cli::try_parse_from([
"gpclient",
"launch-gui",
"globalprotectcallback:cas-as=1&[email protected]&token=token",
])
.expect("authentication callback should parse");
assert!(matches!(
&cli.command,
CliCommand::LaunchGui(args) if args.is_auth_callback()
));
assert!(cli.can_run_alongside_client());
}
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn launch_gui_rejects_callback_with_minimized() {
assert!(Cli::try_parse_from(["gpclient", "launch-gui", "globalprotectcallback:token", "--minimized",]).is_err());
}
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn launch_gui_rejects_non_callback_positional() {
assert!(Cli::try_parse_from(["gpclient", "launch-gui", "https://example.com/callback"]).is_err());
}
fn parse_cli(args: &[&str]) -> Cli {
Cli::try_parse_from(args).expect("arguments should parse")
}
/// Text stays the default: a plain `gpclient connect` must keep the output it
/// has always had, or every existing user's terminal changes under them.
#[test]
fn log_format_defaults_to_text() {
assert_eq!(parse_cli(&["gpclient", "disconnect"]).log_format, LogFormat::Text);
}
#[test]
fn log_format_accepts_json() {
assert_eq!(
parse_cli(&["gpclient", "--log-format", "json", "disconnect"]).log_format,
LogFormat::Json
);
}
/// An unknown value is a mistake worth reporting rather than silently
/// falling back to text, which would leave a caller parsing prose.
#[test]
fn log_format_rejects_an_unknown_value() {
// `.err()` rather than `unwrap_err()`: the Ok side is `Cli`, which is not
// `Debug`, and it is not worth deriving it just to print an error we expect.
let err = Cli::try_parse_from(["gpclient", "--log-format", "yaml", "disconnect"])
.err()
.expect("an unknown log format should be rejected");
let msg = err.to_string();
assert!(msg.contains("yaml"), "error should name the input: {msg}");
assert!(msg.contains("json"), "error should list the valid values: {msg}");
}
/// A `Write` that keeps what was written, so the logger can be driven for
/// real instead of asserting on how it was configured.
#[derive(Clone, Default)]
struct Captured(Arc<Mutex<Vec<u8>>>);
impl Captured {
fn contents(&self) -> String {
String::from_utf8(self.0.lock().unwrap().clone()).expect("log output should be UTF-8")
}
}
impl Write for Captured {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.0.lock().unwrap().extend_from_slice(buf);
Ok(buf.len())
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}
fn log_one_record(args: &[&str]) -> String {
let captured = Captured::default();
let logger = build_logger(&parse_cli(args))
.target(env_logger::Target::Pipe(Box::new(captured.clone())))
.build();
// Drive the logger directly: `init()` installs a global that a second test
// could not replace.
logger.log(
&log::Record::builder()
.level(log::Level::Info)
.target("gpclient")
.args(format_args!("connected to {}", "vpn.example.com"))
.build(),
);
logger.flush();
captured.contents()
}
/// The point of the flag: with `json`, a caller gets fields, and gets them one
/// record per line so the stream can be read incrementally.
#[test]
fn json_format_emits_one_json_object_per_record() {
let out = log_one_record(&["gpclient", "--log-format", "json", "disconnect"]);
let lines: Vec<_> = out.lines().collect();
assert_eq!(lines.len(), 1, "expected exactly one line, got: {out:?}");
let v: serde_json::Value = serde_json::from_str(lines[0]).unwrap_or_else(|e| panic!("not JSON: {out:?} ({e})"));
assert_eq!(v["level"], "INFO");
assert_eq!(v["target"], "gpclient");
assert_eq!(v["message"], "connected to vpn.example.com");
}
#[test]
fn text_format_is_left_alone() {
let out = log_one_record(&["gpclient", "disconnect"]);
assert!(out.contains("connected to vpn.example.com"), "message missing: {out:?}");
assert!(
serde_json::from_str::<serde_json::Value>(out.trim()).is_err(),
"text output should not be JSON: {out:?}"
);
}
} }
+21 -1
View File
@@ -6,7 +6,7 @@ use gpapi::{
os_profile::{ClientOs, OsProfile}, os_profile::{ClientOs, OsProfile},
}; };
use log::warn; use log::warn;
use std::path::PathBuf; use std::{net::IpAddr, path::PathBuf};
#[derive(Args)] #[derive(Args)]
pub(crate) struct ConnectArgs { pub(crate) struct ConnectArgs {
@@ -146,6 +146,9 @@ pub(crate) struct ConnectArgs {
num_args=0..=1 num_args=0..=1
)] )]
pub(super) browser: Option<String>, pub(super) browser: Option<String>,
#[arg(long, help = "Listen on this IP address when using '--browser remote'")]
pub(super) browser_listen: Option<IpAddr>,
} }
pub(super) fn build_os_profile(args: &ConnectArgs) -> OsProfile { pub(super) fn build_os_profile(args: &ConnectArgs) -> OsProfile {
@@ -263,6 +266,23 @@ mod tests {
assert_eq!(cli.args.browser.as_deref(), Some("default")); assert_eq!(cli.args.browser.as_deref(), Some("default"));
} }
#[test]
fn browser_listen_accepts_ip_address() {
use clap::Parser;
let cli = ConnectArgsTestCli::try_parse_from([
"test",
"portal.example.com",
"--browser",
"remote",
"--browser-listen",
"192.168.107.15",
])
.expect("connect args should parse");
assert_eq!(cli.args.browser_listen, Some("192.168.107.15".parse().unwrap()));
}
#[test] #[test]
fn os_defaults_to_runtime_os() { fn os_defaults_to_runtime_os() {
use clap::Parser; use clap::Parser;
+2
View File
@@ -85,6 +85,8 @@ impl ConnectHandler<'_> {
.sslkey(self.args.sslkey.as_deref()) .sslkey(self.args.sslkey.as_deref())
.key_password(key_password.as_deref()) .key_password(key_password.as_deref())
.browser(browser) .browser(browser)
.browser_listen(self.args.browser_listen)
.log_format(self.shared_args.log_format)
.verbose(verbose); .verbose(verbose);
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
+20 -6
View File
@@ -8,6 +8,7 @@ use std::{
}; };
use gpapi::{ use gpapi::{
clap::report,
cookie_store, cookie_store,
credential::{AuthCookieCredential, Credential}, credential::{AuthCookieCredential, Credential},
gateway::{GatewayLogin, GatewayLoginContext, SessionExtensionAuth, gateway_login, gateway_login_with_context}, gateway::{GatewayLogin, GatewayLoginContext, SessionExtensionAuth, gateway_login, gateway_login_with_context},
@@ -18,7 +19,7 @@ use gpapi::{
utils::shutdown_signal, utils::shutdown_signal,
}; };
use inquire::Text; use inquire::Text;
use log::{info, warn}; use log::{Level, info, warn};
use openconnect::{Vpn, VpnBuilder}; use openconnect::{Vpn, VpnBuilder};
use tokio::{runtime::Handle, task::JoinHandle}; use tokio::{runtime::Handle, task::JoinHandle};
@@ -281,9 +282,22 @@ impl ConnectHandler<'_> {
return; return;
} }
eprintln!("\nNOTE: Gateway authentication failed after portal login."); let format = self.shared_args.log_format;
eprintln!("NOTE: If this server also accepts direct gateway login, try:"); report(
eprintln!("NOTE: {}", direct_gateway_command(gateway)); format,
Level::Warn,
"\nNOTE: Gateway authentication failed after portal login.",
);
report(
format,
Level::Warn,
"NOTE: If this server also accepts direct gateway login, try:",
);
report(
format,
Level::Warn,
&format!("NOTE: {}", direct_gateway_command(gateway)),
);
} }
async fn login_gateway( async fn login_gateway(
@@ -386,7 +400,7 @@ impl ConnectHandler<'_> {
let lock_file = self.shared_args.lock_file.to_path_buf(); let lock_file = self.shared_args.lock_file.to_path_buf();
let lock_file_on_connect = lock_file.clone(); let lock_file_on_connect = lock_file.clone();
let log_format = self.shared_args.log_format;
let connect_result = vpn.connect(move |vpn_session_info| { let connect_result = vpn.connect(move |vpn_session_info| {
tunnel_established_on_connect.store(true, Ordering::SeqCst); tunnel_established_on_connect.store(true, Ordering::SeqCst);
write_pid_file(&lock_file_on_connect); write_pid_file(&lock_file_on_connect);
@@ -397,7 +411,7 @@ impl ConnectHandler<'_> {
let session_info = session_info_from_vpn(vpn_session_info, allow_extend_session); let session_info = session_info_from_vpn(vpn_session_info, allow_extend_session);
info!("VPN session info: {}", session_info.log_summary()); info!("VPN session info: {}", session_info.log_summary());
let task = spawn_session_runtime_with_info(&runtime_handle, session_ctx, session_info); let task = spawn_session_runtime_with_info(&runtime_handle, session_ctx, session_info, log_format);
session_task_on_connect.lock().unwrap().replace(task); session_task_on_connect.lock().unwrap().replace(task);
}); });
let tunnel_established = tunnel_established.load(Ordering::SeqCst); let tunnel_established = tunnel_established.load(Ordering::SeqCst);
+30 -5
View File
@@ -6,6 +6,7 @@ use std::cell::RefCell;
use anyhow::bail; use anyhow::bail;
use gpapi::{ use gpapi::{
clap::report,
error::PortalError, error::PortalError,
gateway::{GatewayLoginContext, GatewaySelection}, gateway::{GatewayLoginContext, GatewaySelection},
gp_params::GpParams, gp_params::GpParams,
@@ -14,7 +15,7 @@ use gpapi::{
utils::request::RequestIdentityError, utils::request::RequestIdentityError,
}; };
use inquire::{Password, PasswordDisplayMode, Select}; use inquire::{Password, PasswordDisplayMode, Select};
use log::{info, warn}; use log::{Level, info, warn};
use crate::cli::SharedArgs; use crate::cli::SharedArgs;
@@ -92,6 +93,12 @@ impl<'a> ConnectHandler<'a> {
} }
pub(crate) async fn handle(&self) -> anyhow::Result<()> { pub(crate) async fn handle(&self) -> anyhow::Result<()> {
if self.args.browser_listen.is_some()
&& !matches!(self.args.browser.as_deref(), Some(browser) if browser.eq_ignore_ascii_case("remote"))
{
bail!("The '--browser-listen' option requires '--browser remote'");
}
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
if self.args.default_browser && self.args.browser.is_some() { if self.args.default_browser && self.args.browser.is_some() {
bail!("Cannot use `--default-browser` and `--browser` options at the same time"); bail!("Cannot use `--default-browser` and `--browser` options at the same time");
@@ -110,8 +117,17 @@ impl<'a> ConnectHandler<'a> {
match root_cause { match root_cause {
RequestIdentityError::NoKey => { RequestIdentityError::NoKey => {
eprintln!("ERROR: No private key found in the certificate file"); let format = self.shared_args.log_format;
eprintln!("ERROR: Please provide the private key file using the `-k` option"); report(
format,
Level::Error,
"ERROR: No private key found in the certificate file",
);
report(
format,
Level::Error,
"ERROR: Please provide the private key file using the `-k` option",
);
return Ok(()); return Ok(());
} }
RequestIdentityError::NoPassphrase(cert_type) | RequestIdentityError::DecryptError(cert_type) => { RequestIdentityError::NoPassphrase(cert_type) | RequestIdentityError::DecryptError(cert_type) => {
@@ -153,8 +169,17 @@ impl<'a> ConnectHandler<'a> {
info!("Trying the gateway authentication workflow..."); info!("Trying the gateway authentication workflow...");
self.connect_gateway_with_prelogin(server, server, false, None).await?; self.connect_gateway_with_prelogin(server, server, false, None).await?;
eprintln!("\nNOTE: the server may be a gateway, not a portal."); let format = self.shared_args.log_format;
eprintln!("NOTE: try to use the `--as-gateway` option if you were authenticated twice."); report(
format,
Level::Warn,
"\nNOTE: the server may be a gateway, not a portal.",
);
report(
format,
Level::Warn,
"NOTE: try to use the `--as-gateway` option if you were authenticated twice.",
);
Ok(()) Ok(())
} else { } else {
+86 -23
View File
@@ -1,26 +1,48 @@
use std::{collections::HashMap, env::temp_dir, fs, path::PathBuf}; use std::{collections::HashMap, fs, path::PathBuf};
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
use std::process::{Command, ExitStatus};
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use anyhow::Context;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
use anyhow::bail;
use clap::Args; use clap::Args;
use common::constants::GP_CALLBACK_PORT_FILENAME; #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
use common::binary_paths;
use directories::ProjectDirs; use directories::ProjectDirs;
use gpapi::{ use gpapi::{
process::service_launcher::ServiceLauncher, process::service_launcher::ServiceLauncher,
utils::{endpoint::http_endpoint, env_utils, shutdown_signal}, utils::{endpoint::http_endpoint, env_utils, shutdown_signal},
}; };
use log::info; use log::info;
use tokio::io::AsyncWriteExt;
#[derive(Args)] #[derive(Args)]
pub(crate) struct LaunchGuiArgs { pub(crate) struct LaunchGuiArgs {
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
#[arg( #[arg(
required = false, required = false,
help = "The authentication data, used for the default browser authentication" conflicts_with = "minimized",
value_parser = parse_auth_callback,
help = "The external-browser authentication callback URL"
)] )]
pub auth_data: Option<String>, callback: Option<String>,
#[arg(long, help = "Launch the GUI minimized")] #[arg(long, help = "Launch the GUI minimized")]
minimized: bool, minimized: bool,
} }
impl LaunchGuiArgs {
pub(crate) fn is_auth_callback(&self) -> bool {
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
{
return self.callback.is_some();
}
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
false
}
}
pub(crate) struct LaunchGuiHandler<'a> { pub(crate) struct LaunchGuiHandler<'a> {
args: &'a LaunchGuiArgs, args: &'a LaunchGuiArgs,
} }
@@ -37,11 +59,9 @@ impl<'a> LaunchGuiHandler<'a> {
anyhow::bail!("`launch-gui` cannot be run as root"); anyhow::bail!("`launch-gui` cannot be run as root");
} }
let auth_data = self.args.auth_data.as_deref().unwrap_or_default(); #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
if !auth_data.is_empty() { if let Some(callback) = &self.args.callback {
info!("Received auth callback data"); return forward_auth_callback(callback);
// Process the authentication data, its format is `globalprotectcallback:<data>`
return feed_auth_data(auth_data).await;
} }
if try_active_gui().await.is_ok() { if try_active_gui().await.is_ok() {
@@ -80,24 +100,36 @@ impl<'a> LaunchGuiHandler<'a> {
} }
} }
async fn feed_auth_data(auth_data: &str) -> anyhow::Result<()> { #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
if let Err(err) = feed_auth_data_cli(auth_data).await { fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
info!("Failed to feed auth data to the CLI: {}", err); let status = auth_callback_command(callback)
.status()
.context("Failed to start the authentication callback handler")?;
ensure_auth_callback_succeeded(status)
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
fn auth_callback_command(callback: &str) -> Command {
let mut command = Command::new(binary_paths::gpauth());
command.args(["auth-callback", callback]);
command
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
fn ensure_auth_callback_succeeded(status: ExitStatus) -> anyhow::Result<()> {
if !status.success() {
bail!("Authentication callback handler exited with {status}");
} }
Ok(()) Ok(())
} }
async fn feed_auth_data_cli(auth_data: &str) -> anyhow::Result<()> { #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
info!("Feeding auth data to the CLI"); fn parse_auth_callback(callback: &str) -> Result<String, String> {
callback
let port_file = temp_dir().join(GP_CALLBACK_PORT_FILENAME); .starts_with("globalprotectcallback:")
let port = tokio::fs::read_to_string(port_file).await?; .then(|| callback.to_owned())
let mut stream = tokio::net::TcpStream::connect(format!("127.0.0.1:{}", port.trim())).await?; .ok_or_else(|| "callback URL must use the globalprotectcallback scheme".to_owned())
stream.write_all(auth_data.as_bytes()).await?;
Ok(())
} }
async fn try_active_gui() -> anyhow::Result<()> { async fn try_active_gui() -> anyhow::Result<()> {
@@ -120,3 +152,34 @@ fn get_log_file() -> anyhow::Result<PathBuf> {
Ok(dirs.data_dir().join("gpclient.log")) Ok(dirs.data_dir().join("gpclient.log"))
} }
#[cfg(all(test, unix))]
mod tests {
use std::os::unix::process::ExitStatusExt;
use super::*;
const CALLBACK: &str = "globalprotectcallback:cas-as=1&[email protected]&token=token";
#[test]
fn callback_command_preserves_callback_argument() {
let command = auth_callback_command(CALLBACK);
let args = command
.get_args()
.map(|argument| argument.to_str().unwrap())
.collect::<Vec<_>>();
assert_eq!(args, ["auth-callback", CALLBACK]);
}
#[test]
fn callback_command_status_is_propagated() {
assert!(ensure_auth_callback_succeeded(ExitStatus::from_raw(0)).is_ok());
assert!(ensure_auth_callback_succeeded(ExitStatus::from_raw(1 << 8)).is_err());
}
#[test]
fn rejects_non_callback_url() {
assert!(parse_auth_callback("https://example.com/callback").is_err());
}
}
+13 -6
View File
@@ -1,11 +1,13 @@
use std::time::{Duration, SystemTime, UNIX_EPOCH}; use std::time::{Duration, SystemTime, UNIX_EPOCH};
use gpapi::{ use gpapi::{
clap::report,
gateway::{SessionContext, SessionExtensionAuth, extend_session}, gateway::{SessionContext, SessionExtensionAuth, extend_session},
log_format::LogFormat,
os_profile::OsProfile, os_profile::OsProfile,
session::{SessionInfo, SessionRequestArgs, SessionWarning}, session::{SessionInfo, SessionRequestArgs, SessionWarning},
}; };
use log::{info, warn}; use log::{Level, info, warn};
use openconnect::VpnSessionInfo; use openconnect::VpnSessionInfo;
use tokio::{runtime::Handle, task::JoinHandle}; use tokio::{runtime::Handle, task::JoinHandle};
@@ -59,11 +61,12 @@ pub(crate) fn spawn_session_runtime_with_info(
handle: &Handle, handle: &Handle,
session_ctx: SessionContext, session_ctx: SessionContext,
session_info: SessionInfo, session_info: SessionInfo,
log_format: LogFormat,
) -> JoinHandle<()> { ) -> JoinHandle<()> {
handle.spawn(run_session_runtime(session_ctx, session_info)) handle.spawn(run_session_runtime(session_ctx, session_info, log_format))
} }
async fn run_session_runtime(session_ctx: SessionContext, mut session_info: SessionInfo) { async fn run_session_runtime(session_ctx: SessionContext, mut session_info: SessionInfo, log_format: LogFormat) {
loop { loop {
let Some(schedule) = build_session_warning_schedule(&session_info) else { let Some(schedule) = build_session_warning_schedule(&session_info) else {
info!("No session warning schedule provided by the gateway"); info!("No session warning schedule provided by the gateway");
@@ -72,7 +75,7 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
tokio::time::sleep(schedule.delay).await; tokio::time::sleep(schedule.delay).await;
eprintln!("\nWARNING: {}", schedule.message); report(log_format, Level::Warn, &format!("\nWARNING: {}", schedule.message));
if !schedule.should_auto_extend { if !schedule.should_auto_extend {
info!("Session extension is not allowed by the gateway"); info!("Session extension is not allowed by the gateway");
@@ -87,12 +90,16 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
return; return;
}; };
eprintln!("Session extended."); report(log_format, Level::Info, "Session extended.");
session_info = next_session_info; session_info = next_session_info;
} }
Err(err) => { Err(err) => {
warn!("Failed to extend session: {}", err); warn!("Failed to extend session: {}", err);
eprintln!("WARNING: Failed to extend session: {}", err); report(
log_format,
Level::Warn,
&format!("WARNING: Failed to extend session: {}", err),
);
return; return;
} }
} }
+9
View File
@@ -0,0 +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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`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 x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function te(){return g?!0:!(e.unstable_now()-ee<w)}function ne(){if(g=!1,S){var t=e.unstable_now();ee=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&te());){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&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():S=!1}}}var re;if(typeof y==`function`)re=function(){y(ne)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=ne,re=function(){ae.postMessage(null)}}else re=function(){_(ne,0)};function oe(t,n){C=_(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`):w=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(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,re()))),r},e.unstable_shouldYield=te,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.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.Line truncated
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!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}e.call(n.prototype)}}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{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?we(n):``}function De(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we(`Lazy`);case 13:return e.child!==t&&t!==null?we(`Suspense Fallback`):we(`Suspense`);case 19:return we(`SuspenseList`);case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return we(`Activity`);default:return``}}function Oe(e){try{var t=``,n=null;do t+=De(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,Ae=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Me=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Pe=t.unstable_now,Fe=t.unstable_getCurrentPriorityLevel,Ie=t.unstable_ImmediatePriority,Le=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,ze=t.unstable_LowPriority,Be=t.unstable_IdlePriority,Ve=t.log,He=t.unstable_setDisableYieldValue,Ue=null,We=null;function Ge(e){if(typeof Ve==`function`&&He(e),We&&typeof We.setStrictMode==`function`)try{We.setStrictMode(Ue,e)}catch{}}var Ke=Math.clz32?Math.clz32:Ye,qe=Math.log,Je=Math.LN2;function Ye(e){return e>>>=0,e===0?32:31-(qe(e)/Je|0)|0}var Xe=256,Ze=262144,Qe=4194304;function $e(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&261888;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 et(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=$e(n))):i=$e(o):i=$e(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=$e(n))):i=$e(o)):i=$e(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 tt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nt(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 rt(){var e=Qe;return Qe<<=1,!(Qe&62914560)&&(Qe=4194304),e}function it(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function at(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ot(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-Ke(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&&st(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function st(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ke(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ct(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ke(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function lt(e,t){var n=t&-t;return n=n&42?1:ut(n),(n&(e.suspendedLanes|t))===0?n:0}function ut(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 dt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ft(){var e=E.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function pt(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var mt=Math.random().toString(36).slice(2),ht=`__reactFiber$`+mt,gt=`__reactProps$`+mt,_t=`__reactContainer$`+mt,vt=`__reactEvents$`+mt,yt=`__reactListeners$`+mt,bt=`__reactHandles$`+mt,xt=`__reactResources$`+mt,St=`__reactMarker$`+mt;function Ct(e){delete e[ht],delete e[gt],delete e[vt],delete e[yt],delete e[bt]}function wt(e){var t=e[ht];if(t)return t;for(var n=e.parentNode;n;){if(t=n[_t]||n[ht]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[ht])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function Tt(e){if(e=e[ht]||e[_t]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Et(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Dt(e){var t=e[xt];return t||=e[xt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ot(e){e[St]=!0}var kt=new Set,At={};function jt(e,t){Mt(e,t),Mt(e+`Capture`,t)}function Mt(e,t){for(At[e]=t,e=0;e<t.length;e++)kt.add(t[e])}var Nt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001Line truncated
`).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||en(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&en(e,``+r);break;case`className`:Rt(e,`class`,r);break;case`tabIndex`:Rt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Rt(e,n,r);break;case`style`:rn(e,r,a);break;case`data`:if(t!==`object`){Rt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(``+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}else 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)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=ln);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;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));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=cn(``+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`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),Lt(e,`popover`,r);break;case`xlinkActuate`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Lt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=on.get(n)||n,Lt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:rn(e,r,a);break;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));e.innerHTML=n}}break;case`children`:typeof r==`string`?en(e,r):(typeof r==`number`||typeof r==`bigint`)&&en(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=ln);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`re Line truncated
-1
View File
@@ -1 +0,0 @@
html,body,#root{-webkit-user-select:none;user-select:none;cursor:default;height:100%;margin:0;padding:0}
+1
View File
@@ -0,0 +1 @@
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}
-168
View File
@@ -1,168 +0,0 @@
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((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 x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function te(){return g?!0:!(e.unstable_now()-ee<w)}function ne(){if(g=!1,S){var t=e.unstable_now();ee=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&te());){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&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():S=!1}}}var re;if(typeof y==`function`)re=function(){y(ne)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=ne,re=function(){ae.postMessage(null)}}else re=function(){_(ne,0)};function oe(t,n){C=_(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`):w=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(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,re()))),r},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),u=o(((e,t)=>{t.exports=l()})),d=o((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. Line truncated
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
`+be+e+xe}var Ce=!1;function we(e,t){if(!e||Ce)return``;Ce=!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}e.call(n.prototype)}}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{Ce=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Se(n):``}function Te(e,t){switch(e.tag){case 26:case 27:case 5:return Se(e.type);case 16:return Se(`Lazy`);case 13:return e.child!==t&&t!==null?Se(`Suspense Fallback`):Se(`Suspense`);case 19:return Se(`SuspenseList`);case 0:case 15:return we(e.type,!1);case 11:return we(e.type.render,!1);case 1:return we(e.type,!0);case 31:return Se(`Activity`);default:return``}}function Ee(e){try{var t=``,n=null;do t+=Te(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
Error generating stack: `+e.message+`
`+e.stack}}var De=Object.prototype.hasOwnProperty,Oe=t.unstable_scheduleCallback,ke=t.unstable_cancelCallback,Ae=t.unstable_shouldYield,je=t.unstable_requestPaint,Me=t.unstable_now,Ne=t.unstable_getCurrentPriorityLevel,Pe=t.unstable_ImmediatePriority,Fe=t.unstable_UserBlockingPriority,Ie=t.unstable_NormalPriority,Le=t.unstable_LowPriority,Re=t.unstable_IdlePriority,ze=t.log,Be=t.unstable_setDisableYieldValue,Ve=null,He=null;function Ue(e){if(typeof ze==`function`&&Be(e),He&&typeof He.setStrictMode==`function`)try{He.setStrictMode(Ve,e)}catch{}}var We=Math.clz32?Math.clz32:qe,Ge=Math.log,Ke=Math.LN2;function qe(e){return e>>>=0,e===0?32:31-(Ge(e)/Ke|0)|0}var Je=256,Ye=262144,Xe=4194304;function Ze(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&261888;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 Qe(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=Ze(n))):i=Ze(o):i=Ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ze(n))):i=Ze(o)):i=Ze(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 $e(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function et(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 tt(){var e=Xe;return Xe<<=1,!(Xe&62914560)&&(Xe=4194304),e}function nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function it(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-We(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&&at(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function at(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-We(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ot(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-We(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function st(e,t){var n=t&-t;return n=n&42?1:ct(n),(n&(e.suspendedLanes|t))===0?n:0}function ct(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 lt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ut(){var e=O.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function dt(e,t){var n=O.p;try{return O.p=e,t()}finally{O.p=n}}var ft=Math.random().toString(36).slice(2),pt=`__reactFiber$`+ft,mt=`__reactProps$`+ft,ht=`__reactContainer$`+ft,gt=`__reactEvents$`+ft,_t=`__reactListeners$`+ft,vt=`__reactHandles$`+ft,yt=`__reactResources$`+ft,bt=`__reactMarker$`+ft;function xt(e){delete e[pt],delete e[mt],delete e[gt],delete e[_t],delete e[vt]}function St(e){var t=e[pt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ht]||n[pt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[pt])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function Ct(e){if(e=e[pt]||e[ht]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Tt(e){var t=e[yt];return t||=e[yt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Et(e){e[bt]=!0}var Dt=new Set,Ot={};function kt(e,t){At(e,t),At(e+`Capture`,t)}function At(e,t){for(Ot[e]=t,e=0;e<t.length;e++)Dt.add(t[e])}var jt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001Line truncated
`).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Zt(e,``+r);break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:en(e,r,o);break;case`data`:if(t!==`object`){Ft(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+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}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=on);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));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=an(``+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`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),Pt(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Pt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=nn.get(n)||n,Pt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:en(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Zt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=on);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`re Line truncated
const theme = ${JSON.stringify(t,null,2)};
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
theme.transitions = createTransitions(theme.transitions || {});
export default theme;`}function xa(e){return typeof e==`number`?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}var Sa=e=>{if(!Number.isNaN(+e))return+e;let t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let e=0;e<t.length;e+=1)n+=+t[e];return n};function Ca(e){Object.assign(e,{alpha(t,n){let r=this||e;return r.colorSpace?`oklch(from ${t} l c h / ${typeof n==`string`?`calc(${n})`:n})`:r.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,`var(--$1Channel)`)} / ${typeof n==`string`?`calc(${n})`:n})`:bi(t,Sa(n))},lighten(t,n){let r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #fff ${xa(n)})`:Ci(t,n)},darken(t,n){let r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #000 ${xa(n)})`:Si(t,n)}})}function wa(e={},...t){let{breakpoints:n,mixins:r={},spacing:i,palette:a={},transitions:o={},typography:s={},shape:c,colorSpace:l,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw Error(ee(20));let d=na({...a,colorSpace:l}),f=Nr(e),p=vn(f,{mixins:ia(f.breakpoints,r),palette:d,shadows:fa.slice(),typography:ca(d,s),transitions:_a(o),zIndex:{...va}});return p=vn(p,u),p=t.reduce((e,t)=>vn(e,t),p),p.unstable_sxConfig={...Dr,...u?.unstable_sxConfig},p.unstable_sx=function(e){return jr({sx:e,theme:this})},p.toRuntimeSource=ba,Ca(p),p}function Ta(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}var Ea=[...Array(25)].map((e,t)=>{if(t===0)return`none`;let n=Ta(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Da(e){return{inputPlaceholder:e===`dark`?.5:.42,inputUnderline:e===`dark`?.7:.42,switchTrackDisabled:e===`dark`?.2:.12,switchTrack:e===`dark`?.3:.38}}function Oa(e){return e===`dark`?Ea:[]}function ka(e){let{palette:t={mode:`light`},opacity:n,overlays:r,colorSpace:i,...a}=e,o=na({...t,colorSpace:i});return{palette:o,opacity:{...Da(o.mode),...n},overlays:r||Oa(o.mode),...a}}function Aa(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]===`palette`&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var ja=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:``}overlays-${n}`),`--${e?`${e}-`:``}palette-AppBar-darkBg`,`--${e?`${e}-`:``}palette-AppBar-darkColor`],Ma=e=>(t,n)=>{let r=e.rootSelector||`:root`,i=e.colorSchemeSelector,a=i;if(i===`class`&&(a=`.%s`),i===`data`&&(a=`[data-%s]`),i?.startsWith(`data-`)&&!i.includes(`%s`)&&(a=`[${i}="%s"]`),e.defaultColorScheme===t){if(t===`dark`){let i={};return ja(e.cssVarPrefix).forEach(e=>{i[e]=n[e],delete n[e]}),a===`media`?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace(`%s`,t)]:i,[`${r}, ${a.replace(`%s`,t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!==`media`)return`${r}, ${a.replace(`%s`,String(t))}`}else if(t){if(a===`media`)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace(`%s`,String(t))}return r};function Na(e,t){t.forEach(t=>{e[t]||(e[t]={})})}function B(e,t,n){!e[t]&&n&&(e[t]=n)}function Pa(e){return typeof e!=`string`||!e.startsWith(`hsl`)?e:_i(e)}function Fa(e,t){`${t}Channel`in e||(e[`${t}Channel`]=hi(Pa(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Ia(e){return typeof e==`number`?`${e}px`:typeof e==`string`||typeof e==`function`||Array.isArray(e)?e:`8px`}var La=e=>{try{return e()}catch{}},Ra=(e=`mui`)=>R(e);function za(e,t,n,r,i){if(!n)return;n=n===!0?{}:n;let a=i===`dark`?`dark`:`light`;if(!r){t[i]=ka({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}let{palette:o,...s}=wa({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[i]={...n,palette:o,opacity:{...Da(a),...n?.opacity},overlays:n?.overlays||Oa(a)},s}function Ba(e={},...t){let{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:a=`mui`,nativeColor:o=!1,shouldSkipGeneratingVar:s=Aa,colorSchemeSelector:c=n.light&&n.dark?`media`:void 0,rootSelector:l=`:root`,...u}=e,d=Object.keys(n)[0],f=r||(n.light&&d!==`light`?`light`:d),p=Ra(a),{[f]:m,light:h,dark:g,..._}=n,v={..._},y=m;if((f===`dark`&&!(`dark`in n)||f===`light`&&!(`light`in n))&&(y=!0),!y)throw Error(ee(21,f));let b;o&&(b=`oklch`);let x=za(b,v,y,u,f);h&&!v.light&&za(b,v,h,void 0,`light`),g&&!v.dark&&za(b,v,g,void 0,`dark`);let S={defaultColorScheme:f,...x,cssVarPrefix:a,colorSchemeSelector:c,rootSelector:l,getCssVar:p,colorSchemes:v,font:{...ra(x.typography),...x.font},spacing:Ia(u.spacing)};Object.keys(S.colorSchemes).forEach(e=>{let t=S.colorSchemes[e].palette,n=e=>{let n=e.split(`-`),r=n[1],i=n[2];return p(e,t[r][i])};t.mode===`light`&&(B(t.common,`background`,`#fff`),B(t.common,`onBackground`,`#000`)),t.mode===`dark`&&(B(t.common,`background`,`#000`),B(t.common,`onBackground`,`#fff`));function r(e,t,n){if(b){let r;return e===xi&&(r=`transparent ${((1-n)*100).toFixed(0)}%`),e===F&&(r=`#000 ${(n*100).toFixed(0)}%`),e===I&&(r=`#fff ${(n*100).toFixed(0)}%`),`color-mix(in ${b}, ${t}, ${r})`}return e(t,n)}if(Na(t,[`Alert`,`AppBar`,`Avatar`,`Button`,`Chip`,`FilledInput`,`LinearProgress`,`Skeleton`,`Slider`,`SnackbarContent`,`SpeedDialAction`,`StepConnector`,`StepContent`,`Switch`,`TableCell`,`Tooltip`]),t.mode===`light`){B(t.Alert,`errorColor`,r(F,o?p(`palette-error-light`):t.error.light,.6)),B(t.Alert,`infoColor`,r(F,o?p(`palette-info-light`):t.info.light,.6)),B(t.Alert,`successColor`,r(F,o?p(`palette-success-light`):t.success.light,.6)),B(t.Alert,`warningColor`,r(F,o?p(`palette-warning-light`):t.warning.light,.6)),B(t.Alert,`errorFilledBg`,n(`palette-error-main`)),B(t.Alert,`infoFilledBg`,n(`palette-info-main`)),B(t.Alert,`successFilledBg`,n(`palette-success-main`)),B(t.Alert,`warningFilledBg`,n(`palette-warning-main`)),B(t.Alert,`errorFilledColor`,La(()=>t.getContrastText(t.error.main))),B(t.Alert,`infoFilledColor`,La(()=>t.getContrastText(t.info.main))),B(t.Alert,`successFilledColor`,La(()=>t.getContrastText(t.success.main))),B(t.Alert,`warningFilledColor`,La(()=>t.getContrastText(t.warning.main))),B(t.Alert,`errorStandardBg`,r(I,o?p(`palette-error-light`):t.error.light,.9)),B(t.Alert,`infoStandardBg`,r(I,o?p(`palette-info-light`):t.info.light,.9)),B(t.Alert,`successStandardBg`,r(I,o?p(`palette-success-light`):t.success.light,.9)),B(t.Alert,`warningStandardBg`,r(I,o?p(`palette-warning-light`):t.warning.light,.9)),B(t.Alert,`errorIconColor`,n(`palette-error-main`)),B(t.Alert,`infoIconColor`,n(`palette-info-main`)),B(t.Alert,`successIconColor`,n(`palette-success-main`)),B(t.Alert,`warningIconColor`,n(`palette-warning-main`)),B(t.AppBar,`defaultBg`,n(`palette-grey-100`)),B(t.Avatar,`defaultBg`,n(`palette-grey-400`)),B(t.Button,`inheritContainedBg`,n(`palette-grey-300`)),B(t.Button,`inheritContainedHoverBg`,n(`palette-grey-A100`)),B(t.Chip,`defaultBorder`,n(`palette-grey-400`)),B(t.Chip,`defaultAvatarColor`,n(`palette-grey-700`)),B(t.Chip,`defaultIconColor`,n(`palette-grey-700`)),B(t.FilledInput,`bg`,`rgba(0, 0, 0, 0.06)`),B(t.FilledInput,`hoverBg`,`rgba(0, 0, 0, 0.09)`),B(t.FilledInput,`disabledBg`,`rgba(0, 0, 0, 0.12)`),B(t.LinearProgress,`primaryBg`,r(I,o?p(`palette-primary-main`):t.primary.main,.62)),B(t.LinearProgress,`secondaryBg`,r(I,o?p(`palette-secondary-main`):t.secondary.main,.62)),B(t.LinearProgress,`errorBg`,r(I,o?p(`palette-error-main`):t.error.main,.62)),B(t.LinearProgress,`infoBg`,r(I,o?p(`palette-info-main`):t.info.main,.62)),B(t.LinearProgress,`successBg`,r(I,o?p(`palette-success-main`):t.success.main,.62)),B(t.LinearProgress,`warningBg`,r(I,o?p(`palette-warning-light`):t.warning.main,.62)),B(t.Skeleton,`bg`,b?r(xi,o?p(`palette-text-primary`):t.text.primary,.11):`rgba(${n(`palette-text-primaryChannel`)} / 0.11)`),B(t.Slider,`primaryTrack`,r(I,o?p(`palette-primary-main`):t.primary.main,.62)),B(t.Slider,`secondaryTrack`,r(I,o?p(`palette-secondary-main`):t.secondary.main,.62)),B(t.Slider,`errorTrack`,r(I,o?p(`palette-error-main`):t.error.main,.62)),B(t.Slider,`infoTrack`,r(I,o?p(`palette-info-main`):t.info.main,.62)),B(t.Slider,`successTrack`,r(I,o?p(`palette-success-main`):t.succLine truncated
0% {
transform: scale(0);
opacity: 0.1;
}
100% {
transform: scale(1);
opacity: 0.3;
}
`,ko=Jt`
0% {
opacity: 1;
}
100% {
opacity: 0;
}
`,Ao=Jt`
0% {
transform: scale(1);
}
50% {
transform: scale(0.92);
}
100% {
transform: scale(1);
}
`,jo=Ka(`span`,{name:`MuiTouchRipple`,slot:`Root`})({overflow:`hidden`,pointerEvents:`none`,position:`absolute`,zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:`inherit`}),Mo=Ka(To,{name:`MuiTouchRipple`,slot:`Ripple`})`
opacity: 0;
position: absolute;
&.${Eo.rippleVisible} {
opacity: 0.3;
transform: scale(1);
animation-name: ${Oo};
animation-duration: ${Do}ms;
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
}
&.${Eo.ripplePulsate} {
animation-duration: ${({theme:e})=>e.transitions.duration.shorter}ms;
}
& .${Eo.child} {
opacity: 1;
display: block;
width: 100%;
height: 100%;
border-radius: 50%;
background-color: currentColor;
}
& .${Eo.childLeaving} {
opacity: 0;
animation-name: ${ko};
animation-duration: ${Do}ms;
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
}
& .${Eo.childPulsate} {
position: absolute;
/* @noflip */
left: 0px;
top: 0;
animation-name: ${Ao};
animation-duration: 2500ms;
animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
animation-iteration-count: infinite;
animation-delay: 200ms;
}
`,No=M.forwardRef(function(e,t){let{center:n=!1,classes:r={},className:i,...a}=Za({props:e,name:`MuiTouchRipple`}),[o,s]=M.useState([]),c=M.useRef(0),l=M.useRef(null);M.useEffect(()=>{l.current&&=(l.current(),null)},[o]);let u=M.useRef(!1),d=bo(),f=M.useRef(null),p=M.useRef(null),m=M.useCallback(e=>{let{pulsate:t,rippleX:n,rippleY:i,rippleSize:a,cb:o}=e;s(e=>[...e,(0,N.jsx)(Mo,{classes:{ripple:Gr(r.ripple,Eo.ripple),rippleVisible:Gr(r.rippleVisible,Eo.rippleVisible),ripplePulsate:Gr(r.ripplePulsate,Eo.ripplePulsate),child:Gr(r.child,Eo.child),childLeaving:Gr(r.childLeaving,Eo.childLeaving),childPulsate:Gr(r.childPulsate,Eo.childPulsate)},timeout:Do,pulsate:t,rippleX:n,rippleY:i,rippleSize:a},c.current)]),c.current+=1,l.current=o},[r]),h=M.useCallback((e={},t={},r=()=>{})=>{let{pulsate:i=!1,center:a=n||t.pulsate,fakeElement:o=!1}=t;if(e?.type===`mousedown`&&u.current){u.current=!1;return}e?.type===`touchstart`&&(u.current=!0);let s=o?null:p.current,c=s?s.getBoundingClientRect():{width:0,height:0,left:0,top:0},l,h,g;if(a||e===void 0||e.clientX===0&&e.clientY===0||!e.clientX&&!e.touches)l=Math.round(c.width/2),h=Math.round(c.height/2);else{let{clientX:t,clientY:n}=e.touches&&e.touches.length>0?e.touches[0]:e;l=Math.round(t-c.left),h=Math.round(n-c.top)}if(a)g=Math.sqrt((2*c.width**2+c.height**2)/3),g%2==0&&(g+=1);else{let e=Math.max(Math.abs((s?s.clientWidth:0)-l),l)*2+2,t=Math.max(Math.abs((s?s.clientHeight:0)-h),h)*2+2;g=Math.sqrt(e**2+t**2)}e?.touches?f.current===null&&(f.current=()=>{m({pulsate:i,rippleX:l,rippleY:h,rippleSize:g,cb:r})},d.start(80,()=>{f.current&&=(f.current(),null)})):m({pulsate:i,rippleX:l,rippleY:h,rippleSize:g,cb:r})},[n,m,d]),g=M.useCallback(()=>{h({},{pulsate:!0})},[h]),_=M.useCallback((e,t)=>{if(d.clear(),e?.type===`touchend`&&f.current){f.current(),f.current=null,d.start(0,()=>{_(e,t)});return}f.current=null,s(e=>e.length>0?e.slice(1):e),l.current=t},[d]);return M.useImperativeHandle(t,()=>({pulsate:g,start:h,stop:_}),[g,h,_]),(0,N.jsx)(jo,{className:Gr(Eo.root,r.root,i),ref:p,...a,children:(0,N.jsx)(mo,{component:null,exit:!0,children:o})})});function Po(e){return Jr(`MuiButtonBase`,e)}var Fo=Yr(`MuiButtonBase`,[`root`,`disabled`,`focusVisible`]),Io=e=>{let{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:i}=e,a=Hi({root:[`root`,t&&`disabled`,n&&`focusVisible`]},Po,i);return n&&r&&(a.root+=` ${r}`),a},Lo=Ka(`button`,{name:`MuiButtonBase`,slot:`Root`})({display:`inline-flex`,alignItems:`center`,justifyContent:`center`,position:`relative`,boxSizing:`border-box`,WebkitTapHighlightColor:`transparent`,backgroundColor:`transparent`,outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:`pointer`,userSelect:`none`,verticalAlign:`middle`,MozAppearance:`none`,WebkitAppearance:`none`,textDecoration:`none`,color:`inherit`,"&::-moz-focus-inner":{borderStyle:`none`},[`&.${Fo.disabled}`]:{pointerEvents:`none`,cursor:`default`},"@media print":{colorAdjust:`exact`}}),Ro=M.forwardRef(function(e,t){let n=Za({props:e,name:`MuiButtonBase`}),{action:r,centerRipple:i=!1,children:a,className:o,component:s=`button`,disabled:c=!1,disableRipple:l=!1,disableTouchRipple:u=!1,focusRipple:d=!1,focusVisibleClassName:f,LinkComponent:p=`a`,onBlur:m,onClick:h,onContextMenu:g,onDragLeave:_,onFocus:v,onFocusVisible:y,onKeyDown:b,onKeyUp:x,onMouseDown:S,onMouseLeave:C,onMouseUp:w,onTouchEnd:ee,onTouchMove:te,onTouchStart:ne,tabIndex:re=0,TouchRippleProps:ie,touchRippleRef:ae,type:oe,...T}=n,se=M.useRef(null),E=Co(),ce=no(E.ref,ae),[D,O]=M.useState(!1);c&&D&&O(!1),M.useImperativeHandle(r,()=>({focusVisible:()=>{O(!0),se.current.focus()}}),[]);let le=E.shouldMount&&!l&&!c;M.useEffect(()=>{D&&d&&!l&&E.pulsate()},[l,d,D,E]);let ue=zo(E,`start`,S,u),de=zo(E,`stop`,g,u),fe=zo(E,`stop`,_,u),pe=zo(E,`stop`,w,u),k=zo(E,`stop`,e=>{D&&e.preventDefault(),C&&C(e)},u),me=zo(E,`start`,ne,u),he=zo(E,`stop`,ee,u),ge=zo(E,`stop`,te,u),A=zo(E,`stop`,e=>{xo(e.target)||O(!1),m&&m(e)},!1),_e=eo(e=>{se.current||=e.currentTarget,xo(e.target)&&(O(!0),y&&y(e)),v&&v(e)}),j=()=>{let e=se.current;return e?e.tagName===`BUTTON`?!1:!(e.tagName===`A`&&e.href):s&&s!==`button`},ve=eo(e=>{d&&!e.repeat&&D&&e.key===` `&&E.stop(e,()=>{E.start(e)}),e.target===e.currentTarget&&j()&&e.key===` `&&e.preventDefault(),b&&b(e),e.target===e.currentTarget&&j()&&e.key===`Enter`&&!c&&(e.preventDefault(),h&&h(e))}),ye=eo(e=>{d&&e.key===` `&&D&&!e.defaultPrevented&&E.stop(e,()=>{E.pulsate(e)}),x&&x(e),h&&e.target===e.currentTarget&&j()&&e.key===` `&&!e.defaultPrevented&&!c&&h(e)}),be=s;be===`button`&&(T.href||T.to)&&(be=p);let xe={};if(be===`button`){let e=!!T.formAction;xe.type=oe===void 0&&!e?`button`:oe,xe.disabled=c}else !T.href&&!T.to&&(xe.role=`button`),c&&(xe[`aria-disabled`]=c);let Se=no(t,se),Ce={...n,centerRipple:i,component:s,disabled:c,disableRipple:l,disableTouchRipple:u,focusRipple:d,tabIndex:re,focusVisible:D},we=Io(Ce);return(0,N.jsxs)(Lo,{as:be,className:Gr(we.root,o),ownerState:Ce,onBlur:A,onClick:h,onContextMenu:de,onFocus:_e,onKeyDown Line truncated
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
`,Ko=Jt`
0% {
stroke-dasharray: 1px, 200px;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 100px, 200px;
stroke-dashoffset: -15px;
}
100% {
stroke-dasharray: 1px, 200px;
stroke-dashoffset: -126px;
}
`,qo=typeof Go==`string`?null:qt`
animation: ${Go} 1.4s linear infinite;
`,Jo=typeof Ko==`string`?null:qt`
animation: ${Ko} 1.4s ease-in-out infinite;
`,Yo=e=>{let{classes:t,variant:n,color:r,disableShrink:i}=e;return Hi({root:[`root`,n,`color${V(r)}`],svg:[`svg`],track:[`track`],circle:[`circle`,`circle${V(n)}`,i&&`circleDisableShrink`]},Uo,t)},Xo=Ka(`span`,{name:`MuiCircularProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`color${V(n.color)}`]]}})(Xa(({theme:e})=>({display:`inline-block`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`transform`)}},{props:{variant:`indeterminate`},style:qo||{animation:`${Go} 1.4s linear infinite`}},...Object.entries(e.palette).filter(Ho()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))]}))),Zo=Ka(`svg`,{name:`MuiCircularProgress`,slot:`Svg`})({display:`block`}),Qo=Ka(`circle`,{name:`MuiCircularProgress`,slot:`Circle`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.circle,t[`circle${V(n.variant)}`],n.disableShrink&&t.circleDisableShrink]}})(Xa(({theme:e})=>({stroke:`currentColor`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`stroke-dashoffset`)}},{props:{variant:`indeterminate`},style:{strokeDasharray:`80px, 200px`,strokeDashoffset:0}},{props:({ownerState:e})=>e.variant===`indeterminate`&&!e.disableShrink,style:Jo||{animation:`${Ko} 1.4s ease-in-out infinite`}}]}))),$o=Ka(`circle`,{name:`MuiCircularProgress`,slot:`Track`})(Xa(({theme:e})=>({stroke:`currentColor`,opacity:(e.vars||e).palette.action.activatedOpacity}))),es=M.forwardRef(function(e,t){let n=Za({props:e,name:`MuiCircularProgress`}),{className:r,color:i=`primary`,disableShrink:a=!1,enableTrackSlot:o=!1,size:s=40,style:c,thickness:l=3.6,value:u=0,variant:d=`indeterminate`,...f}=n,p={...n,color:i,disableShrink:a,size:s,thickness:l,value:u,variant:d,enableTrackSlot:o},m=Yo(p),h={},g={},_={};if(d===`determinate`){let e=2*Math.PI*((Wo-l)/2);h.strokeDasharray=e.toFixed(3),_[`aria-valuenow`]=Math.round(u),h.strokeDashoffset=`${((100-u)/100*e).toFixed(3)}px`,g.transform=`rotate(-90deg)`}return(0,N.jsx)(Xo,{className:Gr(m.root,r),style:{width:s,height:s,...g,...c},ownerState:p,ref:t,role:`progressbar`,..._,...f,children:(0,N.jsxs)(Zo,{className:m.svg,ownerState:p,viewBox:`${Wo/2} ${Wo/2} ${Wo} ${Wo}`,children:[o?(0,N.jsx)($o,{className:m.track,ownerState:p,cx:Wo,cy:Wo,r:(Wo-l)/2,fill:`none`,strokeWidth:l,"aria-hidden":`true`}):null,(0,N.jsx)(Qo,{className:m.circle,style:h,ownerState:p,cx:Wo,cy:Wo,r:(Wo-l)/2,fill:`none`,strokeWidth:l})]})})});function ts(e){return Jr(`MuiTypography`,e)}Yr(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]);var ns={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},rs=Ya(),is=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return Hi({root:[`root`,a,e.align!==`inherit`&&`align${V(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},ts,o)},as=Ka(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${V(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Xa(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Ho()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${V(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),os={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},ss=M.forwardRef(function(e,t){let{color:n,...r}=Za({props:e,name:`MuiTypography`}),i=!ns[n],a=rs({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=os,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p};return(0,N.jsx)(as,{as:c||(d?`p`:p[f]||os[f])||`span`,ref:t,className:Gr(is(h).root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})}),cs=Yr(`MuiBox`,[`root`]),ls=Kr({themeId:te,defaultTheme:Ha(),defaultClassName:cs.root,generateClassName:Ur.generate});function us(e){return Line truncated
0% {
left: -35%;
right: 100%;
}
60% {
left: 100%;
right: -90%;
}
100% {
left: 100%;
right: -90%;
}
`,Ns=typeof Ms==`string`?null:qt`
animation: ${Ms} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
`,Ps=Jt`
0% {
left: -200%;
right: 100%;
}
60% {
left: 107%;
right: -8%;
}
100% {
left: 107%;
right: -8%;
}
`,Fs=typeof Ps==`string`?null:qt`
animation: ${Ps} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
`,Is=Jt`
0% {
opacity: 1;
background-position: 0 -23px;
}
60% {
opacity: 0;
background-position: 0 -23px;
}
100% {
opacity: 1;
background-position: -200px -23px;
}
`,Ls=typeof Is==`string`?null:qt`
animation: ${Is} 3s infinite linear;
`,Rs=e=>{let{classes:t,variant:n,color:r}=e;return Hi({root:[`root`,`color${V(r)}`,n],dashed:[`dashed`,`dashedColor${V(r)}`],bar1:[`bar`,`bar1`,`barColor${V(r)}`,(n===`indeterminate`||n===`query`)&&`bar1Indeterminate`,n===`determinate`&&`bar1Determinate`,n===`buffer`&&`bar1Buffer`],bar2:[`bar`,`bar2`,n!==`buffer`&&`barColor${V(r)}`,n===`buffer`&&`color${V(r)}`,(n===`indeterminate`||n===`query`)&&`bar2Indeterminate`,n===`buffer`&&`bar2Buffer`]},As,t)},zs=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),Bs=Ka(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${V(n.color)}`],t[n.variant]]}})(Xa(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(Ho()).map(([t])=>({props:{color:t},style:{backgroundColor:zs(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),Vs=Ka(`span`,{name:`MuiLinearProgress`,slot:`Dashed`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.dashed,t[`dashedColor${V(n.color)}`]]}})(Xa(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(Ho()).map(([t])=>{let n=zs(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),Ls||{animation:`${Is} 3s infinite linear`}),Hs=Ka(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar1,t[`barColor${V(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar1Indeterminate,n.variant===`determinate`&&t.bar1Determinate,n.variant===`buffer`&&t.bar1Buffer]}})(Xa(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(Ho()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{transition:`transform .${js}s linear`}},{props:{variant:`buffer`},style:{zIndex:1,transition:`transform .${js}s linear`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:Ns||{animation:`${Ms} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}}]}))),Us=Ka(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.bar,t.bar2,t[`barColor${V(n.color)}`],(n.variant===`indeterminate`||n.variant===`query`)&&t.bar2Indeterminate,n.variant===`buffer`&&t.bar2Buffer]}})(Xa(({theme:e})=>({width:`100%`,position:`absolute`,left:0,bottom:0,top:0,transition:`transform 0.2s linear`,transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(Ho()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(Ho()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:zs(e,t),transition:`transform .${js}s linear`}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:Fs||{animation:`${Ps} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}}]}))),Ws=M.forwardRef(function(e,t){let n=Za({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,value:a,valueBuffer:o,variant:s=`indeterminate`,...c}=n,l={...n,color:i,variant:s},u=Rs(l),d=Di(),f={},p={bar1:{},bar2:{}};if((s===`determinate`||s===`buffer`)&&a!==void 0){f[`aria-valuenow`]=Math.round(a),f[`aria-valuemin`]=0,f[`aria-valuemax`]=100;let e=a-100;d&&(e=-e),p.bar1.transform=`translateX(${e}%)`}if(s===`buffer`&&o!==void 0){let e=(o||0)-100;d&&(e=-e),p.bar2.transform=`translateX(${e}%)`}return(0,N.jsxs)(Bs,{className:Gr(u.root,r),ownerState:l,role:`progressbar`,...f,ref:t,...c,children:[s===`buffer`?(0,N.jsx)(Vs,{className:u.dashed,ownerState:l}):null,(0,N.jsx)(Hs,{className:u.bar1,ownerState:l,s Line truncated
+3 -3
View File
@@ -4,9 +4,9 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/assets/icon-small-BO4dlTNl.svg" /> <link rel="icon" type="image/svg+xml" href="/assets/icon-small-BO4dlTNl.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GP Connect Helper</title> <title>GPGUI Downloader</title>
<script type="module" crossorigin src="/assets/main-yAo_rN_V.js"></script> <script type="module" crossorigin src="/assets/main-BD0fDtWU.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-C5muOSVO.css"> <link rel="stylesheet" crossorigin href="/assets/main-DiWGniCh.css">
</head> </head>
<body> <body>
<script> <script>
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/icon-small.svg" /> <link rel="icon" type="image/svg+xml" href="/src/assets/icon-small.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GP Connect Helper</title> <title>GPGUI Downloader</title>
</head> </head>
<body> <body>
<script> <script>
-4
View File
@@ -9,10 +9,6 @@
"tauri": "tauri" "tauri": "tauri"
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/icons-material": "^7.3.11",
"@mui/material": "^7.3.11",
"@tauri-apps/api": "^2.11.1", "@tauri-apps/api": "^2.11.1",
"react": "^19.2.7", "react": "^19.2.7",
"react-dom": "^19.2.7" "react-dom": "^19.2.7"
-498
View File
@@ -8,18 +8,6 @@ importers:
.: .:
dependencies: dependencies:
'@emotion/react':
specifier: ^11.14.0
version: 11.14.0(@types/[email protected])([email protected])
'@emotion/styled':
specifier: ^11.14.1
version: 11.14.1(@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@mui/icons-material':
specifier: ^7.3.11
version: 7.3.11(@mui/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected]))([email protected]))(@types/[email protected])([email protected])
'@mui/material':
specifier: ^7.3.11
version: 7.3.11(@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
'@tauri-apps/api': '@tauri-apps/api':
specifier: ^2.11.1 specifier: ^2.11.1
version: 2.11.1 version: 2.11.1
@@ -130,10 +118,6 @@ packages:
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
hasBin: true hasBin: true
'@babel/[email protected]':
resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==}
engines: {node: '>=6.9.0'}
'@babel/[email protected]': '@babel/[email protected]':
resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==} resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
@@ -155,60 +139,6 @@ packages:
'@emnapi/[email protected]': '@emnapi/[email protected]':
resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==}
'@emotion/[email protected]':
resolution: {integrity: sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==}
'@emotion/[email protected]':
resolution: {integrity: sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==}
'@emotion/[email protected]':
resolution: {integrity: sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==}
'@emotion/[email protected]':
resolution: {integrity: sha512-QgD4fyscGcbbKwJmqNvUMSE02OsHUa+lAWKdEUIJKgqe5IwRSKd7+KhibEWdaKwgjLj0DRSHA9biAIqGBk05lw==}
'@emotion/[email protected]':
resolution: {integrity: sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==}
'@emotion/[email protected]':
resolution: {integrity: sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==}
peerDependencies:
'@types/react': '*'
react: '>=16.8.0'
peerDependenciesMeta:
'@types/react':
optional: true
'@emotion/[email protected]':
resolution: {integrity: sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA==}
'@emotion/[email protected]':
resolution: {integrity: sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==}
'@emotion/[email protected]':
resolution: {integrity: sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw==}
peerDependencies:
'@emotion/react': ^11.0.0-rc.0
'@types/react': '*'
react: '>=16.8.0'
peerDependenciesMeta:
'@types/react':
optional: true
'@emotion/[email protected]':
resolution: {integrity: sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==}
'@emotion/[email protected]':
resolution: {integrity: sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==}
peerDependencies:
react: '>=16.8.0'
'@emotion/[email protected]':
resolution: {integrity: sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==}
'@emotion/[email protected]':
resolution: {integrity: sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==}
'@esbuild/[email protected]': '@esbuild/[email protected]':
resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==} resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==}
engines: {node: '>=18'} engines: {node: '>=18'}
@@ -439,97 +369,6 @@ packages:
'@jridgewell/[email protected]': '@jridgewell/[email protected]':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@mui/[email protected]':
resolution: {integrity: sha512-a7I/b/nBTdXYz2cOSlEmkQ9WWE1x8FHpqMhFPp+Y1VPFxcOw91G5ELOHARQAGSPy5V+UCgJua6K/1x70bAtQPw==}
'@mui/[email protected]':
resolution: {integrity: sha512-+hz5ilwHZ3djd5es3sCErLioqe/NhZcYTsV/TNXZAMdJdb23F4xzJjqnnZdnurc3S1+ietcssRNqieOhPQLZ7Q==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@mui/material': ^7.3.11
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@types/react':
optional: true
'@mui/[email protected]':
resolution: {integrity: sha512-yq8bPc3LxOwKRWpcjRgDkYFmpM6aKlARfESTmOQcvLYFeJwtHte2tw6hJDrb8sk8wcvpDprHEHVaoUU0MslIkw==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@emotion/react': ^11.5.0
'@emotion/styled': ^11.3.0
'@mui/material-pigment-css': ^7.3.11
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@mui/material-pigment-css':
optional: true
'@types/react':
optional: true
'@mui/[email protected]':
resolution: {integrity: sha512-9B+YKms0fRHbNrqp9tOT/DNbNnU5gyvJ1o3qAGXfq8GmZcbJnE3At9x07Zr/o0pkhzg4aDdwXVqe4+AcgtOCPA==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@types/react':
optional: true
'@mui/[email protected]':
resolution: {integrity: sha512-WxE9SiF8xskAQqGjsp0poXCkCqsoXFEsSr0HBXfApmGHR+DBnXRp+z46Vsltg4gpPM4Z96DeAQRpeAOnhNg7Ng==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@emotion/react': ^11.4.1
'@emotion/styled': ^11.3.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@mui/[email protected]':
resolution: {integrity: sha512-7izwGWdNawAKpBKcRlx7f2gFnAAjmASBWvMcyX4YYEeLOFsbfGRbUYGInvnAcUeql3rPxI7F9Ft4oY2OLRz44g==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@emotion/react': ^11.5.0
'@emotion/styled': ^11.3.0
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@emotion/react':
optional: true
'@emotion/styled':
optional: true
'@types/react':
optional: true
'@mui/[email protected]':
resolution: {integrity: sha512-iKNAF2u9PzSIj40CjvKJWxFXJo122jXVdrmdh0hMYd+FR+NuJMkr/L88XwWLCRiJ5P1j+uyac25+Kp6YC4hu6w==}
peerDependencies:
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@types/react':
optional: true
'@mui/[email protected]':
resolution: {integrity: sha512-XTjGnifwteg71/ij+0e7Y7d+hwyntMYP5wPoA/g2drdGH+Flkvjwy0OfrVpKBbaOvofq4zU/LIyUZyKgmWu18g==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
react: ^17.0.0 || ^18.0.0 || ^19.0.0
peerDependenciesMeta:
'@types/react':
optional: true
'@napi-rs/[email protected]': '@napi-rs/[email protected]':
resolution: {integrity: sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==} resolution: {integrity: sha512-AWPoBRJ9tsnVhor4sjO7rkni+7p+2IAEFj6cx06UgP10jkQHqay/36uRV/bFkgrh18D9vb4cr8Q0Pthskgzy+Q==}
peerDependencies: peerDependencies:
@@ -539,9 +378,6 @@ packages:
'@oxc-project/[email protected]': '@oxc-project/[email protected]':
resolution: {integrity: sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==} resolution: {integrity: sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==}
'@popperjs/[email protected]':
resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==}
'@rolldown/[email protected]': '@rolldown/[email protected]':
resolution: {integrity: sha512-454rs7jHngixp/NMxd5srYD57OnzSlZ/eFTETjORQHLwJG1lRtmNOJcBerZlfu4GjKqeq8aCCIQrMdHyhI51Hw==} resolution: {integrity: sha512-454rs7jHngixp/NMxd5srYD57OnzSlZ/eFTETjORQHLwJG1lRtmNOJcBerZlfu4GjKqeq8aCCIQrMdHyhI51Hw==}
engines: {node: ^20.19.0 || >=22.12.0} engines: {node: ^20.19.0 || >=22.12.0}
@@ -720,22 +556,11 @@ packages:
'@types/[email protected]': '@types/[email protected]':
resolution: {integrity: sha512-dszCsrKb5U7ZsVZBWiHFklTloVl0mSEnWH/iZXfZUlI4rzCUnsvGmgqfuVRHL54ugE7/wRuxEIXRa2iMZ+BG6g==} resolution: {integrity: sha512-dszCsrKb5U7ZsVZBWiHFklTloVl0mSEnWH/iZXfZUlI4rzCUnsvGmgqfuVRHL54ugE7/wRuxEIXRa2iMZ+BG6g==}
'@types/[email protected]':
resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==}
'@types/[email protected]':
resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==}
'@types/[email protected]': '@types/[email protected]':
resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==} resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==}
peerDependencies: peerDependencies:
'@types/react': ^19.2.0 '@types/react': ^19.2.0
'@types/[email protected]':
resolution: {integrity: sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==}
peerDependencies:
'@types/react': '*'
'@types/[email protected]': '@types/[email protected]':
resolution: {integrity: sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==} resolution: {integrity: sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==}
@@ -867,10 +692,6 @@ packages:
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
[email protected]:
resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==}
engines: {node: '>=10', npm: '>=6'}
[email protected]: [email protected]:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
@@ -918,10 +739,6 @@ packages:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'} engines: {node: '>=10'}
[email protected]:
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
engines: {node: '>=6'}
[email protected]: [email protected]:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'} engines: {node: '>=7.0.0'}
@@ -932,16 +749,9 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
[email protected]:
resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==}
[email protected]: [email protected]:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
[email protected]:
resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==}
engines: {node: '>=10'}
[email protected]: [email protected]:
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@@ -989,9 +799,6 @@ packages:
resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
[email protected]:
resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==}
[email protected]: [email protected]:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -999,9 +806,6 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==} resolution: {integrity: sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==}
[email protected]:
resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==}
[email protected]: [email protected]:
resolution: {integrity: sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==} resolution: {integrity: sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -1137,9 +941,6 @@ packages:
resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}
[email protected]:
resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==}
[email protected]: [email protected]:
resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}
engines: {node: '>=10'} engines: {node: '>=10'}
@@ -1239,9 +1040,6 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==} resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==}
[email protected]:
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
[email protected]: [email protected]:
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
engines: {node: '>= 4'} engines: {node: '>= 4'}
@@ -1266,9 +1064,6 @@ packages:
resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
[email protected]:
resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==}
[email protected]: [email protected]:
resolution: {integrity: sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==} resolution: {integrity: sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -1390,9 +1185,6 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==}
[email protected]:
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
[email protected]: [email protected]:
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
@@ -1485,9 +1277,6 @@ packages:
resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==} resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==}
engines: {node: '>= 12.0.0'} engines: {node: '>= 12.0.0'}
[email protected]:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
[email protected]: [email protected]:
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'} engines: {node: '>=10'}
@@ -1580,10 +1369,6 @@ packages:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'} engines: {node: '>=6'}
[email protected]:
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
engines: {node: '>=8'}
[email protected]: [email protected]:
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
engines: {node: '>=8'} engines: {node: '>=8'}
@@ -1595,10 +1380,6 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
[email protected]:
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
engines: {node: '>=8'}
[email protected]: [email protected]:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -1638,15 +1419,6 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
[email protected]:
resolution: {integrity: sha512-kZFnouyVv7eP/Phmrlo9FK+zcAdriZJvzxXHF1Sl1P377WSGe2G/JxVolhTrB/jeV47lKImhNUsijjHAAbcl/A==}
[email protected]:
resolution: {integrity: sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==}
peerDependencies:
react: '>=16.6.0'
react-dom: '>=16.6.0'
[email protected]: [email protected]:
resolution: {integrity: sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==} resolution: {integrity: sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@@ -1663,11 +1435,6 @@ packages:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'} engines: {node: '>=4'}
[email protected]:
resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==}
engines: {node: '>= 0.4'}
hasBin: true
[email protected]: [email protected]:
resolution: {integrity: sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==} resolution: {integrity: sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -1742,10 +1509,6 @@ packages:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
[email protected]:
resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==}
engines: {node: '>=0.10.0'}
[email protected]: [email protected]:
resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@@ -1773,9 +1536,6 @@ packages:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'} engines: {node: '>=8'}
[email protected]:
resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==}
[email protected]: [email protected]:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'} engines: {node: '>=8'}
@@ -1909,10 +1669,6 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
[email protected]:
resolution: {integrity: sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==}
engines: {node: '>= 6'}
[email protected]: [email protected]:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'} engines: {node: '>=10'}
@@ -2005,8 +1761,6 @@ snapshots:
dependencies: dependencies:
'@babel/types': 7.29.7 '@babel/types': 7.29.7
'@babel/[email protected]': {}
'@babel/[email protected]': '@babel/[email protected]':
dependencies: dependencies:
'@babel/code-frame': 7.29.7 '@babel/code-frame': 7.29.7
@@ -2046,89 +1800,6 @@ snapshots:
tslib: 2.8.1 tslib: 2.8.1
optional: true optional: true
'@emotion/[email protected]':
dependencies:
'@babel/helper-module-imports': 7.29.7
'@babel/runtime': 7.29.7
'@emotion/hash': 0.9.2
'@emotion/memoize': 0.9.0
'@emotion/serialize': 1.3.3
babel-plugin-macros: 3.1.0
convert-source-map: 1.9.0
escape-string-regexp: 4.0.0
find-root: 1.1.0
source-map: 0.5.7
stylis: 4.2.0
transitivePeerDependencies:
- supports-color
'@emotion/[email protected]':
dependencies:
'@emotion/memoize': 0.9.0
'@emotion/sheet': 1.4.0
'@emotion/utils': 1.4.2
'@emotion/weak-memoize': 0.4.0
stylis: 4.2.0
'@emotion/[email protected]': {}
'@emotion/[email protected]':
dependencies:
'@emotion/memoize': 0.9.0
'@emotion/[email protected]': {}
'@emotion/[email protected](@types/[email protected])([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@emotion/babel-plugin': 11.13.5
'@emotion/cache': 11.14.0
'@emotion/serialize': 1.3.3
'@emotion/use-insertion-effect-with-fallbacks': 1.2.0([email protected])
'@emotion/utils': 1.4.2
'@emotion/weak-memoize': 0.4.0
hoist-non-react-statics: 3.3.2
react: 19.2.7
optionalDependencies:
'@types/react': 19.2.17
transitivePeerDependencies:
- supports-color
'@emotion/[email protected]':
dependencies:
'@emotion/hash': 0.9.2
'@emotion/memoize': 0.9.0
'@emotion/unitless': 0.10.0
'@emotion/utils': 1.4.2
csstype: 3.2.3
'@emotion/[email protected]': {}
'@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@emotion/babel-plugin': 11.13.5
'@emotion/is-prop-valid': 1.4.0
'@emotion/react': 11.14.0(@types/[email protected])([email protected])
'@emotion/serialize': 1.3.3
'@emotion/use-insertion-effect-with-fallbacks': 1.2.0([email protected])
'@emotion/utils': 1.4.2
react: 19.2.7
optionalDependencies:
'@types/react': 19.2.17
transitivePeerDependencies:
- supports-color
'@emotion/[email protected]': {}
'@emotion/[email protected]([email protected])':
dependencies:
react: 19.2.7
'@emotion/[email protected]': {}
'@emotion/[email protected]': {}
'@esbuild/[email protected]': '@esbuild/[email protected]':
optional: true optional: true
@@ -2288,93 +1959,6 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/sourcemap-codec': 1.5.5
'@mui/[email protected]': {}
'@mui/[email protected](@mui/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected]))([email protected]))(@types/[email protected])([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@mui/material': 7.3.11(@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
react: 19.2.7
optionalDependencies:
'@types/react': 19.2.17
'@mui/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@mui/core-downloads-tracker': 7.3.11
'@mui/system': 7.3.11(@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@mui/types': 7.4.12(@types/[email protected])
'@mui/utils': 7.3.11(@types/[email protected])([email protected])
'@popperjs/core': 2.11.8
'@types/react-transition-group': 4.4.12(@types/[email protected])
clsx: 2.1.1
csstype: 3.2.3
prop-types: 15.8.1
react: 19.2.7
react-dom: 19.2.7([email protected])
react-is: 19.2.7
react-transition-group: 4.4.5([email protected]([email protected]))([email protected])
optionalDependencies:
'@emotion/react': 11.14.0(@types/[email protected])([email protected])
'@emotion/styled': 11.14.1(@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@types/react': 19.2.17
'@mui/[email protected](@types/[email protected])([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@mui/utils': 7.3.11(@types/[email protected])([email protected])
prop-types: 15.8.1
react: 19.2.7
optionalDependencies:
'@types/react': 19.2.17
'@mui/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@emotion/cache': 11.14.0
'@emotion/serialize': 1.3.3
'@emotion/sheet': 1.4.0
csstype: 3.2.3
prop-types: 15.8.1
react: 19.2.7
optionalDependencies:
'@emotion/react': 11.14.0(@types/[email protected])([email protected])
'@emotion/styled': 11.14.1(@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@mui/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))(@types/[email protected])([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@mui/private-theming': 7.3.11(@types/[email protected])([email protected])
'@mui/styled-engine': 7.3.10(@emotion/[email protected](@types/[email protected])([email protected]))(@emotion/[email protected](@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected]))([email protected])
'@mui/types': 7.4.12(@types/[email protected])
'@mui/utils': 7.3.11(@types/[email protected])([email protected])
clsx: 2.1.1
csstype: 3.2.3
prop-types: 15.8.1
react: 19.2.7
optionalDependencies:
'@emotion/react': 11.14.0(@types/[email protected])([email protected])
'@emotion/styled': 11.14.1(@emotion/[email protected](@types/[email protected])([email protected]))(@types/[email protected])([email protected])
'@types/react': 19.2.17
'@mui/[email protected](@types/[email protected])':
dependencies:
'@babel/runtime': 7.29.7
optionalDependencies:
'@types/react': 19.2.17
'@mui/[email protected](@types/[email protected])([email protected])':
dependencies:
'@babel/runtime': 7.29.7
'@mui/types': 7.4.12(@types/[email protected])
'@types/prop-types': 15.7.15
clsx: 2.1.1
prop-types: 15.8.1
react: 19.2.7
react-is: 19.2.7
optionalDependencies:
'@types/react': 19.2.17
'@napi-rs/[email protected](@emnapi/[email protected])(@emnapi/[email protected])': '@napi-rs/[email protected](@emnapi/[email protected])(@emnapi/[email protected])':
dependencies: dependencies:
'@emnapi/core': 1.10.0 '@emnapi/core': 1.10.0
@@ -2384,8 +1968,6 @@ snapshots:
'@oxc-project/[email protected]': {} '@oxc-project/[email protected]': {}
'@popperjs/[email protected]': {}
'@rolldown/[email protected]': '@rolldown/[email protected]':
optional: true optional: true
@@ -2499,18 +2081,10 @@ snapshots:
dependencies: dependencies:
undici-types: 7.24.6 undici-types: 7.24.6
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected](@types/[email protected])': '@types/[email protected](@types/[email protected])':
dependencies: dependencies:
'@types/react': 19.2.17 '@types/react': 19.2.17
'@types/[email protected](@types/[email protected])':
dependencies:
'@types/react': 19.2.17
'@types/[email protected]': '@types/[email protected]':
dependencies: dependencies:
csstype: 3.2.3 csstype: 3.2.3
@@ -2693,12 +2267,6 @@ snapshots:
dependencies: dependencies:
possible-typed-array-names: 1.1.0 possible-typed-array-names: 1.1.0
[email protected]:
dependencies:
'@babel/runtime': 7.29.7
cosmiconfig: 7.1.0
resolve: 1.22.12
[email protected]: {} [email protected]: {}
[email protected]: {} [email protected]: {}
@@ -2748,8 +2316,6 @@ snapshots:
ansi-styles: 4.3.0 ansi-styles: 4.3.0
supports-color: 7.2.0 supports-color: 7.2.0
[email protected]: {}
[email protected]: [email protected]:
dependencies: dependencies:
color-name: 1.1.4 color-name: 1.1.4
@@ -2758,18 +2324,8 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]:
dependencies:
'@types/parse-json': 4.0.2
import-fresh: 3.3.1
parse-json: 5.2.0
path-type: 4.0.0
yaml: 1.10.3
[email protected]: [email protected]:
dependencies: dependencies:
path-key: 3.1.1 path-key: 3.1.1
@@ -2820,11 +2376,6 @@ snapshots:
dependencies: dependencies:
esutils: 2.0.3 esutils: 2.0.3
[email protected]:
dependencies:
'@babel/runtime': 7.29.7
csstype: 3.2.3
[email protected]: [email protected]:
dependencies: dependencies:
call-bind-apply-helpers: 1.0.2 call-bind-apply-helpers: 1.0.2
@@ -2833,10 +2384,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]:
dependencies:
is-arrayish: 0.2.1
[email protected]: [email protected]:
dependencies: dependencies:
es-errors: 1.3.0 es-errors: 1.3.0
@@ -3100,8 +2647,6 @@ snapshots:
dependencies: dependencies:
flat-cache: 4.0.1 flat-cache: 4.0.1
[email protected]: {}
[email protected]: [email protected]:
dependencies: dependencies:
locate-path: 6.0.0 locate-path: 6.0.0
@@ -3206,10 +2751,6 @@ snapshots:
dependencies: dependencies:
hermes-estree: 0.25.1 hermes-estree: 0.25.1
[email protected]:
dependencies:
react-is: 16.13.1
[email protected]: {} [email protected]: {}
[email protected]: {} [email protected]: {}
@@ -3233,8 +2774,6 @@ snapshots:
call-bound: 1.0.4 call-bound: 1.0.4
get-intrinsic: 1.3.0 get-intrinsic: 1.3.0
[email protected]: {}
[email protected]: [email protected]:
dependencies: dependencies:
async-function: 1.0.0 async-function: 1.0.0
@@ -3362,8 +2901,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]: {} [email protected]: {}
@@ -3435,8 +2972,6 @@ snapshots:
lightningcss-win32-arm64-msvc: 1.32.0 lightningcss-win32-arm64-msvc: 1.32.0
lightningcss-win32-x64-msvc: 1.32.0 lightningcss-win32-x64-msvc: 1.32.0
[email protected]: {}
[email protected]: [email protected]:
dependencies: dependencies:
p-locate: 5.0.0 p-locate: 5.0.0
@@ -3539,21 +3074,12 @@ snapshots:
dependencies: dependencies:
callsites: 3.1.0 callsites: 3.1.0
[email protected]:
dependencies:
'@babel/code-frame': 7.29.7
error-ex: 1.3.4
json-parse-even-better-errors: 2.3.1
lines-and-columns: 1.2.4
[email protected]: {} [email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]: {} [email protected]: {}
@@ -3585,17 +3111,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]([email protected]([email protected]))([email protected]):
dependencies:
'@babel/runtime': 7.29.7
dom-helpers: 5.2.1
loose-envify: 1.4.0
prop-types: 15.8.1
react: 19.2.7
react-dom: 19.2.7([email protected])
[email protected]: {} [email protected]: {}
[email protected]: [email protected]:
@@ -3620,13 +3135,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]:
dependencies:
es-errors: 1.3.0
is-core-module: 2.16.2
path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0
[email protected]: [email protected]:
dependencies: dependencies:
es-errors: 1.3.0 es-errors: 1.3.0
@@ -3740,8 +3248,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: [email protected]:
dependencies: dependencies:
es-errors: 1.3.0 es-errors: 1.3.0
@@ -3794,8 +3300,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: [email protected]:
dependencies: dependencies:
has-flag: 4.0.0 has-flag: 4.0.0
@@ -3933,8 +3437,6 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]([email protected]): [email protected]([email protected]):
+42 -13
View File
@@ -41,6 +41,22 @@ const GUI_LIBC_SUFFIX: &str = "-musl";
#[cfg(not(target_env = "musl"))] #[cfg(not(target_env = "musl"))]
const GUI_LIBC_SUFFIX: &str = ""; const GUI_LIBC_SUFFIX: &str = "";
fn gui_asset_name() -> Option<String> {
gui_asset_name_for(std::env::consts::OS, std::env::consts::ARCH, GUI_LIBC_SUFFIX)
}
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"),
("freebsd", "x86_64") => "gpgui_freebsd_amd64.bin.tar.xz".to_owned(),
("freebsd", "aarch64") => "gpgui_freebsd_arm64.bin.tar.xz".to_owned(),
("openbsd", "x86_64") => "gpgui_openbsd_amd64.bin.tar.xz".to_owned(),
("openbsd", "aarch64") => "gpgui_openbsd_arm64.bin.tar.xz".to_owned(),
_ => return None,
};
Some(name)
}
pub struct ProgressNotifier { pub struct ProgressNotifier {
win: WebviewWindow, win: WebviewWindow,
} }
@@ -366,10 +382,10 @@ impl GuiUpdater {
} }
pub async fn update(&self) { pub async fn update(&self) {
if !cfg!(any(target_arch = "x86_64", target_arch = "aarch64")) { let Some(asset_name) = gui_asset_name() else {
info!("GUI version is not supported on this architecture."); info!("GUI updates are not supported on this platform.");
return; return;
} };
info!("Update GUI, version: {}", self.version); info!("Update GUI, version: {}", self.version);
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
@@ -381,16 +397,8 @@ impl GuiUpdater {
format!("v{}", self.version) format!("v{}", self.version)
}; };
let arch = if cfg!(target_arch = "x86_64") { let file_url =
"x86_64" format!("https://github.com/yuezk/GlobalProtect-openconnect/releases/download/{release_tag}/{asset_name}");
} else {
"aarch64"
};
let file_url = format!(
"https://github.com/yuezk/GlobalProtect-openconnect/releases/download/{}/gpgui_{}{}.bin.tar.xz",
release_tag, arch, GUI_LIBC_SUFFIX
);
let checksum_url = format!("{}.sha256", file_url); let checksum_url = format!("{}.sha256", file_url);
info!("Downloading file: {}", file_url); info!("Downloading file: {}", file_url);
@@ -494,6 +502,27 @@ mod tests {
use super::*; use super::*;
#[test]
fn selects_platform_specific_gui_assets() {
assert_eq!(
gui_asset_name_for("linux", "x86_64", ""),
Some("gpgui_x86_64.bin.tar.xz".to_owned())
);
assert_eq!(
gui_asset_name_for("linux", "aarch64", "-musl"),
Some("gpgui_aarch64-musl.bin.tar.xz".to_owned())
);
assert_eq!(
gui_asset_name_for("freebsd", "x86_64", ""),
Some("gpgui_freebsd_amd64.bin.tar.xz".to_owned())
);
assert_eq!(
gui_asset_name_for("openbsd", "aarch64", ""),
Some("gpgui_openbsd_arm64.bin.tar.xz".to_owned())
);
assert_eq!(gui_asset_name_for("macos", "aarch64", ""), None);
}
#[tokio::test] #[tokio::test]
async fn pending_install_reconnects_with_a_fresh_handshake() { async fn pending_install_reconnects_with_a_fresh_handshake() {
let credential = Arc::new(SessionCredential::generate(Uuid::new_v4(), env!("CARGO_PKG_VERSION")).unwrap()); let credential = Arc::new(SessionCredential::generate(Uuid::new_v4(), env!("CARGO_PKG_VERSION")).unwrap());
+7 -7
View File
@@ -15,15 +15,15 @@
}, },
"windows": [ "windows": [
{ {
"title": "GP Connect Helper", "title": "GPGUI Downloader",
"center": true, "center": true,
"resizable": true, "resizable": true,
"width": 500, "width": 460,
"height": 100, "height": 104,
"minWidth": 500, "minWidth": 460,
"minHeight": 100, "minHeight": 104,
"maxWidth": 500, "maxWidth": 460,
"maxHeight": 100, "maxHeight": 104,
"label": "main", "label": "main",
"decorations": false "decorations": false
} }
+78 -96
View File
@@ -1,4 +1,3 @@
import { Box, Button, CssBaseline, LinearProgress, Typography } from "@mui/material";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
import logo from "../../assets/icon-small.svg"; import logo from "../../assets/icon-small.svg";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@@ -7,129 +6,112 @@ import "./styles.css";
const appWindow = getCurrentWindow(); const appWindow = getCurrentWindow();
function useUpdateProgress() { export default function App() {
const [error, setError] = useState(false);
const [progress, setProgress] = useState<number | null>(null); const [progress, setProgress] = useState<number | null>(null);
useEffect(() => { useEffect(() => {
const unlisten = appWindow.listen("app://update-progress", (event) => { const unlisteners: Array<() => void> = [];
let disposed = false;
const startUpdate = async () => {
const progressUnlisten = await appWindow.listen("app://update-progress", (event) => {
setProgress(event.payload as number); setProgress(event.payload as number);
}); });
const errorUnlisten = await appWindow.listen("app://update-error", () => {
return () => {
unlisten.then((unlisten) => unlisten());
};
}, []);
return progress;
}
export default function App() {
const [error, setError] = useState(false);
useEffect(() => {
appWindow.emit("app://update");
const unlisten = appWindow.listen("app://update-error", () => {
setError(true); setError(true);
}); });
if (disposed) {
progressUnlisten();
errorUnlisten();
return;
}
unlisteners.push(progressUnlisten, errorUnlisten);
await appWindow.emit("app://update");
};
void startUpdate();
return () => { return () => {
unlisten.then((unlisten) => unlisten()); disposed = true;
unlisteners.forEach((unlisten) => unlisten());
}; };
}, []); }, []);
const handleRetry = () => { const handleRetry = () => {
setError(false); setError(false);
setProgress(null);
appWindow.emit("app://update"); appWindow.emit("app://update");
}; };
return ( return (
<> <div className="update-window" data-tauri-drag-region>
<CssBaseline /> <img src={logo} alt="" className="update-logo" data-tauri-drag-region />
<Box <div className="update-content" data-tauri-drag-region>
sx={{ position: "absolute", inset: 0 }} {error ? (
display="flex" <DownloadFailed onRetry={handleRetry} />
alignItems="center" ) : (
px={2} <DownloadIndicator progress={progress} />
data-tauri-drag-region )}
> </div>
<Box display="flex" alignItems="center" flex="1" data-tauri-drag-region> </div>
<Box
component="img"
src={logo}
alt="logo"
sx={{ width: "4rem", height: "4rem" }}
data-tauri-drag-region
/>
<Box flex={1} ml={2}>
{error ? <DownloadFailed onRetry={handleRetry} /> : <DownloadIndicator />}
</Box>
</Box>
</Box>
</>
); );
} }
function DownloadIndicator() { function DownloadIndicator({ progress }: { progress: number | null }) {
const progress = useUpdateProgress();
return ( return (
<> <div className="update-status" data-tauri-drag-region>
<Typography variant="h1" fontSize="1rem" data-tauri-drag-region> <h1 className="update-title" data-tauri-drag-region>
Updating the GUI components... Getting GP Connect ready
</Typography> </h1>
<Box mt={1}> <DownloadProgress value={progress} />
<LinearProgressWithLabel value={progress} /> </div>
</Box>
</>
); );
} }
function DownloadFailed({ onRetry }: { onRetry: () => void }) { function DownloadFailed({ onRetry }: { onRetry: () => void }) {
return ( return (
<> <div className="update-status error-status" data-tauri-drag-region>
<Typography variant="h1" fontSize="1rem" data-tauri-drag-region> <div className="error-copy" role="alert" data-tauri-drag-region>
Failed to update the GUI components. <h1 className="update-title" data-tauri-drag-region>
</Typography> Couldn’t get GP Connect ready
<Box mt={1} data-tauri-drag-region> </h1>
<Button <p className="update-description" data-tauri-drag-region>
variant="contained" Please try again.
color="primary" </p>
size="small" </div>
onClick={onRetry} <button type="button" onClick={onRetry} className="retry-button">
sx={{
textTransform: "none",
}}
>
Retry Retry
</Button> </button>
</Box> </div>
);
}
function DownloadProgress({ value }: { value: number | null }) {
const isDeterminate = value !== null;
return (
<>
<div className="progress-summary" data-tauri-drag-region>
<p className="update-description" data-tauri-drag-region>
This should only take a moment.
</p>
<span className="progress-label" aria-hidden="true">
{isDeterminate ? `${Math.round(value)}%` : "In progress"}
</span>
</div>
<div
className={`progress-bar${isDeterminate ? "" : " progress-bar-indeterminate"}`}
role="progressbar"
aria-label="Update progress"
aria-valuemin={isDeterminate ? 0 : undefined}
aria-valuemax={isDeterminate ? 100 : undefined}
aria-valuenow={isDeterminate ? Math.round(value) : undefined}
>
<div className="progress-fill" style={isDeterminate ? { width: `${value}%` } : undefined} />
</div>
</> </>
); );
} }
function LinearProgressWithLabel(props: { value: number | null }) {
const { value } = props;
return (
<Box sx={{ display: "flex", alignItems: "center" }}>
<Box flex="1">
<LinearProgress
variant={value === null ? "indeterminate" : "determinate"}
value={value ?? 0}
sx={{
py: 1.2,
".MuiLinearProgress-bar": {
transition: "none",
},
}}
/>
</Box>
{value !== null && (
<Box sx={{ minWidth: 35, textAlign: "right", ml: 1 }}>
<Typography variant="body2" color="text.secondary">{`${Math.round(value)}%`}</Typography>
</Box>
)}
</Box>
);
}
@@ -1,10 +1,173 @@
html, html,
body, body,
#root { #root {
box-sizing: border-box;
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden;
-webkit-user-select: none; -webkit-user-select: none;
user-select: none; user-select: none;
cursor: default; cursor: default;
} }
body {
background: #f6f5f4;
color: #2e3436;
font-family:
Inter,
ui-sans-serif,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
}
button {
font: inherit;
}
.update-window {
box-sizing: border-box;
display: flex;
align-items: center;
width: 100%;
height: 100%;
padding: 16px 18px;
gap: 15px;
background: #f6f5f4;
}
.update-logo {
flex: 0 0 auto;
width: 48px;
height: 48px;
}
.update-content,
.update-status {
min-width: 0;
width: 100%;
}
.update-title {
margin: 0;
color: #2e3436;
font-size: 16px;
font-weight: 600;
line-height: 1.25;
letter-spacing: -0.01em;
}
.update-description {
margin: 3px 0 0;
color: #5e5c64;
font-size: 12px;
line-height: 1.4;
}
.progress-summary {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
margin-top: 3px;
}
.progress-summary .update-description {
margin: 0;
}
.progress-bar {
position: relative;
width: 100%;
height: 6px;
margin-top: 9px;
overflow: hidden;
border-radius: 3px;
background-color: #d5d3d1;
}
.progress-fill {
height: 100%;
border-radius: 3px;
background: #3584e4;
transition: width 180ms ease-out;
}
.progress-bar-indeterminate .progress-fill {
width: 35%;
animation: progress-indeterminate 1.4s ease-in-out infinite;
}
@keyframes progress-indeterminate {
from {
transform: translateX(-110%);
}
to {
transform: translateX(300%);
}
}
@media (prefers-reduced-motion: reduce) {
.progress-fill {
transition: none;
}
.progress-bar-indeterminate .progress-fill {
animation: none;
transform: translateX(90%);
}
}
.progress-label {
flex: 0 0 auto;
color: #3d3846;
font-size: 12px;
font-variant-numeric: tabular-nums;
font-weight: 500;
text-align: right;
white-space: nowrap;
}
.error-status {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.error-status .update-title {
color: #9c2f2f;
}
.error-copy {
min-width: 0;
}
.retry-button {
min-width: 68px;
padding: 4px 14px;
border: 0;
border-radius: 8px;
background: #1c71d8;
color: #ffffff;
cursor: pointer;
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: 2px solid #1a5fb4;
outline-offset: 2px;
}
+1
View File
@@ -31,3 +31,4 @@ nix = { version = "0.31", features = ["fs", "socket", "user"] }
[dev-dependencies] [dev-dependencies]
tokio-tungstenite = "0.29" tokio-tungstenite = "0.29"
sha256.workspace = true
+43 -3
View File
@@ -160,7 +160,10 @@ enum GuiInstallError {
} }
fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> { fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
let target = binary_paths::gpgui(); install_gui_at(Path::new(src), checksum, &binary_paths::gpgui_update_target())
}
fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiInstallError> {
let Some(dir) = target.parent() else { let Some(dir) = target.parent() else {
return Err(GuiInstallError::Install(anyhow::anyhow!( return Err(GuiInstallError::Install(anyhow::anyhow!(
"Failed to get parent directory of GUI binary" "Failed to get parent directory of GUI binary"
@@ -168,7 +171,7 @@ fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
}; };
fs::create_dir_all(dir).map_err(|err| GuiInstallError::Install(err.into()))?; fs::create_dir_all(dir).map_err(|err| GuiInstallError::Install(err.into()))?;
let staged_archive = stage_gui_archive(Path::new(src), dir)?; let staged_archive = stage_gui_archive(src, dir)?;
let archive_path = staged_archive.path().to_string_lossy(); let archive_path = staged_archive.path().to_string_lossy();
verify_checksum(&archive_path, checksum).map_err(GuiInstallError::Checksum)?; verify_checksum(&archive_path, checksum).map_err(GuiInstallError::Checksum)?;
@@ -260,7 +263,7 @@ fn extract_gui_binary<R: Read>(archive: &mut Archive<R>, dir: &Path) -> Result<N
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::io::Cursor; use std::{io::Cursor, os::unix::fs::PermissionsExt};
use gpapi::{ use gpapi::{
gateway::Gateway, gateway::Gateway,
@@ -270,6 +273,7 @@ mod tests {
}, },
}; };
use tar::{Builder, EntryType, Header}; use tar::{Builder, EntryType, Header};
use xz2::write::XzEncoder;
use super::*; use super::*;
@@ -288,6 +292,17 @@ mod tests {
data data
} }
fn compressed_gui_archive(contents: &[u8]) -> NamedTempFile {
let tar = archive_with_entry(EntryType::Regular, contents);
let mut encoder = XzEncoder::new(Vec::new(), 6);
encoder.write_all(&tar).unwrap();
let compressed = encoder.finish().unwrap();
let mut archive = NamedTempFile::new().unwrap();
archive.write_all(&compressed).unwrap();
archive.flush().unwrap();
archive
}
#[test] #[test]
fn rejects_non_file_and_empty_gui_entries() { fn rejects_non_file_and_empty_gui_entries() {
let output = tempfile::tempdir().unwrap(); let output = tempfile::tempdir().unwrap();
@@ -337,6 +352,31 @@ mod tests {
assert!(extract_gui_binary(&mut archive, output.path()).is_err()); assert!(extract_gui_binary(&mut archive, output.path()).is_err());
} }
#[test]
fn installs_gui_at_the_supplied_target() {
let archive = compressed_gui_archive(b"gui binary");
let checksum = sha256::try_digest(archive.path()).unwrap();
let output = tempfile::tempdir().unwrap();
let target = output.path().join("gpclient/gpgui");
install_gui_at(archive.path(), &checksum, &target).unwrap();
assert_eq!(std::fs::read(&target).unwrap(), b"gui binary");
assert_eq!(std::fs::metadata(&target).unwrap().permissions().mode() & 0o777, 0o755);
}
#[test]
fn checksum_failure_preserves_the_existing_gui() {
let archive = compressed_gui_archive(b"replacement");
let output = tempfile::tempdir().unwrap();
let target = output.path().join("gpclient/gpgui");
std::fs::create_dir_all(target.parent().unwrap()).unwrap();
std::fs::write(&target, b"existing").unwrap();
assert!(install_gui_at(archive.path(), "invalid", &target).is_err());
assert_eq!(std::fs::read(target).unwrap(), b"existing");
}
#[tokio::test] #[tokio::test]
async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() { async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() {
let (request_tx, _request_rx) = mpsc::channel(1); let (request_tx, _request_rx) = mpsc::channel(1);
+11 -2
View File
@@ -8,18 +8,18 @@ edition.workspace = true
license.workspace = true license.workspace = true
[dependencies] [dependencies]
common = { path = "../common" }
gpapi = { path = "../gpapi" } gpapi = { path = "../gpapi" }
# Shared dependencies # Shared dependencies
anyhow.workspace = true anyhow.workspace = true
log.workspace = true log.workspace = true
tokio.workspace = true tokio = { workspace = true, features = ["io-util", "net", "time"] }
# Browser auth dependencies # Browser auth dependencies
browser-launcher = { path = "../browser-launcher", default-features = false, features = ["launcher"], optional = true } browser-launcher = { path = "../browser-launcher", default-features = false, features = ["launcher"], optional = true }
tiny_http = { version = "0.12", optional = true } tiny_http = { version = "0.12", optional = true }
uuid = { version = "1", optional = true, features = ["v4"] } uuid = { version = "1", optional = true, features = ["v4"] }
uzers = { workspace = true, optional = true }
# Webview auth dependencies # Webview auth dependencies
tauri = { workspace = true, optional = true } tauri = { workspace = true, optional = true }
@@ -33,6 +33,7 @@ webkit2gtk = { version = "2", optional = true }
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
block2 = { version = "0.6", optional = true } block2 = { version = "0.6", optional = true }
objc2 = { version = "0.6", optional = true } objc2 = { version = "0.6", optional = true }
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSWorkspace", "block2"], optional = true }
objc2-foundation = { version = "0.3", optional = true } objc2-foundation = { version = "0.3", optional = true }
objc2-web-kit = { version = "0.3", optional = true } objc2-web-kit = { version = "0.3", optional = true }
@@ -41,6 +42,11 @@ browser-auth = [
"dep:browser-launcher", "dep:browser-launcher",
"dep:tiny_http", "dep:tiny_http",
"dep:uuid", "dep:uuid",
"dep:uzers",
"dep:block2",
"dep:objc2",
"dep:objc2-app-kit",
"dep:objc2-foundation",
] ]
webview-auth = [ webview-auth = [
"gpapi/tauri", "gpapi/tauri",
@@ -55,3 +61,6 @@ webview-auth = [
"dep:objc2-web-kit", "dep:objc2-web-kit",
] ]
release-devtools = ["webview-auth", "tauri/devtools"] release-devtools = ["webview-auth", "tauri/devtools"]
[dev-dependencies]
tempfile.workspace = true
+2 -2
View File
@@ -1,4 +1,4 @@
use std::io::Cursor; use std::{io::Cursor, net::SocketAddr};
use log::info; use log::info;
use tiny_http::{Header, Method, Response, Server}; use tiny_http::{Header, Method, Response, Server};
@@ -10,7 +10,7 @@ pub(super) struct AuthServer {
} }
impl AuthServer { impl AuthServer {
pub fn new(addr: &str) -> anyhow::Result<Self> { pub fn new(addr: SocketAddr) -> anyhow::Result<Self> {
let server = Server::http(addr).map_err(|err| anyhow::anyhow!(err))?; let server = Server::http(addr).map_err(|err| anyhow::anyhow!(err))?;
let auth_id = Uuid::new_v4().to_string(); let auth_id = Uuid::new_v4().to_string();
+39 -50
View File
@@ -1,29 +1,36 @@
use std::{env::temp_dir, fs, os::unix::fs::PermissionsExt}; use std::net::{IpAddr, SocketAddr};
use browser_launcher::Browser as LaunchBrowser; use browser_launcher::Browser as LaunchBrowser;
use common::constants::GP_CALLBACK_PORT_FILENAME;
use gpapi::auth::SamlAuthData; use gpapi::auth::SamlAuthData;
use log::info; use log::info;
use tokio::{ use tokio::net::UdpSocket;
io::AsyncReadExt,
net::{TcpListener, UdpSocket},
};
use crate::browser::auth_server::AuthServer; use crate::{AuthCallbackReceiver, browser::auth_server::AuthServer, ensure_auth_callback_handler};
pub struct BrowserAuthenticator<'a> { pub struct BrowserAuthenticator<'a> {
auth_request: &'a str, auth_request: &'a str,
browser: &'a str, browser: &'a str,
browser_listen: Option<IpAddr>,
} }
impl<'a> BrowserAuthenticator<'a> { impl<'a> BrowserAuthenticator<'a> {
pub fn new(auth_request: &'a str, browser: &'a str) -> Self { pub fn new(auth_request: &'a str, browser: &'a str, browser_listen: Option<IpAddr>) -> Self {
Self { auth_request, browser } Self {
auth_request,
browser,
browser_listen,
}
} }
pub async fn authenticate(&self) -> anyhow::Result<SamlAuthData> { pub async fn authenticate(&self) -> anyhow::Result<SamlAuthData> {
let callback_receiver = if is_remote_browser(self.browser) {
None
} else {
ensure_auth_callback_handler()?;
Some(AuthCallbackReceiver::bind()?)
};
let addr = self.determine_addr().await?; let addr = self.determine_addr().await?;
let auth_server = AuthServer::new(&addr)?; let auth_server = AuthServer::new(addr)?;
let auth_url = auth_server.auth_url(); let auth_url = auth_server.auth_url();
let auth_request = self.auth_request.to_string(); let auth_request = self.auth_request.to_string();
@@ -54,15 +61,18 @@ Note that the URL is only valid for a single use.
browser_launcher::open_url(&auth_url, LaunchBrowser::from_name(self.browser))?; browser_launcher::open_url(&auth_url, LaunchBrowser::from_name(self.browser))?;
info!("Please continue the authentication process in the default browser"); info!("Please continue the authentication process in the default browser");
wait_auth_data().await callback_receiver.unwrap().receive().await
} }
async fn determine_addr(&self) -> anyhow::Result<String> { async fn determine_addr(&self) -> anyhow::Result<SocketAddr> {
if is_remote_browser(self.browser) { if is_remote_browser(self.browser) {
let local_ip = detect_local_ip().await?; let local_ip = match self.browser_listen {
Ok(format!("{}:0", local_ip)) Some(ip) => ip,
None => detect_local_ip().await?,
};
Ok(SocketAddr::new(local_ip, 0))
} else { } else {
Ok("127.0.0.1:0".to_string()) Ok(SocketAddr::from(([127, 0, 0, 1], 0)))
} }
} }
} }
@@ -72,48 +82,16 @@ fn is_remote_browser(browser: &str) -> bool {
} }
/// Detect the local IP address by creating a UDP socket and connecting to an external address /// Detect the local IP address by creating a UDP socket and connecting to an external address
async fn detect_local_ip() -> anyhow::Result<String> { async fn detect_local_ip() -> anyhow::Result<IpAddr> {
let socket = UdpSocket::bind("0.0.0.0:0").await?; let socket = UdpSocket::bind("0.0.0.0:0").await?;
if let Err(err) = socket.connect("1.1.1.1:80").await { if let Err(err) = socket.connect("1.1.1.1:80").await {
anyhow::bail!("Failed to connect to external address to determine local IP: {}", err); anyhow::bail!("Failed to connect to external address to determine local IP: {}", err);
} }
let local_addr = socket.local_addr()?; let local_addr = socket.local_addr()?;
let ip = local_addr.ip().to_string(); let ip = local_addr.ip();
info!("Determined local IP address: {}", ip); info!("Determined local IP address: {}", ip);
Ok(ip.to_string()) Ok(ip)
}
async fn wait_auth_data() -> anyhow::Result<SamlAuthData> {
// Start a local server to receive the browser authentication data
let listener = TcpListener::bind("127.0.0.1:0").await?;
let port = listener.local_addr()?.port();
let port_file = temp_dir().join(GP_CALLBACK_PORT_FILENAME);
// Write the port to a file
fs::write(&port_file, port.to_string())?;
fs::set_permissions(&port_file, fs::Permissions::from_mode(0o600))?;
// Remove the previous log file
let callback_log = temp_dir().join("gpcallback.log");
let _ = fs::remove_file(&callback_log);
info!("Listening authentication data on port {}", port);
info!(
"If it hangs, please check the logs at `{}` for more information",
callback_log.display()
);
let (mut socket, _) = listener.accept().await?;
info!("Received the browser authentication data from the socket");
let mut data = String::new();
socket.read_to_string(&mut data).await?;
// Remove the port file
fs::remove_file(&port_file)?;
let auth_data = SamlAuthData::from_gpcallback(&data)?;
Ok(auth_data)
} }
fn read_auth_data_from_stdin() -> anyhow::Result<SamlAuthData> { fn read_auth_data_from_stdin() -> anyhow::Result<SamlAuthData> {
@@ -140,4 +118,15 @@ mod tests {
assert!(is_remote_browser("REMOTE")); assert!(is_remote_browser("REMOTE"));
assert_ne!(LaunchBrowser::from_name("remote"), LaunchBrowser::Default); assert_ne!(LaunchBrowser::from_name("remote"), LaunchBrowser::Default);
} }
#[tokio::test]
async fn remote_browser_uses_explicit_listen_address() {
let listen_ip = "192.168.107.15".parse().unwrap();
let authenticator = BrowserAuthenticator::new("request", "remote", Some(listen_ip));
assert_eq!(
authenticator.determine_addr().await.unwrap(),
SocketAddr::new(listen_ip, 0)
);
}
} }
+512
View File
@@ -0,0 +1,512 @@
use std::{
fs::{self, DirBuilder, OpenOptions, TryLockError},
io::ErrorKind,
os::unix::fs::{DirBuilderExt, FileTypeExt, MetadataExt, OpenOptionsExt, PermissionsExt},
path::{Path, PathBuf},
time::Duration,
};
use anyhow::{Context, bail};
use gpapi::auth::SamlAuthData;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::{UnixListener, UnixStream},
time::timeout,
};
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use log::warn;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
use std::ffi::OsStr;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use std::process::{Command, Output};
const CALLBACK_SCHEME: &str = "globalprotectcallback";
const PROTOCOL_MAGIC: &[u8; 4] = b"GPAC";
const PROTOCOL_VERSION: u8 = 1;
const MAX_CALLBACK_SIZE: usize = 1024 * 1024;
const IO_TIMEOUT: Duration = Duration::from_secs(5);
const STATUS_ACCEPTED: u8 = 0;
const STATUS_INVALID_CALLBACK: u8 = 1;
const STATUS_UNSUPPORTED_VERSION: u8 = 2;
#[cfg(target_os = "macos")]
mod macos;
pub struct AuthCallbackReceiver {
listener: UnixListener,
socket_path: PathBuf,
_lock_file: fs::File,
}
impl AuthCallbackReceiver {
pub fn bind() -> anyhow::Result<Self> {
let socket_path = callback_socket_path();
prepare_socket_directory(&socket_path)?;
Self::bind_at(socket_path)
}
fn bind_at(socket_path: PathBuf) -> anyhow::Result<Self> {
let lock_file = acquire_lock(&socket_path)?;
match fs::symlink_metadata(&socket_path) {
Ok(_) => remove_stale_socket(&socket_path)?,
Err(err) if err.kind() == ErrorKind::NotFound => {}
Err(err) => return Err(err.into()),
}
finish_bind(UnixListener::bind(&socket_path)?, socket_path, lock_file)
}
pub async fn receive(&self) -> anyhow::Result<SamlAuthData> {
loop {
let (mut stream, _) = self.listener.accept().await?;
let callback = match timeout(IO_TIMEOUT, read_callback(&mut stream)).await {
Ok(callback) => callback,
Err(_) => continue,
};
match callback {
Ok(callback) => match SamlAuthData::from_gpcallback(&callback) {
Ok(auth_data) => {
let _ = write_response(&mut stream, STATUS_ACCEPTED).await;
return Ok(auth_data);
}
Err(_) => {
let _ = write_response(&mut stream, STATUS_INVALID_CALLBACK).await;
}
},
Err(CallbackReadError::UnsupportedVersion) => {
let _ = write_response(&mut stream, STATUS_UNSUPPORTED_VERSION).await;
}
Err(CallbackReadError::Invalid) => {
let _ = write_response(&mut stream, STATUS_INVALID_CALLBACK).await;
}
Err(CallbackReadError::Io) => continue,
}
}
}
}
impl Drop for AuthCallbackReceiver {
fn drop(&mut self) {
if fs::symlink_metadata(&self.socket_path)
.is_ok_and(|metadata| metadata.file_type().is_socket() && metadata.uid() == uzers::get_current_uid())
{
let _ = fs::remove_file(&self.socket_path);
}
}
}
pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
validate_callback(callback)?;
forward_auth_callback_to(callback, &callback_socket_path()).await
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
const MIME_TYPE: &str = "x-scheme-handler/globalprotectcallback";
const HANDLER: &str = "gpgui.desktop";
ensure_lxqt_mime_tool()?;
let current_handler = query_callback_handler(MIME_TYPE)?;
if !should_register_handler(&current_handler) {
return Ok(());
}
let output = Command::new("xdg-mime")
.args(["default", HANDLER, MIME_TYPE])
.output()
.context("xdg-mime is required for external-browser authentication")?;
if !output.status.success() {
log_command_failure("register callback handler", &output);
bail!("Failed to register the globalprotectcallback URL handler");
}
if query_callback_handler(MIME_TYPE)? != HANDLER {
bail!("The globalprotectcallback URL handler registration did not take effect");
}
Ok(())
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn query_callback_handler(mime_type: &str) -> anyhow::Result<String> {
let output = Command::new("xdg-mime")
.args(["query", "default", mime_type])
.output()
.context("xdg-mime is required for external-browser authentication")?;
if !output.status.success() {
log_command_failure("query callback handler", &output);
bail!("Failed to query the globalprotectcallback URL handler");
}
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn ensure_lxqt_mime_tool() -> anyhow::Result<()> {
if !is_lxqt_desktop(std::env::var_os("XDG_CURRENT_DESKTOP").as_deref()) {
return Ok(());
}
let result = Command::new("qtxdg-mat").args(["defapp", "--help"]).output();
match result {
Ok(output) if output.status.success() => Ok(()),
Ok(output) => {
let stderr = String::from_utf8_lossy(&output.stderr);
warn!(
"qtxdg-mat readiness check failed with {}: {}",
output.status,
stderr.trim()
);
bail!("Install qtxdg-tools for browser SSO.")
}
Err(err) => {
warn!("Failed to run qtxdg-mat readiness check: {err}");
bail!("Install qtxdg-tools for browser SSO.")
}
}
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
fn is_lxqt_desktop(current_desktop: Option<&OsStr>) -> bool {
current_desktop
.and_then(OsStr::to_str)
.is_some_and(|desktop| desktop.split(':').any(|name| name.eq_ignore_ascii_case("lxqt")))
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn log_command_failure(action: &str, output: &Output) {
let stderr = String::from_utf8_lossy(&output.stderr);
warn!("xdg-mime failed to {action} with {}: {}", output.status, stderr.trim());
}
#[cfg(target_os = "macos")]
pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
macos::ensure_auth_callback_handler()
}
#[cfg(not(any(
target_os = "linux",
target_os = "freebsd",
target_os = "openbsd",
target_os = "macos"
)))]
pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
Ok(())
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
fn should_register_handler(current_handler: &str) -> bool {
current_handler != "gpgui.desktop"
}
async fn forward_auth_callback_to(callback: &str, socket_path: &Path) -> anyhow::Result<()> {
validate_callback(callback)?;
let (version, status) = timeout(IO_TIMEOUT, async {
let mut stream = UnixStream::connect(socket_path)
.await
.context("No external-browser authentication is waiting for a callback")?;
stream.write_all(PROTOCOL_MAGIC).await?;
stream.write_u8(PROTOCOL_VERSION).await?;
stream.write_u32(callback.len() as u32).await?;
stream.write_all(callback.as_bytes()).await?;
Ok::<_, anyhow::Error>((stream.read_u8().await?, stream.read_u8().await?))
})
.await
.context("Timed out forwarding the authentication callback")??;
if version != PROTOCOL_VERSION {
bail!("Authentication callback protocol version mismatch");
}
match status {
STATUS_ACCEPTED => Ok(()),
STATUS_INVALID_CALLBACK => bail!("Authentication callback was rejected"),
STATUS_UNSUPPORTED_VERSION => bail!("Authentication callback protocol version is unsupported"),
_ => bail!("Authentication callback handler returned an unknown status"),
}
}
fn callback_socket_path() -> PathBuf {
let uid = uzers::get_current_uid();
#[cfg(target_os = "linux")]
{
let runtime_dir = PathBuf::from(format!("/run/user/{uid}"));
if fs::symlink_metadata(&runtime_dir).is_ok_and(|metadata| {
metadata.is_dir()
&& !metadata.file_type().is_symlink()
&& metadata.uid() == uid
&& metadata.permissions().mode() & 0o077 == 0
}) {
return runtime_dir.join("gp-connect/auth-callback.sock");
}
}
PathBuf::from(format!("/tmp/gp-connect-{uid}/auth-callback.sock"))
}
fn prepare_socket_directory(socket_path: &Path) -> anyhow::Result<()> {
let directory = socket_path
.parent()
.ok_or_else(|| anyhow::anyhow!("Authentication callback socket has no parent directory"))?;
match DirBuilder::new().mode(0o700).create(directory) {
Ok(()) => {}
Err(err) if err.kind() == ErrorKind::AlreadyExists => {
let metadata = fs::symlink_metadata(directory)?;
if !metadata.is_dir() || metadata.file_type().is_symlink() {
bail!("Authentication callback runtime path is not a directory");
}
if metadata.uid() != uzers::get_current_uid() {
bail!("Authentication callback runtime directory has the wrong owner");
}
if metadata.permissions().mode() & 0o077 != 0 {
bail!("Authentication callback runtime directory permissions are too broad");
}
}
Err(err) => return Err(err.into()),
}
Ok(())
}
fn finish_bind(
listener: UnixListener,
socket_path: PathBuf,
lock_file: fs::File,
) -> anyhow::Result<AuthCallbackReceiver> {
fs::set_permissions(&socket_path, fs::Permissions::from_mode(0o600))?;
Ok(AuthCallbackReceiver {
listener,
socket_path,
_lock_file: lock_file,
})
}
fn acquire_lock(socket_path: &Path) -> anyhow::Result<fs::File> {
let lock_path = socket_path.with_file_name("auth-callback.lock");
let lock_file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(false)
.mode(0o600)
.open(lock_path)?;
lock_file.set_permissions(fs::Permissions::from_mode(0o600))?;
match lock_file.try_lock() {
Ok(()) => Ok(lock_file),
Err(TryLockError::WouldBlock) => bail!("Another external-browser authentication is already in progress"),
Err(TryLockError::Error(err)) => Err(err.into()),
}
}
fn remove_stale_socket(socket_path: &Path) -> anyhow::Result<()> {
let metadata = fs::symlink_metadata(socket_path)?;
if !metadata.file_type().is_socket() || metadata.uid() != uzers::get_current_uid() {
bail!("Authentication callback socket is not owned by the current user");
}
fs::remove_file(socket_path)?;
Ok(())
}
fn validate_callback(callback: &str) -> anyhow::Result<()> {
if callback.len() > MAX_CALLBACK_SIZE {
bail!("Authentication callback exceeds the maximum supported size");
}
let Some((scheme, data)) = callback.split_once(':') else {
bail!("Authentication callback URL is invalid");
};
if scheme != CALLBACK_SCHEME || data.is_empty() {
bail!("Authentication callback URL is invalid");
}
Ok(())
}
enum CallbackReadError {
UnsupportedVersion,
Invalid,
Io,
}
async fn read_callback(stream: &mut UnixStream) -> Result<String, CallbackReadError> {
let mut magic = [0_u8; 4];
stream.read_exact(&mut magic).await.map_err(|_| CallbackReadError::Io)?;
if &magic != PROTOCOL_MAGIC {
return Err(CallbackReadError::Invalid);
}
let version = stream.read_u8().await.map_err(|_| CallbackReadError::Io)?;
if version != PROTOCOL_VERSION {
return Err(CallbackReadError::UnsupportedVersion);
}
let length = stream.read_u32().await.map_err(|_| CallbackReadError::Io)? as usize;
if length == 0 || length > MAX_CALLBACK_SIZE {
return Err(CallbackReadError::Invalid);
}
let mut payload = vec![0; length];
stream
.read_exact(&mut payload)
.await
.map_err(|_| CallbackReadError::Io)?;
let callback = String::from_utf8(payload).map_err(|_| CallbackReadError::Invalid)?;
validate_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
Ok(callback)
}
async fn write_response(stream: &mut UnixStream, status: u8) -> anyhow::Result<()> {
stream.write_u8(PROTOCOL_VERSION).await?;
stream.write_u8(status).await?;
Ok(())
}
#[cfg(test)]
mod tests {
use tempfile::tempdir;
use super::*;
const VALID_CALLBACK: &str = "globalprotectcallback:cas-as=1&[email protected]&token=very_long_string";
#[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());
}
#[test]
fn replaces_any_other_callback_handler() {
assert!(!should_register_handler("gpgui.desktop"));
assert!(should_register_handler(""));
assert!(should_register_handler("gpauth.desktop"));
assert!(should_register_handler("other-vpn.desktop"));
}
#[test]
fn detects_lxqt_desktop_session() {
assert!(is_lxqt_desktop(Some(OsStr::new("LXQt"))));
assert!(is_lxqt_desktop(Some(OsStr::new("LXQt:KDE"))));
assert!(is_lxqt_desktop(Some(OsStr::new("lxqt"))));
assert!(!is_lxqt_desktop(Some(OsStr::new("LXDE"))));
assert!(!is_lxqt_desktop(None));
}
#[tokio::test]
async fn forwards_callback_to_waiting_receiver() {
let directory = tempdir().unwrap();
let socket_path = directory.path().join("callback.sock");
let receiver = AuthCallbackReceiver::bind_at(socket_path.clone()).unwrap();
assert_eq!(
fs::symlink_metadata(&socket_path).unwrap().permissions().mode() & 0o777,
0o600
);
let sender = tokio::spawn(async move { forward_auth_callback_to(VALID_CALLBACK, &socket_path).await });
let auth_data = receiver.receive().await.unwrap();
sender.await.unwrap().unwrap();
assert_eq!(auth_data.username(), "[email protected]");
assert_eq!(auth_data.token(), Some("very_long_string"));
let socket_path = receiver.socket_path.clone();
drop(receiver);
assert!(!socket_path.exists());
}
#[tokio::test]
async fn rejects_bad_requests_and_keeps_waiting() {
let directory = tempdir().unwrap();
let socket_path = directory.path().join("callback.sock");
let receiver = AuthCallbackReceiver::bind_at(socket_path.clone()).unwrap();
let sender = tokio::spawn(async move {
assert_eq!(
send_raw_callback(&socket_path, PROTOCOL_VERSION, "https://example.com").await,
STATUS_INVALID_CALLBACK
);
assert_eq!(
send_raw_callback(&socket_path, PROTOCOL_VERSION + 1, VALID_CALLBACK).await,
STATUS_UNSUPPORTED_VERSION
);
forward_auth_callback_to(VALID_CALLBACK, &socket_path).await
});
let auth_data = receiver.receive().await.unwrap();
sender.await.unwrap().unwrap();
assert_eq!(auth_data.username(), "[email protected]");
}
#[tokio::test]
async fn ignores_sender_that_disconnects_before_sending() {
let directory = tempdir().unwrap();
let socket_path = directory.path().join("callback.sock");
let receiver = AuthCallbackReceiver::bind_at(socket_path.clone()).unwrap();
drop(UnixStream::connect(&socket_path).await.unwrap());
let sender = tokio::spawn(async move { forward_auth_callback_to(VALID_CALLBACK, &socket_path).await });
let auth_data = receiver.receive().await.unwrap();
sender.await.unwrap().unwrap();
assert_eq!(auth_data.username(), "[email protected]");
}
#[tokio::test]
async fn replaces_owned_stale_socket() {
let directory = tempdir().unwrap();
let socket_path = directory.path().join("callback.sock");
drop(std::os::unix::net::UnixListener::bind(&socket_path).unwrap());
let receiver = AuthCallbackReceiver::bind_at(socket_path.clone()).unwrap();
assert!(socket_path.exists());
drop(receiver);
assert!(!socket_path.exists());
}
#[tokio::test]
async fn reports_when_no_receiver_is_active() {
let directory = tempdir().unwrap();
let socket_path = directory.path().join("missing.sock");
let err = forward_auth_callback_to(VALID_CALLBACK, &socket_path)
.await
.unwrap_err();
assert!(err.to_string().contains("No external-browser authentication"));
}
#[test]
fn rejects_runtime_directory_with_broad_permissions() {
let directory = tempdir().unwrap();
let runtime_dir = directory.path().join("runtime");
fs::create_dir(&runtime_dir).unwrap();
fs::set_permissions(&runtime_dir, fs::Permissions::from_mode(0o755)).unwrap();
let err = prepare_socket_directory(&runtime_dir.join("callback.sock")).unwrap_err();
assert!(err.to_string().contains("permissions are too broad"));
}
#[tokio::test]
async fn rejects_second_active_receiver() {
let directory = tempdir().unwrap();
let socket_path = directory.path().join("callback.sock");
let _receiver = AuthCallbackReceiver::bind_at(socket_path.clone()).unwrap();
let err = AuthCallbackReceiver::bind_at(socket_path).err().unwrap();
assert!(err.to_string().contains("already in progress"));
}
async fn send_raw_callback(socket_path: &Path, version: u8, callback: &str) -> u8 {
let mut stream = UnixStream::connect(socket_path).await.unwrap();
stream.write_all(PROTOCOL_MAGIC).await.unwrap();
stream.write_u8(version).await.unwrap();
stream.write_u32(callback.len() as u32).await.unwrap();
stream.write_all(callback.as_bytes()).await.unwrap();
assert_eq!(stream.read_u8().await.unwrap(), PROTOCOL_VERSION);
stream.read_u8().await.unwrap()
}
}
+119
View File
@@ -0,0 +1,119 @@
use std::{ffi::OsStr, os::raw::c_void, path::PathBuf, thread, time::Duration};
use anyhow::{Context, bail};
use objc2_app_kit::NSWorkspace;
use objc2_foundation::{NSBundle, NSString, NSURL};
const CALLBACK_SCHEME: &str = "globalprotectcallback";
const CALLBACK_URL: &str = "globalprotectcallback:";
const HANDLER_BUNDLE_ID: &str = "com.yuezk.gpauth";
const LOGIN_APP_NAME: &str = "GP Connect Login.app";
#[link(name = "CoreServices", kind = "framework")]
unsafe extern "C" {
fn LSRegisterURL(url: *const c_void, update: u8) -> i32;
}
pub(super) fn ensure_auth_callback_handler() -> anyhow::Result<()> {
let workspace = NSWorkspace::sharedWorkspace();
let app_paths = callback_app_paths();
let selected_handler = current_handler(&workspace);
match selected_handler.as_ref() {
Some((handler, path))
if handler == HANDLER_BUNDLE_ID && app_paths.iter().any(|candidate| same_path(candidate, path)) =>
{
return Ok(());
}
Some((handler, _)) if handler == HANDLER_BUNDLE_ID => {}
None => {}
Some((handler, _)) => bail!("The globalprotectcallback URL scheme is owned by {handler}"),
}
let app_path = app_paths
.first()
.context("GP Connect Login.app is required for external-browser authentication; install GP Connect")?;
let app_url = file_url(app_path);
register_app(&app_url)?;
workspace.setDefaultApplicationAtURL_toOpenURLsWithScheme_completionHandler(
&app_url,
&NSString::from_str(CALLBACK_SCHEME),
None,
);
for _ in 0..50 {
if current_handler(&workspace)
.is_some_and(|(handler, path)| handler == HANDLER_BUNDLE_ID && same_path(app_path, &path))
{
return Ok(());
}
thread::sleep(Duration::from_millis(100));
}
bail!("The globalprotectcallback URL handler registration did not take effect")
}
fn register_app(app_url: &NSURL) -> anyhow::Result<()> {
// A nested application is not necessarily known to LaunchServices until it
// has been launched. Register it explicitly before assigning its URL scheme.
let status = unsafe { LSRegisterURL(app_url as *const NSURL as *const c_void, 1) };
if status != 0 {
bail!("Failed to register GP Connect Login.app with LaunchServices (OSStatus {status})");
}
Ok(())
}
fn current_handler(workspace: &NSWorkspace) -> Option<(String, PathBuf)> {
let callback_url = NSURL::URLWithString(&NSString::from_str(CALLBACK_URL))?;
let app_url = workspace.URLForApplicationToOpenURL(&callback_url)?;
let identifier = bundle_identifier(&app_url)?;
let path = app_url.path().map(|path| PathBuf::from(path.to_string()))?;
Some((identifier, path))
}
fn callback_app_paths() -> Vec<PathBuf> {
let mut candidates = Vec::new();
if let Ok(executable) = std::env::current_exe() {
for path in executable.ancestors() {
if path.file_name() == Some(OsStr::new("Helpers")) {
candidates.push(path.join(LOGIN_APP_NAME));
}
if path.extension() == Some(OsStr::new("app")) {
candidates.push(path.to_path_buf());
}
}
}
if let Some(user_dir) = std::env::var_os("HOME").filter(|path| !path.is_empty()) {
let applications = PathBuf::from(user_dir).join("Applications");
candidates.push(
applications
.join("GP Connect.app/Contents/Helpers")
.join(LOGIN_APP_NAME),
);
}
candidates.push(PathBuf::from("/Applications/GP Connect.app/Contents/Helpers").join(LOGIN_APP_NAME));
candidates
.into_iter()
.filter(|path| path.is_dir() && bundle_identifier(&file_url(path)).as_deref() == Some(HANDLER_BUNDLE_ID))
.collect()
}
fn same_path(left: &std::path::Path, right: &std::path::Path) -> bool {
match (left.canonicalize(), right.canonicalize()) {
(Ok(left), Ok(right)) => left == right,
_ => left == right,
}
}
fn file_url(path: &std::path::Path) -> objc2::rc::Retained<NSURL> {
NSURL::fileURLWithPath(&NSString::from_str(&path.to_string_lossy()))
}
fn bundle_identifier(app_url: &NSURL) -> Option<String> {
NSBundle::bundleWithURL(app_url)?
.bundleIdentifier()
.map(|identifier| identifier.to_string())
}
+6
View File
@@ -7,9 +7,15 @@ use gpapi::{
#[cfg(feature = "browser-auth")] #[cfg(feature = "browser-auth")]
mod browser; mod browser;
#[cfg(feature = "browser-auth")]
mod callback;
#[cfg(feature = "browser-auth")] #[cfg(feature = "browser-auth")]
pub use browser::*; pub use browser::*;
#[cfg(feature = "browser-auth")]
pub use callback::*;
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
mod webview; mod webview;
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
+15
View File
@@ -1,6 +1,8 @@
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use anyhow::bail; use anyhow::bail;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use gpapi::utils::window::{WindowTypeHint, set_window_type_hint};
use gpapi::{ use gpapi::{
auth::{AuthWindowTheme, AuthenticationCancelled, SamlAuthData}, auth::{AuthWindowTheme, AuthenticationCancelled, SamlAuthData},
gp_params::GpParams, gp_params::GpParams,
@@ -8,6 +10,8 @@ use gpapi::{
utils::{redact::redact_uri, window::get_title_bar_height}, utils::{redact::redact_uri, window::get_title_bar_height},
}; };
use log::{info, warn}; use log::{info, warn};
#[cfg(target_os = "macos")]
use tauri::Manager;
use tauri::{ use tauri::{
AppHandle, WebviewUrl, WebviewWindow, WindowEvent, AppHandle, WebviewUrl, WebviewWindow, WindowEvent,
webview::{PageLoadEvent, PageLoadPayload}, webview::{PageLoadEvent, PageLoadPayload},
@@ -154,6 +158,9 @@ impl<'a> WebviewAuthenticator<'a> {
.center() .center()
.build()?; .build()?;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
set_window_type_hint(&auth_window, WindowTypeHint::Dialog)?;
self self
.setup_auth_window(&auth_window, Arc::clone(&auth_messenger)) .setup_auth_window(&auth_window, Arc::clone(&auth_messenger))
.await?; .await?;
@@ -318,6 +325,14 @@ impl<'a> WebviewAuthenticator<'a> {
info!("Raising auth window..."); info!("Raising auth window...");
#[cfg(target_os = "macos")]
if let Err(err) = auth_window
.app_handle()
.set_activation_policy(tauri::ActivationPolicy::Regular)
{
warn!("Failed to show the application in the Dock: {}", err);
}
use gpapi::utils::window::WindowExt; use gpapi::utils::window::WindowExt;
let result = auth_window.raise(); let result = auth_window.raise();
+222 -28
View File
@@ -1,5 +1,6 @@
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use anyhow::Context;
use log::{debug, info, warn}; use log::{debug, info, warn};
use crate::Browser; use crate::Browser;
@@ -11,11 +12,56 @@ const EDGE_BETA_BROWSERS: &[&str] = &["microsoft-edge-beta"];
const EDGE_DEV_BROWSERS: &[&str] = &["microsoft-edge-dev"]; const EDGE_DEV_BROWSERS: &[&str] = &["microsoft-edge-dev"];
const FIREFOX_BROWSERS: &[&str] = &["firefox"]; const FIREFOX_BROWSERS: &[&str] = &["firefox"];
const FIREFOX_ESR_BROWSERS: &[&str] = &["firefox-esr"]; const FIREFOX_ESR_BROWSERS: &[&str] = &["firefox-esr"];
const BRAVE_BROWSERS: &[&str] = &["brave-browser-stable"];
const VIVALDI_BROWSERS: &[&str] = &["vivaldi-stable"];
const FALKON_BROWSERS: &[&str] = &["falkon"];
const EPIPHANY_BROWSERS: &[&str] = &["epiphany"];
const OPERA_BROWSERS: &[&str] = &["opera"];
const LIBREWOLF_BROWSERS: &[&str] = &["librewolf"];
const WATERFOX_BROWSERS: &[&str] = &["waterfox"];
const QUTEBROWSER_BROWSERS: &[&str] = &["qutebrowser"];
const AUTO_BROWSER_PROGRAMS: &[&[&str]] = &[
GOOGLE_CHROME_BROWSERS,
CHROMIUM_BROWSERS,
EDGE_BROWSERS,
EDGE_BETA_BROWSERS,
EDGE_DEV_BROWSERS,
FIREFOX_BROWSERS,
FIREFOX_ESR_BROWSERS,
BRAVE_BROWSERS,
VIVALDI_BROWSERS,
FALKON_BROWSERS,
EPIPHANY_BROWSERS,
OPERA_BROWSERS,
LIBREWOLF_BROWSERS,
WATERFOX_BROWSERS,
QUTEBROWSER_BROWSERS,
];
const AUTO_BROWSER_FLATPAK_IDS: &[&str] = &[
"com.google.Chrome",
"org.chromium.Chromium",
"com.microsoft.Edge",
"org.mozilla.firefox",
"com.brave.Browser",
"com.vivaldi.Vivaldi",
"org.kde.falkon",
"org.gnome.Epiphany",
"com.opera.Opera",
"io.gitlab.librewolf-community",
"net.waterfox.waterfox",
"org.qutebrowser.qutebrowser",
];
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum LauncherSpec { enum LauncherSpec {
Programs(&'static [&'static str]), Programs(&'static [&'static str]),
Flatpak(&'static str), Flatpak(&'static str),
ProgramsOrFlatpak {
programs: &'static [&'static str],
app_id: &'static str,
},
} }
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
@@ -28,20 +74,25 @@ pub(super) fn open_url(url: &str, browser: Browser<'_>) -> anyhow::Result<()> {
match browser { match browser {
Browser::Auto => open_auto_browser(url), Browser::Auto => open_auto_browser(url),
Browser::Default => open_default_browser(url), Browser::Default => open_default_browser(url),
Browser::Chrome => { Browser::Chrome => open_resolved_browser(url, find_chrome_browser(), "Chrome is not available."),
let browser = find_chrome_browser().unwrap_or_else(|| browser.as_str().to_string()); Browser::Edge => open_resolved_browser(url, find_edge_browser(), "Edge is not available."),
open_with_browser(url, &browser) Browser::Firefox => open_resolved_browser(url, find_firefox_browser(), "Firefox is not available."),
Browser::Safari => open_resolved_browser(url, find_program(browser.as_str()), "Safari is not available."),
Browser::Other(browser) => open_resolved_browser(
url,
find_program(browser.trim()),
"Configured browser is not available.",
),
} }
Browser::Edge => {
let browser = find_edge_browser().unwrap_or_else(|| browser.as_str().to_string());
open_with_browser(url, &browser)
}
Browser::Firefox => {
let browser = find_firefox_browser().unwrap_or_else(|| browser.as_str().to_string());
open_with_browser(url, &browser)
}
Browser::Safari | Browser::Other(_) => open_with_browser(url, browser.as_str()),
} }
fn open_resolved_browser(
url: &str,
executable: Option<String>,
unavailable_message: &'static str,
) -> anyhow::Result<()> {
let executable = executable.context(unavailable_message)?;
open_with_browser(url, &executable)
} }
fn open_auto_browser(url: &str) -> anyhow::Result<()> { fn open_auto_browser(url: &str) -> anyhow::Result<()> {
@@ -146,7 +197,28 @@ fn launcher_spec_for_desktop_id(desktop_id: &str) -> Option<LauncherSpec> {
"com.google.Chrome.desktop" => Some(LauncherSpec::Flatpak("com.google.Chrome")), "com.google.Chrome.desktop" => Some(LauncherSpec::Flatpak("com.google.Chrome")),
"org.chromium.Chromium.desktop" => Some(LauncherSpec::Flatpak("org.chromium.Chromium")), "org.chromium.Chromium.desktop" => Some(LauncherSpec::Flatpak("org.chromium.Chromium")),
"com.microsoft.Edge.desktop" => Some(LauncherSpec::Flatpak("com.microsoft.Edge")), "com.microsoft.Edge.desktop" => Some(LauncherSpec::Flatpak("com.microsoft.Edge")),
"org.mozilla.firefox.desktop" => Some(LauncherSpec::Flatpak("org.mozilla.firefox")), "org.mozilla.firefox.desktop" => Some(LauncherSpec::ProgramsOrFlatpak {
programs: FIREFOX_BROWSERS,
app_id: "org.mozilla.firefox",
}),
"com.brave.Browser.desktop" => Some(LauncherSpec::Flatpak("com.brave.Browser")),
"vivaldi-stable.desktop" => Some(LauncherSpec::Programs(VIVALDI_BROWSERS)),
"com.vivaldi.Vivaldi.desktop" => Some(LauncherSpec::Flatpak("com.vivaldi.Vivaldi")),
"org.kde.falkon.desktop" => Some(LauncherSpec::ProgramsOrFlatpak {
programs: FALKON_BROWSERS,
app_id: "org.kde.falkon",
}),
"org.gnome.Epiphany.desktop" => Some(LauncherSpec::ProgramsOrFlatpak {
programs: EPIPHANY_BROWSERS,
app_id: "org.gnome.Epiphany",
}),
"com.opera.Opera.desktop" => Some(LauncherSpec::Flatpak("com.opera.Opera")),
"io.gitlab.librewolf-community.desktop" => Some(LauncherSpec::Flatpak("io.gitlab.librewolf-community")),
"net.waterfox.waterfox.desktop" => Some(LauncherSpec::Flatpak("net.waterfox.waterfox")),
"org.qutebrowser.qutebrowser.desktop" => Some(LauncherSpec::ProgramsOrFlatpak {
programs: QUTEBROWSER_BROWSERS,
app_id: "org.qutebrowser.qutebrowser",
}),
_ => None, _ => None,
} }
} }
@@ -154,20 +226,62 @@ fn launcher_spec_for_desktop_id(desktop_id: &str) -> Option<LauncherSpec> {
fn resolve_launcher(spec: LauncherSpec) -> Option<BrowserLauncher> { fn resolve_launcher(spec: LauncherSpec) -> Option<BrowserLauncher> {
match spec { match spec {
LauncherSpec::Programs(programs) => find_programs(programs).map(BrowserLauncher::Executable), LauncherSpec::Programs(programs) => find_programs(programs).map(BrowserLauncher::Executable),
LauncherSpec::Flatpak(app_id) => { LauncherSpec::Flatpak(app_id) => find_flatpak_browser(app_id),
find_program("flatpak").map(|executable| BrowserLauncher::Flatpak { executable, app_id }) LauncherSpec::ProgramsOrFlatpak { programs, app_id } => find_programs(programs)
.map(BrowserLauncher::Executable)
.or_else(|| find_flatpak_browser(app_id)),
} }
} }
fn find_flatpak_browser(app_id: &'static str) -> Option<BrowserLauncher> {
let executable = find_program("flatpak")?;
let installed = Command::new(&executable)
.args(["info", app_id])
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.is_ok_and(|status| status.success());
installed.then_some(BrowserLauncher::Flatpak { executable, app_id })
} }
fn find_auto_browser_launcher() -> Option<BrowserLauncher> { fn find_auto_browser_launcher() -> Option<BrowserLauncher> {
find_auto_browser().map(BrowserLauncher::Executable) find_auto_browser()
.map(BrowserLauncher::Executable)
.or_else(find_auto_flatpak_browser)
} }
fn find_auto_browser() -> Option<String> { fn find_auto_browser() -> Option<String> {
find_chrome_browser() AUTO_BROWSER_PROGRAMS
.or_else(find_edge_browser) .iter()
.or_else(find_firefox_browser) .find_map(|programs| find_programs(programs))
}
fn find_auto_flatpak_browser() -> Option<BrowserLauncher> {
let executable = find_program("flatpak")?;
let output = Command::new(&executable)
.args(["list", "--app", "--columns=application"])
.stdin(Stdio::null())
.stderr(Stdio::null())
.output()
.ok()?;
if !output.status.success() {
return None;
}
let installed_apps = String::from_utf8_lossy(&output.stdout);
let app_id = find_auto_flatpak_app_id(&installed_apps)?;
Some(BrowserLauncher::Flatpak { executable, app_id })
}
fn find_auto_flatpak_app_id(installed_apps: &str) -> Option<&'static str> {
AUTO_BROWSER_FLATPAK_IDS
.iter()
.copied()
.find(|app_id| installed_apps.lines().any(|installed| installed.trim() == *app_id))
} }
fn find_chrome_browser() -> Option<String> { fn find_chrome_browser() -> Option<String> {
@@ -197,15 +311,10 @@ mod tests {
use super::*; use super::*;
#[test] #[test]
fn auto_candidates_try_chrome_then_edge_then_firefox() { fn auto_candidates_use_the_expected_order() {
let candidates = GOOGLE_CHROME_BROWSERS let candidates = AUTO_BROWSER_PROGRAMS
.iter() .iter()
.chain(CHROMIUM_BROWSERS) .flat_map(|programs| programs.iter())
.chain(EDGE_BROWSERS)
.chain(EDGE_BETA_BROWSERS)
.chain(EDGE_DEV_BROWSERS)
.chain(FIREFOX_BROWSERS)
.chain(FIREFOX_ESR_BROWSERS)
.copied() .copied()
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@@ -222,6 +331,32 @@ mod tests {
"microsoft-edge-dev", "microsoft-edge-dev",
"firefox", "firefox",
"firefox-esr", "firefox-esr",
"brave-browser-stable",
"vivaldi-stable",
"falkon",
"epiphany",
"opera",
"librewolf",
"waterfox",
"qutebrowser",
]
);
assert_eq!(
AUTO_BROWSER_FLATPAK_IDS,
[
"com.google.Chrome",
"org.chromium.Chromium",
"com.microsoft.Edge",
"org.mozilla.firefox",
"com.brave.Browser",
"com.vivaldi.Vivaldi",
"org.kde.falkon",
"org.gnome.Epiphany",
"com.opera.Opera",
"io.gitlab.librewolf-community",
"net.waterfox.waterfox",
"org.qutebrowser.qutebrowser",
] ]
); );
} }
@@ -253,7 +388,46 @@ mod tests {
), ),
( (
"org.mozilla.firefox.desktop", "org.mozilla.firefox.desktop",
LauncherSpec::Flatpak("org.mozilla.firefox"), LauncherSpec::ProgramsOrFlatpak {
programs: FIREFOX_BROWSERS,
app_id: "org.mozilla.firefox",
},
),
("com.brave.Browser.desktop", LauncherSpec::Flatpak("com.brave.Browser")),
("vivaldi-stable.desktop", LauncherSpec::Programs(VIVALDI_BROWSERS)),
(
"com.vivaldi.Vivaldi.desktop",
LauncherSpec::Flatpak("com.vivaldi.Vivaldi"),
),
(
"org.kde.falkon.desktop",
LauncherSpec::ProgramsOrFlatpak {
programs: FALKON_BROWSERS,
app_id: "org.kde.falkon",
},
),
(
"org.gnome.Epiphany.desktop",
LauncherSpec::ProgramsOrFlatpak {
programs: EPIPHANY_BROWSERS,
app_id: "org.gnome.Epiphany",
},
),
("com.opera.Opera.desktop", LauncherSpec::Flatpak("com.opera.Opera")),
(
"io.gitlab.librewolf-community.desktop",
LauncherSpec::Flatpak("io.gitlab.librewolf-community"),
),
(
"net.waterfox.waterfox.desktop",
LauncherSpec::Flatpak("net.waterfox.waterfox"),
),
(
"org.qutebrowser.qutebrowser.desktop",
LauncherSpec::ProgramsOrFlatpak {
programs: QUTEBROWSER_BROWSERS,
app_id: "org.qutebrowser.qutebrowser",
},
), ),
]; ];
@@ -266,4 +440,24 @@ mod tests {
fn unknown_desktop_id_is_not_used() { fn unknown_desktop_id_is_not_used() {
assert_eq!(launcher_spec_for_desktop_id("code.desktop"), None); assert_eq!(launcher_spec_for_desktop_id("code.desktop"), None);
} }
#[test]
fn auto_flatpak_candidates_use_priority_and_exact_ids() {
assert_eq!(
find_auto_flatpak_app_id("org.kde.falkon\ncom.brave.Browser\n"),
Some("com.brave.Browser")
);
assert_eq!(find_auto_flatpak_app_id("com.brave.Browser.beta\n"), None);
}
#[test]
fn unavailable_custom_browser_returns_an_error() {
let err = open_url(
"https://example.com",
Browser::Other("gpgui-browser-that-does-not-exist"),
)
.unwrap_err();
assert_eq!(err.to_string(), "Configured browser is not available.");
}
} }
+23
View File
@@ -3,6 +3,11 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
#[cfg(all(
not(debug_assertions),
any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")
))]
use crate::constants::GP_DOWNLOADED_GUI_BINARY;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
use crate::constants::GP_VPNC_SCRIPT_INSTALLER_BINARY; use crate::constants::GP_VPNC_SCRIPT_INSTALLER_BINARY;
use crate::constants::{GP_AUTH_BINARY, GP_CLIENT_BINARY, GP_GUI_BINARY, GP_GUI_HELPER_BINARY, GP_SERVICE_BINARY}; use crate::constants::{GP_AUTH_BINARY, GP_CLIENT_BINARY, GP_GUI_BINARY, GP_GUI_HELPER_BINARY, GP_SERVICE_BINARY};
@@ -32,6 +37,24 @@ pub fn gpgui() -> PathBuf {
resolve("GP_GUI_BINARY", "gpgui", GP_GUI_BINARY) resolve("GP_GUI_BINARY", "gpgui", GP_GUI_BINARY)
} }
pub fn gpgui_update_target() -> PathBuf {
#[cfg(all(
not(debug_assertions),
any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")
))]
{
PathBuf::from(GP_DOWNLOADED_GUI_BINARY)
}
#[cfg(any(
debug_assertions,
not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))
))]
{
gpgui()
}
}
pub fn gpgui_helper() -> PathBuf { pub fn gpgui_helper() -> PathBuf {
resolve("GP_GUI_HELPER_BINARY", "gpgui-helper", GP_GUI_HELPER_BINARY) resolve("GP_GUI_HELPER_BINARY", "gpgui-helper", GP_GUI_HELPER_BINARY)
} }
+4 -1
View File
@@ -16,7 +16,6 @@ pub const INSTALLED_VPNC_SCRIPT: &str = "/var/db/gpclient/scripts/vpnc-script";
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))] #[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
pub const INSTALLED_VPNC_SCRIPT_METADATA: &str = "/var/db/gpclient/scripts/vpnc-script.metadata"; pub const INSTALLED_VPNC_SCRIPT_METADATA: &str = "/var/db/gpclient/scripts/vpnc-script.metadata";
pub const MAX_VPNC_SCRIPT_SIZE: usize = 1024 * 1024; pub const MAX_VPNC_SCRIPT_SIZE: usize = 1024 * 1024;
pub const GP_CALLBACK_PORT_FILENAME: &str = "gpcallback.port";
// Release binaries - macOS (Apple Silicon Homebrew) // Release binaries - macOS (Apple Silicon Homebrew)
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))] #[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
@@ -49,6 +48,8 @@ pub const GP_CLIENT_BINARY: &str = "/usr/local/bin/gpclient";
pub const GP_SERVICE_BINARY: &str = "/usr/local/bin/gpservice"; pub const GP_SERVICE_BINARY: &str = "/usr/local/bin/gpservice";
#[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))] #[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))]
pub const GP_GUI_BINARY: &str = "/usr/local/bin/gpgui"; pub const GP_GUI_BINARY: &str = "/usr/local/bin/gpgui";
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
pub const GP_DOWNLOADED_GUI_BINARY: &str = "/usr/local/libexec/gpclient/gpgui";
#[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))] #[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))]
pub const GP_GUI_HELPER_BINARY: &str = "/usr/local/bin/gpgui-helper"; pub const GP_GUI_HELPER_BINARY: &str = "/usr/local/bin/gpgui-helper";
#[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))] #[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))]
@@ -70,6 +71,8 @@ pub const GP_SERVICE_BINARY: &str = "/usr/bin/gpservice";
not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")) not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))
))] ))]
pub const GP_GUI_BINARY: &str = "/usr/bin/gpgui"; pub const GP_GUI_BINARY: &str = "/usr/bin/gpgui";
#[cfg(target_os = "linux")]
pub const GP_DOWNLOADED_GUI_BINARY: &str = "/var/lib/gpclient/gpgui";
#[cfg(all( #[cfg(all(
not(debug_assertions), not(debug_assertions),
not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")) not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))
+1 -2
View File
@@ -154,7 +154,6 @@ impl SamlAuthData {
let auth_data: SamlAuthData = serde_urlencoded::from_str(auth_data.borrow()).map_err(|e| { let auth_data: SamlAuthData = serde_urlencoded::from_str(auth_data.borrow()).map_err(|e| {
warn!("Failed to parse token auth data: {}", e); warn!("Failed to parse token auth data: {}", e);
warn!("Auth data: {}", auth_data);
AuthDataParseError::Invalid(anyhow::anyhow!(e)) AuthDataParseError::Invalid(anyhow::anyhow!(e))
})?; })?;
@@ -163,7 +162,7 @@ impl SamlAuthData {
} }
let auth_data = decode_to_string(auth_data).map_err(|e| { let auth_data = decode_to_string(auth_data).map_err(|e| {
warn!("Failed to decode SAML auth data: {}, data: {}", e, data); warn!("Failed to decode SAML auth data: {}", e);
AuthDataParseError::Invalid(anyhow::anyhow!(e)) AuthDataParseError::Invalid(anyhow::anyhow!(e))
})?; })?;
let auth_data = Self::from_html(&auth_data)?; let auth_data = Self::from_html(&auth_data)?;
+243 -11
View File
@@ -1,33 +1,139 @@
use std::io::{self, Write};
use clap_verbosity_flag::{LogLevel, Verbosity, VerbosityFilter}; use clap_verbosity_flag::{LogLevel, Verbosity, VerbosityFilter};
use log::Level; use log::Level;
use crate::error::PortalError; use crate::{
error::PortalError,
log_format::{LogFormat, write_json_record},
};
pub mod args; pub mod args;
pub trait Args { pub trait Args {
fn fix_openssl(&self) -> bool; fn fix_openssl(&self) -> bool;
fn ignore_tls_errors(&self) -> bool; fn ignore_tls_errors(&self) -> bool;
/// How this program renders its logs.
///
/// Required rather than defaulted: a default would let an implementor drop
/// the override and silently report failures as prose to a caller that asked
/// for JSON, with nothing — not even a warning — to catch it.
fn log_format(&self) -> LogFormat;
} }
pub fn handle_error(err: anyhow::Error, args: &impl Args) { /// Suggestions for re-running the command, for failures that have a known
eprintln!("\nError: {:?}", err); /// workaround. Empty when there is nothing useful to say — including when the
/// relevant option is already in use.
fn retry_hints(err: &anyhow::Error, args: &impl Args) -> Vec<String> {
let Some(err) = err.downcast_ref::<PortalError>() else { let Some(err) = err.downcast_ref::<PortalError>() else {
return; return Vec::new();
}; };
let command_line = || {
let argv = std::env::args().collect::<Vec<_>>();
let program = argv.first().cloned().unwrap_or_default();
let rest = argv.get(1..).map(|rest| rest.join(" ")).unwrap_or_default();
(program, rest)
};
// The blank line between the sentence and the command is part of the output
// users already see; keep it exactly.
let mut hints = Vec::new();
if err.is_legacy_openssl_error() && !args.fix_openssl() { if err.is_legacy_openssl_error() && !args.fix_openssl() {
eprintln!("\nRe-run it with the `--fix-openssl` option to work around this issue, e.g.:\n"); let (program, rest) = command_line();
let args = std::env::args().collect::<Vec<_>>(); hints.push(format!(
eprintln!("{} --fix-openssl {}\n", args[0], args[1..].join(" ")); "Re-run it with the `--fix-openssl` option to work around this issue, e.g.:\n\n{program} --fix-openssl {rest}"
));
} }
if err.is_tls_error() && !args.ignore_tls_errors() { if err.is_tls_error() && !args.ignore_tls_errors() {
eprintln!("\nRe-run it with the `--ignore-tls-errors` option to ignore the certificate error, e.g.:\n"); let (program, rest) = command_line();
let args = std::env::args().collect::<Vec<_>>(); hints.push(format!(
eprintln!("{} --ignore-tls-errors {}\n", args[0], args[1..].join(" ")); "Re-run it with the `--ignore-tls-errors` option to ignore the certificate error, e.g.:\n\n{program} --ignore-tls-errors {rest}"
));
} }
hints
}
/// Write one message to `w` the way `format` asks for.
///
/// Text is emitted exactly as it always was, so existing output does not move.
/// JSON is written directly rather than through the `log` macros, because these
/// are reports rather than log lines: they must survive `--quiet`, which would
/// otherwise discard the only explanation of a failed run.
///
/// The record is rendered into one buffer and written once. `serde_json`'s
/// `Display` would otherwise reach the stream in dozens of fragments, and any
/// process sharing this stderr — the spawned authenticator, a connect script —
/// could land a line inside a half-written record.
fn write_message<W: Write>(w: &mut W, format: LogFormat, level: Level, message: &str) -> io::Result<()> {
match format {
LogFormat::Text => writeln!(w, "{message}"),
LogFormat::Json => {
// Callers pass the exact text line, blank-line padding included, so the
// text form does not move. A record carries its own separation.
let message = message.trim_start_matches('\n');
let mut line = Vec::new();
write_json_record(
&mut line,
&log::Record::builder()
.level(level)
.target(module_path!())
.args(format_args!("{message}"))
.build(),
)?;
w.write_all(&line)
}
}
}
/// Report a user-facing line that is not a log record — a note, a warning, or
/// advice about what to try next.
///
/// Callers used `eprintln!` directly, which in JSON mode drops prose into a
/// stream the caller is parsing a line at a time. Routing them here keeps one
/// answer to "how does this program emit a user-facing line", and leaves the
/// text form byte-for-byte unchanged.
pub fn report(format: LogFormat, level: Level, message: &str) {
let _ = write_message(&mut io::stderr().lock(), format, level, message);
}
fn write_failure<W: Write>(w: &mut W, format: LogFormat, err: &anyhow::Error, hints: &[String]) -> io::Result<()> {
match format {
LogFormat::Text => {
writeln!(w, "\nError: {err:?}")?;
for hint in hints {
writeln!(w, "\n{hint}\n")?;
}
}
LogFormat::Json => {
write_message(w, format, Level::Error, &format!("{err:?}"))?;
for hint in hints {
write_message(w, format, Level::Error, hint)?;
}
}
}
Ok(())
}
fn handle_error_to<W: Write>(w: &mut W, err: anyhow::Error, args: &impl Args) -> io::Result<()> {
let hints = retry_hints(&err, args);
write_failure(w, args.log_format(), &err, &hints)
}
pub fn handle_error(err: anyhow::Error, args: &impl Args) {
// Nothing useful to do if stderr itself is gone.
let _ = handle_error_to(&mut io::stderr().lock(), err, args);
} }
#[derive(Debug)] #[derive(Debug)]
@@ -79,3 +185,129 @@ impl ToVerboseArg for Level {
} }
} }
} }
#[cfg(test)]
mod tests {
use anyhow::anyhow;
use super::*;
#[derive(Default)]
struct TestArgs {
fix_openssl: bool,
ignore_tls_errors: bool,
log_format: LogFormat,
}
impl Args for TestArgs {
fn fix_openssl(&self) -> bool {
self.fix_openssl
}
fn ignore_tls_errors(&self) -> bool {
self.ignore_tls_errors
}
fn log_format(&self) -> LogFormat {
self.log_format
}
}
/// The seam that matters: `handle_error` must ask the args which format to
/// use. Testing the writer alone would leave a version that always reports as
/// prose passing every test.
#[test]
fn handle_error_honours_the_requested_format() {
let args = TestArgs {
log_format: LogFormat::Json,
..Default::default()
};
let mut out = Vec::new();
handle_error_to(&mut out, anyhow!(PortalError::TlsError), &args).expect("writing to a Vec cannot fail");
let out = String::from_utf8(out).expect("output should be UTF-8");
for line in out.lines() {
serde_json::from_str::<serde_json::Value>(line).unwrap_or_else(|e| panic!("not JSON: {line:?} ({e})"));
}
assert!(!out.is_empty(), "the failure must be reported");
}
#[test]
fn a_tls_failure_suggests_ignoring_tls_errors() {
let hints = retry_hints(&anyhow!(PortalError::TlsError), &TestArgs::default());
assert_eq!(hints.len(), 1, "expected one hint, got {hints:?}");
assert!(hints[0].contains("--ignore-tls-errors"), "got {:?}", hints[0]);
// The command sits on its own line after a blank one, as it always has.
assert!(
hints[0].contains("e.g.:\n\n"),
"blank line before the command: {:?}",
hints[0]
);
}
/// Suggesting an option the user already passed is noise, and in JSON mode it
/// would be an extra record on every failed run.
#[test]
fn no_hint_when_the_option_is_already_in_use() {
let args = TestArgs {
ignore_tls_errors: true,
..Default::default()
};
assert!(retry_hints(&anyhow!(PortalError::TlsError), &args).is_empty());
}
/// Most failures have no known workaround; inventing advice for them would
/// mislead.
#[test]
fn no_hints_for_an_unrelated_error() {
let hints = retry_hints(&anyhow!("something else went wrong"), &TestArgs::default());
assert!(hints.is_empty(), "got {hints:?}");
}
fn failure_output(format: LogFormat) -> String {
let hints = vec!["Re-run it with the `--ignore-tls-errors` option".to_string()];
let mut out = Vec::new();
write_failure(&mut out, format, &anyhow!(PortalError::TlsError), &hints).expect("writing to a Vec cannot fail");
String::from_utf8(out).expect("output should be UTF-8")
}
/// The failure is the program's final report, so in JSON mode it must be one
/// more record on the same stream — and it must not be filtered away, which
/// is why it does not go through the log macros. A run that fails silently is
/// worse than one that fails noisily.
#[test]
fn the_failure_is_reported_as_records() {
let out = failure_output(LogFormat::Json);
let lines: Vec<_> = out.lines().collect();
assert_eq!(lines.len(), 2, "expected the error and its hint: {out:?}");
for line in lines {
let v: serde_json::Value = serde_json::from_str(line).unwrap_or_else(|e| panic!("not JSON: {line:?} ({e})"));
assert_eq!(v["level"], "ERROR");
}
}
/// The format has to be honoured, not merely available: reporting the failure
/// as prose to a caller that asked for JSON is the defect this whole flag
/// exists to remove.
#[test]
fn the_format_decides_how_the_failure_is_written() {
assert!(
serde_json::from_str::<serde_json::Value>(failure_output(LogFormat::Json).lines().next().unwrap()).is_ok(),
"json mode must not emit prose"
);
let text = failure_output(LogFormat::Text);
assert!(text.starts_with("\nError: "), "text mode keeps its shape: {text:?}");
assert!(
serde_json::from_str::<serde_json::Value>(text.trim()).is_err(),
"text mode must not emit JSON: {text:?}"
);
}
}
+1
View File
@@ -4,6 +4,7 @@ pub mod credential;
pub mod error; pub mod error;
pub mod gateway; pub mod gateway;
pub mod gp_params; pub mod gp_params;
pub mod log_format;
pub mod os_profile; pub mod os_profile;
pub mod params; pub mod params;
pub mod portal; pub mod portal;
+164
View File
@@ -0,0 +1,164 @@
//! Machine-readable log output.
//!
//! The default human format is fine at a terminal, but tools that drive
//! gpclient headless have to parse it — and end up matching on prose, including
//! text that comes from dependencies rather than from this project. JSON lines
//! give those callers fields instead.
//!
//! This module deliberately depends only on `log` and `serde_json`, so every
//! binary can use it without pulling in a logging backend, and so the rendering
//! can be tested without installing a global logger.
use std::io::{self, Write};
use chrono::{SecondsFormat, Utc};
use serde_json::json;
/// How log records are rendered.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
pub enum LogFormat {
/// The human-readable default.
#[default]
Text,
/// One JSON object per line.
Json,
}
impl LogFormat {
/// The name this format is known by on a command line.
pub fn as_str(&self) -> &'static str {
match self {
Self::Text => "text",
Self::Json => "json",
}
}
}
/// Write a [`log::Record`] to `w` as one JSON line, newline included.
///
/// This is the form a logging backend needs, and it writes into the buffer the
/// backend already handed us rather than allocating a line to be copied. It
/// takes a `Record` and a `Write` rather than any backend's own types, so `log`
/// stays the only logging dependency here — with `env_logger`, this function
/// *is* the format callback:
///
/// ```ignore
/// // Not compiled as a doctest: env_logger is an optional dependency of this
/// // crate, so it is not linked when the docs are built.
/// env_logger::builder().format(write_json_record).init();
/// ```
pub fn write_json_record<W: Write>(w: &mut W, record: &log::Record) -> io::Result<()> {
writeln!(
w,
"{}",
json!({
"timestamp": Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true),
"level": record.level().as_str(),
"target": record.target(),
"message": record.args().to_string(),
})
)
}
#[cfg(test)]
mod tests {
use chrono::{DateTime, SubsecRound};
use log::Level;
use super::*;
fn parse(line: &str) -> serde_json::Value {
serde_json::from_str(line).expect("each line must be valid JSON")
}
fn write_record(record: &log::Record) -> String {
let mut buf = Vec::new();
write_json_record(&mut buf, record).expect("writing to a Vec cannot fail");
String::from_utf8(buf).expect("output should be UTF-8")
}
/// The fields a consumer is promised, taken off a `Record` as a backend
/// hands it over.
#[test]
fn record_renders_the_expected_fields() {
// Built inline: `format_args!` borrows its arguments for the statement it
// appears in, so a `Record` held in a `let` would outlive them.
let v = parse(&write_record(
&log::Record::builder()
.level(Level::Error)
.target("gpclient::connect")
.args(format_args!("portal {} unreachable", "vpn.example.com"))
.build(),
));
assert_eq!(v["level"], "ERROR");
assert_eq!(v["target"], "gpclient::connect");
assert_eq!(v["message"], "portal vpn.example.com unreachable");
}
/// Without a timestamp the JSON output would be strictly less informative
/// than the text format it replaces, and a consumer could not order or
/// correlate events.
#[test]
fn records_carry_a_utc_timestamp() {
let before = Utc::now();
let v = parse(&write_record(
&log::Record::builder()
.level(Level::Info)
.target("t")
.args(format_args!("connected"))
.build(),
));
let after = Utc::now();
let ts = v["timestamp"].as_str().expect("timestamp must be a string");
let parsed = DateTime::parse_from_rfc3339(ts)
.unwrap_or_else(|e| panic!("timestamp must be RFC 3339: {ts:?} ({e})"))
.with_timezone(&Utc);
assert!(ts.ends_with('Z'), "timestamp must be UTC, got {ts:?}");
assert!(
parsed >= before.trunc_subsecs(3) && parsed <= after,
"timestamp {parsed} should be between {before} and {after}"
);
}
/// The backend appends records to one stream, so each has to terminate its
/// own line — exactly one, or the next record joins this one. A message
/// containing a newline must be escaped into the JSON string rather than
/// splitting the record in two.
#[test]
fn record_ends_with_a_single_newline() {
let out = write_record(
&log::Record::builder()
.level(Level::Info)
.target("t")
.args(format_args!("first\nsecond"))
.build(),
);
assert!(out.ends_with('\n'), "record must terminate its line: {out:?}");
assert_eq!(out.matches('\n').count(), 1, "record must be one line: {out:?}");
assert_eq!(parse(&out)["message"], "first\nsecond", "the newline must survive");
}
/// `as_str` is what gets passed to a child process on the command line, and
/// clap parses that with the names from its own `ValueEnum` derive. If the
/// two ever disagree, gpclient hands gpauth a value gpauth rejects.
#[cfg(feature = "clap")]
#[test]
fn as_str_agrees_with_the_names_clap_parses() {
use clap::ValueEnum;
for format in [LogFormat::Text, LogFormat::Json] {
let clap_name = format
.to_possible_value()
.expect("every variant is selectable")
.get_name()
.to_owned();
assert_eq!(format.as_str(), clap_name);
}
}
}
+58 -7
View File
@@ -4,15 +4,17 @@ use anyhow::bail;
use log::{Level, Log, warn}; use log::{Level, Log, warn};
use log_reload::{ReloadHandle, ReloadLog}; use log_reload::{ReloadHandle, ReloadLog};
use crate::log_format::{LogFormat, write_json_record};
pub const LOG_BACKEND_ENV: &str = "GP_LOG_BACKEND"; pub const LOG_BACKEND_ENV: &str = "GP_LOG_BACKEND";
pub const MACOS_UNIFIED_LOG_BACKEND: &str = "macos-unified"; pub const MACOS_UNIFIED_LOG_BACKEND: &str = "macos-unified";
type BoxedLogger = Box<dyn Log + Send + Sync>; type BoxedLogger = Box<dyn Log + Send + Sync>;
static LOG_HANDLE: OnceLock<ReloadHandle<log_reload::LevelFilter<BoxedLogger>>> = OnceLock::new(); static LOG_HANDLE: OnceLock<ReloadHandle<log_reload::LevelFilter<BoxedLogger>>> = OnceLock::new();
pub fn init(level: Level, subsystem: &str, category: &str) { pub fn init(level: Level, subsystem: &str, category: &str, log_format: LogFormat) {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
if macos_unified_log_enabled() { if log_format == LogFormat::Text && macos_unified_log_enabled() {
init_with_logger(level, MacosLogger::new(subsystem, category)); init_with_logger(level, MacosLogger::new(subsystem, category));
return; return;
} }
@@ -20,10 +22,19 @@ pub fn init(level: Level, subsystem: &str, category: &str) {
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
let _ = (subsystem, category); let _ = (subsystem, category);
// Initialize the env_logger and global max level to trace, the logs will be init_with_logger(level, build_env_logger(log_format).build());
// filtered by the outer logger }
let logger = env_logger::builder().filter_level(log::LevelFilter::Trace).build();
init_with_logger(level, logger); fn build_env_logger(log_format: LogFormat) -> env_logger::Builder {
let mut builder = env_logger::builder();
// The outer reloadable logger owns filtering.
builder.filter_level(log::LevelFilter::Trace);
if log_format == LogFormat::Json {
builder.format(write_json_record);
}
builder
} }
pub fn init_with_logger(level: Level, logger: impl Log + Send + Sync + 'static) { pub fn init_with_logger(level: Level, logger: impl Log + Send + Sync + 'static) {
@@ -103,11 +114,51 @@ fn macos_log_level(level: Level) -> oslog::Level {
} }
} }
#[cfg(all(test, target_os = "macos"))] #[cfg(test)]
mod tests { mod tests {
use std::{
io::Write,
sync::{Arc, Mutex},
};
use super::*; use super::*;
#[derive(Clone, Default)]
struct Captured(Arc<Mutex<Vec<u8>>>);
impl Write for Captured {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.0.lock().unwrap().extend_from_slice(buf);
Ok(buf.len())
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}
#[test] #[test]
fn json_format_configures_the_env_logger() {
let captured = Captured::default();
let logger = build_env_logger(LogFormat::Json)
.target(env_logger::Target::Pipe(Box::new(captured.clone())))
.build();
logger.log(
&log::Record::builder()
.level(Level::Info)
.target("gpauth")
.args(format_args!("authenticating"))
.build(),
);
let output = String::from_utf8(captured.0.lock().unwrap().clone()).unwrap();
let value: serde_json::Value = serde_json::from_str(output.trim()).unwrap();
assert_eq!(value["message"], "authenticating");
}
#[test]
#[cfg(target_os = "macos")]
fn info_logs_use_the_persistent_macos_level() { fn info_logs_use_the_persistent_macos_level() {
assert_eq!(macos_log_level(Level::Info) as u8, oslog::Level::Default as u8); assert_eq!(macos_log_level(Level::Info) as u8, oslog::Level::Default as u8);
} }
+95 -9
View File
@@ -1,4 +1,8 @@
use std::{path::PathBuf, process::Stdio}; use std::{
net::IpAddr,
path::{Path, PathBuf},
process::Stdio,
};
use anyhow::bail; use anyhow::bail;
use common::binary_paths; use common::binary_paths;
@@ -6,7 +10,7 @@ use tokio::process::Command;
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
use crate::auth::AuthWindowTheme; use crate::auth::AuthWindowTheme;
use crate::{auth::SamlAuthResult, credential::Credential, os_profile::OsProfile}; use crate::{auth::SamlAuthResult, credential::Credential, log_format::LogFormat, os_profile::OsProfile};
use super::command_traits::CommandExt; use super::command_traits::CommandExt;
@@ -34,7 +38,9 @@ pub struct SamlAuthLauncher<'a> {
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
window_theme: Option<AuthWindowTheme>, window_theme: Option<AuthWindowTheme>,
browser: Option<&'a str>, browser: Option<&'a str>,
browser_listen: Option<IpAddr>,
verbose: Option<&'a str>, verbose: Option<&'a str>,
log_format: LogFormat,
} }
impl<'a> SamlAuthLauncher<'a> { impl<'a> SamlAuthLauncher<'a> {
@@ -63,7 +69,9 @@ impl<'a> SamlAuthLauncher<'a> {
#[cfg(feature = "webview-auth")] #[cfg(feature = "webview-auth")]
window_theme: None, window_theme: None,
browser: None, browser: None,
browser_listen: None,
verbose: None, verbose: None,
log_format: LogFormat::Text,
} }
} }
@@ -149,18 +157,32 @@ impl<'a> SamlAuthLauncher<'a> {
self self
} }
pub fn browser_listen(mut self, browser_listen: Option<IpAddr>) -> Self {
self.browser_listen = browser_listen;
self
}
/// Render the child's logs the same way as ours.
///
/// gpauth inherits this process's stderr, so both processes must use the same
/// format to keep the stream consistent.
pub fn log_format(mut self, log_format: LogFormat) -> Self {
self.log_format = log_format;
self
}
pub fn verbose(mut self, verbose: Option<&'a str>) -> Self { pub fn verbose(mut self, verbose: Option<&'a str>) -> Self {
self.verbose = verbose; self.verbose = verbose;
self self
} }
/// Launch the authenticator binary as the current user or SUDO_USER if available. /// The command line this launcher will run.
pub async fn launch(self) -> anyhow::Result<Credential> { ///
let program = self /// Split out from `launch` so a test can observe the argv the child actually
.auth_executable /// receives: asserting on the builder's own fields would not catch an
.map(PathBuf::from) /// argument that never gets appended.
.unwrap_or_else(binary_paths::gpauth); fn build_command(&self, program: &Path) -> Command {
let mut auth_cmd = Command::new(&program); let mut auth_cmd = Command::new(program);
auth_cmd.arg(self.server); auth_cmd.arg(self.server);
if self.gateway { if self.gateway {
@@ -230,10 +252,27 @@ impl<'a> SamlAuthLauncher<'a> {
auth_cmd.arg("--browser").arg(browser); auth_cmd.arg("--browser").arg(browser);
} }
if let Some(browser_listen) = self.browser_listen {
auth_cmd.arg("--browser-listen").arg(browser_listen.to_string());
}
auth_cmd.arg("--log-format").arg(self.log_format.as_str());
if let Some(verbose) = self.verbose { if let Some(verbose) = self.verbose {
auth_cmd.arg(verbose); auth_cmd.arg(verbose);
} }
auth_cmd
}
/// Launch the authenticator binary as the current user or SUDO_USER if available.
pub async fn launch(self) -> anyhow::Result<Credential> {
let program = self
.auth_executable
.map(PathBuf::from)
.unwrap_or_else(binary_paths::gpauth);
let auth_cmd = self.build_command(&program);
let mut non_root_cmd = auth_cmd.into_non_root()?; let mut non_root_cmd = auth_cmd.into_non_root()?;
let child = non_root_cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn(); let child = non_root_cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn();
@@ -286,6 +325,45 @@ mod tests {
assert_eq!(launcher.client_version, Some("6.0.0")); assert_eq!(launcher.client_version, Some("6.0.0"));
} }
fn child_args(launcher: SamlAuthLauncher) -> Vec<String> {
launcher
.build_command(Path::new("gpauth"))
.as_std()
.get_args()
.map(|arg| arg.to_string_lossy().into_owned())
.collect()
}
/// gpauth writes to the same stderr as its parent, so a caller reading the
/// parent's JSON would hit gpauth's text records mid-stream unless the format
/// is passed down.
#[test]
fn json_is_forwarded_to_the_child() {
let args = child_args(SamlAuthLauncher::new("portal.example.com").log_format(LogFormat::Json));
assert!(
args.windows(2).any(|pair| pair == ["--log-format", "json"]),
"expected --log-format json in {args:?}"
);
}
/// The launcher always passes the selected format so the parent and child
/// cannot silently drift onto different output formats.
#[test]
fn text_is_forwarded_to_the_child() {
for launcher in [
SamlAuthLauncher::new("portal.example.com").log_format(LogFormat::Text),
SamlAuthLauncher::new("portal.example.com"),
] {
let args = child_args(launcher);
assert!(
args.windows(2).any(|pair| pair == ["--log-format", "text"]),
"expected --log-format text in {args:?}"
);
}
}
#[test] #[test]
fn client_certificate_options_are_stored() { fn client_certificate_options_are_stored() {
let launcher = SamlAuthLauncher::new("portal.example.com") let launcher = SamlAuthLauncher::new("portal.example.com")
@@ -297,4 +375,12 @@ mod tests {
assert_eq!(launcher.sslkey, Some("/tmp/client.key")); assert_eq!(launcher.sslkey, Some("/tmp/client.key"));
assert_eq!(launcher.key_password, Some("secret")); assert_eq!(launcher.key_password, Some("secret"));
} }
#[test]
fn browser_listen_address_is_stored() {
let listen_ip = "192.168.107.15".parse().unwrap();
let launcher = SamlAuthLauncher::new("portal.example.com").browser_listen(Some(listen_ip));
assert_eq!(launcher.browser_listen, Some(listen_ip));
}
} }
+108 -18
View File
@@ -1,6 +1,6 @@
use std::{ use std::{
collections::HashMap, collections::HashMap,
path::PathBuf, path::{Path, PathBuf},
process::{ExitStatus, Stdio}, process::{ExitStatus, Stdio},
sync::Arc, sync::Arc,
}; };
@@ -16,7 +16,7 @@ use super::command_traits::CommandExt;
pub struct GuiLauncher<'a> { pub struct GuiLauncher<'a> {
version: &'a str, version: &'a str,
program: PathBuf, programs: Vec<PathBuf>,
credential: Arc<SessionCredential>, credential: Arc<SessionCredential>,
minimized: bool, minimized: bool,
envs: Option<HashMap<String, String>>, envs: Option<HashMap<String, String>>,
@@ -24,9 +24,17 @@ pub struct GuiLauncher<'a> {
impl<'a> GuiLauncher<'a> { impl<'a> GuiLauncher<'a> {
pub fn new(version: &'a str, credential: Arc<SessionCredential>) -> Self { pub fn new(version: &'a str, credential: Arc<SessionCredential>) -> Self {
let primary = binary_paths::gpgui();
let update_target = binary_paths::gpgui_update_target();
let programs = if primary == update_target {
vec![primary]
} else {
vec![primary, update_target]
};
Self { Self {
version, version,
program: binary_paths::gpgui(), programs,
credential, credential,
minimized: false, minimized: false,
envs: None, envs: None,
@@ -44,18 +52,33 @@ impl<'a> GuiLauncher<'a> {
} }
pub async fn launch(&self) -> anyhow::Result<ExitStatus> { pub async fn launch(&self) -> anyhow::Result<ExitStatus> {
// Check if the program's version if let Some(program) = self.find_compatible_program().await {
if let Err(err) = self.check_version().await { return self.launch_program(&program).await;
info!("Check version failed: {}", err); }
// Download the program and replace the current one
self.download_program().await?; self.download_program().await?;
let program = binary_paths::gpgui_update_target();
self.check_version(&program).await?;
self.launch_program(&program).await
} }
self.launch_program().await async fn find_compatible_program(&self) -> Option<PathBuf> {
for program in &self.programs {
match self.check_version(program).await {
Ok(()) => return Some(program.clone()),
Err(err) => info!(
"GUI candidate {} is unavailable or incompatible: {err}",
program.display()
),
}
} }
async fn launch_program(&self) -> anyhow::Result<ExitStatus> { None
let mut cmd = Command::new(&self.program); }
async fn launch_program(&self, program: &Path) -> anyhow::Result<ExitStatus> {
let mut cmd = Command::new(program);
if let Some(envs) = &self.envs { if let Some(envs) = &self.envs {
cmd.env_clear(); cmd.env_clear();
@@ -73,7 +96,7 @@ impl<'a> GuiLauncher<'a> {
let child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn(); let child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn();
let mut child = match child { let mut child = match child {
Ok(child) => child, Ok(child) => child,
Err(err) => bail!("Failed to spawn {}: {}", self.program.display(), err), Err(err) => bail!("Failed to spawn {}: {}", program.display(), err),
}; };
let Some(mut stdin) = child.stdin.take() else { let Some(mut stdin) = child.stdin.take() else {
@@ -89,9 +112,18 @@ impl<'a> GuiLauncher<'a> {
Ok(exit_status) Ok(exit_status)
} }
async fn check_version(&self) -> anyhow::Result<()> { async fn check_version(&self, program: &Path) -> anyhow::Result<()> {
let cmd = Command::new(&self.program).arg("--version").output().await?; let mut cmd = Command::new(program);
let output = String::from_utf8_lossy(&cmd.stdout); if let Some(envs) = &self.envs {
cmd.env_clear();
cmd.envs(envs);
}
cmd.arg("--version");
let output = cmd.into_non_root()?.output().await?;
if !output.status.success() {
bail!("Version command exited with {}", output.status);
}
let output = String::from_utf8_lossy(&output.stdout);
// Version string: "gpgui 2.0.0 (2024-02-05)" // Version string: "gpgui 2.0.0 (2024-02-05)"
let Some(version) = output.split_whitespace().nth(1) else { let Some(version) = output.split_whitespace().nth(1) else {
@@ -114,11 +146,69 @@ impl<'a> GuiLauncher<'a> {
.envs(self.envs.as_ref()) .envs(self.envs.as_ref())
.gui_version(Some(self.version)) .gui_version(Some(self.version))
.launch() .launch()
.await?; .await
}
}
// Check the version again #[cfg(test)]
self.check_version().await?; mod tests {
use std::{fs, os::unix::fs::PermissionsExt};
Ok(()) use tempfile::TempDir;
use uuid::Uuid;
use super::*;
const VERSION: &str = "test-version";
fn executable(dir: &TempDir, name: &str, output: &str, exit_code: i32) -> PathBuf {
fs::set_permissions(dir.path(), fs::Permissions::from_mode(0o755)).unwrap();
let path = dir.path().join(name);
fs::write(
&path,
format!("#!/bin/sh\nprintf '%s\\n' '{output}'\nexit {exit_code}\n"),
)
.unwrap();
fs::set_permissions(&path, fs::Permissions::from_mode(0o755)).unwrap();
path
}
fn launcher(version: &'static str, programs: Vec<PathBuf>) -> GuiLauncher<'static> {
GuiLauncher {
version,
programs,
credential: Arc::new(SessionCredential::generate(Uuid::new_v4(), version).unwrap()),
minimized: false,
envs: None,
}
}
#[tokio::test]
async fn prefers_the_first_compatible_program() {
let dir = TempDir::new().unwrap();
let packaged = executable(&dir, "packaged", "gpgui test-version", 0);
let downloaded = executable(&dir, "downloaded", "gpgui test-version", 0);
let launcher = launcher(VERSION, vec![packaged.clone(), downloaded]);
assert_eq!(launcher.find_compatible_program().await, Some(packaged));
}
#[tokio::test]
async fn falls_back_when_the_first_program_is_incompatible() {
let dir = TempDir::new().unwrap();
let packaged = executable(&dir, "packaged", "gpgui other-version", 0);
let downloaded = executable(&dir, "downloaded", "gpgui test-version", 0);
let launcher = launcher(VERSION, vec![packaged, downloaded.clone()]);
assert_eq!(launcher.find_compatible_program().await, Some(downloaded));
}
#[tokio::test]
async fn rejects_an_unsuccessful_version_command() {
let dir = TempDir::new().unwrap();
let program = executable(&dir, "broken", "gpgui test-version", 1);
let launcher = launcher(VERSION, vec![program]);
assert_eq!(launcher.find_compatible_program().await, None);
} }
} }
+25
View File
@@ -1,5 +1,30 @@
use tauri::WebviewWindow; use tauri::WebviewWindow;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum WindowTypeHint {
Dialog,
Utility,
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
pub fn is_screen_composited() -> bool {
gtk::gdk::Screen::default().is_some_and(|screen| screen.is_composited())
}
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
pub fn set_window_type_hint(window: &WebviewWindow, hint: WindowTypeHint) -> anyhow::Result<()> {
use gtk::{gdk, traits::GtkWindowExt};
let hint = match hint {
WindowTypeHint::Dialog => gdk::WindowTypeHint::Dialog,
WindowTypeHint::Utility => gdk::WindowTypeHint::Utility,
};
window.gtk_window()?.set_type_hint(hint);
Ok(())
}
/// Returns the frame-to-content height difference for a standard titled macOS window. /// Returns the frame-to-content height difference for a standard titled macOS window.
/// This is nonzero only on macOS. /// This is nonzero only on macOS.
pub fn get_title_bar_height() -> f64 { pub fn get_title_bar_height() -> f64 {
+10 -1
View File
@@ -117,7 +117,10 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
config.disable_static().enable_shared(); config
.disable_static()
.enable_shared()
.without("gnutls", None);
config.ldflag("-liconv"); config.ldflag("-liconv");
config.env("LIBS", "-liconv"); config.env("LIBS", "-liconv");
} }
@@ -168,6 +171,11 @@ fn main() {
// Using pkg-config to find system deps // Using pkg-config to find system deps
pkg_config::probe_library("zlib").unwrap(); pkg_config::probe_library("zlib").unwrap();
#[cfg(target_os = "macos")]
pkg_config::probe_library("openssl").unwrap();
#[cfg(not(target_os = "macos"))]
{
pkg_config::probe_library("liblz4").unwrap(); pkg_config::probe_library("liblz4").unwrap();
pkg_config::probe_library("gnutls").unwrap(); pkg_config::probe_library("gnutls").unwrap();
@@ -176,6 +184,7 @@ fn main() {
pkg_config::probe_library("hogweed").unwrap(); pkg_config::probe_library("hogweed").unwrap();
pkg_config::probe_library("nettle").unwrap(); pkg_config::probe_library("nettle").unwrap();
pkg_config::probe_library("gmp").unwrap(); pkg_config::probe_library("gmp").unwrap();
}
// Compile the vpn.c file // Compile the vpn.c file
println!("cargo:rerun-if-changed=src/ffi/vpn.c"); println!("cargo:rerun-if-changed=src/ffi/vpn.c");
+2 -2
View File
@@ -19,7 +19,7 @@ Install build and runtime dependencies:
```sh ```sh
sudo pkg install git rust libiconv gettext-tools autoconf automake libtool patch \ sudo pkg install git rust libiconv gettext-tools autoconf automake libtool patch \
gmake pkgconf libxml2 gnutls p11-kit nettle gmp gnome-keyring \ gmake pkgconf libxml2 gnutls p11-kit nettle gmp gnome-keyring \
libayatana-appindicator polkit webkit2-gtk_41 libayatana-appindicator polkit webkit2-gtk_41 xdg-utils
``` ```
Build and install: Build and install:
@@ -45,7 +45,7 @@ Install build and runtime dependencies:
```sh ```sh
doas pkg_add git rust libiconv gettext-tools autoconf-2.72 automake-1.17 \ doas pkg_add git rust libiconv gettext-tools autoconf-2.72 automake-1.17 \
libtool patch gmake pkgconf libxml gnutls p11-kit nettle gmp \ libtool patch gmake pkgconf libxml gnutls p11-kit nettle gmp \
gnome-keyring polkit webkitgtk41 gnome-keyring polkit webkitgtk41 xdg-utils
``` ```
Use the installed Autoconf and Automake versions: Use the installed Autoconf and Automake versions:
Generated
+7 -35
View File
@@ -43,7 +43,9 @@
"naersk": { "naersk": {
"inputs": { "inputs": {
"fenix": "fenix", "fenix": "fenix",
"nixpkgs": "nixpkgs" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1763384566, "lastModified": 1763384566,
@@ -60,22 +62,6 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1752077645,
"narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "be9e214982e20b8310878ac2baa063a961c1bdf6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1766410818, "lastModified": 1766410818,
"narHash": "sha256-ruVneSx6wFy5PMw1ow3BE+znl653TJ6+eeNUj4B/9y8=", "narHash": "sha256-ruVneSx6wFy5PMw1ow3BE+znl653TJ6+eeNUj4B/9y8=",
@@ -91,27 +77,11 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
@@ -134,7 +104,9 @@
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_3" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1766457837, "lastModified": 1766457837,
+42 -25
View File
@@ -1,9 +1,15 @@
{ {
inputs = { inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay"; flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@@ -26,7 +32,7 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = "globalprotect-openconnect"; pname = "globalprotect-openconnect";
version = cargoToml.workspace.package.version; version = cargoToml.workspace.package.version;
releaseTag = "v2.6.5"; releaseTag = "snapshot";
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -37,14 +43,14 @@
src = pkgs.fetchzip { src = pkgs.fetchzip {
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect-${version}.tar.gz"; url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect-${version}.tar.gz";
hash = "sha256-T4jze6/25YTsfuQdcuDfz3kX/ooDB1T0hnWsEBu4xMQ="; hash = "sha256-jbv5OX7XeLZkY6y+eGbKEg77TKJDpmvzzwVWTjqKFJQ=";
}; };
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name; cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
gpguiHashes = { gpguiHashes = {
x86_64 = "sha256-wPLsH/b/ZSo2pA/kU1HUGiQ98k8xSihyxGyf5o6tvyU="; x86_64 = "sha256-QPPQoR3QpA7evloCrjDb+0XsF0d1ONw5D2mvoaECGiY=";
aarch64 = "sha256-WFyPhGD9fLAVYGeMSrMcZhSdfM99uVmWPrH68O+4BfE="; aarch64 = "sha256-tDmliqiNZZ2pkt2V51OKDILt2IjdIasduvPZKxLOf0U=";
}; };
gpgui = pkgs.fetchzip { gpgui = pkgs.fetchzip {
@@ -53,8 +59,8 @@
}; };
binaryHashes = { binaryHashes = {
x86_64 = "sha256-spaKxruu15ro5lir14nAfy8MPXNQhaoCXcG4PDZ9lfM="; x86_64 = "sha256-lR64CR4yG0pV5tMJaYz9+EVYsIPnYrZdXsZNCLmhNwE=";
aarch64 = "sha256-iu/zE4B4gjk1I5PQY0m/59ZoJ/k5focT0CxYYlJi7+A="; aarch64 = "sha256-nkXdTNkDevS/Q5bbDWw50y8ciYI5TJst2M9TGRl/SKQ=";
}; };
binaryPackage = pkgs.fetchzip { binaryPackage = pkgs.fetchzip {
@@ -65,6 +71,7 @@
linuxRuntimeDependencies = with pkgs; [ linuxRuntimeDependencies = with pkgs; [
glib-networking glib-networking
libayatana-appindicator libayatana-appindicator
xdg-utils
]; ];
linuxBuildInputs = linuxBuildInputs =
@@ -95,10 +102,7 @@
'' ''
+ lib.optionalString pkgs.stdenv.isLinux '' + lib.optionalString pkgs.stdenv.isLinux ''
substituteInPlace $out/share/applications/gpgui.desktop \ substituteInPlace $out/share/applications/gpgui.desktop \
--replace-fail /usr/bin/gpclient /run/current-system/sw/bin/gpclient --replace-fail /usr/bin/gpclient $out/bin/gpclient
substituteInPlace $out/share/applications/gpauth.desktop \
--replace-fail /usr/bin/gpauth /run/current-system/sw/bin/gpauth
substituteInPlace $out/share/polkit-1/actions/com.yuezk.gpgui.policy \ substituteInPlace $out/share/polkit-1/actions/com.yuezk.gpgui.policy \
--replace-fail /usr/bin/gpservice $out/bin/gpservice \ --replace-fail /usr/bin/gpservice $out/bin/gpservice \
@@ -112,10 +116,7 @@
rewriteHostInstallPaths = '' rewriteHostInstallPaths = ''
substituteInPlace $out/share/applications/gpgui.desktop \ substituteInPlace $out/share/applications/gpgui.desktop \
--replace-fail /usr/bin/gpclient /run/current-system/sw/bin/gpclient --replace-fail /usr/bin/gpclient $out/bin/gpclient
substituteInPlace $out/share/applications/gpauth.desktop \
--replace-fail /usr/bin/gpauth /run/current-system/sw/bin/gpauth
substituteInPlace $out/share/polkit-1/actions/com.yuezk.gpgui.policy \ substituteInPlace $out/share/polkit-1/actions/com.yuezk.gpgui.policy \
--replace-fail /usr/bin/gpservice $out/bin/gpservice \ --replace-fail /usr/bin/gpservice $out/bin/gpservice \
@@ -177,6 +178,10 @@
runtimeDependencies = lib.optionals pkgs.stdenv.isLinux linuxRuntimeDependencies; runtimeDependencies = lib.optionals pkgs.stdenv.isLinux linuxRuntimeDependencies;
preFixup = lib.optionalString pkgs.stdenv.isLinux ''
gappsWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ pkgs.xdg-utils ]})
'';
overrideMain = overrideMain =
{ ... }: { ... }:
{ {
@@ -337,26 +342,40 @@
gpclient_fhs='${prebuiltCommands.gpclient}/bin/gpclient' gpclient_fhs='${prebuiltCommands.gpclient}/bin/gpclient'
gpservice_public='@gpservice_public@' gpservice_public='@gpservice_public@'
gpauth_public='@gpauth_public@'
if [ "''${1:-}" = "launch-gui" ]; then if [ "''${1:-}" = "launch-gui" ]; then
shift shift
auth_data=
minimized= minimized=
callback=
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
--minimized) --minimized)
minimized=--minimized minimized=--minimized
;; ;;
--*) globalprotectcallback:*)
if [ -n "$callback" ]; then
echo "Multiple authentication callback URLs were provided" >&2
exit 2
fi
callback=$arg
;; ;;
*) *)
auth_data=$arg echo "Unsupported launch-gui argument: $arg" >&2
exit 2
;; ;;
esac esac
done done
if [ -z "$auth_data" ]; then if [ -n "$callback" ]; then
if [ -n "$minimized" ]; then
echo "An authentication callback cannot be combined with --minimized" >&2
exit 2
fi
exec "$gpauth_public" auth-callback "$callback"
fi
if [ -n "''${XDG_DATA_HOME:-}" ]; then if [ -n "''${XDG_DATA_HOME:-}" ]; then
data_home=$XDG_DATA_HOME data_home=$XDG_DATA_HOME
elif [ -n "''${HOME:-}" ]; then elif [ -n "''${HOME:-}" ]; then
@@ -390,13 +409,11 @@
exit "$status" exit "$status"
fi fi
set -- launch-gui "$@"
fi
exec "$gpclient_fhs" "$@" exec "$gpclient_fhs" "$@"
EOF EOF
substituteInPlace $out/bin/gpclient \ substituteInPlace $out/bin/gpclient \
--replace-fail '@gpservice_public@' "$out/bin/gpservice" --replace-fail '@gpservice_public@' "$out/bin/gpservice" \
--replace-fail '@gpauth_public@' "$out/bin/gpauth"
chmod +x $out/bin/gpclient chmod +x $out/bin/gpclient
cat > $out/bin/gpservice <<'EOF' cat > $out/bin/gpservice <<'EOF'
+3 -1
View File
@@ -1,7 +1,9 @@
#!/bin/sh #!/bin/sh
rm -f \ rm -f \
/var/lib/gpclient/gpgui \
/var/lib/gpclient/scripts/vpnc-script \ /var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata || /var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true rmdir /var/lib/gpclient/scripts 2>/dev/null || true
rmdir /var/lib/gpclient 2>/dev/null || true
@@ -28,6 +28,7 @@ pkgbase = globalprotect-openconnect-git
depends = libxml2 depends = libxml2
depends = shared-mime-info depends = shared-mime-info
depends = desktop-file-utils depends = desktop-file-utils
depends = xdg-utils
optdepends = wmctrl: for window management optdepends = wmctrl: for window management
provides = globalprotect-openconnect provides = globalprotect-openconnect
provides = gpclient provides = gpclient
@@ -10,7 +10,7 @@ url="https://github.com/yuezk/GlobalProtect-openconnect"
license=('GPL3') license=('GPL3')
makedepends=(git pkg-config 'openconnect>=8.20' webkit2gtk-4.1 curl wget file openssl appmenu-gtk-module libappindicator-gtk3 librsvg libsecret cargo) makedepends=(git pkg-config 'openconnect>=8.20' webkit2gtk-4.1 curl wget file openssl appmenu-gtk-module libappindicator-gtk3 librsvg libsecret cargo)
depends=(vpnc openssl webkit2gtk-4.1 libappindicator-gtk3 libsecret libxml2 shared-mime-info desktop-file-utils) depends=(vpnc openssl webkit2gtk-4.1 libappindicator-gtk3 libsecret libxml2 shared-mime-info desktop-file-utils xdg-utils)
optdepends=('wmctrl: for window management') optdepends=('wmctrl: for window management')
conflicts=('globalprotect-openconnect') conflicts=('globalprotect-openconnect')
@@ -3,22 +3,19 @@ post_install() {
update-desktop-database -q update-desktop-database -q
} }
pre_upgrade() {
rm -f /usr/bin/gpgui
}
post_upgrade() { post_upgrade() {
update-mime-database /usr/share/mime update-mime-database /usr/share/mime
update-desktop-database -q update-desktop-database -q
} }
post_remove() { post_remove() {
rm -f /usr/bin/gpgui
rm -f \ rm -f \
/var/lib/gpclient/gpgui \
/var/lib/gpclient/scripts/vpnc-script \ /var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata || /var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true rmdir /var/lib/gpclient/scripts 2>/dev/null || true
rmdir /var/lib/gpclient 2>/dev/null || true
update-mime-database /usr/share/mime update-mime-database /usr/share/mime
update-desktop-database -q update-desktop-database -q
} }
+3 -3
View File
@@ -19,7 +19,6 @@ install:
install -Dm755 artifacts/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook install -Dm755 artifacts/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook
install -Dm644 artifacts/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop install -Dm644 artifacts/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop
install -Dm644 artifacts/usr/share/applications/gpauth.desktop $(DESTDIR)/usr/share/applications/gpauth.desktop
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg install -Dm644 artifacts/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
install -Dm644 artifacts/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png install -Dm644 artifacts/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
install -Dm644 artifacts/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png install -Dm644 artifacts/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
@@ -44,7 +43,6 @@ uninstall:
rm -f $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook rm -f $(DESTDIR)/usr/lib/NetworkManager/dispatcher.d/gpclient-nm-hook
rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop
rm -f $(DESTDIR)/usr/share/applications/gpauth.desktop
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
rm -f $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
@@ -53,6 +51,8 @@ uninstall:
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \ rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
$(DESTDIR)/var/lib/gpclient/gpgui \
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \ $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true
rmdir $(DESTDIR)/var/lib/gpclient 2>/dev/null || true
+4
View File
@@ -47,6 +47,10 @@ deps: {
origin: "www/webkit2-gtk" origin: "www/webkit2-gtk"
version: "*" version: "*"
} }
"xdg-utils": {
origin: "devel/xdg-utils"
version: "*"
}
} }
desc: <<EOD desc: <<EOD
A GlobalProtect VPN client based on OpenConnect. A GlobalProtect VPN client based on OpenConnect.
+4 -1
View File
@@ -3,7 +3,10 @@
root=${PKG_ROOTDIR:-} root=${PKG_ROOTDIR:-}
rm -f \ rm -f \
"$root/usr/local/libexec/gpclient/gpgui" \
"$root/var/db/gpclient/scripts/vpnc-script" \ "$root/var/db/gpclient/scripts/vpnc-script" \
"$root/var/db/gpclient/scripts/vpnc-script.metadata" || "$root/var/db/gpclient/scripts/vpnc-script.metadata" ||
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir "$root/usr/local/libexec/gpclient" 2>/dev/null || true
rmdir "$root/var/db/gpclient/scripts" 2>/dev/null || true rmdir "$root/var/db/gpclient/scripts" 2>/dev/null || true
rmdir "$root/var/db/gpclient" 2>/dev/null || true
+1
View File
@@ -36,5 +36,6 @@ Depends:
libsecret-1-0, libsecret-1-0,
libayatana-appindicator3-1, libayatana-appindicator3-1,
gnome-keyring, gnome-keyring,
xdg-utils,
Description: A GUI client for GlobalProtect VPN Description: A GUI client for GlobalProtect VPN
A GUI client for GlobalProtect VPN, based on OpenConnect, supports the SSO authentication method. A GUI client for GlobalProtect VPN, based on OpenConnect, supports the SSO authentication method.
+3 -9
View File
@@ -4,18 +4,12 @@ set -e
case "$1" in case "$1" in
purge|remove) purge|remove)
rm -f \ rm -f \
/var/lib/gpclient/gpgui \
/var/lib/gpclient/scripts/vpnc-script \ /var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata || /var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true rmdir /var/lib/gpclient/scripts 2>/dev/null || true
rmdir /var/lib/gpclient 2>/dev/null || true
# Remove the gpgui binary downloaded at runtime
rm -f /usr/bin/gpgui
;;
upgrade)
# Remove the gpgui binary downloaded at runtime
rm -f /usr/bin/gpgui
;; ;;
*) *)
@@ -1,10 +0,0 @@
[Desktop Entry]
Type=Application
Name=GP Connect Login
Comment=Authenticate GP Connect VPN connections
NoDisplay=true
Terminal=false
TryExec=/usr/bin/gpauth
Exec=/usr/bin/gpauth
Icon=gpgui
Categories=Network;
+3 -1
View File
@@ -1,7 +1,9 @@
post_remove() { post_remove() {
rm -f \ rm -f \
/var/lib/gpclient/gpgui \
/var/lib/gpclient/scripts/vpnc-script \ /var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata || /var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || true rmdir /var/lib/gpclient/scripts 2>/dev/null || true
rmdir /var/lib/gpclient 2>/dev/null || true
} }
@@ -38,6 +38,7 @@ Requires: (libappindicator3-1 or libayatana-appindicator3-1)
%else %else
Requires: (libappindicator-gtk3 or libayatana-appindicator-gtk3) Requires: (libappindicator-gtk3 or libayatana-appindicator-gtk3)
%endif %endif
Requires: xdg-utils
Conflicts: globalprotect-openconnect-snapshot Conflicts: globalprotect-openconnect-snapshot
%global debug_package %{nil} %global debug_package %{nil}
@@ -50,12 +51,13 @@ A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authenticati
%postun %postun
if [ "$1" -eq 0 ]; then if [ "$1" -eq 0 ]; then
rm -f %{_bindir}/gpgui
rm -f \ rm -f \
/var/lib/gpclient/gpgui \
/var/lib/gpclient/scripts/vpnc-script \ /var/lib/gpclient/scripts/vpnc-script \
/var/lib/gpclient/scripts/vpnc-script.metadata || /var/lib/gpclient/scripts/vpnc-script.metadata ||
echo "Warning: failed to remove the installed VPN script" >&2 echo "Warning: failed to remove gpclient runtime files" >&2
rmdir /var/lib/gpclient/scripts 2>/dev/null || : rmdir /var/lib/gpclient/scripts 2>/dev/null || :
rmdir /var/lib/gpclient 2>/dev/null || :
fi fi
%build %build
@@ -73,7 +75,6 @@ make build
%{_libexecdir}/gpclient/hipreport.sh %{_libexecdir}/gpclient/hipreport.sh
%{_libexecdir}/gpclient/gp-vpnc-script-installer %{_libexecdir}/gpclient/gp-vpnc-script-installer
%{_datadir}/applications/gpgui.desktop %{_datadir}/applications/gpgui.desktop
%{_datadir}/applications/gpauth.desktop
%{_datadir}/icons/hicolor/32x32/apps/gpgui.png %{_datadir}/icons/hicolor/32x32/apps/gpgui.png
%{_datadir}/icons/hicolor/128x128/apps/gpgui.png %{_datadir}/icons/hicolor/128x128/apps/gpgui.png
%{_datadir}/icons/hicolor/256x256/apps/gpgui.png %{_datadir}/icons/hicolor/256x256/apps/gpgui.png
+58 -20
View File
@@ -10,6 +10,7 @@ fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
GP_DIR="$(dirname "$SCRIPT_DIR")" GP_DIR="$(dirname "$SCRIPT_DIR")"
GPGUI_DIR="$1" GPGUI_DIR="$1"
GPGUI_APP_DIR="$GPGUI_DIR/apps/desktop"
verify_same_file() { verify_same_file() {
local source_file="$1" local source_file="$1"
@@ -22,59 +23,96 @@ verify_same_file() {
fi fi
} }
verify_contains() {
local file="$1"
local expected="$2"
if ! grep -Fqx "$expected" "$file"; then
echo "Linux desktop asset is missing '$expected': $file" >&2
exit 1
fi
}
verify_absent() {
local file="$1"
if [[ -e "$file" ]]; then
echo "Obsolete Linux desktop asset is still present: $file" >&2
exit 1
fi
}
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/32x32.png" \ "$GPGUI_APP_DIR/src-tauri/icons/32x32.png" \
"$GP_DIR/packaging/files/usr/share/icons/hicolor/32x32/apps/gpgui.png" "$GP_DIR/packaging/files/usr/share/icons/hicolor/32x32/apps/gpgui.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/128x128.png" \ "$GPGUI_APP_DIR/src-tauri/icons/128x128.png" \
"$GP_DIR/packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png" "$GP_DIR/packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/[email protected]" \ "$GPGUI_APP_DIR/src-tauri/icons/[email protected]" \
"$GP_DIR/packaging/files/usr/share/icons/hicolor/256x256/apps/gpgui.png" "$GP_DIR/packaging/files/usr/share/icons/hicolor/256x256/apps/gpgui.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.png" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.png" \
"$GP_DIR/packaging/files/usr/share/icons/hicolor/256x256@2/apps/gpgui.png" "$GP_DIR/packaging/files/usr/share/icons/hicolor/256x256@2/apps/gpgui.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.svg" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.svg" \
"$GP_DIR/packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg" "$GP_DIR/packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/32x32.png" \ "$GPGUI_APP_DIR/src-tauri/icons/32x32.png" \
"$GP_DIR/apps/gpauth/icons/32x32.png" "$GP_DIR/apps/gpauth/icons/32x32.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/128x128.png" \ "$GPGUI_APP_DIR/src-tauri/icons/128x128.png" \
"$GP_DIR/apps/gpauth/icons/128x128.png" "$GP_DIR/apps/gpauth/icons/128x128.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/[email protected]" \ "$GPGUI_APP_DIR/src-tauri/icons/[email protected]" \
"$GP_DIR/apps/gpauth/icons/[email protected]" "$GP_DIR/apps/gpauth/icons/[email protected]"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.png" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.png" \
"$GP_DIR/apps/gpauth/icons/icon.png" "$GP_DIR/apps/gpauth/icons/icon.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/32x32.png" \ "$GPGUI_APP_DIR/src-tauri/icons/32x32.png" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/32x32.png" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/32x32.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/128x128.png" \ "$GPGUI_APP_DIR/src-tauri/icons/128x128.png" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/128x128.png" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/128x128.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/[email protected]" \ "$GPGUI_APP_DIR/src-tauri/icons/[email protected]" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/[email protected]" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/[email protected]"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.png" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.png" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.png" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.png"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.svg" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.svg" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.svg" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.svg"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.icns" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.icns" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.icns" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.icns"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon.ico" \ "$GPGUI_APP_DIR/src-tauri/icons/icon.ico" \
"$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.ico" "$GP_DIR/apps/gpgui-helper/src-tauri/icons/icon.ico"
verify_same_file \ verify_same_file \
"$GPGUI_DIR/app/src-tauri/icons/icon-small.svg" \ "$GPGUI_APP_DIR/src-tauri/icons/icon-small.svg" \
"$GP_DIR/apps/gpgui-helper/src/assets/icon-small.svg" "$GP_DIR/apps/gpgui-helper/src/assets/icon-small.svg"
verify_same_file \ verify_contains \
"$GPGUI_DIR/app/gpauth.desktop" \ "$GPGUI_APP_DIR/gpgui.desktop.in" \
"$GP_DIR/packaging/files/usr/share/applications/gpauth.desktop" "Exec=/usr/bin/gpclient launch-gui %u"
verify_contains \
"$GPGUI_APP_DIR/gpgui.desktop.in" \
"MimeType=x-scheme-handler/globalprotectcallback;"
verify_contains \
"$GP_DIR/packaging/files/usr/share/applications/gpgui.desktop" \
"Exec=/usr/bin/gpclient launch-gui %u"
verify_contains \
"$GP_DIR/packaging/files/usr/share/applications/gpgui.desktop" \
"MimeType=x-scheme-handler/globalprotectcallback;"
verify_contains \
"$GP_DIR/packaging/bsd/gpgui.desktop" \
"Exec=/usr/local/bin/gpclient launch-gui %u"
verify_contains \
"$GP_DIR/packaging/bsd/gpgui.desktop" \
"MimeType=x-scheme-handler/globalprotectcallback;"
verify_absent "$GPGUI_APP_DIR/gpauth.desktop"
verify_absent "$GP_DIR/packaging/files/usr/share/applications/gpauth.desktop"
verify_absent "$GP_DIR/packaging/bsd/gpauth.desktop"
echo "Linux desktop assets are synchronized" echo "Linux desktop assets are synchronized"