diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a5a414c1..2de6dc4c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,28 +1,28 @@ -name: 'lint' +name: "lint" on: push: branches: - main - dev - - 'release/**' + - "release/**" pull_request: branches: - main - dev - - 'release/**' + - "release/**" jobs: lint-web: runs-on: [self-hosted, Linux, X64] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: - submodules: 'recursive' + submodules: recursive - uses: actions/setup-node@v4 with: - node-version: '20' + node-version: "22" - uses: pnpm/action-setup@v2 with: @@ -34,7 +34,7 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2e23d235..685cd79f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: architecture: [arm64, amd64] runs-on: [self-hosted, macOS] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: repository: WireGuard/wireguard-go ref: master @@ -71,7 +71,7 @@ jobs: deb_arch: amd64 binary_arch: x86_64 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - name: Write release version @@ -81,7 +81,7 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: "20" + node-version: "22" - uses: pnpm/action-setup@v2 with: version: 9 @@ -90,7 +90,7 @@ jobs: shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} @@ -230,7 +230,7 @@ jobs: APPLE_ID: "kamil@defguard.net" APPLE_TEAM_ID: "82GZ7KN29J" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - name: Write release version @@ -240,7 +240,7 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: "20" + node-version: "22" - uses: pnpm/action-setup@v2 with: version: 9 @@ -248,7 +248,7 @@ jobs: - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} @@ -312,7 +312,7 @@ jobs: - create-release runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - name: Write release version @@ -322,7 +322,7 @@ jobs: echo "VERSION=$env:VERSION" >> $env:GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: "20" + node-version: "22" - uses: pnpm/action-setup@v2 with: version: 9 @@ -330,7 +330,7 @@ jobs: - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $env:GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80fd06f8..f1655dc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,29 +24,24 @@ env: jobs: test: runs-on: [self-hosted, Linux, X64] - container: rust:1 + container: + image: rust:1 + options: --user root defaults: run: working-directory: ./src-tauri steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: submodules: recursive - - name: Debug - run: echo ${{ github.ref_name }} - name: Cache uses: Swatinem/rust-cache@v2 - name: Install required packages run: | apt-get update - apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip - - name: Install protobuf compiler - run: | - PB_REL='https://github.com/protocolbuffers/protobuf/releases' - PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip - unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr/local + apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler - name: Check format run: | rustup component add rustfmt diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index e5582a5a..72f0bb71 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -850,9 +850,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.44" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c1f056bae57e3e54c3375c41ff79619ddd13460a17d7438712bd0d83fda4ff8" +checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" dependencies = [ "clap_builder", "clap_derive", @@ -872,9 +872,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.41" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" +checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -4708,9 +4708,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.22" +version = "0.12.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" dependencies = [ "base64 0.22.1", "bytes", @@ -5138,9 +5138,9 @@ dependencies = [ [[package]] name = "serde-untagged" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299d9c19d7d466db4ab10addd5703e4c615dec2a5a16dbbafe191045e87ee66e" +checksum = "34836a629bcbc6f1afdf0907a744870039b1e14c0561cb26094fa683b158eff3" dependencies = [ "erased-serde", "serde", diff --git a/src-tauri/src/bin/defguard-client.rs b/src-tauri/src/bin/defguard-client.rs index 67a57d79..f3d717cc 100644 --- a/src-tauri/src/bin/defguard-client.rs +++ b/src-tauri/src/bin/defguard-client.rs @@ -306,10 +306,13 @@ fn main() { }); debug!("Ctrl-C handler has been set up successfully"); } - RunEvent::ExitRequested { api, .. } => { + RunEvent::ExitRequested { code, api, .. } => { debug!("Received exit request"); - // Prevent shutdown on window close. - api.prevent_exit(); + // `code` is `None` when the exit is requested by user interaction. + if code.is_none() { + // Prevent shutdown on window close. + api.prevent_exit(); + } } // Handle shutdown. RunEvent::Exit => { diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index fa7ac7b7..548a5f55 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -41,6 +41,9 @@ use crate::{ ConnectionType, }; +#[cfg(target_os = "windows")] +use crate::active_connections::find_connection; + pub(crate) static DEFAULT_ROUTE_IPV4: &str = "0.0.0.0/0"; pub(crate) static DEFAULT_ROUTE_IPV6: &str = "::/0"; @@ -927,11 +930,7 @@ async fn check_connection( } } - if appstate - .find_connection(id, connection_type) - .await - .is_some() - { + if find_connection(id, connection_type).await.is_some() { debug!("{connection_type} {name} has already a connected state, skipping synchronization"); return Ok(()); }