Skip to content

Commit

Permalink
merge dev -> main (#349)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
6 people authored Oct 31, 2024
1 parent ac7eaa0 commit dcb343d
Show file tree
Hide file tree
Showing 142 changed files with 13,784 additions and 8,140 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ rulers = 90
indent_style = space
indent_size = 2
rulers = 80

[*.{rs}]
indent_style = space
indent_size = 4
rulers = 90
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

#### Documentation ###

- [ ] 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
- [ ] 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
- [ ] I have commented on my code, particularly in hard-to-understand areas

#### Testing ###
#### Testing ###

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

### 🏚️ Main Branch Merge Checklist:

#### Testing ###
#### Testing ###

- [ ] I have merged my changes before to dev and the dev checklist is done
- [ ] I have tested all functionalities on the dev instance and they work
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- main
- dev

pull_request:
branches:
- main
Expand All @@ -19,13 +18,13 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '20'

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?

*.db
*.db-shm
*.db-wal
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Desktop client for managing WireGuard VPN connections (any WireGuard server and
- 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!
- Fast! - Built with Rust, [tauri](https://tauri.app/) and [React.js](https://react.dev/).

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

## Development

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

### Proto submodule

Make sure you have cloned, and up to date, proto submodule in `src-tauri/proto`

### Protoc compiler

Make sure you have [protoc](https://grpc.io/docs/protoc-installation/) available.

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

### Sqlx and local database file

To work with sqlx on a local db file, you'll have to set `DATABASE_URL` env variable.
It's best to set it to absolute path since `pnpm tauri dev` runs with weird paths.

Init the file with:

```bash
export DATABASE_URL=sqlite://<full-path-to-project-dir>/dev.db`
sqlx db create
sqlx migrate run --source src-tauri/migrations/
```

Then keep the `$DATABASE_URL` set during development (use direnv etc.)

### Dev server command

```bash
pnpm tauri dev
```

### Build command

```bash
pnpm tauri build
```

Built packages are available after in `src-tauri/target/release/bundle`.

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

# Legal

WireGuard® is [registered trademarks](https://www.wireguard.com/trademark-policy/) of Jason A. Donenfeld.

# Known issues
Expand All @@ -80,3 +100,23 @@ The app launches but the window is blank. Set the `WEBKIT_DISABLE_DMABUF_RENDERE
```
WEBKIT_DISABLE_DMABUF_RENDERER=1 defguard-client
```
## Failed to run `pnpm tauri dev`
`pnpm tauri dev` command may result in the following error:
```
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.
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.
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at Object.<anonymous> (/home/jck/workspace/work/teonite/defguard/client/node_modules/.pnpm/[email protected]/node_modules/read-pkg/index.js:4:18) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v22.7.0
 ELIFECYCLE  Command failed with exit code 1.
Error The "beforeDevCommand" terminated with a non-zero status code.
 ELIFECYCLE  Command failed with exit code 1.
```
To fix this remove node_modules and rerun `pnpm install`.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "defguard-client",
"private": false,
"version": "0.4.1",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "npm-run-all --parallel vite typesafe-i18n",
Expand Down Expand Up @@ -42,17 +42,17 @@
"dependencies": {
"@floating-ui/react": "^0.26.3",
"@hookform/resolvers": "^3.3.2",
"@ladle/react": "^3.3.1",
"@ladle/react": "^4.1.1",
"@stablelib/base64": "^1.0.1",
"@stablelib/x25519": "^1.0.3",
"@tanstack/query-core": "^5.12.1",
"@tanstack/react-virtual": "3.0.0-beta.54",
"@tauri-apps/api": "^1.5.1",
"@tauri-apps/api": "^1.6.0",
"@types/byte-size": "^8.1.2",
"byte-size": "^8.1.1",
"classnames": "^2.3.2",
"compare-versions": "^6.1.0",
"dayjs": "^1.11.10",
"dayjs": "^1.11.13",
"detect-browser": "^5.3.0",
"fast-deep-equal": "^3.1.3",
"file-saver": "^2.0.5",
Expand All @@ -70,9 +70,9 @@
"react-hook-form": "^7.48.2",
"react-loading-skeleton": "^3.3.1",
"react-markdown": "^9.0.1",
"react-qr-code": "^2.0.12",
"react-qr-code": "^2.0.15",
"react-router-dom": "^6.20.1",
"react-virtualized-auto-sizer": "^1.0.20",
"react-virtualized-auto-sizer": "^1.0.24",
"recharts": "^2.10.3",
"rehype-sanitize": "^6.0.0",
"rxjs": "^7.8.1",
Expand All @@ -87,7 +87,7 @@
"@svgr/cli": "^8.1.0",
"@tanstack/react-query": "^5.12.2",
"@tanstack/react-query-devtools": "^5.12.2",
"@tauri-apps/cli": "^1.5.7",
"@tauri-apps/cli": "^1.6.2",
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.10.3",
Expand All @@ -97,7 +97,7 @@
"@typescript-eslint/parser": "^6.13.1",
"@vitejs/plugin-react": "^4.2.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.16",
"autoprefixer": "^10.4.20",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.0",
Expand All @@ -113,7 +113,7 @@
"typesafe-i18n": "^5.26.2",
"typescript": "^5.3.2",
"typescript-eslint-language-service": "^5.0.5",
"vite": "^4.5.1"
"vite": "^4.5.3"
},
"volta": {
"node": "20.5.1"
Expand Down
Loading

0 comments on commit dcb343d

Please sign in to comment.