mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16dcb3aa6c |
No files matched your search
+236
-133
@@ -40,8 +40,8 @@ on:
|
|||||||
- v*.*.*
|
- v*.*.*
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && 'release' || github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }}
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-gp:
|
test-gp:
|
||||||
@@ -60,7 +60,6 @@ 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 \
|
||||||
@@ -316,8 +315,6 @@ 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: |
|
||||||
@@ -336,92 +333,232 @@ jobs:
|
|||||||
gpgui-source/*.bin.tar.xz
|
gpgui-source/*.bin.tar.xz
|
||||||
gpgui-source/*.bin.tar.xz.sha256
|
gpgui-source/*.bin.tar.xz.sha256
|
||||||
|
|
||||||
trigger-gpgui-macos:
|
build-gpgui-macos:
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.build_macos) }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.build_macos) }}
|
||||||
permissions:
|
runs-on: macos-26
|
||||||
contents: read
|
environment: macos-release
|
||||||
runs-on: ubuntu-latest
|
name: build-gpgui (macOS, arm64)
|
||||||
name: trigger private macOS release
|
|
||||||
outputs:
|
outputs:
|
||||||
run_id: ${{ steps.dispatch.outputs.run_id }}
|
archive_name: ${{ steps.release.outputs.archive_name }}
|
||||||
run_url: ${{ steps.dispatch.outputs.run_url }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Dispatch private macOS release
|
- name: Verify runner architecture
|
||||||
id: dispatch
|
run: test "$(uname -m)" = arm64
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GPGUI_ACTIONS_TOKEN }}
|
- uses: pnpm/action-setup@v5
|
||||||
PUBLIC_GH_TOKEN: ${{ github.token }}
|
with:
|
||||||
CHANNEL: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }}
|
version: 9.15.1
|
||||||
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || github.ref_name }}
|
|
||||||
GP_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref_name }}
|
- name: Prepare workspace
|
||||||
GPGUI_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
|
run: rm -rf gpgui-source && mkdir gpgui-source
|
||||||
BUILD_VERSION: ${{ github.run_number }}.${{ github.run_attempt }}
|
|
||||||
REQUEST_ID: ${{ github.run_id }}.${{ github.run_attempt }}.macos
|
- name: Checkout GlobalProtect-openconnect
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GH_PAT }}
|
||||||
|
repository: yuezk/GlobalProtect-openconnect
|
||||||
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gp_branch || github.ref }}
|
||||||
|
path: gpgui-source/gp
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Checkout gpgui
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GH_PAT }}
|
||||||
|
repository: yuezk/gpgui
|
||||||
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
|
||||||
|
path: gpgui-source/gpgui
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: pnpm
|
||||||
|
cache-dependency-path: gpgui-source/gpgui/app/pnpm-lock.yaml
|
||||||
|
|
||||||
|
- name: Validate release versions
|
||||||
|
id: release
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if [[ -z "${GH_TOKEN:-}" ]]; then
|
gp_version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' gpgui-source/gp/Cargo.toml | head -1)"
|
||||||
echo "GPGUI_ACTIONS_TOKEN is not configured" >&2
|
gpgui_version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' gpgui-source/gpgui/Cargo.toml | head -1)"
|
||||||
|
if [[ -z "$gp_version" || "$gp_version" != "$gpgui_version" ]]; then
|
||||||
|
echo "gp and gpgui versions must match: gp=$gp_version, gpgui=$gpgui_version" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gp_ref_path="$(jq -rn --arg ref "$GP_REF" '$ref | @uri')"
|
build_number="${{ github.run_number }}.${{ github.run_attempt }}"
|
||||||
gpgui_ref_path="$(jq -rn --arg ref "$GPGUI_REF" '$ref | @uri')"
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
gp_sha="$(GH_TOKEN="$PUBLIC_GH_TOKEN" gh api \
|
channel="snapshot"
|
||||||
"repos/yuezk/GlobalProtect-openconnect/commits/$gp_ref_path" --jq .sha)"
|
release_tag="snapshot"
|
||||||
gpgui_sha="$(gh api "repos/yuezk/gpgui/commits/$gpgui_ref_path" --jq .sha)"
|
artifact_version="$gpgui_version-snapshot.$build_number"
|
||||||
if [[ -z "$gp_sha" || -z "$gpgui_sha" ]]; then
|
feed_url="https://github.com/${{ github.repository }}/releases/download/snapshot/appcast.xml"
|
||||||
echo "Could not resolve release source refs" >&2
|
else
|
||||||
|
channel="stable"
|
||||||
|
release_tag="${{ github.ref_name }}"
|
||||||
|
artifact_version="$gpgui_version"
|
||||||
|
feed_url="https://github.com/${{ github.repository }}/releases/latest/download/appcast.xml"
|
||||||
|
if [[ "$release_tag" != "v$gpgui_version" ]]; then
|
||||||
|
echo "Release tag $release_tag does not match gpgui version $gpgui_version" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
expected_title="macOS $CHANNEL $RELEASE_TAG ($REQUEST_ID)"
|
archive_name="GPConnect_${artifact_version}_arm64.zip"
|
||||||
jq -n \
|
|
||||||
--arg workflow_ref "$GPGUI_REF" \
|
|
||||||
--arg request_id "$REQUEST_ID" \
|
|
||||||
--arg build_version "$BUILD_VERSION" \
|
|
||||||
--arg channel "$CHANNEL" \
|
|
||||||
--arg release_tag "$RELEASE_TAG" \
|
|
||||||
--arg gp_ref "$gp_sha" \
|
|
||||||
--arg gpgui_ref "$gpgui_sha" \
|
|
||||||
'{
|
|
||||||
ref: $workflow_ref,
|
|
||||||
inputs: {
|
|
||||||
request_id: $request_id,
|
|
||||||
build_version: $build_version,
|
|
||||||
channel: $channel,
|
|
||||||
release_tag: $release_tag,
|
|
||||||
gp_ref: $gp_ref,
|
|
||||||
gpgui_ref: $gpgui_ref
|
|
||||||
}
|
|
||||||
}' | gh api --method POST \
|
|
||||||
repos/yuezk/gpgui/actions/workflows/release-macos.yaml/dispatches \
|
|
||||||
--input -
|
|
||||||
|
|
||||||
run_id=""
|
|
||||||
run_url=""
|
|
||||||
for _ in {1..40}; do
|
|
||||||
runs="$(gh api \
|
|
||||||
'repos/yuezk/gpgui/actions/workflows/release-macos.yaml/runs?event=workflow_dispatch&per_page=50')"
|
|
||||||
run_id="$(jq -r --arg title "$expected_title" \
|
|
||||||
'[.workflow_runs[] | select(.display_title == $title)] | first | .id // empty' \
|
|
||||||
<<<"$runs")"
|
|
||||||
run_url="$(jq -r --arg title "$expected_title" \
|
|
||||||
'[.workflow_runs[] | select(.display_title == $title)] | first | .html_url // empty' \
|
|
||||||
<<<"$runs")"
|
|
||||||
if [[ -n "$run_id" ]]; then
|
|
||||||
{
|
{
|
||||||
echo "run_id=$run_id"
|
echo "MACOS_BUILD_NUMBER=$build_number"
|
||||||
echo "run_url=$run_url"
|
echo "MACOS_ARTIFACT_VERSION=$artifact_version"
|
||||||
} >> "$GITHUB_OUTPUT"
|
echo "SPARKLE_FEED_URL=$feed_url"
|
||||||
echo "Triggered private workflow: $run_url"
|
echo "RELEASE_TAG=$release_tag"
|
||||||
exit 0
|
echo "UPDATE_CHANNEL=$channel"
|
||||||
|
} >> "$GITHUB_ENV"
|
||||||
|
echo "archive_name=$archive_name" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: |
|
||||||
|
brew install \
|
||||||
|
autoconf \
|
||||||
|
automake \
|
||||||
|
create-dmg \
|
||||||
|
dylibbundler \
|
||||||
|
gettext \
|
||||||
|
gmp \
|
||||||
|
gnutls \
|
||||||
|
libidn2 \
|
||||||
|
libtool \
|
||||||
|
libtasn1 \
|
||||||
|
libunistring \
|
||||||
|
lz4 \
|
||||||
|
nettle \
|
||||||
|
openssl@3 \
|
||||||
|
p11-kit \
|
||||||
|
pkgconf
|
||||||
|
|
||||||
|
- name: Import signing identity
|
||||||
|
env:
|
||||||
|
MACOS_CERTIFICATE_P12: ${{ secrets.MACOS_CERTIFICATE_P12 }}
|
||||||
|
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
|
||||||
|
APPLE_NOTARY_KEY_P8: ${{ secrets.APPLE_NOTARY_KEY_P8 }}
|
||||||
|
APPLE_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
|
||||||
|
APPLE_NOTARY_ISSUER_ID: ${{ secrets.APPLE_NOTARY_ISSUER_ID }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
for variable in \
|
||||||
|
MACOS_CERTIFICATE_P12 \
|
||||||
|
MACOS_CERTIFICATE_PASSWORD; do
|
||||||
|
if [[ -z "${!variable:-}" ]]; then
|
||||||
|
echo "$variable is not configured" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
sleep 3
|
done
|
||||||
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
for variable in \
|
||||||
|
APPLE_NOTARY_KEY_P8 \
|
||||||
|
APPLE_NOTARY_KEY_ID \
|
||||||
|
APPLE_NOTARY_ISSUER_ID; do
|
||||||
|
if [[ -z "${!variable:-}" ]]; then
|
||||||
|
echo "$variable is not configured" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
keychain="$RUNNER_TEMP/gp-connect.keychain-db"
|
||||||
|
keychain_password="$(openssl rand -hex 24)"
|
||||||
|
certificate="$RUNNER_TEMP/signing-identity.p12"
|
||||||
|
|
||||||
|
printf '%s' "$MACOS_CERTIFICATE_P12" | base64 -D > "$certificate"
|
||||||
|
chmod 600 "$certificate"
|
||||||
|
|
||||||
|
security create-keychain -p "$keychain_password" "$keychain"
|
||||||
|
security set-keychain-settings -lut 21600 "$keychain"
|
||||||
|
security unlock-keychain -p "$keychain_password" "$keychain"
|
||||||
|
security import "$certificate" -k "$keychain" \
|
||||||
|
-P "$MACOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12
|
||||||
|
security set-key-partition-list -S apple-tool:,apple: \
|
||||||
|
-s -k "$keychain_password" "$keychain"
|
||||||
|
security list-keychains -d user -s "$keychain" login.keychain-db
|
||||||
|
|
||||||
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
identity="$(security find-identity -v -p codesigning "$keychain" \
|
||||||
|
| sed -n 's/.*"\(Developer ID Application:.*\)"/\1/p' | head -1)"
|
||||||
|
else
|
||||||
|
identity="$(security find-identity -v -p codesigning "$keychain" \
|
||||||
|
| sed -n \
|
||||||
|
-e 's/.*"\(Developer ID Application:.*\)"/\1/p' \
|
||||||
|
-e 's/.*"\(Apple Development:.*\)"/\1/p' \
|
||||||
|
| head -1)"
|
||||||
|
fi
|
||||||
|
if [[ -z "$identity" ]]; then
|
||||||
|
echo "A compatible Apple code-signing identity was not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "CI_KEYCHAIN=$keychain"
|
||||||
|
echo "MACOS_SIGN_IDENTITY=$identity"
|
||||||
|
} >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
notary_key="$RUNNER_TEMP/AuthKey.p8"
|
||||||
|
notary_profile="gp-connect-ci"
|
||||||
|
printf '%s' "$APPLE_NOTARY_KEY_P8" > "$notary_key"
|
||||||
|
chmod 600 "$notary_key"
|
||||||
|
xcrun notarytool store-credentials "$notary_profile" \
|
||||||
|
--key "$notary_key" \
|
||||||
|
--key-id "$APPLE_NOTARY_KEY_ID" \
|
||||||
|
--issuer "$APPLE_NOTARY_ISSUER_ID" \
|
||||||
|
--keychain "$keychain"
|
||||||
|
{
|
||||||
|
echo "APPLE_NOTARY_PROFILE=$notary_profile"
|
||||||
|
echo "APPLE_NOTARY_KEYCHAIN=$keychain"
|
||||||
|
} >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build macOS release artifacts
|
||||||
|
env:
|
||||||
|
SPARKLE_PUBLIC_KEY: ${{ vars.SPARKLE_PUBLIC_KEY }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
cd gpgui-source/gpgui
|
||||||
|
if [[ "$UPDATE_CHANNEL" == "stable" ]]; then
|
||||||
|
build_mode="release"
|
||||||
|
else
|
||||||
|
build_mode="development"
|
||||||
|
export SPARKLE_CREATE_UPDATE_ARCHIVE=1
|
||||||
|
fi
|
||||||
|
./scripts/build-macos.sh dmg "$build_mode"
|
||||||
|
|
||||||
|
- name: Prepare release assets
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
artifact_dir="gpgui-source/artifacts"
|
||||||
|
mkdir -p "$artifact_dir"
|
||||||
|
dmg_name="GPConnect_${MACOS_ARTIFACT_VERSION}_arm64.dmg"
|
||||||
|
archive_name="GPConnect_${MACOS_ARTIFACT_VERSION}_arm64.zip"
|
||||||
|
mv "gpgui-source/gpgui/target/release/bundle/dmg/GP Connect.dmg" \
|
||||||
|
"$artifact_dir/$dmg_name"
|
||||||
|
mv "gpgui-source/gpgui/target/release/bundle/sparkle/$archive_name" \
|
||||||
|
"$artifact_dir/$archive_name"
|
||||||
|
|
||||||
|
for file in "$artifact_dir"/*; do
|
||||||
|
shasum -a 256 "$file" > "$file.sha256"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Could not locate the dispatched private workflow run" >&2
|
- name: Upload macOS artifacts
|
||||||
exit 1
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: artifact-gpgui-macos-arm64
|
||||||
|
if-no-files-found: error
|
||||||
|
path: gpgui-source/artifacts/*
|
||||||
|
|
||||||
|
- name: Remove signing keychain
|
||||||
|
if: ${{ always() }}
|
||||||
|
run: |
|
||||||
|
if [[ -n "${CI_KEYCHAIN:-}" && -f "$CI_KEYCHAIN" ]]; then
|
||||||
|
security delete-keychain "$CI_KEYCHAIN"
|
||||||
|
fi
|
||||||
|
|
||||||
setup-bsd-matrix:
|
setup-bsd-matrix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -493,7 +630,7 @@ jobs:
|
|||||||
path: gpgui-frontend/gpgui
|
path: gpgui-frontend/gpgui
|
||||||
- name: Build gpgui frontend
|
- name: Build gpgui frontend
|
||||||
run: |
|
run: |
|
||||||
cd gpgui-frontend/gpgui/apps/desktop
|
cd gpgui-frontend/gpgui/app
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
pnpm build
|
pnpm build
|
||||||
- name: Upload gpgui frontend
|
- name: Upload gpgui frontend
|
||||||
@@ -501,7 +638,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/apps/desktop/dist/**
|
path: gpgui-frontend/gpgui/app/dist/**
|
||||||
|
|
||||||
build-bsd:
|
build-bsd:
|
||||||
needs:
|
needs:
|
||||||
@@ -535,7 +672,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/apps/desktop/dist
|
path: ${{ matrix.workspace }}/gpgui/app/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
|
||||||
@@ -566,16 +703,14 @@ 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/apps/desktop/src-tauri
|
cd ../gpgui/app/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
|
||||||
@@ -609,8 +744,7 @@ 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
|
||||||
@@ -621,16 +755,14 @@ 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/apps/desktop/src-tauri
|
cd ../gpgui/app/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
|
||||||
@@ -661,6 +793,7 @@ jobs:
|
|||||||
- build-gp
|
- build-gp
|
||||||
- build-docker-image
|
- build-docker-image
|
||||||
- build-gpgui
|
- build-gpgui
|
||||||
|
- build-gpgui-macos
|
||||||
- setup-bsd-matrix
|
- setup-bsd-matrix
|
||||||
- build-gpgui-frontend
|
- build-gpgui-frontend
|
||||||
- build-bsd
|
- build-bsd
|
||||||
@@ -670,6 +803,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NEEDS_JSON: ${{ toJson(needs) }}
|
NEEDS_JSON: ${{ toJson(needs) }}
|
||||||
BSD_MATRIX_ENABLED: ${{ needs.setup-bsd-matrix.outputs.enabled }}
|
BSD_MATRIX_ENABLED: ${{ needs.setup-bsd-matrix.outputs.enabled }}
|
||||||
|
MACOS_BUILD_ENABLED: ${{ startsWith(github.ref, 'refs/tags/') || inputs.build_macos }}
|
||||||
IS_TAG: ${{ startsWith(github.ref, 'refs/tags/') }}
|
IS_TAG: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: |
|
run: |
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
@@ -679,6 +813,7 @@ jobs:
|
|||||||
|
|
||||||
needs = json.loads(os.environ["NEEDS_JSON"])
|
needs = json.loads(os.environ["NEEDS_JSON"])
|
||||||
bsd_matrix_enabled = os.environ["BSD_MATRIX_ENABLED"] == "true"
|
bsd_matrix_enabled = os.environ["BSD_MATRIX_ENABLED"] == "true"
|
||||||
|
macos_build_enabled = os.environ["MACOS_BUILD_ENABLED"] == "true"
|
||||||
is_tag = os.environ["IS_TAG"] == "true"
|
is_tag = os.environ["IS_TAG"] == "true"
|
||||||
failed = []
|
failed = []
|
||||||
|
|
||||||
@@ -690,6 +825,8 @@ jobs:
|
|||||||
continue
|
continue
|
||||||
elif name in {"build-gpgui-frontend", "build-bsd"} and result == "skipped" and not bsd_matrix_enabled:
|
elif name in {"build-gpgui-frontend", "build-bsd"} and result == "skipped" and not bsd_matrix_enabled:
|
||||||
continue
|
continue
|
||||||
|
elif name == "build-gpgui-macos" and result == "skipped" and not macos_build_enabled:
|
||||||
|
continue
|
||||||
elif result == "skipped":
|
elif result == "skipped":
|
||||||
failed.append(f"{name}: {result}")
|
failed.append(f"{name}: {result}")
|
||||||
|
|
||||||
@@ -756,53 +893,19 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd gh-release/gp/scripts && ./gh-release.sh "$RELEASE_TAG"
|
cd gh-release/gp/scripts && ./gh-release.sh "$RELEASE_TAG"
|
||||||
|
|
||||||
wait-gpgui-macos:
|
publish-macos-appcast:
|
||||||
if: ${{ always() && needs.trigger-gpgui-macos.result != 'skipped' }}
|
if: ${{ always() && needs.gh-release.result == 'success' && needs.build-gpgui-macos.result == 'success' }}
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
needs:
|
needs:
|
||||||
- gh-release
|
- gh-release
|
||||||
- trigger-gpgui-macos
|
- build-gpgui-macos
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/publish-macos-appcast.yaml
|
||||||
timeout-minutes: 130
|
with:
|
||||||
steps:
|
channel: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }}
|
||||||
- name: Wait for private macOS release
|
release_tag: ${{ github.event_name == 'workflow_dispatch' && 'snapshot' || github.ref_name }}
|
||||||
env:
|
archive_name: ${{ needs.build-gpgui-macos.outputs.archive_name }}
|
||||||
GH_TOKEN: ${{ secrets.GPGUI_ACTIONS_TOKEN }}
|
secrets: inherit
|
||||||
PUBLIC_RELEASE_RESULT: ${{ needs.gh-release.result }}
|
|
||||||
PRIVATE_RUN_ID: ${{ needs.trigger-gpgui-macos.outputs.run_id }}
|
|
||||||
PRIVATE_RUN_URL: ${{ needs.trigger-gpgui-macos.outputs.run_url }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
if [[ -z "$PRIVATE_RUN_ID" ]]; then
|
|
||||||
echo "The private macOS workflow was not started" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ "$PUBLIC_RELEASE_RESULT" != "success" ]]; then
|
|
||||||
gh api --method POST \
|
|
||||||
"repos/yuezk/gpgui/actions/runs/$PRIVATE_RUN_ID/cancel" >/dev/null || true
|
|
||||||
echo "The public release failed; cancelled $PRIVATE_RUN_URL" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for _ in $(seq 1 480); do
|
|
||||||
run="$(gh api "repos/yuezk/gpgui/actions/runs/$PRIVATE_RUN_ID")"
|
|
||||||
status="$(jq -r '.status' <<<"$run")"
|
|
||||||
conclusion="$(jq -r '.conclusion // ""' <<<"$run")"
|
|
||||||
if [[ "$status" == "completed" ]]; then
|
|
||||||
echo "Private macOS workflow completed: $PRIVATE_RUN_URL"
|
|
||||||
if [[ "$conclusion" != "success" ]]; then
|
|
||||||
echo "Private macOS workflow concluded with: $conclusion" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
sleep 15
|
|
||||||
done
|
|
||||||
|
|
||||||
gh api --method POST \
|
|
||||||
"repos/yuezk/gpgui/actions/runs/$PRIVATE_RUN_ID/cancel" >/dev/null || true
|
|
||||||
echo "Private macOS workflow timed out: $PRIVATE_RUN_URL" >&2
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
publish-docker-image:
|
publish-docker-image:
|
||||||
needs:
|
needs:
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
aur:
|
||||||
name: Validate AUR package
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: archlinux:base-devel
|
container: archlinux:base-devel
|
||||||
defaults:
|
defaults:
|
||||||
@@ -33,6 +32,7 @@ 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,42 +102,8 @@ jobs:
|
|||||||
cd "$AUR_PACKAGE_DIR"
|
cd "$AUR_PACKAGE_DIR"
|
||||||
runuser -u builder -- makepkg --noconfirm --clean --cleanbuild
|
runuser -u builder -- makepkg --noconfirm --clean --cleanbuild
|
||||||
|
|
||||||
- name: Upload AUR package metadata
|
|
||||||
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
|
- name: Configure SSH
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }}
|
||||||
env:
|
env:
|
||||||
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
run: |
|
run: |
|
||||||
@@ -152,6 +118,7 @@ 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: |
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
name: Publish macOS appcast
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
channel:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
release_tag:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
archive_name:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
channel:
|
||||||
|
description: Update channel
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- stable
|
||||||
|
- snapshot
|
||||||
|
release_tag:
|
||||||
|
description: Release containing the macOS update archive
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
archive_name:
|
||||||
|
description: Exact ZIP asset name; leave empty when the release has one macOS update archive
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: macos-appcast-${{ inputs.channel }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: macos-15
|
||||||
|
environment: macos-release
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
env:
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
RELEASE_TAG: ${{ inputs.release_tag }}
|
||||||
|
CHANNEL: ${{ inputs.channel }}
|
||||||
|
REQUESTED_ARCHIVE: ${{ inputs.archive_name }}
|
||||||
|
SPARKLE_VERSION: 2.9.2
|
||||||
|
SPARKLE_ARCHIVE_SHA256: b83e37436774556ed055e0244b297ef2c790e0737393bf65bf495fcbba6eed65
|
||||||
|
steps:
|
||||||
|
- name: Validate inputs
|
||||||
|
env:
|
||||||
|
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ "$CHANNEL" != "stable" && "$CHANNEL" != "snapshot" ]]; then
|
||||||
|
echo "channel must be stable or snapshot" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$CHANNEL" == "snapshot" && "$RELEASE_TAG" != "snapshot" ]]; then
|
||||||
|
echo "The snapshot channel must publish to the snapshot release" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$CHANNEL" == "stable" && "$RELEASE_TAG" == "snapshot" ]]; then
|
||||||
|
echo "The stable channel cannot publish to the snapshot release" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ -z "$SPARKLE_PRIVATE_KEY" ]]; then
|
||||||
|
echo "SPARKLE_PRIVATE_KEY is not configured" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Prepare Sparkle tools
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
archive="$RUNNER_TEMP/Sparkle.zip"
|
||||||
|
curl --fail --location --silent --show-error \
|
||||||
|
"https://github.com/sparkle-project/Sparkle/releases/download/$SPARKLE_VERSION/Sparkle-for-Swift-Package-Manager.zip" \
|
||||||
|
--output "$archive"
|
||||||
|
echo "$SPARKLE_ARCHIVE_SHA256 $archive" | shasum -a 256 --check
|
||||||
|
ditto -x -k "$archive" "$RUNNER_TEMP/sparkle"
|
||||||
|
test -x "$RUNNER_TEMP/sparkle/bin/generate_appcast"
|
||||||
|
|
||||||
|
- name: Download update archive
|
||||||
|
id: archive
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
mkdir -p "$RUNNER_TEMP/updates"
|
||||||
|
archive_name="$REQUESTED_ARCHIVE"
|
||||||
|
if [[ -z "$archive_name" ]]; then
|
||||||
|
archives="$(gh release view "$RELEASE_TAG" --repo "$REPOSITORY" --json assets \
|
||||||
|
--jq '.assets[].name | select(test("^GPConnect_[0-9A-Za-z._-]+_arm64\\.zip$"))')"
|
||||||
|
archive_count="$(printf '%s\n' "$archives" | sed '/^$/d' | wc -l | tr -d ' ')"
|
||||||
|
if [[ "$archive_count" != "1" ]]; then
|
||||||
|
echo "Expected one macOS update archive on $RELEASE_TAG, found $archive_count" >&2
|
||||||
|
printf '%s\n' "$archives" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
archive_name="$archives"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! "$archive_name" =~ ^GPConnect_[0-9A-Za-z._-]+_arm64\.zip$ ]]; then
|
||||||
|
echo "Invalid macOS update archive name: $archive_name" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh release download "$RELEASE_TAG" --repo "$REPOSITORY" \
|
||||||
|
--pattern "$archive_name" --dir "$RUNNER_TEMP/updates"
|
||||||
|
echo "name=$archive_name" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "path=$RUNNER_TEMP/updates/$archive_name" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Verify update archive
|
||||||
|
id: bundle
|
||||||
|
env:
|
||||||
|
ARCHIVE_PATH: ${{ steps.archive.outputs.path }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
extract_dir="$RUNNER_TEMP/extracted"
|
||||||
|
ditto -x -k "$ARCHIVE_PATH" "$extract_dir"
|
||||||
|
app="$extract_dir/GP Connect.app"
|
||||||
|
test -d "$app"
|
||||||
|
codesign --verify --deep --strict --verbose=2 "$app"
|
||||||
|
|
||||||
|
signing_info="$(codesign -d --verbose=4 "$app" 2>&1)"
|
||||||
|
if [[ "$CHANNEL" == "stable" ]]; then
|
||||||
|
xcrun stapler validate "$app"
|
||||||
|
grep -q '^Authority=Developer ID Application:' <<<"$signing_info"
|
||||||
|
grep -q '^CodeDirectory .*flags=.*runtime' <<<"$signing_info"
|
||||||
|
else
|
||||||
|
grep -E -q '^Authority=(Apple Development|Developer ID Application):' \
|
||||||
|
<<<"$signing_info"
|
||||||
|
fi
|
||||||
|
team_identifier="$(sed -n 's/^TeamIdentifier=//p' <<<"$signing_info")"
|
||||||
|
if [[ -z "$team_identifier" || "$team_identifier" == "not set" ]]; then
|
||||||
|
echo "Signed application has no Team Identifier" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
identifier="$(sed -n 's/^Identifier=//p' <<<"$signing_info")"
|
||||||
|
if [[ "$identifier" != "com.yuezk.gpgui" ]]; then
|
||||||
|
echo "Unexpected bundle identifier: $identifier" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
file "$app/Contents/MacOS/gpgui" | grep -q 'arm64'
|
||||||
|
|
||||||
|
feed_url="$(plutil -extract SUFeedURL raw "$app/Contents/Info.plist")"
|
||||||
|
expected_feed="https://github.com/$REPOSITORY/releases/latest/download/appcast.xml"
|
||||||
|
if [[ "$CHANNEL" == "snapshot" ]]; then
|
||||||
|
expected_feed="https://github.com/$REPOSITORY/releases/download/snapshot/appcast.xml"
|
||||||
|
fi
|
||||||
|
if [[ "$feed_url" != "$expected_feed" ]]; then
|
||||||
|
echo "Unexpected Sparkle feed URL: $feed_url" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
bundle_version="$(plutil -extract CFBundleVersion raw "$app/Contents/Info.plist")"
|
||||||
|
short_version="$(plutil -extract CFBundleShortVersionString raw "$app/Contents/Info.plist")"
|
||||||
|
if [[ ! "$bundle_version" =~ ^[0-9]+(\.[0-9]+){0,2}$ ]]; then
|
||||||
|
echo "Invalid bundle version: $bundle_version" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "version=$bundle_version" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "short_version=$short_version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Prepare release notes
|
||||||
|
env:
|
||||||
|
ARCHIVE_NAME: ${{ steps.archive.outputs.name }}
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
notes="$RUNNER_TEMP/updates/${ARCHIVE_NAME%.zip}.md"
|
||||||
|
gh release view "$RELEASE_TAG" --repo "$REPOSITORY" --json body --jq '.body // ""' > "$notes"
|
||||||
|
if [[ ! -s "$notes" ]]; then
|
||||||
|
printf 'GP Connect %s\n' '${{ steps.bundle.outputs.short_version }}' > "$notes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Generate appcast
|
||||||
|
env:
|
||||||
|
ARCHIVE_NAME: ${{ steps.archive.outputs.name }}
|
||||||
|
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
embedded_public_key="$(plutil -extract SUPublicEDKey raw \
|
||||||
|
"$RUNNER_TEMP/extracted/GP Connect.app/Contents/Info.plist")"
|
||||||
|
derived_public_key="$(swift -e '
|
||||||
|
import Foundation
|
||||||
|
import CryptoKit
|
||||||
|
let encoded = ProcessInfo.processInfo.environment["SPARKLE_PRIVATE_KEY"]!
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
let privateKey = try Curve25519.Signing.PrivateKey(
|
||||||
|
rawRepresentation: Data(base64Encoded: encoded)!)
|
||||||
|
print(privateKey.publicKey.rawRepresentation.base64EncodedString())
|
||||||
|
')"
|
||||||
|
if [[ "$derived_public_key" != "$embedded_public_key" ]]; then
|
||||||
|
echo "Sparkle private key does not match the public key embedded in the application" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
download_prefix="https://github.com/$REPOSITORY/releases/download/$RELEASE_TAG/"
|
||||||
|
printf '%s' "$SPARKLE_PRIVATE_KEY" | \
|
||||||
|
"$RUNNER_TEMP/sparkle/bin/generate_appcast" \
|
||||||
|
--download-url-prefix "$download_prefix" \
|
||||||
|
--maximum-deltas 0 \
|
||||||
|
--embed-release-notes \
|
||||||
|
--ed-key-file - \
|
||||||
|
"$RUNNER_TEMP/updates"
|
||||||
|
|
||||||
|
appcast="$RUNNER_TEMP/updates/appcast.xml"
|
||||||
|
test -s "$appcast"
|
||||||
|
grep -Fq "sparkle:version>${{ steps.bundle.outputs.version }}<" "$appcast"
|
||||||
|
grep -Fq "sparkle:shortVersionString>${{ steps.bundle.outputs.short_version }}<" "$appcast"
|
||||||
|
grep -Fq "url=\"$download_prefix$ARCHIVE_NAME\"" "$appcast"
|
||||||
|
grep -q 'sparkle:edSignature=' "$appcast"
|
||||||
|
|
||||||
|
- name: Publish appcast
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
gh release upload "$RELEASE_TAG" "$RUNNER_TEMP/updates/appcast.xml" \
|
||||||
|
--repo "$REPOSITORY" --clobber
|
||||||
|
|
||||||
|
- name: Verify published appcast
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ "$CHANNEL" == "stable" ]]; then
|
||||||
|
feed_url="https://github.com/$REPOSITORY/releases/latest/download/appcast.xml"
|
||||||
|
else
|
||||||
|
feed_url="https://github.com/$REPOSITORY/releases/download/$RELEASE_TAG/appcast.xml"
|
||||||
|
fi
|
||||||
|
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
||||||
|
published_appcast="$(curl --fail --location --silent --show-error "$feed_url" || true)"
|
||||||
|
if grep -Fq "sparkle:version>${{ steps.bundle.outputs.version }}<" <<<"$published_appcast"; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
echo "Published appcast did not become available at $feed_url" >&2
|
||||||
|
exit 1
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
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 }}'
|
|
||||||
@@ -272,6 +272,13 @@ jobs:
|
|||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v8
|
||||||
with:
|
with:
|
||||||
path: gh-release
|
path: gh-release
|
||||||
|
- name: Generate release notes
|
||||||
|
id: release-notes
|
||||||
|
run: |
|
||||||
|
cd gh-release/gp
|
||||||
|
mkdir -p .build
|
||||||
|
scripts/release-notes.sh "${{ inputs.tag }}" > .build/release-notes.md
|
||||||
|
echo "path=$GITHUB_WORKSPACE/gh-release/gp/.build/release-notes.md" >> "$GITHUB_OUTPUT"
|
||||||
- name: Rename APK artifacts
|
- name: Rename APK artifacts
|
||||||
run: |
|
run: |
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
@@ -283,6 +290,7 @@ jobs:
|
|||||||
mv "$file" "${file%.apk}-aarch64.apk"
|
mv "$file" "${file%.apk}-aarch64.apk"
|
||||||
done
|
done
|
||||||
- name: Generate release asset checksums
|
- name: Generate release asset checksums
|
||||||
|
id: release-assets
|
||||||
run: |
|
run: |
|
||||||
cd gh-release/gp
|
cd gh-release/gp
|
||||||
mkdir -p .build
|
mkdir -p .build
|
||||||
@@ -295,20 +303,21 @@ jobs:
|
|||||||
digest=$(sha256sum "$file" | cut -d ' ' -f 1)
|
digest=$(sha256sum "$file" | cut -d ' ' -f 1)
|
||||||
printf '%s %s\n' "$digest" "$(basename "$file")"
|
printf '%s %s\n' "$digest" "$(basename "$file")"
|
||||||
done < .build/release-assets.txt > .build/release-assets.sha256
|
done < .build/release-assets.txt > .build/release-assets.sha256
|
||||||
|
{
|
||||||
|
echo 'files<<EOF'
|
||||||
|
cat .build/release-assets.txt
|
||||||
|
echo EOF
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
- name: Attest release assets
|
- name: Attest release assets
|
||||||
uses: actions/attest-build-provenance@v4
|
uses: actions/attest-build-provenance@v4
|
||||||
with:
|
with:
|
||||||
subject-checksums: gh-release/gp/.build/release-assets.sha256
|
subject-checksums: gh-release/gp/.build/release-assets.sha256
|
||||||
- name: Upload release assets
|
- name: Update release
|
||||||
env:
|
uses: softprops/action-gh-release@v1
|
||||||
GH_TOKEN: ${{ secrets.GH_PAT }}
|
with:
|
||||||
run: |
|
token: ${{ secrets.GH_PAT }}
|
||||||
mapfile -t files < gh-release/gp/.build/release-assets.txt
|
prerelease: ${{ contains(github.ref, 'snapshot') }}
|
||||||
if [[ "${{ inputs.tag }}" == "snapshot" ]]; then
|
fail_on_unmatched_files: true
|
||||||
for file in "${files[@]}"; do
|
tag_name: ${{ inputs.tag }}
|
||||||
gh release upload snapshot "$file" --clobber \
|
body_path: ${{ steps.release-notes.outputs.path }}
|
||||||
--repo yuezk/GlobalProtect-openconnect
|
files: ${{ steps.release-assets.outputs.files }}
|
||||||
done
|
|
||||||
else
|
|
||||||
gh-release/gp/scripts/upload-release-assets.sh "${{ inputs.tag }}" "${files[@]}"
|
|
||||||
fi
|
|
||||||
Generated
+10
-13
@@ -214,26 +214,24 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "auth"
|
name = "auth"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
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",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -417,7 +415,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "browser-launcher"
|
name = "browser-launcher"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"log",
|
"log",
|
||||||
@@ -712,7 +710,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "compile-time"
|
name = "compile-time"
|
||||||
@@ -1834,7 +1832,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpapi"
|
name = "gpapi"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -1882,7 +1880,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpauth"
|
name = "gpauth"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auth",
|
"auth",
|
||||||
@@ -1901,7 +1899,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpclient"
|
name = "gpclient"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"askama",
|
"askama",
|
||||||
@@ -1930,7 +1928,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpgui-helper"
|
name = "gpgui-helper"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1951,7 +1949,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpservice"
|
name = "gpservice"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -1966,7 +1964,6 @@ dependencies = [
|
|||||||
"openconnect",
|
"openconnect",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha256",
|
|
||||||
"tar",
|
"tar",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
@@ -3297,7 +3294,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openconnect"
|
name = "openconnect"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autotools",
|
"autotools",
|
||||||
"cc",
|
"cc",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
rust-version = "1.89"
|
rust-version = "1.89"
|
||||||
version = "2.6.5"
|
version = "2.6.4"
|
||||||
authors = ["Kevin Yue <[email protected]>"]
|
authors = ["Kevin Yue <[email protected]>"]
|
||||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ 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
|
||||||
@@ -250,10 +251,8 @@ 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 /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/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/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); \
|
||||||
@@ -261,7 +260,6 @@ 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" \
|
||||||
@@ -271,7 +269,6 @@ 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)"
|
||||||
|
|
||||||
@@ -292,6 +289,7 @@ 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
|
||||||
@@ -299,12 +297,10 @@ 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/gpgui \
|
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
|
||||||
$(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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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
|
||||||
@@ -324,19 +320,18 @@ init-debian: clean-debian tarball
|
|||||||
|
|
||||||
sed -i "s/@RUST_VERSION@/$(RUST_VERSION)/g" .build/deb/$(PKG)/debian/control
|
sed -i "s/@RUST_VERSION@/$(RUST_VERSION)/g" .build/deb/$(PKG)/debian/control
|
||||||
|
|
||||||
# Remove the GUI dependencies if neither GUI component is included
|
# Remove the GUI dependencies if BUILD_GUI_HELPER is set to 0
|
||||||
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
if [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
||||||
sed -i "/libsecret-1-0/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/libsecret-1-0/d" .build/deb/$(PKG)/debian/control; \
|
||||||
sed -i "/libayatana-appindicator3-1/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/libayatana-appindicator3-1/d" .build/deb/$(PKG)/debian/control; \
|
||||||
sed -i "/gnome-keyring/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/gnome-keyring/d" .build/deb/$(PKG)/debian/control; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove WebKitGTK only if no included component needs it
|
# Remove the WebKitGTK build dependency only if neither gpauth webview auth nor gpgui-helper needs it
|
||||||
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ] && [ $(BUILD_WEBVIEW_AUTH) -eq 0 ]; then \
|
if [ $(BUILD_GUI_HELPER) -eq 0 ] && [ $(BUILD_WEBVIEW_AUTH) -eq 0 ]; then \
|
||||||
sed -i "/libwebkit2gtk-4.1-dev/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/libwebkit2gtk-4.1-dev/d" .build/deb/$(PKG)/debian/control; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "s/@INCLUDE_GUI@/$(INCLUDE_GUI)/g" .build/deb/$(PKG)/debian/rules
|
|
||||||
sed -i "s/@BUILD_GUI_HELPER@/$(BUILD_GUI_HELPER)/g" .build/deb/$(PKG)/debian/rules
|
sed -i "s/@BUILD_GUI_HELPER@/$(BUILD_GUI_HELPER)/g" .build/deb/$(PKG)/debian/rules
|
||||||
sed -i "s/@BUILD_WEBVIEW_AUTH@/$(BUILD_WEBVIEW_AUTH)/g" .build/deb/$(PKG)/debian/rules
|
sed -i "s/@BUILD_WEBVIEW_AUTH@/$(BUILD_WEBVIEW_AUTH)/g" .build/deb/$(PKG)/debian/rules
|
||||||
sed -i "s/@RUST_VERSION@/$(RUST_VERSION)/g" .build/deb/$(PKG)/debian/rules
|
sed -i "s/@RUST_VERSION@/$(RUST_VERSION)/g" .build/deb/$(PKG)/debian/rules
|
||||||
@@ -438,17 +433,6 @@ init-apk: clean-apk tarball
|
|||||||
checksum=$$(sha512sum .build/apk/${PKG}.tar.gz | cut -d' ' -f1); \
|
checksum=$$(sha512sum .build/apk/${PKG}.tar.gz | cut -d' ' -f1); \
|
||||||
sed -i "s/@SHA512@/$$checksum/g" .build/apk/APKBUILD
|
sed -i "s/@SHA512@/$$checksum/g" .build/apk/APKBUILD
|
||||||
|
|
||||||
# Remove the GUI dependencies if neither GUI component is included
|
|
||||||
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
|
||||||
sed -i "/^\tlibayatana-appindicator$$/d" .build/apk/APKBUILD; \
|
|
||||||
sed -i "/^\tlibsecret$$/d" .build/apk/APKBUILD; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove WebKitGTK only if no included component needs it
|
|
||||||
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ] && [ $(BUILD_WEBVIEW_AUTH) -eq 0 ]; then \
|
|
||||||
sed -i "/^\twebkit2gtk-4.1$$/d" .build/apk/APKBUILD; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
apk: init-apk
|
apk: init-apk
|
||||||
cd .build/apk && abuild -r -P "$(CURDIR)/.build/apk/packages"
|
cd .build/apk && abuild -r -P "$(CURDIR)/.build/apk/packages"
|
||||||
|
|
||||||
|
|||||||
@@ -56,16 +56,12 @@ 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 Uses extended compatibility mode for OpenSSL operations to support a broader range of systems and formats.
|
--fix-openssl Get around the OpenSSL 'unsafe legacy renegotiation' error
|
||||||
--ignore-tls-errors Ignore the TLS errors
|
--ignore-tls-errors Ignore TLS errors
|
||||||
--log-format <LOG_FORMAT> Log output format. JSON is intended for non-interactive consumers; interactive prompts remain text. [default: text] [possible values: text, json]
|
-h, --help Print help
|
||||||
-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
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -317,12 +313,6 @@ 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
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
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(())
|
|
||||||
}
|
|
||||||
+9
-112
@@ -1,22 +1,16 @@
|
|||||||
#[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!(
|
||||||
@@ -33,8 +27,6 @@ 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}
|
||||||
@@ -49,12 +41,8 @@ See 'gpauth -h' for more information.
|
|||||||
"
|
"
|
||||||
)]
|
)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
#[arg(help = "The portal server to authenticate")]
|
||||||
#[command(subcommand)]
|
server: String,
|
||||||
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,
|
||||||
@@ -90,29 +78,18 @@ 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 or `remote` for headless servers.",
|
help = "Use external browser authentication. With no value, auto-select Chrome, Firefox, then system default. Use `default` for the system default browser.",
|
||||||
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,
|
||||||
@@ -133,16 +110,6 @@ 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
|
||||||
@@ -151,10 +118,6 @@ 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 {
|
||||||
@@ -173,19 +136,13 @@ 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.as_deref().expect("server is required for authentication"))?;
|
let server = normalize_server(&self.server)?;
|
||||||
let gp_params = self.build_gp_params();
|
let gp_params = self.build_gp_params();
|
||||||
info!(
|
info!(
|
||||||
"gpauth auth host-id: {}",
|
"gpauth auth host-id: {}",
|
||||||
@@ -208,7 +165,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, self.browser_listen);
|
let authenticator = BrowserAuthenticator::new(&auth_request, browser);
|
||||||
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));
|
||||||
@@ -268,26 +225,16 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn init_logger(cli: &Cli) {
|
fn init_logger(cli: &Cli) {
|
||||||
let Some(level) = cli.verbose.log_level_filter().to_level() else {
|
if let Some(level) = cli.verbose.log_level_filter().to_level() {
|
||||||
|
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);
|
||||||
|
|
||||||
@@ -317,24 +264,6 @@ 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");
|
||||||
@@ -342,23 +271,6 @@ 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"])
|
||||||
@@ -393,21 +305,6 @@ 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"])
|
||||||
|
|||||||
@@ -2,34 +2,10 @@
|
|||||||
|
|
||||||
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"))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
pub fn get() -> tauri::Context<tauri::Wry> {
|
|
||||||
tauri::generate_context!()
|
|
||||||
}
|
|
||||||
@@ -19,9 +19,6 @@ 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();
|
||||||
|
|
||||||
@@ -42,7 +39,7 @@ pub async fn authenticate(
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.build(crate::tauri_context::get())?
|
.build(tauri::generate_context!())?
|
||||||
.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() {
|
||||||
|
|||||||
+15
-168
@@ -1,4 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
|
env::temp_dir,
|
||||||
|
fs::File,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
@@ -7,7 +9,6 @@ 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;
|
||||||
@@ -37,7 +38,6 @@ 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,14 +89,6 @@ 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,
|
||||||
}
|
}
|
||||||
@@ -109,21 +101,9 @@ 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;
|
||||||
@@ -154,7 +134,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 !self.can_run_alongside_client() && self.is_running().await {
|
if !matches!(self.command, CliCommand::Disconnect(_)) && self.is_running().await {
|
||||||
bail!("Another instance of the client is already running");
|
bail!("Another instance of the client is already running");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +146,6 @@ 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 {
|
||||||
@@ -182,23 +161,28 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_logger(cli: &Cli) -> env_logger::Builder {
|
fn init_logger(cli: &Cli) {
|
||||||
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());
|
||||||
|
|
||||||
// Text is env_logger's own format, so leave it untouched rather than
|
// Output the log messages to a file if the command is the auth callback
|
||||||
// reimplementing it.
|
if let CliCommand::LaunchGui(args) = &cli.command {
|
||||||
if cli.log_format == LogFormat::Json {
|
let auth_data = args.auth_data.as_deref().unwrap_or_default();
|
||||||
builder.format(write_json_record);
|
if !auth_data.is_empty()
|
||||||
|
&& 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
|
builder.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn run() {
|
pub(crate) async fn run() {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
build_logger(&cli).init();
|
init_logger(&cli);
|
||||||
|
|
||||||
info!("gpclient started: {}", VERSION);
|
info!("gpclient started: {}", VERSION);
|
||||||
|
|
||||||
@@ -210,13 +194,6 @@ 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]
|
||||||
@@ -239,134 +216,4 @@ 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:?}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ use gpapi::{
|
|||||||
os_profile::{ClientOs, OsProfile},
|
os_profile::{ClientOs, OsProfile},
|
||||||
};
|
};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use std::{net::IpAddr, path::PathBuf};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
pub(crate) struct ConnectArgs {
|
pub(crate) struct ConnectArgs {
|
||||||
@@ -146,9 +146,6 @@ 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 {
|
||||||
@@ -266,23 +263,6 @@ 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;
|
||||||
|
|||||||
@@ -85,8 +85,6 @@ 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")]
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ 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},
|
||||||
@@ -19,7 +18,7 @@ use gpapi::{
|
|||||||
utils::shutdown_signal,
|
utils::shutdown_signal,
|
||||||
};
|
};
|
||||||
use inquire::Text;
|
use inquire::Text;
|
||||||
use log::{Level, info, warn};
|
use log::{info, warn};
|
||||||
use openconnect::{Vpn, VpnBuilder};
|
use openconnect::{Vpn, VpnBuilder};
|
||||||
use tokio::{runtime::Handle, task::JoinHandle};
|
use tokio::{runtime::Handle, task::JoinHandle};
|
||||||
|
|
||||||
@@ -282,22 +281,9 @@ impl ConnectHandler<'_> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let format = self.shared_args.log_format;
|
eprintln!("\nNOTE: Gateway authentication failed after portal login.");
|
||||||
report(
|
eprintln!("NOTE: If this server also accepts direct gateway login, try:");
|
||||||
format,
|
eprintln!("NOTE: {}", direct_gateway_command(gateway));
|
||||||
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(
|
||||||
@@ -400,7 +386,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);
|
||||||
@@ -411,7 +397,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, log_format);
|
let task = spawn_session_runtime_with_info(&runtime_handle, session_ctx, session_info);
|
||||||
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);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ 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,
|
||||||
@@ -15,7 +14,7 @@ use gpapi::{
|
|||||||
utils::request::RequestIdentityError,
|
utils::request::RequestIdentityError,
|
||||||
};
|
};
|
||||||
use inquire::{Password, PasswordDisplayMode, Select};
|
use inquire::{Password, PasswordDisplayMode, Select};
|
||||||
use log::{Level, info, warn};
|
use log::{info, warn};
|
||||||
|
|
||||||
use crate::cli::SharedArgs;
|
use crate::cli::SharedArgs;
|
||||||
|
|
||||||
@@ -93,12 +92,6 @@ 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");
|
||||||
@@ -117,17 +110,8 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
|
|
||||||
match root_cause {
|
match root_cause {
|
||||||
RequestIdentityError::NoKey => {
|
RequestIdentityError::NoKey => {
|
||||||
let format = self.shared_args.log_format;
|
eprintln!("ERROR: No private key found in the certificate file");
|
||||||
report(
|
eprintln!("ERROR: Please provide the private key file using the `-k` option");
|
||||||
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) => {
|
||||||
@@ -169,17 +153,8 @@ 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?;
|
||||||
|
|
||||||
let format = self.shared_args.log_format;
|
eprintln!("\nNOTE: the server may be a gateway, not a portal.");
|
||||||
report(
|
eprintln!("NOTE: try to use the `--as-gateway` option if you were authenticated twice.");
|
||||||
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 {
|
||||||
|
|||||||
@@ -1,48 +1,26 @@
|
|||||||
use std::{collections::HashMap, fs, path::PathBuf};
|
use std::{collections::HashMap, env::temp_dir, 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;
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
|
use common::constants::GP_CALLBACK_PORT_FILENAME;
|
||||||
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,
|
||||||
conflicts_with = "minimized",
|
help = "The authentication data, used for the default browser authentication"
|
||||||
value_parser = parse_auth_callback,
|
|
||||||
help = "The external-browser authentication callback URL"
|
|
||||||
)]
|
)]
|
||||||
callback: Option<String>,
|
pub auth_data: 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,
|
||||||
}
|
}
|
||||||
@@ -59,9 +37,11 @@ impl<'a> LaunchGuiHandler<'a> {
|
|||||||
anyhow::bail!("`launch-gui` cannot be run as root");
|
anyhow::bail!("`launch-gui` cannot be run as root");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
let auth_data = self.args.auth_data.as_deref().unwrap_or_default();
|
||||||
if let Some(callback) = &self.args.callback {
|
if !auth_data.is_empty() {
|
||||||
return forward_auth_callback(callback);
|
info!("Received auth callback data");
|
||||||
|
// 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() {
|
||||||
@@ -100,36 +80,24 @@ impl<'a> LaunchGuiHandler<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
async fn feed_auth_data(auth_data: &str) -> anyhow::Result<()> {
|
||||||
fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
|
if let Err(err) = feed_auth_data_cli(auth_data).await {
|
||||||
let status = auth_callback_command(callback)
|
info!("Failed to feed auth data to the CLI: {}", err);
|
||||||
.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(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
|
async fn feed_auth_data_cli(auth_data: &str) -> anyhow::Result<()> {
|
||||||
fn parse_auth_callback(callback: &str) -> Result<String, String> {
|
info!("Feeding auth data to the CLI");
|
||||||
callback
|
|
||||||
.starts_with("globalprotectcallback:")
|
let port_file = temp_dir().join(GP_CALLBACK_PORT_FILENAME);
|
||||||
.then(|| callback.to_owned())
|
let port = tokio::fs::read_to_string(port_file).await?;
|
||||||
.ok_or_else(|| "callback URL must use the globalprotectcallback scheme".to_owned())
|
let mut stream = tokio::net::TcpStream::connect(format!("127.0.0.1:{}", port.trim())).await?;
|
||||||
|
|
||||||
|
stream.write_all(auth_data.as_bytes()).await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn try_active_gui() -> anyhow::Result<()> {
|
async fn try_active_gui() -> anyhow::Result<()> {
|
||||||
@@ -152,34 +120,3 @@ 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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
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::{Level, info, warn};
|
use log::{info, warn};
|
||||||
use openconnect::VpnSessionInfo;
|
use openconnect::VpnSessionInfo;
|
||||||
use tokio::{runtime::Handle, task::JoinHandle};
|
use tokio::{runtime::Handle, task::JoinHandle};
|
||||||
|
|
||||||
@@ -61,12 +59,11 @@ 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, log_format))
|
handle.spawn(run_session_runtime(session_ctx, session_info))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run_session_runtime(session_ctx: SessionContext, mut session_info: SessionInfo, log_format: LogFormat) {
|
async fn run_session_runtime(session_ctx: SessionContext, mut session_info: SessionInfo) {
|
||||||
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");
|
||||||
@@ -75,7 +72,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;
|
||||||
|
|
||||||
report(log_format, Level::Warn, &format!("\nWARNING: {}", schedule.message));
|
eprintln!("\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");
|
||||||
@@ -90,16 +87,12 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
report(log_format, Level::Info, "Session extended.");
|
eprintln!("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);
|
||||||
report(
|
eprintln!("WARNING: Failed to extend session: {}", err);
|
||||||
log_format,
|
|
||||||
Level::Warn,
|
|
||||||
&format!("WARNING: Failed to extend session: {}", err),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
html,body,#root{-webkit-user-select:none;user-select:none;cursor:default;height:100%;margin:0;padding:0}
|
||||||
@@ -1 +0,0 @@
|
|||||||
html,body,#root{box-sizing:border-box;-webkit-user-select:none;user-select:none;cursor:default;height:100%;margin:0;padding:0;overflow:hidden}body{color:#2e3436;background:#f6f5f4;font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}button{font:inherit}.update-window{box-sizing:border-box;background:#f6f5f4;align-items:center;gap:15px;width:100%;height:100%;padding:16px 18px;display:flex}.update-logo{flex:none;width:48px;height:48px}.update-content,.update-status{width:100%;min-width:0}.update-title{color:#2e3436;letter-spacing:-.01em;margin:0;font-size:16px;font-weight:600;line-height:1.25}.update-description{color:#5e5c64;margin:3px 0 0;font-size:12px;line-height:1.4}.progress-summary{justify-content:space-between;align-items:baseline;gap:12px;margin-top:3px;display:flex}.progress-summary .update-description{margin:0}.progress-bar{background-color:#d5d3d1;border-radius:3px;width:100%;height:6px;margin-top:9px;position:relative;overflow:hidden}.progress-fill{background:#3584e4;border-radius:3px;height:100%;transition:width .18s ease-out}.progress-bar-indeterminate .progress-fill{width:35%;animation:1.4s ease-in-out infinite progress-indeterminate}@keyframes progress-indeterminate{0%{transform:translate(-110%)}to{transform:translate(300%)}}@media (prefers-reduced-motion:reduce){.progress-fill{transition:none}.progress-bar-indeterminate .progress-fill{animation:none;transform:translate(90%)}}.progress-label{color:#3d3846;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;flex:none;font-size:12px;font-weight:500}.error-status{justify-content:space-between;align-items:center;gap:16px;display:flex}.error-status .update-title{color:#9c2f2f}.error-copy{min-width:0}.retry-button{color:#fff;cursor:pointer;background:#1c71d8;border:0;border-radius:8px;min-width:68px;padding:4px 14px;font-size:12px;font-weight:600;line-height:1.5}.retry-button:hover{background:#1a5fb4}.retry-button:active{background:#174a8b}.retry-button:focus-visible{outline-offset:2px;outline:2px solid #1a5fb4}
|
|
||||||
+168
@@ -0,0 +1,168 @@
|
|||||||
|
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
|
||||||
Vendored
+3
-3
@@ -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>GPGUI Downloader</title>
|
<title>GP Connect Helper</title>
|
||||||
<script type="module" crossorigin src="/assets/main-BD0fDtWU.js"></script>
|
<script type="module" crossorigin src="/assets/main-yAo_rN_V.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/main-DiWGniCh.css">
|
<link rel="stylesheet" crossorigin href="/assets/main-C5muOSVO.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -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>GPGUI Downloader</title>
|
<title>GP Connect Helper</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
"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"
|
||||||
|
|||||||
Generated
+498
@@ -8,6 +8,18 @@ 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
|
||||||
@@ -118,6 +130,10 @@ 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'}
|
||||||
@@ -139,6 +155,60 @@ 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'}
|
||||||
@@ -369,6 +439,97 @@ 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:
|
||||||
@@ -378,6 +539,9 @@ 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}
|
||||||
@@ -556,11 +720,22 @@ 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==}
|
||||||
|
|
||||||
@@ -692,6 +867,10 @@ 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==}
|
||||||
|
|
||||||
@@ -739,6 +918,10 @@ 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'}
|
||||||
@@ -749,9 +932,16 @@ 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'}
|
||||||
@@ -799,6 +989,9 @@ 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'}
|
||||||
@@ -806,6 +999,9 @@ 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'}
|
||||||
@@ -941,6 +1137,9 @@ 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'}
|
||||||
@@ -1040,6 +1239,9 @@ 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'}
|
||||||
@@ -1064,6 +1266,9 @@ 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'}
|
||||||
@@ -1185,6 +1390,9 @@ 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==}
|
||||||
|
|
||||||
@@ -1277,6 +1485,9 @@ 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'}
|
||||||
@@ -1369,6 +1580,10 @@ 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'}
|
||||||
@@ -1380,6 +1595,10 @@ 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==}
|
||||||
|
|
||||||
@@ -1419,6 +1638,15 @@ 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'}
|
||||||
@@ -1435,6 +1663,11 @@ 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'}
|
||||||
@@ -1509,6 +1742,10 @@ 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'}
|
||||||
@@ -1536,6 +1773,9 @@ 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'}
|
||||||
@@ -1669,6 +1909,10 @@ 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'}
|
||||||
@@ -1761,6 +2005,8 @@ 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
|
||||||
@@ -1800,6 +2046,89 @@ 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
|
||||||
|
|
||||||
@@ -1959,6 +2288,93 @@ 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
|
||||||
@@ -1968,6 +2384,8 @@ snapshots:
|
|||||||
|
|
||||||
'@oxc-project/[email protected]': {}
|
'@oxc-project/[email protected]': {}
|
||||||
|
|
||||||
|
'@popperjs/[email protected]': {}
|
||||||
|
|
||||||
'@rolldown/[email protected]':
|
'@rolldown/[email protected]':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -2081,10 +2499,18 @@ 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
|
||||||
@@ -2267,6 +2693,12 @@ 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]: {}
|
||||||
@@ -2316,6 +2748,8 @@ 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
|
||||||
@@ -2324,8 +2758,18 @@ 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
|
||||||
@@ -2376,6 +2820,11 @@ 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
|
||||||
@@ -2384,6 +2833,10 @@ 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
|
||||||
@@ -2647,6 +3100,8 @@ 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
|
||||||
@@ -2751,6 +3206,10 @@ 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]: {}
|
||||||
@@ -2774,6 +3233,8 @@ 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
|
||||||
@@ -2901,6 +3362,8 @@ snapshots:
|
|||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
|
[email protected]: {}
|
||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
@@ -2972,6 +3435,8 @@ 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
|
||||||
@@ -3074,12 +3539,21 @@ 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]: {}
|
||||||
@@ -3111,6 +3585,17 @@ 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]:
|
||||||
@@ -3135,6 +3620,13 @@ 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
|
||||||
@@ -3248,6 +3740,8 @@ snapshots:
|
|||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
|
[email protected]: {}
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
dependencies:
|
dependencies:
|
||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
@@ -3300,6 +3794,8 @@ snapshots:
|
|||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
|
[email protected]: {}
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
dependencies:
|
dependencies:
|
||||||
has-flag: 4.0.0
|
has-flag: 4.0.0
|
||||||
@@ -3437,6 +3933,8 @@ snapshots:
|
|||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
|
[email protected]: {}
|
||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
[email protected]([email protected]):
|
[email protected]([email protected]):
|
||||||
|
|||||||
@@ -41,22 +41,6 @@ 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,
|
||||||
}
|
}
|
||||||
@@ -382,10 +366,10 @@ impl GuiUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update(&self) {
|
pub async fn update(&self) {
|
||||||
let Some(asset_name) = gui_asset_name() else {
|
if !cfg!(any(target_arch = "x86_64", target_arch = "aarch64")) {
|
||||||
info!("GUI updates are not supported on this platform.");
|
info!("GUI version is not supported on this architecture.");
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
info!("Update GUI, version: {}", self.version);
|
info!("Update GUI, version: {}", self.version);
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
@@ -397,8 +381,16 @@ impl GuiUpdater {
|
|||||||
format!("v{}", self.version)
|
format!("v{}", self.version)
|
||||||
};
|
};
|
||||||
|
|
||||||
let file_url =
|
let arch = if cfg!(target_arch = "x86_64") {
|
||||||
format!("https://github.com/yuezk/GlobalProtect-openconnect/releases/download/{release_tag}/{asset_name}");
|
"x86_64"
|
||||||
|
} 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);
|
||||||
@@ -502,27 +494,6 @@ 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());
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
},
|
},
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "GPGUI Downloader",
|
"title": "GP Connect Helper",
|
||||||
"center": true,
|
"center": true,
|
||||||
"resizable": true,
|
"resizable": true,
|
||||||
"width": 460,
|
"width": 500,
|
||||||
"height": 104,
|
"height": 100,
|
||||||
"minWidth": 460,
|
"minWidth": 500,
|
||||||
"minHeight": 104,
|
"minHeight": 100,
|
||||||
"maxWidth": 460,
|
"maxWidth": 500,
|
||||||
"maxHeight": 104,
|
"maxHeight": 100,
|
||||||
"label": "main",
|
"label": "main",
|
||||||
"decorations": false
|
"decorations": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
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";
|
||||||
@@ -6,112 +7,129 @@ import "./styles.css";
|
|||||||
|
|
||||||
const appWindow = getCurrentWindow();
|
const appWindow = getCurrentWindow();
|
||||||
|
|
||||||
export default function App() {
|
function useUpdateProgress() {
|
||||||
const [error, setError] = useState(false);
|
|
||||||
const [progress, setProgress] = useState<number | null>(null);
|
const [progress, setProgress] = useState<number | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const unlisteners: Array<() => void> = [];
|
const unlisten = appWindow.listen("app://update-progress", (event) => {
|
||||||
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 () => {
|
||||||
disposed = true;
|
unlisten.then((unlisten) => unlisten());
|
||||||
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>
|
<>
|
||||||
<img src={logo} alt="" className="update-logo" data-tauri-drag-region />
|
<CssBaseline />
|
||||||
<div className="update-content" data-tauri-drag-region>
|
<Box
|
||||||
{error ? (
|
sx={{ position: "absolute", inset: 0 }}
|
||||||
<DownloadFailed onRetry={handleRetry} />
|
display="flex"
|
||||||
) : (
|
alignItems="center"
|
||||||
<DownloadIndicator progress={progress} />
|
px={2}
|
||||||
)}
|
data-tauri-drag-region
|
||||||
</div>
|
>
|
||||||
</div>
|
<Box display="flex" alignItems="center" flex="1" data-tauri-drag-region>
|
||||||
|
<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({ progress }: { progress: number | null }) {
|
function DownloadIndicator() {
|
||||||
|
const progress = useUpdateProgress();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="update-status" data-tauri-drag-region>
|
<>
|
||||||
<h1 className="update-title" data-tauri-drag-region>
|
<Typography variant="h1" fontSize="1rem" data-tauri-drag-region>
|
||||||
Getting GP Connect ready
|
Updating the GUI components...
|
||||||
</h1>
|
</Typography>
|
||||||
<DownloadProgress value={progress} />
|
<Box mt={1}>
|
||||||
</div>
|
<LinearProgressWithLabel value={progress} />
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DownloadFailed({ onRetry }: { onRetry: () => void }) {
|
function DownloadFailed({ onRetry }: { onRetry: () => void }) {
|
||||||
return (
|
|
||||||
<div className="update-status error-status" data-tauri-drag-region>
|
|
||||||
<div className="error-copy" role="alert" data-tauri-drag-region>
|
|
||||||
<h1 className="update-title" data-tauri-drag-region>
|
|
||||||
Couldn’t get GP Connect ready
|
|
||||||
</h1>
|
|
||||||
<p className="update-description" data-tauri-drag-region>
|
|
||||||
Please try again.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button type="button" onClick={onRetry} className="retry-button">
|
|
||||||
Retry
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function DownloadProgress({ value }: { value: number | null }) {
|
|
||||||
const isDeterminate = value !== null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="progress-summary" data-tauri-drag-region>
|
<Typography variant="h1" fontSize="1rem" data-tauri-drag-region>
|
||||||
<p className="update-description" data-tauri-drag-region>
|
Failed to update the GUI components.
|
||||||
This should only take a moment.
|
</Typography>
|
||||||
</p>
|
<Box mt={1} data-tauri-drag-region>
|
||||||
<span className="progress-label" aria-hidden="true">
|
<Button
|
||||||
{isDeterminate ? `${Math.round(value)}%` : "In progress"}
|
variant="contained"
|
||||||
</span>
|
color="primary"
|
||||||
</div>
|
size="small"
|
||||||
<div
|
onClick={onRetry}
|
||||||
className={`progress-bar${isDeterminate ? "" : " progress-bar-indeterminate"}`}
|
sx={{
|
||||||
role="progressbar"
|
textTransform: "none",
|
||||||
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} />
|
Retry
|
||||||
</div>
|
</Button>
|
||||||
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,173 +1,10 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
@@ -31,4 +31,3 @@ nix = { version = "0.31", features = ["fs", "socket", "user"] }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio-tungstenite = "0.29"
|
tokio-tungstenite = "0.29"
|
||||||
sha256.workspace = true
|
|
||||||
@@ -160,10 +160,7 @@ enum GuiInstallError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
|
fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
|
||||||
install_gui_at(Path::new(src), checksum, &binary_paths::gpgui_update_target())
|
let target = binary_paths::gpgui();
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
||||||
@@ -171,7 +168,7 @@ fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiIn
|
|||||||
};
|
};
|
||||||
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(src, dir)?;
|
let staged_archive = stage_gui_archive(Path::new(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)?;
|
||||||
|
|
||||||
@@ -263,7 +260,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, os::unix::fs::PermissionsExt};
|
use std::io::Cursor;
|
||||||
|
|
||||||
use gpapi::{
|
use gpapi::{
|
||||||
gateway::Gateway,
|
gateway::Gateway,
|
||||||
@@ -273,7 +270,6 @@ mod tests {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
use tar::{Builder, EntryType, Header};
|
use tar::{Builder, EntryType, Header};
|
||||||
use xz2::write::XzEncoder;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -292,17 +288,6 @@ 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();
|
||||||
@@ -352,31 +337,6 @@ 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);
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 2.6.5
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
- Fixed duplicate tray icons caused by both Tauri configuration and application code creating a tray icon (fix [#464](https://github.com/yuezk/GlobalProtect-openconnect/issues/464)).
|
|
||||||
- Fixed a potential crash when VPN progress messages contain printf-style format specifiers.
|
|
||||||
|
|
||||||
## 2.6.4
|
## 2.6.4
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
+2
-11
@@ -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, features = ["io-util", "net", "time"] }
|
tokio.workspace = true
|
||||||
|
|
||||||
# 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,7 +33,6 @@ 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 }
|
||||||
|
|
||||||
@@ -42,11 +41,6 @@ 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",
|
||||||
@@ -61,6 +55,3 @@ 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
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{io::Cursor, net::SocketAddr};
|
use std::io::Cursor;
|
||||||
|
|
||||||
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: SocketAddr) -> anyhow::Result<Self> {
|
pub fn new(addr: &str) -> 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();
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +1,29 @@
|
|||||||
use std::net::{IpAddr, SocketAddr};
|
use std::{env::temp_dir, fs, os::unix::fs::PermissionsExt};
|
||||||
|
|
||||||
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::net::UdpSocket;
|
use tokio::{
|
||||||
|
io::AsyncReadExt,
|
||||||
|
net::{TcpListener, UdpSocket},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{AuthCallbackReceiver, browser::auth_server::AuthServer, ensure_auth_callback_handler};
|
use crate::browser::auth_server::AuthServer;
|
||||||
|
|
||||||
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, browser_listen: Option<IpAddr>) -> Self {
|
pub fn new(auth_request: &'a str, browser: &'a str) -> Self {
|
||||||
Self {
|
Self { auth_request, browser }
|
||||||
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();
|
||||||
@@ -61,18 +54,15 @@ 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");
|
||||||
callback_receiver.unwrap().receive().await
|
wait_auth_data().await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn determine_addr(&self) -> anyhow::Result<SocketAddr> {
|
async fn determine_addr(&self) -> anyhow::Result<String> {
|
||||||
if is_remote_browser(self.browser) {
|
if is_remote_browser(self.browser) {
|
||||||
let local_ip = match self.browser_listen {
|
let local_ip = detect_local_ip().await?;
|
||||||
Some(ip) => ip,
|
Ok(format!("{}:0", local_ip))
|
||||||
None => detect_local_ip().await?,
|
|
||||||
};
|
|
||||||
Ok(SocketAddr::new(local_ip, 0))
|
|
||||||
} else {
|
} else {
|
||||||
Ok(SocketAddr::from(([127, 0, 0, 1], 0)))
|
Ok("127.0.0.1:0".to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,16 +72,48 @@ 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<IpAddr> {
|
async fn detect_local_ip() -> anyhow::Result<String> {
|
||||||
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();
|
let ip = local_addr.ip().to_string();
|
||||||
info!("Determined local IP address: {}", ip);
|
info!("Determined local IP address: {}", ip);
|
||||||
|
|
||||||
Ok(ip)
|
Ok(ip.to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
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> {
|
||||||
@@ -118,15 +140,4 @@ 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)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,512 +0,0 @@
|
|||||||
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(¤t_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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
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())
|
|
||||||
}
|
|
||||||
@@ -7,15 +7,9 @@ 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")]
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
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,
|
||||||
@@ -10,8 +8,6 @@ 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},
|
||||||
@@ -158,9 +154,6 @@ 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?;
|
||||||
@@ -325,14 +318,6 @@ 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();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
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;
|
||||||
@@ -12,56 +11,11 @@ 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)]
|
||||||
@@ -74,25 +28,20 @@ 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 => open_resolved_browser(url, find_chrome_browser(), "Chrome is not available."),
|
Browser::Chrome => {
|
||||||
Browser::Edge => open_resolved_browser(url, find_edge_browser(), "Edge is not available."),
|
let browser = find_chrome_browser().unwrap_or_else(|| browser.as_str().to_string());
|
||||||
Browser::Firefox => open_resolved_browser(url, find_firefox_browser(), "Firefox is not available."),
|
open_with_browser(url, &browser)
|
||||||
Browser::Safari => open_resolved_browser(url, find_program(browser.as_str()), "Safari is not available."),
|
}
|
||||||
Browser::Other(browser) => open_resolved_browser(
|
Browser::Edge => {
|
||||||
url,
|
let browser = find_edge_browser().unwrap_or_else(|| browser.as_str().to_string());
|
||||||
find_program(browser.trim()),
|
open_with_browser(url, &browser)
|
||||||
"Configured browser is not available.",
|
}
|
||||||
),
|
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<()> {
|
||||||
@@ -197,28 +146,7 @@ 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::ProgramsOrFlatpak {
|
"org.mozilla.firefox.desktop" => Some(LauncherSpec::Flatpak("org.mozilla.firefox")),
|
||||||
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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,62 +154,20 @@ 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) => find_flatpak_browser(app_id),
|
LauncherSpec::Flatpak(app_id) => {
|
||||||
LauncherSpec::ProgramsOrFlatpak { programs, app_id } => find_programs(programs)
|
find_program("flatpak").map(|executable| BrowserLauncher::Flatpak { executable, app_id })
|
||||||
.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()
|
find_auto_browser().map(BrowserLauncher::Executable)
|
||||||
.map(BrowserLauncher::Executable)
|
|
||||||
.or_else(find_auto_flatpak_browser)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_auto_browser() -> Option<String> {
|
fn find_auto_browser() -> Option<String> {
|
||||||
AUTO_BROWSER_PROGRAMS
|
find_chrome_browser()
|
||||||
.iter()
|
.or_else(find_edge_browser)
|
||||||
.find_map(|programs| find_programs(programs))
|
.or_else(find_firefox_browser)
|
||||||
}
|
|
||||||
|
|
||||||
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> {
|
||||||
@@ -311,10 +197,15 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn auto_candidates_use_the_expected_order() {
|
fn auto_candidates_try_chrome_then_edge_then_firefox() {
|
||||||
let candidates = AUTO_BROWSER_PROGRAMS
|
let candidates = GOOGLE_CHROME_BROWSERS
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|programs| programs.iter())
|
.chain(CHROMIUM_BROWSERS)
|
||||||
|
.chain(EDGE_BROWSERS)
|
||||||
|
.chain(EDGE_BETA_BROWSERS)
|
||||||
|
.chain(EDGE_DEV_BROWSERS)
|
||||||
|
.chain(FIREFOX_BROWSERS)
|
||||||
|
.chain(FIREFOX_ESR_BROWSERS)
|
||||||
.copied()
|
.copied()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
@@ -331,32 +222,6 @@ 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",
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -388,46 +253,7 @@ mod tests {
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
"org.mozilla.firefox.desktop",
|
"org.mozilla.firefox.desktop",
|
||||||
LauncherSpec::ProgramsOrFlatpak {
|
LauncherSpec::Flatpak("org.mozilla.firefox"),
|
||||||
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",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -440,24 +266,4 @@ 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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,6 @@ 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};
|
||||||
@@ -37,24 +32,6 @@ 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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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"))]
|
||||||
@@ -48,8 +49,6 @@ 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")))]
|
||||||
@@ -71,8 +70,6 @@ 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"))
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ 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))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@@ -162,7 +163,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: {}", e);
|
warn!("Failed to decode SAML auth data: {}, data: {}", e, data);
|
||||||
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)?;
|
||||||
|
|||||||
+18
-250
@@ -1,139 +1,33 @@
|
|||||||
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::{
|
use crate::error::PortalError;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Suggestions for re-running the command, for failures that have a known
|
|
||||||
/// 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 {
|
|
||||||
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() {
|
|
||||||
let (program, rest) = command_line();
|
|
||||||
hints.push(format!(
|
|
||||||
"Re-run it with the `--fix-openssl` option to work around this issue, e.g.:\n\n{program} --fix-openssl {rest}"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if err.is_tls_error() && !args.ignore_tls_errors() {
|
|
||||||
let (program, rest) = command_line();
|
|
||||||
hints.push(format!(
|
|
||||||
"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) {
|
pub fn handle_error(err: anyhow::Error, args: &impl Args) {
|
||||||
// Nothing useful to do if stderr itself is gone.
|
eprintln!("\nError: {:?}", err);
|
||||||
let _ = handle_error_to(&mut io::stderr().lock(), err, args);
|
|
||||||
|
let Some(err) = err.downcast_ref::<PortalError>() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 args = std::env::args().collect::<Vec<_>>();
|
||||||
|
eprintln!("{} --fix-openssl {}\n", args[0], args[1..].join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
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 args = std::env::args().collect::<Vec<_>>();
|
||||||
|
eprintln!("{} --ignore-tls-errors {}\n", args[0], args[1..].join(" "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -185,129 +79,3 @@ 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:?}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ 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;
|
||||||
|
|||||||
@@ -1,164 +0,0 @@
|
|||||||
//! 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,17 +4,15 @@ 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, log_format: LogFormat) {
|
pub fn init(level: Level, subsystem: &str, category: &str) {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
if log_format == LogFormat::Text && macos_unified_log_enabled() {
|
if macos_unified_log_enabled() {
|
||||||
init_with_logger(level, MacosLogger::new(subsystem, category));
|
init_with_logger(level, MacosLogger::new(subsystem, category));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -22,19 +20,10 @@ pub fn init(level: Level, subsystem: &str, category: &str, log_format: LogFormat
|
|||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
let _ = (subsystem, category);
|
let _ = (subsystem, category);
|
||||||
|
|
||||||
init_with_logger(level, build_env_logger(log_format).build());
|
// Initialize the env_logger and global max level to trace, the logs will be
|
||||||
}
|
// filtered by the outer logger
|
||||||
|
let logger = env_logger::builder().filter_level(log::LevelFilter::Trace).build();
|
||||||
fn build_env_logger(log_format: LogFormat) -> env_logger::Builder {
|
init_with_logger(level, logger);
|
||||||
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) {
|
||||||
@@ -114,51 +103,11 @@ fn macos_log_level(level: Level) -> oslog::Level {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(all(test, target_os = "macos"))]
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
use std::{
|
use std::{path::PathBuf, process::Stdio};
|
||||||
net::IpAddr,
|
|
||||||
path::{Path, PathBuf},
|
|
||||||
process::Stdio,
|
|
||||||
};
|
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use common::binary_paths;
|
use common::binary_paths;
|
||||||
@@ -10,7 +6,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, log_format::LogFormat, os_profile::OsProfile};
|
use crate::{auth::SamlAuthResult, credential::Credential, os_profile::OsProfile};
|
||||||
|
|
||||||
use super::command_traits::CommandExt;
|
use super::command_traits::CommandExt;
|
||||||
|
|
||||||
@@ -38,9 +34,7 @@ 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> {
|
||||||
@@ -69,9 +63,7 @@ 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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,32 +149,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The command line this launcher will run.
|
/// Launch the authenticator binary as the current user or SUDO_USER if available.
|
||||||
///
|
pub async fn launch(self) -> anyhow::Result<Credential> {
|
||||||
/// Split out from `launch` so a test can observe the argv the child actually
|
let program = self
|
||||||
/// receives: asserting on the builder's own fields would not catch an
|
.auth_executable
|
||||||
/// argument that never gets appended.
|
.map(PathBuf::from)
|
||||||
fn build_command(&self, program: &Path) -> Command {
|
.unwrap_or_else(binary_paths::gpauth);
|
||||||
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 {
|
||||||
@@ -252,27 +230,10 @@ 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();
|
||||||
|
|
||||||
@@ -325,45 +286,6 @@ 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")
|
||||||
@@ -375,12 +297,4 @@ 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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
path::{Path, PathBuf},
|
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,
|
||||||
programs: Vec<PathBuf>,
|
program: PathBuf,
|
||||||
credential: Arc<SessionCredential>,
|
credential: Arc<SessionCredential>,
|
||||||
minimized: bool,
|
minimized: bool,
|
||||||
envs: Option<HashMap<String, String>>,
|
envs: Option<HashMap<String, String>>,
|
||||||
@@ -24,17 +24,9 @@ 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,
|
||||||
programs,
|
program: binary_paths::gpgui(),
|
||||||
credential,
|
credential,
|
||||||
minimized: false,
|
minimized: false,
|
||||||
envs: None,
|
envs: None,
|
||||||
@@ -52,33 +44,18 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn launch(&self) -> anyhow::Result<ExitStatus> {
|
pub async fn launch(&self) -> anyhow::Result<ExitStatus> {
|
||||||
if let Some(program) = self.find_compatible_program().await {
|
// Check if the program's version
|
||||||
return self.launch_program(&program).await;
|
if let Err(err) = self.check_version().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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn find_compatible_program(&self) -> Option<PathBuf> {
|
self.launch_program().await
|
||||||
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()
|
|
||||||
),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
async fn launch_program(&self) -> anyhow::Result<ExitStatus> {
|
||||||
}
|
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();
|
||||||
@@ -96,7 +73,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 {}: {}", program.display(), err),
|
Err(err) => bail!("Failed to spawn {}: {}", self.program.display(), err),
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(mut stdin) = child.stdin.take() else {
|
let Some(mut stdin) = child.stdin.take() else {
|
||||||
@@ -112,18 +89,9 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
Ok(exit_status)
|
Ok(exit_status)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn check_version(&self, program: &Path) -> anyhow::Result<()> {
|
async fn check_version(&self) -> anyhow::Result<()> {
|
||||||
let mut cmd = Command::new(program);
|
let cmd = Command::new(&self.program).arg("--version").output().await?;
|
||||||
if let Some(envs) = &self.envs {
|
let output = String::from_utf8_lossy(&cmd.stdout);
|
||||||
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 {
|
||||||
@@ -146,69 +114,11 @@ 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?;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
// Check the version again
|
||||||
mod tests {
|
self.check_version().await?;
|
||||||
use std::{fs, os::unix::fs::PermissionsExt};
|
|
||||||
|
|
||||||
use tempfile::TempDir;
|
Ok(())
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,16 +29,9 @@ impl LockFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn unlock(&self) -> anyhow::Result<()> {
|
pub fn unlock(&self) -> anyhow::Result<()> {
|
||||||
match std::fs::read_to_string(&self.path) {
|
|
||||||
Ok(content) if LockInfo::parse(&content).is_ok_and(|info| info.pid == self.pid) => {
|
|
||||||
std::fs::remove_file(&self.path)?;
|
std::fs::remove_file(&self.path)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Ok(_) => Ok(()),
|
|
||||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(()),
|
|
||||||
Err(err) => Err(err.into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn check_health(&self) -> bool {
|
pub async fn check_health(&self) -> bool {
|
||||||
match std::fs::read_to_string(&self.path) {
|
match std::fs::read_to_string(&self.path) {
|
||||||
@@ -149,42 +142,4 @@ mod tests {
|
|||||||
PathBuf::from("/var/run/gpservice-dev-123/gpservice.lock")
|
PathBuf::from("/var/run/gpservice-dev-123/gpservice.lock")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn unlock_removes_lock_owned_by_process() {
|
|
||||||
let temp = tempfile::tempdir().unwrap();
|
|
||||||
let path = temp.path().join("gpservice.lock");
|
|
||||||
let lock = LockFile::new(&path, 1234);
|
|
||||||
lock.lock("8080").unwrap();
|
|
||||||
|
|
||||||
lock.unlock().unwrap();
|
|
||||||
|
|
||||||
assert!(!path.exists());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn unlock_preserves_lock_owned_by_another_process() {
|
|
||||||
let temp = tempfile::tempdir().unwrap();
|
|
||||||
let path = temp.path().join("gpservice.lock");
|
|
||||||
let owner = LockFile::new(&path, 1234);
|
|
||||||
let other = LockFile::new(&path, 5678);
|
|
||||||
owner.lock("8080").unwrap();
|
|
||||||
|
|
||||||
other.unlock().unwrap();
|
|
||||||
|
|
||||||
assert_eq!(std::fs::read_to_string(path).unwrap(), "1234:8080");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn unlock_ignores_missing_or_malformed_lock() {
|
|
||||||
let temp = tempfile::tempdir().unwrap();
|
|
||||||
let path = temp.path().join("gpservice.lock");
|
|
||||||
let lock = LockFile::new(&path, 1234);
|
|
||||||
|
|
||||||
lock.unlock().unwrap();
|
|
||||||
std::fs::write(&path, "not-a-lock").unwrap();
|
|
||||||
lock.unlock().unwrap();
|
|
||||||
|
|
||||||
assert_eq!(std::fs::read_to_string(path).unwrap(), "not-a-lock");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,5 @@
|
|||||||
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 {
|
||||||
|
|||||||
@@ -117,10 +117,7 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf {
|
|||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
config
|
config.disable_static().enable_shared();
|
||||||
.disable_static()
|
|
||||||
.enable_shared()
|
|
||||||
.without("gnutls", None);
|
|
||||||
config.ldflag("-liconv");
|
config.ldflag("-liconv");
|
||||||
config.env("LIBS", "-liconv");
|
config.env("LIBS", "-liconv");
|
||||||
}
|
}
|
||||||
@@ -171,11 +168,6 @@ 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();
|
||||||
|
|
||||||
@@ -184,7 +176,6 @@ 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");
|
||||||
|
|||||||
@@ -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 xdg-utils
|
libayatana-appindicator polkit webkit2-gtk_41
|
||||||
```
|
```
|
||||||
|
|
||||||
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 xdg-utils
|
gnome-keyring polkit webkitgtk41
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the installed Autoconf and Automake versions:
|
Use the installed Autoconf and Automake versions:
|
||||||
|
|||||||
Generated
+35
-7
@@ -43,9 +43,7 @@
|
|||||||
"naersk": {
|
"naersk": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"fenix": "fenix",
|
"fenix": "fenix",
|
||||||
"nixpkgs": [
|
"nixpkgs": "nixpkgs"
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1763384566,
|
"lastModified": 1763384566,
|
||||||
@@ -62,6 +60,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"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=",
|
||||||
@@ -77,11 +91,27 @@
|
|||||||
"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",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -104,9 +134,7 @@
|
|||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": "nixpkgs_3"
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1766457837,
|
"lastModified": 1766457837,
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
naersk = {
|
naersk.url = "github:nix-community/naersk";
|
||||||
url = "github:nix-community/naersk";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
};
|
|
||||||
rust-overlay = {
|
|
||||||
url = "github:oxalica/rust-overlay";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
@@ -43,14 +37,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-jbv5OX7XeLZkY6y+eGbKEg77TKJDpmvzzwVWTjqKFJQ=";
|
hash = "sha256-0+kwFPmq2F9jN8DIM2OHL/jOu+yDH4DXtB5/8XA3U70=";
|
||||||
};
|
};
|
||||||
|
|
||||||
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
||||||
|
|
||||||
gpguiHashes = {
|
gpguiHashes = {
|
||||||
x86_64 = "sha256-QPPQoR3QpA7evloCrjDb+0XsF0d1ONw5D2mvoaECGiY=";
|
x86_64 = "sha256-kMwQ31AYVdrpP52/Gh0Vtq6MTd4iBvweSqtm0rdswmY=";
|
||||||
aarch64 = "sha256-tDmliqiNZZ2pkt2V51OKDILt2IjdIasduvPZKxLOf0U=";
|
aarch64 = "sha256-GeuAGlIZ2jXJaYJG/wSwrHlZwNtEHRM/SbdN6qKCbmc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpgui = pkgs.fetchzip {
|
gpgui = pkgs.fetchzip {
|
||||||
@@ -59,8 +53,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
binaryHashes = {
|
binaryHashes = {
|
||||||
x86_64 = "sha256-lR64CR4yG0pV5tMJaYz9+EVYsIPnYrZdXsZNCLmhNwE=";
|
x86_64 = "sha256-Q49FvGUX6BQtZV/oieEPI+K8p1MZaxZZ3/7aKdbgG8I=";
|
||||||
aarch64 = "sha256-nkXdTNkDevS/Q5bbDWw50y8ciYI5TJst2M9TGRl/SKQ=";
|
aarch64 = "sha256-XoJXH2qngOswIGiqvpeziYBhQF8WUP63EFFdY8N8PtM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
binaryPackage = pkgs.fetchzip {
|
binaryPackage = pkgs.fetchzip {
|
||||||
@@ -71,7 +65,6 @@
|
|||||||
linuxRuntimeDependencies = with pkgs; [
|
linuxRuntimeDependencies = with pkgs; [
|
||||||
glib-networking
|
glib-networking
|
||||||
libayatana-appindicator
|
libayatana-appindicator
|
||||||
xdg-utils
|
|
||||||
];
|
];
|
||||||
|
|
||||||
linuxBuildInputs =
|
linuxBuildInputs =
|
||||||
@@ -102,7 +95,10 @@
|
|||||||
''
|
''
|
||||||
+ 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 $out/bin/gpclient
|
--replace-fail /usr/bin/gpclient /run/current-system/sw/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 \
|
||||||
@@ -116,7 +112,10 @@
|
|||||||
|
|
||||||
rewriteHostInstallPaths = ''
|
rewriteHostInstallPaths = ''
|
||||||
substituteInPlace $out/share/applications/gpgui.desktop \
|
substituteInPlace $out/share/applications/gpgui.desktop \
|
||||||
--replace-fail /usr/bin/gpclient $out/bin/gpclient
|
--replace-fail /usr/bin/gpclient /run/current-system/sw/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 \
|
||||||
@@ -178,10 +177,6 @@
|
|||||||
|
|
||||||
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 =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
@@ -342,40 +337,26 @@
|
|||||||
|
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported launch-gui argument: $arg" >&2
|
auth_data=$arg
|
||||||
exit 2
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$callback" ]; then
|
if [ -z "$auth_data" ]; 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
|
||||||
@@ -409,11 +390,13 @@
|
|||||||
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'
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
#!/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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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,7 +28,6 @@ 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 xdg-utils)
|
depends=(vpnc openssl webkit2gtk-4.1 libappindicator-gtk3 libsecret libxml2 shared-mime-info desktop-file-utils)
|
||||||
optdepends=('wmctrl: for window management')
|
optdepends=('wmctrl: for window management')
|
||||||
|
|
||||||
conflicts=('globalprotect-openconnect')
|
conflicts=('globalprotect-openconnect')
|
||||||
|
|||||||
@@ -3,19 +3,22 @@ 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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@ 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
|
||||||
@@ -43,6 +44,7 @@ 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
|
||||||
@@ -51,8 +53,6 @@ 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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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
|
|
||||||
@@ -47,10 +47,6 @@ 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.
|
||||||
|
|||||||
@@ -3,10 +3,7 @@
|
|||||||
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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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
|
|
||||||
@@ -36,6 +36,5 @@ 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.
|
||||||
@@ -4,12 +4,18 @@ 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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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,6 +1,5 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
export INCLUDE_GUI = @INCLUDE_GUI@
|
|
||||||
export BUILD_GUI_HELPER = @BUILD_GUI_HELPER@
|
export BUILD_GUI_HELPER = @BUILD_GUI_HELPER@
|
||||||
export BUILD_WEBVIEW_AUTH = @BUILD_WEBVIEW_AUTH@
|
export BUILD_WEBVIEW_AUTH = @BUILD_WEBVIEW_AUTH@
|
||||||
export DISABLE_RUST_TOOLCHAIN = 0
|
export DISABLE_RUST_TOOLCHAIN = 0
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[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;
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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,17 +28,16 @@ BuildRequires: wget
|
|||||||
BuildRequires: file
|
BuildRequires: file
|
||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
|
|
||||||
BuildRequires: pkgconfig(webkit2gtk-4.1)
|
%if 0%{?suse_version}
|
||||||
BuildRequires: (pkgconfig(appindicator3-0.1) or pkgconfig(ayatana-appindicator3-0.1))
|
BuildRequires: webkit2gtk3-devel
|
||||||
|
%else
|
||||||
|
BuildRequires: webkit2gtk4.1-devel
|
||||||
|
%endif
|
||||||
|
|
||||||
|
BuildRequires: (libappindicator-gtk3-devel or libappindicator3-1)
|
||||||
BuildRequires: (librsvg2-devel or librsvg-devel)
|
BuildRequires: (librsvg2-devel or librsvg-devel)
|
||||||
|
|
||||||
%if 0%{?suse_version}
|
Requires: (libappindicator-gtk3 or libayatana-appindicator)
|
||||||
Requires: (libappindicator3-1 or libayatana-appindicator3-1)
|
|
||||||
%else
|
|
||||||
Requires: (libappindicator-gtk3 or libayatana-appindicator-gtk3)
|
|
||||||
%endif
|
|
||||||
Requires: xdg-utils
|
|
||||||
Conflicts: globalprotect-openconnect-snapshot
|
Conflicts: globalprotect-openconnect-snapshot
|
||||||
|
|
||||||
%global debug_package %{nil}
|
%global debug_package %{nil}
|
||||||
@@ -50,14 +49,13 @@ A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authenticati
|
|||||||
%setup
|
%setup
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
|
rm -f %{_bindir}/gpgui
|
||||||
if [ "$1" -eq 0 ]; then
|
if [ "$1" -eq 0 ]; then
|
||||||
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 gpclient runtime files" >&2
|
echo "Warning: failed to remove the installed VPN script" >&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
|
||||||
@@ -75,6 +73,7 @@ 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
|
||||||
|
|||||||
+14
-21
@@ -135,19 +135,16 @@ upload_file() {
|
|||||||
release_snapshot() {
|
release_snapshot() {
|
||||||
mapfile -t files < <(release_assets)
|
mapfile -t files < <(release_assets)
|
||||||
local existing_assets
|
local existing_assets
|
||||||
|
local includes_macos=false
|
||||||
local is_current
|
local is_current
|
||||||
local asset
|
local asset
|
||||||
local file
|
local file
|
||||||
local snapshot_commit
|
for file in "${files[@]}"; do
|
||||||
|
if [[ "$(basename "$file")" == GPConnect_*_arm64.* ]]; then
|
||||||
snapshot_commit="$(git -C "$SCRIPT_DIR/.." rev-parse HEAD)"
|
includes_macos=true
|
||||||
if ! gh -R "$REPO" release view "$TAG" >/dev/null 2>&1; then
|
break
|
||||||
gh -R "$REPO" release create "$TAG" \
|
|
||||||
--prerelease \
|
|
||||||
--target "$snapshot_commit" \
|
|
||||||
--title "Snapshot" \
|
|
||||||
--notes "Rolling snapshot release from trusted CI builds."
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo "Uploading new assets..."
|
echo "Uploading new assets..."
|
||||||
# Upload first so a transient cleanup failure cannot leave the snapshot
|
# Upload first so a transient cleanup failure cannot leave the snapshot
|
||||||
@@ -156,7 +153,7 @@ release_snapshot() {
|
|||||||
|
|
||||||
if ! existing_assets="$(release_asset_names)"; then
|
if ! existing_assets="$(release_asset_names)"; then
|
||||||
echo "::warning::Could not list stale snapshot assets for cleanup" >&2
|
echo "::warning::Could not list stale snapshot assets for cleanup" >&2
|
||||||
existing_assets=""
|
return 0
|
||||||
fi
|
fi
|
||||||
while IFS= read -r asset; do
|
while IFS= read -r asset; do
|
||||||
if [[ -z "$asset" || "$asset" == "appcast.xml" ]]; then
|
if [[ -z "$asset" || "$asset" == "appcast.xml" ]]; then
|
||||||
@@ -174,25 +171,22 @@ release_snapshot() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The appcast publisher removes expired macOS snapshots after the new feed
|
if [[ "$includes_macos" == "false" && \
|
||||||
# is live. Removing them here would temporarily break the current feed.
|
"$asset" == GPConnect_*_arm64.* ]]; then
|
||||||
if [[ "$asset" == GPConnect_*_arm64.* ]]; then
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if ! delete_release_asset "$asset"; then
|
if ! delete_release_asset "$asset"; then
|
||||||
echo "::warning::Could not remove stale snapshot asset: $asset" >&2
|
echo "::warning::Could not remove stale snapshot asset: $asset" >&2
|
||||||
fi
|
fi
|
||||||
done <<<"$existing_assets"
|
done <<<"$existing_assets"
|
||||||
|
|
||||||
gh api --method PATCH "repos/$REPO/git/refs/tags/$TAG" \
|
|
||||||
-f sha="$snapshot_commit" -F force=true >/dev/null
|
|
||||||
gh -R "$REPO" release edit "$TAG" --prerelease --title "Snapshot"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release_tag() {
|
release_tag() {
|
||||||
local release_notes_file
|
echo "Removing existing release..."
|
||||||
if ! gh -R "$REPO" release view "$TAG" >/dev/null 2>&1; then
|
gh -R "$REPO" release delete "$TAG" --yes --cleanup-tag || true
|
||||||
|
|
||||||
echo "Creating release..."
|
echo "Creating release..."
|
||||||
|
local release_notes_file
|
||||||
release_notes_file="$(mktemp)"
|
release_notes_file="$(mktemp)"
|
||||||
"$SCRIPT_DIR/release-notes.sh" "$TAG" > "$release_notes_file"
|
"$SCRIPT_DIR/release-notes.sh" "$TAG" > "$release_notes_file"
|
||||||
|
|
||||||
@@ -201,10 +195,9 @@ release_tag() {
|
|||||||
gh -R "$REPO" release create "$TAG" \
|
gh -R "$REPO" release create "$TAG" \
|
||||||
--title "$TAG" \
|
--title "$TAG" \
|
||||||
--notes-file "$release_notes_file"
|
--notes-file "$release_notes_file"
|
||||||
fi
|
|
||||||
|
|
||||||
mapfile -t files < <(release_assets)
|
mapfile -t files < <(release_assets)
|
||||||
GITHUB_REPOSITORY="$REPO" "$SCRIPT_DIR/upload-release-assets.sh" "$TAG" "${files[@]}"
|
upload_files "${files[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $TAG == *"snapshot" ]]; then
|
if [[ $TAG == *"snapshot" ]]; then
|
||||||
|
|||||||
@@ -1,108 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Usage: ./scripts/upload-release-assets.sh [--clobber] <tag> <file> [file...]
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
REPOSITORY="${RELEASE_REPOSITORY:-${GITHUB_REPOSITORY:-yuezk/GlobalProtect-openconnect}}"
|
|
||||||
MAX_ATTEMPTS=8
|
|
||||||
CLOBBER=false
|
|
||||||
|
|
||||||
if [[ "${1:-}" == "--clobber" ]]; then
|
|
||||||
CLOBBER=true
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
TAG="${1:-}"
|
|
||||||
|
|
||||||
if [[ -z "$TAG" || "$#" -lt 2 ]]; then
|
|
||||||
echo "Usage: $0 [--clobber] <tag> <file> [file...]" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
|
|
||||||
if [[ -z "${GH_TOKEN:-}" ]]; then
|
|
||||||
echo "GH_TOKEN is not configured" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
API_HEADERS=(
|
|
||||||
-H "Authorization: Bearer $GH_TOKEN"
|
|
||||||
-H 'Accept: application/vnd.github+json'
|
|
||||||
-H 'X-GitHub-Api-Version: 2022-11-28'
|
|
||||||
)
|
|
||||||
RELEASE_ID="$(curl --fail --silent --show-error \
|
|
||||||
"${API_HEADERS[@]}" \
|
|
||||||
"https://api.github.com/repos/$REPOSITORY/releases/tags/$TAG" | jq -r .id)"
|
|
||||||
|
|
||||||
file_digest() {
|
|
||||||
if command -v sha256sum >/dev/null; then
|
|
||||||
sha256sum "$1" | awk '{ print $1 }'
|
|
||||||
else
|
|
||||||
shasum -a 256 "$1" | awk '{ print $1 }'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
upload_asset() {
|
|
||||||
local file=$1
|
|
||||||
local asset
|
|
||||||
local asset_id
|
|
||||||
local assets_json
|
|
||||||
local encoded_asset
|
|
||||||
local local_digest
|
|
||||||
local remote_digest
|
|
||||||
local attempt=1
|
|
||||||
local delay
|
|
||||||
|
|
||||||
if [[ ! -f "$file" ]]; then
|
|
||||||
echo "Release asset does not exist: $file" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
asset="$(basename "$file")"
|
|
||||||
encoded_asset="$(jq -rn --arg name "$asset" '$name | @uri')"
|
|
||||||
local_digest="sha256:$(file_digest "$file")"
|
|
||||||
|
|
||||||
while (( attempt <= MAX_ATTEMPTS )); do
|
|
||||||
assets_json="$(curl --fail --silent --show-error \
|
|
||||||
"${API_HEADERS[@]}" \
|
|
||||||
"https://api.github.com/repos/$REPOSITORY/releases/$RELEASE_ID/assets?per_page=100")"
|
|
||||||
asset_id="$(jq -r --arg name "$asset" \
|
|
||||||
'[.[] | select(.name == $name)] | first | .id // empty' <<<"$assets_json")"
|
|
||||||
if [[ -n "$asset_id" ]]; then
|
|
||||||
remote_digest="$(jq -r --arg name "$asset" \
|
|
||||||
'.[] | select(.name == $name) | .digest // empty' <<<"$assets_json")"
|
|
||||||
if [[ "$CLOBBER" == "false" && "$remote_digest" == "$local_digest" ]]; then
|
|
||||||
echo "$asset is already uploaded with the expected digest"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if [[ "$CLOBBER" == "false" ]]; then
|
|
||||||
echo "Refusing to replace immutable release asset: $asset" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
curl --fail --silent --show-error \
|
|
||||||
"${API_HEADERS[@]}" \
|
|
||||||
--request DELETE \
|
|
||||||
"https://api.github.com/repos/$REPOSITORY/releases/assets/$asset_id"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if curl --fail --silent --show-error \
|
|
||||||
"${API_HEADERS[@]}" \
|
|
||||||
--request POST \
|
|
||||||
-H 'Content-Type: application/octet-stream' \
|
|
||||||
--data-binary "@$file" \
|
|
||||||
"https://uploads.github.com/repos/$REPOSITORY/releases/$RELEASE_ID/assets?name=$encoded_asset" \
|
|
||||||
>/dev/null; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if (( attempt >= MAX_ATTEMPTS )); then
|
|
||||||
echo "Failed to upload release asset after $attempt attempts: $asset" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
delay=$((attempt * 3))
|
|
||||||
echo "GitHub upload failed; retrying in ${delay}s" >&2
|
|
||||||
sleep "$delay"
|
|
||||||
((attempt += 1))
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
for file in "$@"; do
|
|
||||||
upload_asset "$file"
|
|
||||||
done
|
|
||||||
@@ -10,7 +10,6 @@ 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"
|
||||||
@@ -23,96 +22,59 @@ 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_APP_DIR/src-tauri/icons/32x32.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/128x128.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/[email protected]" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.svg" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/32x32.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/128x128.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/[email protected]" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/32x32.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/128x128.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/[email protected]" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.png" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.svg" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.icns" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon.ico" \
|
"$GPGUI_DIR/app/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_APP_DIR/src-tauri/icons/icon-small.svg" \
|
"$GPGUI_DIR/app/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_contains \
|
verify_same_file \
|
||||||
"$GPGUI_APP_DIR/gpgui.desktop.in" \
|
"$GPGUI_DIR/app/gpauth.desktop" \
|
||||||
"Exec=/usr/bin/gpclient launch-gui %u"
|
"$GP_DIR/packaging/files/usr/share/applications/gpauth.desktop"
|
||||||
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"
|
||||||
Reference in new issue
Block a user