Skip to content

Commit 35d3a54

Browse files
Merge pull request #649 from DefGuard/merger-pre-1.6
Merge main branch into dev before 1.6-alpha release
2 parents 96bc7e8 + cb01cbc commit 35d3a54

9 files changed

Lines changed: 180 additions & 7 deletions

File tree

.github/workflows/release.yaml

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
tags:
55
- v*.*.*
6-
76
jobs:
87
create-release:
98
name: create-release
@@ -23,6 +22,95 @@ jobs:
2322
uses: ./.github/workflows/sbom.yml
2423
with:
2524
upload_url: ${{ needs.create-release.outputs.upload_url }}
25+
ubuntu-22-04-build:
26+
needs:
27+
- create-release
28+
runs-on:
29+
- self-hosted
30+
- Linux
31+
- ${{ matrix.architecture }}
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
architecture: [ARM64, X64]
36+
include:
37+
- architecture: ARM64
38+
deb_arch: arm64
39+
binary_arch: aarch64
40+
- architecture: X64
41+
deb_arch: amd64
42+
binary_arch: x86_64
43+
container:
44+
image: ubuntu:22.04
45+
env:
46+
DEBIAN_FRONTEND: noninteractive
47+
HOME: /root
48+
RUSTUP_HOME: /root/.rustup
49+
CARGO_HOME: /root/.cargo
50+
steps:
51+
- name: git install
52+
run: |
53+
apt-get update
54+
apt-get install -y git curl ca-certificates
55+
git config --global --add safe.directory '*'
56+
- uses: actions/checkout@v5
57+
with:
58+
submodules: "recursive"
59+
- uses: pnpm/action-setup@v4
60+
with:
61+
version: 10.17
62+
run_install: false
63+
- uses: actions/setup-node@v5
64+
with:
65+
node-version: "24"
66+
- name: Get pnpm store directory
67+
run: |
68+
echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
69+
- name: Write release version
70+
run: |
71+
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
72+
echo Version: $VERSION
73+
echo "VERSION=$VERSION" >> ${GITHUB_ENV}
74+
- uses: actions/cache@v4
75+
name: Setup pnpm cache
76+
with:
77+
path: ${{ env.STORE_PATH }}
78+
key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }}
79+
restore-keys: |
80+
${{ runner.os }}-pnpm-build-store-
81+
- name: Install Node dependencies
82+
run: pnpm install --frozen-lockfile
83+
- uses: dtolnay/rust-toolchain@stable
84+
- name: Install dependencies
85+
run: |
86+
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
87+
- name: Build packages
88+
uses: tauri-apps/tauri-action@v0.5.23
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
args: "--bundles deb"
93+
- name: Upload DEB
94+
uses: actions/upload-release-asset@v1
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
with:
98+
upload_url: ${{ needs.create-release.outputs.upload_url }}
99+
asset_path: src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
100+
asset_name: defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb
101+
asset_content_type: application/octet-stream
102+
- name: Install ruby with deb-s3
103+
if: matrix.build != 'freebsd'
104+
run: |
105+
apt-get install -y ruby
106+
gem install deb-s3
107+
echo "$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" >> $GITHUB_PATH
108+
- name: Upload DEB to APT repository
109+
run: |
110+
COMPONENT=$([[ "${{ github.ref_name }}" == *"-"* ]] && echo "pre-release" || echo "release") # if tag contain "-" assume it's pre-release.
111+
112+
deb-s3 upload -l --bucket=apt.defguard.net --access-key-id=${{ secrets.AWS_ACCESS_KEY_APT }} --secret-access-key=${{ secrets.AWS_SECRET_KEY_APT }} --s3-region=eu-north-1 --no-fail-if-exists --codename=bookworm --component="$COMPONENT" src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
113+
26114
27115
build-linux:
28116
needs:
@@ -468,3 +556,40 @@ jobs:
468556
asset_path: defguard-client-signed.msi
469557
asset_name: defguard-client_${{ env.VERSION }}_x64_en-US.msi
470558
asset_content_type: application/octet-stream
559+
560+
apt-sign:
561+
needs:
562+
- build-linux
563+
- ubuntu-22-04-build
564+
runs-on:
565+
- self-hosted
566+
- Linux
567+
- X64
568+
strategy:
569+
fail-fast: false
570+
steps:
571+
- name: Sign APT repository
572+
run: |
573+
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_APT }}
574+
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY_APT }}
575+
export AWS_REGION=eu-north-1
576+
sudo apt update -y
577+
sudo apt install -y awscli curl jq
578+
579+
for DIST in trixie bookworm; do
580+
aws s3 cp s3://apt.defguard.net/dists/${DIST}/Release .
581+
582+
curl -X POST "${{ secrets.DEFGUARD_SIGNING_URL }}?signature_type=both" \
583+
-H "Authorization: Bearer ${{ secrets.DEFGUARD_SIGNING_API_KEY }}" \
584+
-F "file=@Release" \
585+
-o response.json
586+
587+
cat response.json | jq -r '.files["Release.gpg"].content' | base64 --decode > Release.gpg
588+
cat response.json | jq -r '.files.Release.content' | base64 --decode > InRelease
589+
590+
aws s3 cp Release.gpg s3://apt.defguard.net/dists/${DIST}/ --acl public-read
591+
aws s3 cp InRelease s3://apt.defguard.net/dists/${DIST}/ --acl public-read
592+
593+
done
594+
(aws s3 ls s3://apt.defguard.net/dists/ --recursive; aws s3 ls s3://apt.defguard.net/pool/ --recursive) | awk '{print "<a href=\""$4"\">"$4"</a><br>"}' > index.html
595+
aws s3 cp index.html s3://apt.defguard.net/ --acl public-read

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"@tauri-apps/plugin-notification": "^2.3.1",
6565
"@tauri-apps/plugin-opener": "^2.5.0",
6666
"@tauri-apps/plugin-os": "^2.3.1",
67+
"@tauri-apps/plugin-process": "^2.3.0",
6768
"@tauri-apps/plugin-window-state": "^2.4.0",
6869
"@types/byte-size": "^8.1.2",
6970
"@use-gesture/react": "^10.3.1",
@@ -92,6 +93,7 @@
9293
"react-click-away-listener": "^2.4.0",
9394
"react-dom": "^19.2.0",
9495
"react-hook-form": "^7.63.0",
96+
"react-hotkeys-hook": "^5.2.1",
9597
"react-loading-skeleton": "^3.5.0",
9698
"react-markdown": "^10.1.0",
9799
"react-qr-code": "^2.0.18",

pnpm-lock.yaml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ x25519-dalek = { version = "2", features = [
112112
"serde",
113113
"static_secrets",
114114
] }
115+
tauri-plugin-process = "2.3.0"
115116

116117
[target.'cfg(unix)'.dependencies]
117118
nix = { version = "0.30.1", features = ["user", "fs"] }

src-tauri/capabilities/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"os:allow-hostname",
4949
"dialog:default",
5050
"clipboard-manager:allow-write-text",
51+
"process:allow-exit",
5152
{
5253
"identifier": "http:default",
5354
"allow": [

src-tauri/deny.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ ignore = [
8787
{ id = "RUSTSEC-2024-0420", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
8888
{ id = "RUSTSEC-2025-0052", reason = "Discontinued, but dark-light v2.0.0 needs it" },
8989
{ id = "RUSTSEC-2025-0057", reason = "Tauri needs it" },
90-
{ id = "RUSTSEC-2025-0075", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
91-
{ id = "RUSTSEC-2025-0080", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
92-
{ id = "RUSTSEC-2025-0081", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
93-
{ id = "RUSTSEC-2025-0098", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
94-
{ id = "RUSTSEC-2025-0100", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
90+
{ id = "RUSTSEC-2025-0075", reason = "Tauri v2 dependency (unmaintained)" },
91+
{ id = "RUSTSEC-2025-0080", reason = "Tauri v2 dependency (unmaintained)" },
92+
{ id = "RUSTSEC-2025-0081", reason = "Tauri v2 dependency (unmaintained)" },
93+
{ id = "RUSTSEC-2025-0098", reason = "Tauri v2 dependency (unmaintained)" },
94+
{ id = "RUSTSEC-2025-0100", reason = "Tauri v2 dependency (unmaintained)" },
9595
]
9696
# If this is true, then cargo deny will use the git executable to fetch advisory database.
9797
# If this is false, then it uses a built-in git library.

src-tauri/src/bin/defguard-client.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ fn main() {
160160
.plugin(tauri_plugin_window_state::Builder::new().build())
161161
.plugin(tauri_plugin_opener::init())
162162
.plugin(tauri_plugin_os::init())
163+
.plugin(tauri_plugin_process::init())
163164
.setup(|app| {
164165
// Register for linux and dev windows builds
165166
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]

src/components/App/App.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import '../../shared/scss/index.scss';
44

55
import { QueryClient } from '@tanstack/query-core';
66
import { QueryClientProvider } from '@tanstack/react-query';
7-
import { debug } from '@tauri-apps/plugin-log';
7+
import { debug, info } from '@tauri-apps/plugin-log';
88
import { openUrl } from '@tauri-apps/plugin-opener';
99
import dayjs from 'dayjs';
1010
import customParseData from 'dayjs/plugin/customParseFormat';
@@ -38,6 +38,8 @@ import { useTheme } from '../../shared/defguard-ui/hooks/theme/useTheme';
3838
import { ThemeProvider } from '../../shared/providers/ThemeProvider/ThemeProvider';
3939
import { routes } from '../../shared/routes';
4040
import { ApplicationUpdateManager } from '../ApplicationUpdateManager/ApplicationUpdateManager';
41+
import { exit } from '@tauri-apps/plugin-process';
42+
import { useHotkeys } from 'react-hotkeys-hook';
4143

4244
dayjs.extend(duration);
4345
dayjs.extend(utc);
@@ -186,6 +188,12 @@ export const App = () => {
186188
};
187189
}, []);
188190

191+
// register ctrl+q keyboard shortcut
192+
useHotkeys('ctrl+q', () => {
193+
info("Ctrl-Q pressed, exiting.");
194+
exit(0);
195+
});
196+
189197
if (!appLoaded) return null;
190198

191199
return (

0 commit comments

Comments
 (0)