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
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@
"@tauri-apps/plugin-http": "^2.5.2",
"@tauri-apps/plugin-log": "^2.6.0",
"@tauri-apps/plugin-notification": "^2.3.1",
"@tauri-apps/plugin-opener": "^2.5.0",
"@tauri-apps/plugin-window-state": "^2.4.0",
"@types/byte-size": "^8.1.2",
"@use-gesture/react": "^10.3.1",
"byte-size": "^9.0.1",
"classnames": "^2.5.1",
"clsx": "^2.1.1",
"compare-versions": "^6.1.1",
"dayjs": "^1.11.14",
"dayjs": "^1.11.15",
"deepmerge-ts": "^7.1.5",
"detect-browser": "^5.3.0",
"fast-deep-equal": "^3.1.3",
Expand Down Expand Up @@ -113,9 +114,9 @@
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^24.3.0",
"@types/react": "^19.1.11",
"@types/react": "^19.1.12",
"@types/react-dom": "^19.1.8",
"@vitejs/plugin-react": "^5.0.1",
"@vitejs/plugin-react": "^5.0.2",
"@vitejs/plugin-react-swc": "^4.0.1",
"autoprefixer": "^10.4.21",
"npm-run-all": "^4.1.5",
Expand Down
295 changes: 155 additions & 140 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions src-tauri/Cargo.lock

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

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ x25519-dalek = { version = "2", features = [
"serde",
"static_secrets",
] }
tauri-plugin-opener = "2.5.0"

[target.'cfg(unix)'.dependencies]
tokio-stream = "0.1"
Expand Down
8 changes: 8 additions & 0 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
"url": "http://*:*"
}
]
},
{
"identifier": "opener:allow-open-url",
"allow": [
{
"url": "https://*"
}
]
}
]
}
1 change: 1 addition & 0 deletions src-tauri/src/bin/defguard-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ fn main() {
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_window_state::Builder::new().build())
.plugin(tauri_plugin_opener::init())
.setup(|app| {
// Handle deep-links.
let app_handle = app.app_handle().clone();
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub static DB_POOL: LazyLock<SqlitePool> = LazyLock::new(|| {
let db_url = prepare_db_url().expect("Wrong database URL.");
let opts = SqliteConnectOptions::from_str(&db_url)
.expect("Failed to set database connenction options.")
.create_if_missing(true)
.auto_vacuum(SqliteAutoVacuum::Incremental)
.journal_mode(SqliteJournalMode::Wal);
debug!("Connecting to database: {db_url} with options: {opts:?}");
Expand Down
21 changes: 21 additions & 0 deletions src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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 { openUrl } from '@tauri-apps/plugin-opener';
import dayjs from 'dayjs';
import customParseData from 'dayjs/plugin/customParseFormat';
import duration from 'dayjs/plugin/duration';
Expand Down Expand Up @@ -166,6 +167,26 @@ export const App = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
const handler = (e: MouseEvent) => {
const target = e.target as HTMLElement | undefined;
if (target) {
const link = target.closest('a');
if (
link instanceof HTMLAnchorElement &&
link.target === '_blank' &&
link.href.startsWith('https')
) {
void openUrl(link.href);
}
}
};
document.addEventListener('click', handler);
return () => {
document.removeEventListener('click', handler);
};
}, []);

if (!appLoaded) return null;

return (
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ If this will not change, please contact your administrator.`,
vpn: 'Configure VPN',
finish: 'Finish',
mfa: 'Configure MFA',
mfaChoice: 'Choose method',
mfaSetup: 'Complete method',
mfaRecovery: 'Recovery codes',
},
appVersion: 'Application version',
},
Expand Down
24 changes: 24 additions & 0 deletions src/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,18 @@ type RootTranslation = {
* C​o​n​f​i​g​u​r​e​ ​M​F​A
*/
mfa: string
/**
* C​h​o​o​s​e​ ​m​e​t​h​o​d
*/
mfaChoice: string
/**
* C​o​m​p​l​e​t​e​ ​m​e​t​h​o​d
*/
mfaSetup: string
/**
* R​e​c​o​v​e​r​y​ ​c​o​d​e​s
*/
mfaRecovery: string
}
/**
* A​p​p​l​i​c​a​t​i​o​n​ ​v​e​r​s​i​o​n
Expand Down Expand Up @@ -2798,6 +2810,18 @@ export type TranslationFunctions = {
* Configure MFA
*/
mfa: () => LocalizedString
/**
* Choose method
*/
mfaChoice: () => LocalizedString
/**
* Complete method
*/
mfaSetup: () => LocalizedString
/**
* Recovery codes
*/
mfaRecovery: () => LocalizedString
}
/**
* Application version
Expand Down
15 changes: 9 additions & 6 deletions src/pages/client/components/ClientSideBar/ClientSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ import { IconContainer } from '../../../../shared/defguard-ui/components/Layout/
import SvgIconPlus from '../../../../shared/defguard-ui/components/svg/IconPlus';
import SvgIconSettings from '../../../../shared/defguard-ui/components/svg/IconSettings';
import { routes } from '../../../../shared/routes';
import { clientApi } from '../../clientAPI/clientApi';
import { useClientStore } from '../../hooks/useClientStore';
import { WireguardInstanceType } from '../../types';
import { ClientBarItem } from './components/ClientBarItem/ClientBarItem';
import { NewApplicationVersionAvailableInfo } from './components/NewApplicationVersionAvailableInfo/NewApplicationVersionAvailableInfo';

const { openLink } = clientApi;

export const ClientSideBar = () => {
const navigate = useNavigate();
const { LL } = useI18nContext();
Expand Down Expand Up @@ -133,13 +130,19 @@ const FooterApplicationInfo = () => {
<div id="footer-application-info">
<p>
Copyright © {new Date().getFullYear()}{' '}
<span onClick={() => openLink('https://teonite.com/')}>teonite</span>
<a href="https://defguard.net" target="_blank" rel="noopener">
defguard
</a>
</p>
<p>
{LL.pages.client.sideBar.applicationVersion()}
<span onClick={() => openLink('https://github.com/DefGuard/client/releases')}>
<a
href="https://github.com/DefGuard/client/releases"
target="_blank"
rel="noopener"
>
{appVersion}
</span>
</a>
</p>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/client/components/ClientSideBar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@
padding-right: 5px;
}

& > span {
& > a {
color: inherit;
cursor: pointer;
}
}
Expand Down
Loading