Skip to content

Commit 8fb205c

Browse files
committed
Fix Windows build
1 parent b59830e commit 8fb205c

6 files changed

+129
-32
lines changed

src-tauri/.sqlx/query-5953a81f34f906e34aabec089dfe0cebf2afc3ad798638db9ea0aabcd506192b.json

+86
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.lock

+2-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

+18-18
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,24 @@ serde = { version = "1.0", features = ["derive"] }
5050
serde_json = "1.0"
5151
serde_with = "3.11"
5252
sqlx = { version = "0.8", features = [
53-
"chrono",
54-
"sqlite",
55-
"runtime-tokio",
56-
"uuid",
57-
"macros",
53+
"chrono",
54+
"sqlite",
55+
"runtime-tokio",
56+
"uuid",
57+
"macros",
5858
] }
5959
struct-patch = "0.8"
6060
strum = { version = "0.26", features = ["derive"] }
6161
tauri = { version = "1.8", features = [
62-
"notification-all",
63-
"dialog-all",
64-
"clipboard-all",
65-
"http-all",
66-
"window-all",
67-
"system-tray",
68-
"native-tls-vendored",
69-
"icon-png",
70-
"fs-all",
62+
"notification-all",
63+
"dialog-all",
64+
"clipboard-all",
65+
"http-all",
66+
"window-all",
67+
"system-tray",
68+
"native-tls-vendored",
69+
"icon-png",
70+
"fs-all",
7171
] }
7272
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
7373
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
@@ -82,15 +82,15 @@ tracing-appender = "0.2"
8282
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
8383
webbrowser = "1.0"
8484
x25519-dalek = { version = "2", features = [
85-
"getrandom",
86-
"serde",
87-
"static_secrets",
85+
"getrandom",
86+
"serde",
87+
"static_secrets",
8888
] }
8989

9090
[target.'cfg(target_os = "windows")'.dependencies]
9191
windows-service = "0.7"
9292
winapi = { version = "0.3", features = ["winsvc", "winerror"] }
93-
widestring = "0.4"
93+
widestring = "1.1"
9494

9595
[target.'cfg(target_os = "macos")'.dependencies]
9696
nix = { version = "0.29", features = ["net"] }

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
//! This binary is meant to run as a daemon with root privileges
44
//! and communicate with the desktop client over HTTP.
55
6-
use clap::Parser;
7-
use defguard_client::service::{config::Config, run_server};
8-
96
#[cfg(not(windows))]
107
#[tokio::main]
118
async fn main() -> anyhow::Result<()> {
12-
use defguard_client::service::utils::logging_setup;
9+
use clap::Parser;
10+
use defguard_client::service::{config::Config, run_server, utils::logging_setup};
1311

1412
// parse config
1513
let config: Config = Config::parse();

src-tauri/src/database/models/location.rs

+15
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ impl fmt::Display for Location<NoId> {
3636
}
3737

3838
impl Location<Id> {
39+
#[cfg(windows)]
40+
pub(crate) async fn all<'e, E>(executor: E) -> Result<Vec<Self>, SqlxError>
41+
where
42+
E: SqliteExecutor<'e>,
43+
{
44+
query_as!(
45+
Self,
46+
"SELECT id, instance_id, name, address, pubkey, endpoint, allowed_ips, dns, network_id,\
47+
route_all_traffic, mfa_enabled, keepalive_interval \
48+
FROM location;"
49+
)
50+
.fetch_all(executor)
51+
.await
52+
}
53+
3954
pub(crate) async fn save<'e, E>(&mut self, executor: E) -> Result<(), SqlxError>
4055
where
4156
E: SqliteExecutor<'e>,

src-tauri/src/utils.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,9 @@ pub async fn sync_connections(app_handle: &AppHandle) -> Result<(), Error> {
996996
continue;
997997
}
998998

999-
appstate.add_connection(location.id, &interface_name, ConnectionType::Location);
999+
appstate
1000+
.add_connection(location.id, &interface_name, ConnectionType::Location)
1001+
.await;
10001002

10011003
debug!("Sending event informing the frontend that a new connection has been created.");
10021004
app_handle.emit_all(
@@ -1084,7 +1086,9 @@ pub async fn sync_connections(app_handle: &AppHandle) -> Result<(), Error> {
10841086
continue;
10851087
}
10861088

1087-
appstate.add_connection(tunnel.id, &interface_name, ConnectionType::Tunnel);
1089+
appstate
1090+
.add_connection(tunnel.id, &interface_name, ConnectionType::Tunnel)
1091+
.await;
10881092

10891093
debug!("Sending event informing the frontend that a new connection has been created.");
10901094
app_handle.emit_all(

0 commit comments

Comments
 (0)