Skip to content

Commit dcb343d

Browse files
t-aleksandercpprianmoubctezteonj-chmielewski
authored
merge dev -> main (#349)
* After configuring the client with enrollment go to the instance and not adding new instance (#255) * change redirect from addInstant to instantPage * del wireguard-go binary * add app handle for opening app icon from dock in macOS (#260) * Delete wireguard-go-aarch64-apple-darwin accidentally added binaries for macOS * Detail view and grid view (#256) * store ClientView preference into database + if single location with no preference then choose detail view * impl ClientView preference in frontend * swap default value in .envrc * delete attribute from SelectedInstance * Fixes in the enrollment process (#262) * save selectedInstance view after closing client * save last selected location from instance after closing client * fix tunnel pages * add X64 * X64 on lint.yml * first version of toaster for token expiration * add toaster for token expiration * change type of res.data when receiving data from pxoy * Client should remember last instance (#263) * X64 on lint.yml * save selectedInstance view after closing client * save last selected location from instance after closing client * fix tunnel pages * add X64 * fix active instance bugs (#268) * set new activeLocationId after deleting instance * fix closing modals after deleting instance * del unecessary import * Carousel defguard instances (#261) * 'defguard Instances' now redirect to carousel page * navigate to carousel if instances and tunnels lists are empty * add X64 compile options * prerelease 0.5.0 (#269) * After configuring the client with enrollment go to the instance and not adding new instance (#255) * change redirect from addInstant to instantPage * del wireguard-go binary * add app handle for opening app icon from dock in macOS (#260) * Delete wireguard-go-aarch64-apple-darwin accidentally added binaries for macOS * Detail view and grid view (#256) * store ClientView preference into database + if single location with no preference then choose detail view * impl ClientView preference in frontend * swap default value in .envrc * delete attribute from SelectedInstance * Fixes in the enrollment process (#262) * save selectedInstance view after closing client * save last selected location from instance after closing client * fix tunnel pages * add X64 * X64 on lint.yml * first version of toaster for token expiration * add toaster for token expiration * change type of res.data when receiving data from pxoy * Client should remember last instance (#263) * X64 on lint.yml * save selectedInstance view after closing client * save last selected location from instance after closing client * fix tunnel pages * add X64 * fix active instance bugs (#268) * set new activeLocationId after deleting instance * fix closing modals after deleting instance * del unecessary import * Carousel defguard instances (#261) * 'defguard Instances' now redirect to carousel page * navigate to carousel if instances and tunnels lists are empty * add X64 compile options * prerelease 0.5.0 * Version pre 0.5.0 (#270) * prerelease 0.5.0 * update external packages * update rust version from 1.74 to 1.75 --------- Co-authored-by: Aleksander <[email protected]> * Version pre 0.5.0 (#271) * prerelease 0.5.0 * update external packages * update rust version from 1.74 to 1.75 * undo migration file --------- Co-authored-by: Aleksander <[email protected]> * Logs in critical places (#273) * set new activeLocationId after deleting instance * fix closing modals after deleting instance * del unecessary import * add logs about network error * del wireguard-go * add networkError type * Client should remember last instance (#277) * X64 on lint.yml * save selectedInstance view after closing client * save last selected location from instance after closing client * fix tunnel pages * add X64 * fix None occurence if there are no any type of errors * Update src/pages/client/pages/ClientInstancePage/components/StatsLayoutSelect/StatsLayoutSelect.tsx Co-authored-by: Aleksander <[email protected]> --------- Co-authored-by: Aleksander <[email protected]> * Client should remember last instance (#278) * X64 on lint.yml * save selectedInstance view after closing client * save last selected location from instance after closing client * fix tunnel pages * add X64 * fix None occurence if there are no any type of errors * del cargo.lock * remove None from selected view * Code cleanup; service: log dir is a hidden option * Handle quit in AppState * Bump vite * Install Ctrl-C handler; remove unwrap()s * Bump pnpm to v9 * Add known issue to readme * impl tray menu instance submenu (#289) * impl tray menu instance submenu * refactor handle_tray_event * Apply suggestions from code review Co-authored-by: Adam <[email protected]> * Apply suggestions from code review part 2 Co-authored-by: Adam <[email protected]> * Apply suggestions from code review part 3 * add mfa trigger event --------- Co-authored-by: Adam <[email protected]> * Fix: connect location from tray menu (#291) * del preshared_key from event tray menu * cargo fmt && cargo clippy * enhance ux when the desktop configuration session expires (#292) * fixes * fix tests * feat: config polling (#283) * Update protos * Change log level * add reload tray menu in commands: update_instance & delete_instance * update reload tray menu * swap maybe_update with reload_tray_menu * chore: more logs for enrollment process (#296) * chore: database::models module refactoring (#295) * Typestate for Connection * Typestate for `Tunnel` * Refactor `Settings::init_default` method * Typestate for `WireguardKeys` * Typestate for LocationStats & TunnelStats * Typestate for `InstanceInfo` * Working transaction in polling * All models transaction-ready * Remove superfluous FromRow; code cleanup --------- Co-authored-by: Adam Ciarciński <[email protected]> * CI: stick to X64 self-hosted runner * Fix update_tunnel (#300) * feat: add option to prevent routing all traffic through the vpn (#297) * handle disabling route all traffic option on client * cargo fmt * disable_route_all_traffic -> disable_all_traffic * update protobufs * cleanup, fix dev merge conflict errors * Bump defguard_wireguard_rs to v0.4.8 * Handle gRPC connection loss (#288) * fix: fix locked db issue (#298) * Bump defguard_wireguard_rs to 0.4.9 * Rework instance config fetching (#301) * disconnect all traffic when the option changes * sqlx prepare * rework instance settings fetching * cleanup * fix misleading log * update protos * cargo prepare * fix: failed polling request shouldn't make disconnect fail (#303) * Generate polling token on instance update (#304) * set token on update * emit event after commiting * sqlx prepare * multiple dns servers and search domains (#306) * multiple dns and search domains * capitalize * bump wireguard rs (#307) * bump wireguard version (#308) * Updated wireguard-rs dependency * Build deb packages for arm, remove AppImage (#316) * try building client for both architectures * attempt 2 * add dependency * Revert "add dependency" This reverts commit 77204eb. * Revert "attempt 2" This reverts commit 01948b0. * trigger ci * trigger ci 2 * build only for arm * trigger ci 3 * protobuf compiler * finish arm building * attempt 2 * fix * cleanup * WGApi and route cleanup (#318) * wg-rs version bump to 0.5.1 (#322) * Restart defgaurd-service on re-installation (#321) * fix: fix minor bugs (#323) * fix saving a new tunnel * fix font * allow number input * add messages to error toasts * rephrase * New log watcher (#324) * New log watcher * fix inifnite loop, don't parse empty lines * change logs --------- Co-authored-by: Aleksander <[email protected]> * move config polling to enterprise (#328) * feat: Display all logs in settings (#327) * fix number input * New log watcher * fix inifnite loop, don't parse empty lines * global log watcher 1 * cleanup * fix * fix --------- Co-authored-by: Adam Ciarciński <[email protected]> * Align dev branch with main (#336) * Update README.md * move pre/post command functionality to client (#331) * move command functionality to client * fix builds * fix linter * update workflow * change version to 0.4.1 * fmt * command cleanup --------- Co-authored-by: Robert Olejnik <[email protected]> * Change some logs, update wireguard-rs to 0.5.2 (#337) * change logs 1 * don't poll instance that has no token * check if thread is cancelled before executing the loop code * change logs * fix log levels * change some logs * cleanup * bump wireguard-rs * sqlx prepare * fix config polling comparison bug (#338) * Log improvements (#340) * some log improvements, also updates the documentation url * cleanup * cleanup 2 * sqlx prepare * bump wireguard-rs to 0.5.5 * feat: Sync system's connection state on windows (#346) * sync client connections on windows * add target_os to imports * add target_os to more imports * change log message * Bump client version, move more enterprise logic to enterprise folder (#348) * move the disable enterprise function to the enterprise folder * bump version --------- Co-authored-by: Cyprian <[email protected]> Co-authored-by: Adam Ciarciński <[email protected]> Co-authored-by: Robert Olejnik <[email protected]> Co-authored-by: Jacek Chmielewski <[email protected]> Co-authored-by: cpprian <[email protected]>
1 parent ac7eaa0 commit dcb343d

File tree

142 files changed

+13784
-8140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+13784
-8140
lines changed

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ rulers = 90
2626
indent_style = space
2727
indent_size = 2
2828
rulers = 80
29+
30+
[*.{rs}]
31+
indent_style = space
32+
indent_size = 4
33+
rulers = 90

.github/pull_request_template.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88
#### Documentation ###
99

10-
- [ ] If testing requires changes in the environment or deployment, please **update the documentation** (https://defguard.gitbook.io) first and **attach the link to the documentation** section in this pull request
10+
- [ ] If testing requires changes in the environment or deployment, please **update the documentation** (https://docs.defguard.net) first and **attach the link to the documentation** section in this pull request
1111
- [ ] I have commented on my code, particularly in hard-to-understand areas
1212

13-
#### Testing ###
13+
#### Testing ###
1414

1515
- [ ] I have performed manual tests manually and all changes work
1616
- [ ] New and existing unit tests pass locally with my changes
1717

1818
### 🏚️ Main Branch Merge Checklist:
1919

20-
#### Testing ###
20+
#### Testing ###
2121

2222
- [ ] I have merged my changes before to dev and the dev checklist is done
2323
- [ ] I have tested all functionalities on the dev instance and they work

.github/workflows/lint.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches:
66
- main
77
- dev
8-
98
pull_request:
109
branches:
1110
- main
@@ -19,13 +18,13 @@ jobs:
1918
- uses: actions/checkout@v4
2019
with:
2120
submodules: 'recursive'
22-
- uses: actions/setup-node@v3
21+
- uses: actions/setup-node@v4
2322
with:
2423
node-version: '20'
2524

2625
- uses: pnpm/action-setup@v2
2726
with:
28-
version: 8
27+
version: 9
2928
run_install: false
3029

3130
- name: Get pnpm store directory

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
26+
*.db
27+
*.db-shm
28+
*.db-wal

README.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Desktop client for managing WireGuard VPN connections (any WireGuard server and
1717
- Multiple instances & locations - When combining with [defguard](https://github.com/DefGuard/defguard) VPN & SSO you can have multiple defguard instances (sites/installations) and multiple Locations (VPN tunnels in that location/site) in <strong>one client</strong>! If you are an admin/devops - all your customers (instances) and all their tunnels (locations) can be in one place!
1818
- Fast! - Built with Rust, [tauri](https://tauri.app/) and [React.js](https://react.dev/).
1919

20-
To learn more about the system see our [documentation](https://defguard.gitbook.io).
20+
To learn more about the system see our [documentation](https://docs.defguard.net).
2121

2222
## Development
2323

@@ -26,9 +26,11 @@ To learn more about the system see our [documentation](https://defguard.gitbook.
2626
Make sure to install prerequisites from [tauri](https://tauri.app/v1/guides/getting-started/prerequisites/).
2727

2828
### Proto submodule
29+
2930
Make sure you have cloned, and up to date, proto submodule in `src-tauri/proto`
3031

3132
### Protoc compiler
33+
3234
Make sure you have [protoc](https://grpc.io/docs/protoc-installation/) available.
3335

3436
### Install pnpm and node deps
@@ -37,16 +39,33 @@ Make sure you have [protoc](https://grpc.io/docs/protoc-installation/) available
3739
pnpm install
3840
```
3941

42+
### Sqlx and local database file
43+
44+
To work with sqlx on a local db file, you'll have to set `DATABASE_URL` env variable.
45+
It's best to set it to absolute path since `pnpm tauri dev` runs with weird paths.
46+
47+
Init the file with:
48+
49+
```bash
50+
export DATABASE_URL=sqlite://<full-path-to-project-dir>/dev.db`
51+
sqlx db create
52+
sqlx migrate run --source src-tauri/migrations/
53+
```
54+
55+
Then keep the `$DATABASE_URL` set during development (use direnv etc.)
56+
4057
### Dev server command
4158

4259
```bash
4360
pnpm tauri dev
4461
```
4562

4663
### Build command
64+
4765
```bash
4866
pnpm tauri build
4967
```
68+
5069
Built packages are available after in `src-tauri/target/release/bundle`.
5170

5271
### Windows
@@ -60,6 +79,7 @@ Remove `default-run` line from `[package]` section in `Cargo.toml` to build the
6079
</p>
6180

6281
# Legal
82+
6383
WireGuard® is [registered trademarks](https://www.wireguard.com/trademark-policy/) of Jason A. Donenfeld.
6484

6585
# Known issues
@@ -80,3 +100,23 @@ The app launches but the window is blank. Set the `WEBKIT_DISABLE_DMABUF_RENDERE
80100
```
81101
WEBKIT_DISABLE_DMABUF_RENDERER=1 defguard-client
82102
```
103+
104+
## Failed to run `pnpm tauri dev`
105+
106+
`pnpm tauri dev` command may result in the following error:
107+
108+
```
109+
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/jck/workspace/work/teonite/defguard/client/node_modules/.pnpm/[email protected]/node_modules/path-type/index.js from /home/jck/workspace/work/teonite/defguard/client/node_modules/.pnpm/[email protected]/node_modules/read-pkg/index.js not supported.
110+
Instead change the require of /home/jck/workspace/work/teonite/defguard/client/node_modules/.pnpm/[email protected]/node_modules/path-type/index.js in /home/jck/workspace/work/teonite/defguard/client/node_modules/.pnpm/[email protected]/node_modules/read-pkg/index.js to a dynamic import() which is available in all CommonJS modules.
111+
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
112+
at Object.<anonymous> (/home/jck/workspace/work/teonite/defguard/client/node_modules/.pnpm/[email protected]/node_modules/read-pkg/index.js:4:18) {
113+
code: 'ERR_REQUIRE_ESM'
114+
}
115+
116+
Node.js v22.7.0
117+
 ELIFECYCLE  Command failed with exit code 1.
118+
Error The "beforeDevCommand" terminated with a non-zero status code.
119+
 ELIFECYCLE  Command failed with exit code 1.
120+
```
121+
122+
To fix this remove node_modules and rerun `pnpm install`.

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "defguard-client",
33
"private": false,
4-
"version": "0.4.1",
4+
"version": "1.0.0",
55
"type": "module",
66
"scripts": {
77
"dev": "npm-run-all --parallel vite typesafe-i18n",
@@ -42,17 +42,17 @@
4242
"dependencies": {
4343
"@floating-ui/react": "^0.26.3",
4444
"@hookform/resolvers": "^3.3.2",
45-
"@ladle/react": "^3.3.1",
45+
"@ladle/react": "^4.1.1",
4646
"@stablelib/base64": "^1.0.1",
4747
"@stablelib/x25519": "^1.0.3",
4848
"@tanstack/query-core": "^5.12.1",
4949
"@tanstack/react-virtual": "3.0.0-beta.54",
50-
"@tauri-apps/api": "^1.5.1",
50+
"@tauri-apps/api": "^1.6.0",
5151
"@types/byte-size": "^8.1.2",
5252
"byte-size": "^8.1.1",
5353
"classnames": "^2.3.2",
5454
"compare-versions": "^6.1.0",
55-
"dayjs": "^1.11.10",
55+
"dayjs": "^1.11.13",
5656
"detect-browser": "^5.3.0",
5757
"fast-deep-equal": "^3.1.3",
5858
"file-saver": "^2.0.5",
@@ -70,9 +70,9 @@
7070
"react-hook-form": "^7.48.2",
7171
"react-loading-skeleton": "^3.3.1",
7272
"react-markdown": "^9.0.1",
73-
"react-qr-code": "^2.0.12",
73+
"react-qr-code": "^2.0.15",
7474
"react-router-dom": "^6.20.1",
75-
"react-virtualized-auto-sizer": "^1.0.20",
75+
"react-virtualized-auto-sizer": "^1.0.24",
7676
"recharts": "^2.10.3",
7777
"rehype-sanitize": "^6.0.0",
7878
"rxjs": "^7.8.1",
@@ -87,7 +87,7 @@
8787
"@svgr/cli": "^8.1.0",
8888
"@tanstack/react-query": "^5.12.2",
8989
"@tanstack/react-query-devtools": "^5.12.2",
90-
"@tauri-apps/cli": "^1.5.7",
90+
"@tauri-apps/cli": "^1.6.2",
9191
"@types/file-saver": "^2.0.7",
9292
"@types/lodash-es": "^4.17.12",
9393
"@types/node": "^20.10.3",
@@ -97,7 +97,7 @@
9797
"@typescript-eslint/parser": "^6.13.1",
9898
"@vitejs/plugin-react": "^4.2.0",
9999
"@vitejs/plugin-react-swc": "^3.5.0",
100-
"autoprefixer": "^10.4.16",
100+
"autoprefixer": "^10.4.20",
101101
"eslint": "^8.55.0",
102102
"eslint-config-prettier": "^9.1.0",
103103
"eslint-plugin-import": "^2.29.0",
@@ -113,7 +113,7 @@
113113
"typesafe-i18n": "^5.26.2",
114114
"typescript": "^5.3.2",
115115
"typescript-eslint-language-service": "^5.0.5",
116-
"vite": "^4.5.1"
116+
"vite": "^4.5.3"
117117
},
118118
"volta": {
119119
"node": "20.5.1"

0 commit comments

Comments
 (0)