From fe4841b069eabd7eaf7ecc9fc38fd26b2283579e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 18 May 2026 13:05:25 +0200 Subject: [PATCH 1/6] Build new UI --- .github/workflows/build-macos.yaml | 9 +++++++-- .github/workflows/lint.yaml | 4 ++-- .github/workflows/release.yaml | 10 +++++----- src-tauri/build.rs | 6 ++++++ src-tauri/src/bin/defguard-client.rs | 4 ++-- src-tauri/src/window.rs | 4 ++-- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 1ef16da5..2e11d3e0 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -38,12 +38,12 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - uses: pnpm/action-setup@v6 with: cache: true - version: 10 + version: 11 # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 @@ -63,6 +63,11 @@ jobs: - name: Unlock keychain run: security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain + - name: Build new UI + run: | + cd new-ui + pnpm build + - name: Build app uses: tauri-apps/tauri-action@v0 env: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b1b883b5..12a59f5b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -30,11 +30,11 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - uses: pnpm/action-setup@v6 with: - version: 10 + version: 11 run_install: false - name: Get pnpm store directory diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f7519b1f..d12e6c23 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -62,7 +62,7 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v6 with: - version: 10 + version: 11 - uses: actions/setup-node@v6 with: @@ -166,11 +166,11 @@ jobs: echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV} - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - uses: pnpm/action-setup@v6 with: - version: 10 + version: 11 run_install: false - name: Get pnpm store directory @@ -343,10 +343,10 @@ jobs: # echo "VERSION=$env:VERSION" >> $env:GITHUB_ENV # - uses: actions/setup-node@v6 # with: - # node-version: 25 + # node-version: 26 # - uses: pnpm/action-setup@v6 # with: - # version: 10 + # version: 11 # run_install: false # - name: Get pnpm store directory # shell: bash diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 3be5441f..7f1bfcb1 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -3,6 +3,12 @@ use vergen_git2::{Emitter, Git2Builder}; fn main() -> Result<(), Box> { println!("cargo:rerun-if-env-changed=DEFGUARD_CLIENT_BUILD_VERSION"); + println!("cargo:rerun-if-env-changed=DEFGUARD_CLIENT_DEV"); + println!("cargo::rustc-check-cfg=cfg(defguard_client_env)"); + if std::env::var("DEFGUARD_CLIENT_DEV").is_ok() { + println!("cargo::rustc-cfg=defguard_client_env"); + } + // set VERGEN_GIT_SHA env variable based on git commit hash let git2 = Git2Builder::default().branch(true).sha(true).build()?; Emitter::default().add_instructions(&git2)?.emit()?; diff --git a/src-tauri/src/bin/defguard-client.rs b/src-tauri/src/bin/defguard-client.rs index 6766108f..1d0554aa 100644 --- a/src-tauri/src/bin/defguard-client.rs +++ b/src-tauri/src/bin/defguard-client.rs @@ -348,7 +348,7 @@ fn main() { app.manage(state); // Open new UI window. - let new_url = if cfg!(debug_assertions) { + let new_url = if cfg!(defguard_client_env) { WebviewUrl::External("http://localhost:5072".parse().unwrap()) } else { WebviewUrl::App("new-ui/".into()) @@ -360,7 +360,7 @@ fn main() { .build()?; // Open old UI window. - let old_url = if cfg!(debug_assertions) { + let old_url = if cfg!(defguard_client_env) { WebviewUrl::External("http://localhost:5071".parse().unwrap()) } else { WebviewUrl::App("old-ui/index.html/".into()) diff --git a/src-tauri/src/window.rs b/src-tauri/src/window.rs index 1064516e..b7f92f2c 100644 --- a/src-tauri/src/window.rs +++ b/src-tauri/src/window.rs @@ -13,7 +13,7 @@ pub const OLD_UI_WIDTH: f64 = 920.0; pub const OLD_UI_HEIGHT: f64 = 720.0; fn new_ui_url() -> WebviewUrl { - if cfg!(debug_assertions) { + if cfg!(defguard_client_env) { WebviewUrl::External("http://localhost:5072".parse().unwrap()) } else { WebviewUrl::App("new-ui/".into()) @@ -21,7 +21,7 @@ fn new_ui_url() -> WebviewUrl { } fn old_ui_url() -> WebviewUrl { - if cfg!(debug_assertions) { + if cfg!(defguard_client_env) { WebviewUrl::External("http://localhost:5071".parse().unwrap()) } else { WebviewUrl::App("old-ui/index.html".into()) From 7311a6cfdbb03bad1363f89f321b6ad44b65cddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 18 May 2026 13:07:11 +0200 Subject: [PATCH 2/6] Rename to defguard_client_dev --- src-tauri/build.rs | 4 ++-- src-tauri/src/bin/defguard-client.rs | 4 ++-- src-tauri/src/window.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 7f1bfcb1..0bbd4977 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -4,9 +4,9 @@ fn main() -> Result<(), Box> { println!("cargo:rerun-if-env-changed=DEFGUARD_CLIENT_BUILD_VERSION"); println!("cargo:rerun-if-env-changed=DEFGUARD_CLIENT_DEV"); - println!("cargo::rustc-check-cfg=cfg(defguard_client_env)"); + println!("cargo::rustc-check-cfg=cfg(defguard_client_dev)"); if std::env::var("DEFGUARD_CLIENT_DEV").is_ok() { - println!("cargo::rustc-cfg=defguard_client_env"); + println!("cargo::rustc-cfg=defguard_client_dev"); } // set VERGEN_GIT_SHA env variable based on git commit hash diff --git a/src-tauri/src/bin/defguard-client.rs b/src-tauri/src/bin/defguard-client.rs index 1d0554aa..0d0bf13e 100644 --- a/src-tauri/src/bin/defguard-client.rs +++ b/src-tauri/src/bin/defguard-client.rs @@ -348,7 +348,7 @@ fn main() { app.manage(state); // Open new UI window. - let new_url = if cfg!(defguard_client_env) { + let new_url = if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5072".parse().unwrap()) } else { WebviewUrl::App("new-ui/".into()) @@ -360,7 +360,7 @@ fn main() { .build()?; // Open old UI window. - let old_url = if cfg!(defguard_client_env) { + let old_url = if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5071".parse().unwrap()) } else { WebviewUrl::App("old-ui/index.html/".into()) diff --git a/src-tauri/src/window.rs b/src-tauri/src/window.rs index b7f92f2c..e4fce3fb 100644 --- a/src-tauri/src/window.rs +++ b/src-tauri/src/window.rs @@ -13,7 +13,7 @@ pub const OLD_UI_WIDTH: f64 = 920.0; pub const OLD_UI_HEIGHT: f64 = 720.0; fn new_ui_url() -> WebviewUrl { - if cfg!(defguard_client_env) { + if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5072".parse().unwrap()) } else { WebviewUrl::App("new-ui/".into()) @@ -21,7 +21,7 @@ fn new_ui_url() -> WebviewUrl { } fn old_ui_url() -> WebviewUrl { - if cfg!(defguard_client_env) { + if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5071".parse().unwrap()) } else { WebviewUrl::App("old-ui/index.html".into()) From ab1526cffb67acbb330a979abe4875181513573d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 18 May 2026 13:10:44 +0200 Subject: [PATCH 3/6] Link new UI --- .github/workflows/lint.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 12a59f5b..5fc95007 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -56,8 +56,13 @@ jobs: run: pnpm install --no-frozen-lockfile - name: Run Biome and Prettier Lint - run: pnpm lint + run: | + pnpm lint + cd new-ui + pnpm lint - # TODO: Restore when it works again: https://github.com/pnpm/pnpm/issues/11265 - # - name: Audit - # run: pnpm audit --prod + - name: Audit + run: | + pnpm audit --prod + cd new-ui + pnpm audit --prod From a1c10de542bfb5f83f01db5f698c7f39ac5862f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 18 May 2026 13:17:02 +0200 Subject: [PATCH 4/6] pnpm install --- .github/workflows/build-macos.yaml | 5 ++++- .github/workflows/lint.yaml | 5 ++++- .github/workflows/release.yaml | 10 ++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 2e11d3e0..82ce20f3 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -48,7 +48,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies - run: pnpm install --no-frozen-lockfile + run: | + pnpm install --no-frozen-lockfile + cd new-ui + pnpm install --no-frozen-lockfile - name: Install Rust stable uses: dtolnay/rust-toolchain@stable diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5fc95007..36a84586 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -53,7 +53,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies - run: pnpm install --no-frozen-lockfile + run: | + pnpm install --no-frozen-lockfile + cd new-ui + pnpm install --no-frozen-lockfile - name: Run Biome and Prettier Lint run: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d12e6c23..5250004a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -89,7 +89,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies - run: pnpm install --no-frozen-lockfile + run: | + pnpm install --no-frozen-lockfile + cd new-ui + pnpm install --no-frozen-lockfile - name: Install Rust stable uses: dtolnay/rust-toolchain@stable @@ -189,7 +192,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies - run: pnpm install --no-frozen-lockfile + run: | + pnpm install --no-frozen-lockfile + cd new-ui + pnpm install --no-frozen-lockfile - name: Install Rust stable uses: dtolnay/rust-toolchain@stable From a3899022aded9af7d6e3db5252a8324befbd9882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 18 May 2026 13:30:29 +0200 Subject: [PATCH 5/6] More actions --- .github/workflows/build-macos.yaml | 4 +++- .github/workflows/lint.yaml | 14 ++++++++++---- .github/workflows/release.yaml | 18 ++++++++++++++++-- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 82ce20f3..8f698e19 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -48,8 +48,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies + run: pnpm install --no-frozen-lockfile + + - name: Install Node dependencies for New UI run: | - pnpm install --no-frozen-lockfile cd new-ui pnpm install --no-frozen-lockfile diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 36a84586..2679140d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -53,19 +53,25 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies + run: pnpm install --no-frozen-lockfile + + - name: Install Node dependencies for new UI run: | - pnpm install --no-frozen-lockfile cd new-ui pnpm install --no-frozen-lockfile - name: Run Biome and Prettier Lint + run: pnpm lint + + - name: Audit + run: pnpm audit --prod + + - name: Run Biome and Prettier Lint for new UI run: | - pnpm lint cd new-ui pnpm lint - - name: Audit + - name: Audit new UI run: | - pnpm audit --prod cd new-ui pnpm audit --prod diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5250004a..391f59d8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -89,8 +89,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies + run: pnpm install --no-frozen-lockfile + + - name: Install Node dependencies for new UI run: | - pnpm install --no-frozen-lockfile cd new-ui pnpm install --no-frozen-lockfile @@ -101,6 +103,11 @@ jobs: run: | apt-get install -y build-essential libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm + - name: Build new UI + run: | + cd new-ui + pnpm build + - name: Build packages uses: tauri-apps/tauri-action@v0.5.23 env: @@ -192,8 +199,10 @@ jobs: # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies + run: pnpm install --no-frozen-lockfile + + - name: Install Node dependencies for new UI run: | - pnpm install --no-frozen-lockfile cd new-ui pnpm install --no-frozen-lockfile @@ -205,6 +214,11 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm + - name: Build new UI + run: | + cd new-ui + pnpm build + - name: Build packages uses: tauri-apps/tauri-action@v0.5.23 # .24 seems broken, TODO: update when fixed env: From ae71bdc728fcffbe2cf9b878486a56a94caed394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 18 May 2026 13:36:44 +0200 Subject: [PATCH 6/6] More actions --- .github/workflows/lint.yaml | 9 +-------- .github/workflows/release.yaml | 26 +++----------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2679140d..f7bb499b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -34,6 +34,7 @@ jobs: - uses: pnpm/action-setup@v6 with: + cache: true version: 11 run_install: false @@ -42,14 +43,6 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - name: Setup pnpm cache - uses: actions/cache@v5 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-lint-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-lint-store- - # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 391f59d8..c1ee0173 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -62,11 +62,12 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v6 with: + cache: true version: 11 - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - name: Get pnpm store directory run: | @@ -78,13 +79,6 @@ jobs: echo Version: $VERSION echo "VERSION=$VERSION" >> ${GITHUB_ENV} echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV} - - uses: actions/cache@v5 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-build-store- # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 @@ -180,6 +174,7 @@ jobs: - uses: pnpm/action-setup@v6 with: + cache: true version: 11 run_install: false @@ -188,14 +183,6 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV} - - name: Setup pnpm cache - uses: actions/cache@v5 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-build-store- - # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies @@ -371,13 +358,6 @@ jobs: # - name: Get pnpm store directory # shell: bash # run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV} - # - uses: actions/cache@v5 - # name: Setup pnpm cache - # with: - # path: ${{ env.STORE_PATH }} - # key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} - # restore-keys: | - # ${{ runner.os }}-pnpm-build-store- # - name: Install deps # run: pnpm install --frozen-lockfile # - uses: dtolnay/rust-toolchain@stable