Skip to content

Commit a2dc75a

Browse files
authored
Open desktop app page (#254)
1 parent 872b3a0 commit a2dc75a

14 files changed

Lines changed: 1015 additions & 735 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ log = { version = "0.4", features = ["serde"] }
2929
# data de/serialization
3030
serde = { version = "1.0", features = ["derive"] }
3131
serde_json = { version = "1.0" }
32-
toml = { version = "0.9", default-features = false, features = [
32+
toml = { version = "1.0", default-features = false, features = [
3333
"parse",
3434
"serde",
3535
] }
@@ -58,7 +58,7 @@ bytes = { version = "1.11" }
5858

5959
[build-dependencies]
6060
tonic-prost-build = "0.14"
61-
vergen-git2 = { version = "1.0", features = ["build"] }
61+
vergen-git2 = { version = "9.1", features = ["build"] }
6262

6363
[profile.release]
6464
lto = "thin"

src/grpc.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,18 @@ impl proxy_server::Proxy for ProxyServer {
250250
debug!("Received message from Defguard Core ID={}", response.id);
251251
connected.store(true, Ordering::Relaxed);
252252
if let Some(payload) = response.payload {
253-
match payload {
254-
core_response::Payload::InitialInfo(payload) => {
255-
info!("Received private cookies key");
256-
let key = Key::from(&payload.private_cookies_key);
257-
*cookie_key.write().unwrap() = Some(key);
258-
},
259-
_ => {
260-
let maybe_rx = results.write().expect("Failed to acquire lock on results hashmap when processing response").remove(&response.id);
261-
if let Some(rx) = maybe_rx {
262-
if let Err(err) = rx.send(payload) {
263-
error!("Failed to send message to rx {:?}", err.type_id());
264-
}
265-
} else {
266-
error!("Missing receiver for response #{}", response.id);
253+
if let core_response::Payload::InitialInfo(payload) = payload {
254+
info!("Received private cookies key");
255+
let key = Key::from(&payload.private_cookies_key);
256+
*cookie_key.write().unwrap() = Some(key);
257+
} else {
258+
let maybe_rx = results.write().expect("Failed to acquire lock on results hashmap when processing response").remove(&response.id);
259+
if let Some(rx) = maybe_rx {
260+
if let Err(err) = rx.send(payload) {
261+
error!("Failed to send message to rx {:?}", err.type_id());
267262
}
263+
} else {
264+
error!("Missing receiver for response #{}", response.id);
268265
}
269266
}
270267
}
@@ -281,7 +278,8 @@ impl proxy_server::Proxy for ProxyServer {
281278
}
282279
info!("Defguard core client disconnected: {address}");
283280
connected.store(false, Ordering::Relaxed);
284-
clients.write().expect("Failed to acquire lock on clients hashmap when removing disconnected client").remove(&address);
281+
clients.write().expect("Failed to acquire lock on clients hashmap when removing \
282+
disconnected client").remove(&address);
285283
}
286284
.instrument(tracing::Span::current()),
287285
);

src/handlers/desktop_client_mfa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async fn handle_remote_auth_socket(
118118
Err(err) => {
119119
error!("Failed to receive preshared key from receiver: {err:?}");
120120
}
121-
};
121+
}
122122

123123
// Close the websocket once we're done.
124124
let _ = ws_tx.close().await;

src/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub async fn run_server(
241241
debug!("Using config: {env_config:?}");
242242

243243
let mut tasks = JoinSet::new();
244-
let cookie_key = Default::default();
244+
let cookie_key = Arc::default();
245245
let (reset_tx, mut reset_rx) = tokio::sync::broadcast::channel(1);
246246

247247
// connect to upstream gRPC server

web/messages/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,8 @@
105105
"openid_mfa_redirect_error_message": "No token provided in the URL. Please ensure you have a valid token to proceed with OpenID authentication.",
106106
"openid_mfa_redirect_error_missing_args": "Missing code or state in the callback's URL. The provider might not be configured correctly.",
107107
"openid_mfa_complete_title": "Authentication Completed",
108-
"openid_mfa_complete_subtitle": "You have been successfully authenticated. Please close this window and get back to the Defguard VPN Client"
108+
"openid_mfa_complete_subtitle": "You have been successfully authenticated. Please close this window and get back to the Defguard VPN Client",
109+
"open_desktop_title": "Open the desktop app to continue",
110+
"open_desktop_description": "We tried to open the desktop app automatically, but it didn't respond. This can happen if the browser blocks the request or the app didn't start in time.",
111+
"open_desktop_button": "Open desktop app"
109112
}

web/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
},
1515
"dependencies": {
1616
"@axa-ch/react-polymorphic-types": "^1.4.1",
17-
"@floating-ui/react": "^0.27.17",
18-
"@inlang/paraglide-js": "^2.10.0",
19-
"@tanstack/react-devtools": "^0.9.5",
20-
"@tanstack/react-form": "^1.28.0",
21-
"@tanstack/react-query": "^5.90.20",
17+
"@floating-ui/react": "^0.27.18",
18+
"@inlang/paraglide-js": "^2.12.0",
19+
"@tanstack/react-devtools": "^0.9.6",
20+
"@tanstack/react-form": "^1.28.3",
21+
"@tanstack/react-query": "^5.90.21",
2222
"@tanstack/react-query-devtools": "^5.91.3",
23-
"@tanstack/react-router": "^1.159.4",
24-
"@tanstack/react-router-devtools": "^1.159.4",
23+
"@tanstack/react-router": "^1.162.8",
24+
"@tanstack/react-router-devtools": "^1.162.8",
2525
"@uidotdev/usehooks": "^2.4.1",
2626
"axios": "^1.13.5",
2727
"change-case": "^5.4.4",
2828
"clsx": "^2.1.1",
2929
"dayjs": "^1.11.19",
3030
"lodash-es": "^4.17.23",
31-
"motion": "^12.33.0",
31+
"motion": "^12.34.3",
3232
"qrcode.react": "^4.2.0",
33-
"qs": "^6.14.1",
33+
"qs": "^6.15.0",
3434
"react": "^19.2.4",
3535
"react-dom": "^19.2.4",
3636
"react-markdown": "^10.1.0",
@@ -42,22 +42,22 @@
4242
"@biomejs/biome": "2.3.14",
4343
"@inlang/paraglide-js": "2.10.0",
4444
"@tanstack/devtools-vite": "^0.5.1",
45-
"@tanstack/router-plugin": "^1.159.4",
45+
"@tanstack/router-plugin": "^1.162.8",
4646
"@types/lodash-es": "^4.17.12",
47-
"@types/node": "^25.2.2",
47+
"@types/node": "^25.3.0",
4848
"@types/qs": "^6.14.0",
49-
"@types/react": "^19.2.13",
49+
"@types/react": "^19.2.14",
5050
"@types/react-dom": "^19.2.3",
5151
"@vitejs/plugin-react-swc": "^4.2.3",
5252
"globals": "^17.3.0",
5353
"prettier": "^3.8.1",
5454
"sass": "^1.97.3",
5555
"sharp": "^0.34.5",
56-
"stylelint": "^17.1.1",
56+
"stylelint": "^17.3.0",
5757
"stylelint-config-standard-scss": "^17.0.0",
5858
"stylelint-scss": "^7.0.0",
5959
"typescript": "~5.9.3",
60-
"typescript-eslint": "^8.54.0",
60+
"typescript-eslint": "^8.56.1",
6161
"vite": "^7.3.1",
6262
"vite-plugin-image-optimizer": "^2.0.3"
6363
},

0 commit comments

Comments
 (0)