Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@tauri-apps/plugin-notification": "^2.3.1",
"@tauri-apps/plugin-opener": "^2.5.0",
"@tauri-apps/plugin-os": "^2.3.1",
"@tauri-apps/plugin-process": "^2.3.0",
"@tauri-apps/plugin-window-state": "^2.4.0",
"@types/byte-size": "^8.1.2",
"@use-gesture/react": "^10.3.1",
Expand Down Expand Up @@ -92,6 +93,7 @@
"react-click-away-listener": "^2.4.0",
"react-dom": "^19.1.1",
"react-hook-form": "^7.63.0",
"react-hotkeys-hook": "^5.2.1",
"react-loading-skeleton": "^3.5.0",
"react-markdown": "^10.1.0",
"react-qr-code": "^2.0.18",
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 11 additions & 40 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ x25519-dalek = { version = "2", features = [
"serde",
"static_secrets",
] }
tauri-plugin-global-shortcut = "2.3.0"
tauri-plugin-process = "2.3.0"

[target.'cfg(unix)'.dependencies]
hyper-util = "0.1"
Expand Down
1 change: 1 addition & 0 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"os:allow-hostname",
"dialog:default",
"clipboard-manager:allow-write-text",
"process:allow-exit",
{
"identifier": "http:default",
"allow": [
Expand Down
5 changes: 5 additions & 0 deletions src-tauri/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ ignore = [
{ id = "RUSTSEC-2024-0420", reason = "Tauri v2 GTK3 dependency (unmaintained)" },
{ id = "RUSTSEC-2025-0052", reason = "Discontinued, but dark-light v2.0.0 needs it" },
{ id = "RUSTSEC-2025-0057", reason = "Tauri needs it" },
{ id = "RUSTSEC-2025-0075", reason = "Tauri v2 dependency (unmaintained)" },
{ id = "RUSTSEC-2025-0080", reason = "Tauri v2 dependency (unmaintained)" },
{ id = "RUSTSEC-2025-0081", reason = "Tauri v2 dependency (unmaintained)" },
{ id = "RUSTSEC-2025-0098", reason = "Tauri v2 dependency (unmaintained)" },
{ id = "RUSTSEC-2025-0100", reason = "Tauri v2 dependency (unmaintained)" },
]
# If this is true, then cargo deny will use the git executable to fetch advisory database.
# If this is false, then it uses a built-in git library.
Expand Down
16 changes: 1 addition & 15 deletions src-tauri/src/bin/defguard-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use log::{Level, LevelFilter};
#[cfg(target_os = "macos")]
use tauri::{process, Env};
use tauri::{AppHandle, Builder, Manager, RunEvent, WindowEvent};
use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt, Modifiers, Shortcut, ShortcutState};
use tauri_plugin_log::{Target, TargetKind};

#[macro_use]
Expand Down Expand Up @@ -185,6 +184,7 @@ fn main() {
.plugin(tauri_plugin_window_state::Builder::new().build())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_process::init())
.setup(|app| {
// Register for linux and dev windows builds
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]
Expand Down Expand Up @@ -264,20 +264,6 @@ fn main() {
.build(),
)?;

// Setup ctrl-q keyboard shortcut
let ctrl_q_shortcut = Shortcut::new(Some(Modifiers::CONTROL), Code::KeyQ);
app_handle.plugin(
tauri_plugin_global_shortcut::Builder::new()
.with_handler(move |app, shortcut, event| {
if shortcut == &ctrl_q_shortcut && event.state() == ShortcutState::Pressed {
info!("Ctrl-Q pressed, closing active connections and exiting");
app.exit(0);
}
})
.build(),
)?;
app.global_shortcut().register(ctrl_q_shortcut)?;

let state = AppState::new(config);
app.manage(state);

Expand Down
10 changes: 9 additions & 1 deletion src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '../../shared/scss/index.scss';

import { QueryClient } from '@tanstack/query-core';
import { QueryClientProvider } from '@tanstack/react-query';
import { debug } from '@tauri-apps/plugin-log';
import { debug, info } from '@tauri-apps/plugin-log';
import { openUrl } from '@tauri-apps/plugin-opener';
import dayjs from 'dayjs';
import customParseData from 'dayjs/plugin/customParseFormat';
Expand Down Expand Up @@ -38,6 +38,8 @@ import { useTheme } from '../../shared/defguard-ui/hooks/theme/useTheme';
import { ThemeProvider } from '../../shared/providers/ThemeProvider/ThemeProvider';
import { routes } from '../../shared/routes';
import { ApplicationUpdateManager } from '../ApplicationUpdateManager/ApplicationUpdateManager';
import { exit } from '@tauri-apps/plugin-process';
import { useHotkeys } from 'react-hotkeys-hook';

dayjs.extend(duration);
dayjs.extend(utc);
Expand Down Expand Up @@ -186,6 +188,12 @@ export const App = () => {
};
}, []);

// register ctrl+q keyboard shortcut
useHotkeys('ctrl+q', () => {
info("Ctrl-Q pressed, exiting.");
exit(0);
});

if (!appLoaded) return null;

return (
Expand Down