mirror of
https://github.com/WGDashboard/WGDashboard.git
synced 2026-12-01 08:57:45 +00:00
+1







![dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>](/assets/img/avatar_default.png)

Donald Zou
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
daanselen
neolegshishov
Tom Mills
Giuseppe Marinelli
Claude Sonnet 4.6
freetushkan
sneds91
sgtdeagle
Truffle
b83c0f85ba
* build(deps): bump sqlalchemy from 2.0.46 to 2.0.49 in /src
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.46 to 2.0.49.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)
---
updated-dependencies:
- dependency-name: sqlalchemy
dependency-version: 2.0.49
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump ol from 10.7.0 to 10.8.0 in /src/static/app
Bumps [ol](https://github.com/openlayers/openlayers) from 10.7.0 to 10.8.0.
- [Release notes](https://github.com/openlayers/openlayers/releases)
- [Commits](https://github.com/openlayers/openlayers/compare/v10.7.0...v10.8.0)
---
updated-dependencies:
- dependency-name: ol
dependency-version: 10.8.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump vue from 3.5.31 to 3.5.32 in /src/static/app
Bumps [vue](https://github.com/vuejs/core) from 3.5.31 to 3.5.32.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.5.31...v3.5.32)
---
updated-dependencies:
- dependency-name: vue
dependency-version: 3.5.32
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump fuse.js from 7.1.0 to 7.3.0 in /src/static/app
Bumps [fuse.js](https://github.com/krisk/Fuse) from 7.1.0 to 7.3.0.
- [Release notes](https://github.com/krisk/Fuse/releases)
- [Changelog](https://github.com/krisk/Fuse/blob/main/CHANGELOG.md)
- [Commits](https://github.com/krisk/Fuse/compare/v7.1.0...v7.3.0)
---
updated-dependencies:
- dependency-name: fuse.js
dependency-version: 7.3.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 7.3.1 to 8.0.8 in /src/static/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 7.3.1 to 8.0.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.8/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.8
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 6.4.1 to 8.0.8 in /src/static/client
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.4.1 to 8.0.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.8/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.8
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump cidr-tools from 11.3.2 to 11.3.3 in /src/static/app
Bumps [cidr-tools](https://github.com/silverwind/cidr-tools) from 11.3.2 to 11.3.3.
- [Release notes](https://github.com/silverwind/cidr-tools/releases)
- [Commits](https://github.com/silverwind/cidr-tools/compare/11.3.2...11.3.3)
---
updated-dependencies:
- dependency-name: cidr-tools
dependency-version: 11.3.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump uuid from 11.1.0 to 13.0.0 in /src/static/client
Bumps [uuid](https://github.com/uuidjs/uuid) from 11.1.0 to 13.0.0.
- [Release notes](https://github.com/uuidjs/uuid/releases)
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v11.1.0...v13.0.0)
---
updated-dependencies:
- dependency-name: uuid
dependency-version: 13.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump oidc-client-ts in /src/static/client
Bumps [oidc-client-ts](https://github.com/authts/oidc-client-ts) from 3.2.1 to 3.5.0.
- [Release notes](https://github.com/authts/oidc-client-ts/releases)
- [Commits](https://github.com/authts/oidc-client-ts/compare/v3.2.1...v3.5.0)
---
updated-dependencies:
- dependency-name: oidc-client-ts
dependency-version: 3.5.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump pydantic from 2.12.5 to 2.13.0 in /src
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.12.5 to 2.13.0.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.12.5...v2.13.0)
---
updated-dependencies:
- dependency-name: pydantic
dependency-version: 2.13.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump vue from 3.5.16 to 3.5.32 in /src/static/client
Bumps [vue](https://github.com/vuejs/core) from 3.5.16 to 3.5.32.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.5.16...v3.5.32)
---
updated-dependencies:
- dependency-name: vue
dependency-version: 3.5.32
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* fix: misspell (#1231)
* build(deps-dev): bump vite-plugin-vue-devtools in /src/static/client
Bumps [vite-plugin-vue-devtools](https://github.com/vuejs/devtools/tree/HEAD/packages/vite) from 7.7.6 to 8.1.1.
- [Release notes](https://github.com/vuejs/devtools/releases)
- [Commits](https://github.com/vuejs/devtools/commits/v8.1.1/packages/vite)
---
updated-dependencies:
- dependency-name: vite-plugin-vue-devtools
dependency-version: 8.1.1
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite-plugin-vue-devtools in /src/static/client
Bumps [vite-plugin-vue-devtools](https://github.com/vuejs/devtools/tree/HEAD/packages/vite) from 7.7.6 to 8.1.1.
- [Release notes](https://github.com/vuejs/devtools/releases)
- [Commits](https://github.com/vuejs/devtools/commits/v8.1.1/packages/vite)
---
updated-dependencies:
- dependency-name: vite-plugin-vue-devtools
dependency-version: 8.1.1
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump vue from 3.5.16 to 3.5.32 in /src/static/client
Bumps [vue](https://github.com/vuejs/core) from 3.5.16 to 3.5.32.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.5.16...v3.5.32)
---
updated-dependencies:
- dependency-name: vue
dependency-version: 3.5.32
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump pydantic from 2.12.5 to 2.13.0 in /src
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.12.5 to 2.13.0.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.12.5...v2.13.0)
---
updated-dependencies:
- dependency-name: pydantic
dependency-version: 2.13.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump sqlalchemy from 2.0.46 to 2.0.49 in /src
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.46 to 2.0.49.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)
---
updated-dependencies:
- dependency-name: sqlalchemy
dependency-version: 2.0.49
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* feat: commit PR 1237 to development
* Add preshared key default toggle (#1207)
* Add previous PR changes
* Import lowercase dayjs
* Build dist
* Revert "Build dist"
This reverts commit 152da2ca10
Dist not to be built at @DaanSelen request
* build(deps): bump pydantic from 2.13.0 to 2.13.3 in /src
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.13.0 to 2.13.3.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.13.0...v2.13.3)
---
updated-dependencies:
- dependency-name: pydantic
dependency-version: 2.13.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump uuid from 13.0.0 to 14.0.0 in /src/static/app
Bumps [uuid](https://github.com/uuidjs/uuid) from 13.0.0 to 14.0.0.
- [Release notes](https://github.com/uuidjs/uuid/releases)
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v13.0.0...v14.0.0)
---
updated-dependencies:
- dependency-name: uuid
dependency-version: 14.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 8.0.8 to 8.0.9 in /src/static/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.0.8 to 8.0.9.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.9/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.9
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump @vue/language-server in /src/static/app
Bumps [@vue/language-server](https://github.com/vuejs/language-tools/tree/HEAD/packages/language-server) from 3.2.4 to 3.2.7.
- [Release notes](https://github.com/vuejs/language-tools/releases)
- [Changelog](https://github.com/vuejs/language-tools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vuejs/language-tools/commits/v3.2.7/packages/language-server)
---
updated-dependencies:
- dependency-name: "@vue/language-server"
dependency-version: 3.2.7
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump ol from 10.8.0 to 10.9.0 in /src/static/app
Bumps [ol](https://github.com/openlayers/openlayers) from 10.8.0 to 10.9.0.
- [Release notes](https://github.com/openlayers/openlayers/releases)
- [Commits](https://github.com/openlayers/openlayers/compare/v10.8.0...v10.9.0)
---
updated-dependencies:
- dependency-name: ol
dependency-version: 10.9.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump @vitejs/plugin-vue in /src/static/client
Bumps [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue) from 5.2.4 to 6.0.6.
- [Release notes](https://github.com/vitejs/vite-plugin-vue/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-vue/commits/[email protected]/packages/plugin-vue)
---
updated-dependencies:
- dependency-name: "@vitejs/plugin-vue"
dependency-version: 6.0.6
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump axios from 1.14.0 to 1.15.1 in /src/static/client
Bumps [axios](https://github.com/axios/axios) from 1.14.0 to 1.15.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.14.0...v1.15.1)
---
updated-dependencies:
- dependency-name: axios
dependency-version: 1.15.1
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump uuid from 13.0.0 to 14.0.0 in /src/static/client
Bumps [uuid](https://github.com/uuidjs/uuid) from 13.0.0 to 14.0.0.
- [Release notes](https://github.com/uuidjs/uuid/releases)
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v13.0.0...v14.0.0)
---
updated-dependencies:
- dependency-name: uuid
dependency-version: 14.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump pinia from 3.0.2 to 3.0.4 in /src/static/client
Bumps [pinia](https://github.com/vuejs/pinia) from 3.0.2 to 3.0.4.
- [Release notes](https://github.com/vuejs/pinia/releases)
- [Commits](https://github.com/vuejs/pinia/compare/v3.0.2...v3.0.4)
---
updated-dependencies:
- dependency-name: pinia
dependency-version: 3.0.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* Refactor peer schedule job API to use proper REST verbs (#1239)
* Fixed quotation marks
* Update wgd.sh
* Refactor peer schedule job API to use proper REST verbs
Replace single POST endpoints with POST/PUT/DELETE for peer schedule jobs.
Add require_fields decorator for request validation. Add fetchPut and
fetchDelete helpers in the frontend.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* Add local development with Docker section to docker/README.md
Explains how to mount src/ as a volume for live code editing
using a compose-local.yaml setup.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* Update README dev section with frontend build instructions
Replace Vite dev server tip with npm install/build workflow
and docker restart step.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---------
Co-authored-by: Donald Zou <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
* A patch to support a wide range of AmneziaWG versions. (#1210)
Support for all keys ever used in AmneziaWG has been added. Setting an empty value to a key will prevent it from being used or rendered in the configuration. This ensures flexible support for all versions and specific configurations.
* Fix config info loss when renaming a tunnel. (#1254)
This migrates data to the new tunnel when renaming, such as: Description, OverridePeerSettings, PeerGroups, PeerHistoricalEndpointTracking, PeerTrafficTracking.
* build(deps-dev): bump @vitejs/plugin-vue in /src/static/app
Bumps [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/HEAD/packages/plugin-vue) from 6.0.4 to 6.0.6.
- [Release notes](https://github.com/vitejs/vite-plugin-vue/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-vue/commits/[email protected]/packages/plugin-vue)
---
updated-dependencies:
- dependency-name: "@vitejs/plugin-vue"
dependency-version: 6.0.6
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump bootstrap from 5.3.6 to 5.3.8 in /src/static/client
Bumps [bootstrap](https://github.com/twbs/bootstrap) from 5.3.6 to 5.3.8.
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v5.3.6...v5.3.8)
---
updated-dependencies:
- dependency-name: bootstrap
dependency-version: 5.3.8
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* Fix TOTP verification with valid window
* build(deps): bump pymysql from 1.1.2 to 1.1.3 in /src
Bumps [pymysql](https://github.com/PyMySQL/PyMySQL) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/PyMySQL/PyMySQL/releases)
- [Changelog](https://github.com/PyMySQL/PyMySQL/blob/main/CHANGELOG.md)
- [Commits](https://github.com/PyMySQL/PyMySQL/compare/v1.1.2...v1.1.3)
---
updated-dependencies:
- dependency-name: pymysql
dependency-version: 1.1.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump psycopg from 3.3.3 to 3.3.4 in /src
Bumps [psycopg](https://github.com/psycopg/psycopg) from 3.3.3 to 3.3.4.
- [Changelog](https://github.com/psycopg/psycopg/blob/master/docs/news.rst)
- [Commits](https://github.com/psycopg/psycopg/compare/3.3.3...3.3.4)
---
updated-dependencies:
- dependency-name: psycopg
dependency-version: 3.3.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump npm from 11.12.1 to 11.13.0 in /src/static/app
Bumps [npm](https://github.com/npm/cli) from 11.12.1 to 11.13.0.
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/v11.13.0/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v11.12.1...v11.13.0)
---
updated-dependencies:
- dependency-name: npm
dependency-version: 11.13.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump @vueuse/shared in /src/static/app
Bumps [@vueuse/shared](https://github.com/vueuse/vueuse/tree/HEAD/packages/shared) from 14.2.1 to 14.3.0.
- [Release notes](https://github.com/vueuse/vueuse/releases)
- [Commits](https://github.com/vueuse/vueuse/commits/v14.3.0/packages/shared)
---
updated-dependencies:
- dependency-name: "@vueuse/shared"
dependency-version: 14.3.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump vue-router from 5.0.4 to 5.0.6 in /src/static/app
Bumps [vue-router](https://github.com/vuejs/router) from 5.0.4 to 5.0.6.
- [Release notes](https://github.com/vuejs/router/releases)
- [Commits](https://github.com/vuejs/router/compare/v5.0.4...v5.0.6)
---
updated-dependencies:
- dependency-name: vue-router
dependency-version: 5.0.6
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 8.0.9 to 8.0.10 in /src/static/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.0.9 to 8.0.10.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.10/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.10
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump cidr-tools from 11.3.3 to 11.3.5 in /src/static/app
Bumps [cidr-tools](https://github.com/silverwind/cidr-tools) from 11.3.3 to 11.3.5.
- [Release notes](https://github.com/silverwind/cidr-tools/releases)
- [Commits](https://github.com/silverwind/cidr-tools/compare/11.3.3...11.3.5)
---
updated-dependencies:
- dependency-name: cidr-tools
dependency-version: 11.3.5
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump axios from 1.15.1 to 1.16.0 in /src/static/client
Bumps [axios](https://github.com/axios/axios) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.15.1...v1.16.0)
---
updated-dependencies:
- dependency-name: axios
dependency-version: 1.16.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* change email attachmentname to peerName if not empty
* Use network_address for single-address IPs
When parsing allowed_ip entries in API_ping_getAllPeersIpAddress(), detect networks with a single address (ip.num_addresses == 1) and append ip.network_address directly to the parsed list. This replaces the previous host-list construction (list(ip.hosts()) / host[0]) to simplify logic and avoid iterating hosts for /32 or single-address ranges while keeping existing error logging for invalid addresses.
* build(deps): bump requests from 2.32.5 to 2.34.0 in /src
Bumps [requests](https://github.com/psf/requests) from 2.32.5 to 2.34.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.5...v2.34.0)
---
updated-dependencies:
- dependency-name: requests
dependency-version: 2.34.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump gunicorn from 25.0.3 to 26.0.0 in /src
Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 25.0.3 to 26.0.0.
- [Release notes](https://github.com/benoitc/gunicorn/releases)
- [Commits](https://github.com/benoitc/gunicorn/compare/25.0.3...26.0.0)
---
updated-dependencies:
- dependency-name: gunicorn
dependency-version: 26.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump pydantic from 2.13.3 to 2.13.4 in /src
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.13.3 to 2.13.4.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/v2.13.4/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.13.3...v2.13.4)
---
updated-dependencies:
- dependency-name: pydantic
dependency-version: 2.13.4
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 8.0.8 to 8.0.12 in /src/static/client
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.0.8 to 8.0.12.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.12/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.12
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* Fix Python 3.11 SyntaxError in AmneziaPeer.py (#1290)
Python 3.11 raises 'f-string expression part cannot include a backslash'
on line 91, where strip('\n') sits inside an f-string {...}. PEP 701
lifted this restriction in 3.12.
Bind the decoded output to a local so the strip call happens outside
the f-string, which also removes the duplicate decode+strip already
performed on the preceding length check.
Closes #1289
Signed-off-by: Truffle <[email protected]>
* build(deps): bump vue from 3.5.32 to 3.5.35 in /src/static/client
Bumps [vue](https://github.com/vuejs/core) from 3.5.32 to 3.5.35.
- [Release notes](https://github.com/vuejs/core/releases)
- [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vuejs/core/compare/v3.5.32...v3.5.35)
---
updated-dependencies:
- dependency-name: vue
dependency-version: 3.5.34
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite-plugin-vue-devtools in /src/static/client
Bumps [vite-plugin-vue-devtools](https://github.com/vuejs/devtools/tree/HEAD/packages/vite) from 8.1.1 to 8.1.2.
- [Release notes](https://github.com/vuejs/devtools/releases)
- [Commits](https://github.com/vuejs/devtools/commits/v8.1.2/packages/vite)
---
updated-dependencies:
- dependency-name: vite-plugin-vue-devtools
dependency-version: 8.1.2
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump vue-router from 4.5.1 to 5.1.0 in /src/static/client
Bumps [vue-router](https://github.com/vuejs/router) from 4.5.1 to 5.1.0.
- [Release notes](https://github.com/vuejs/router/releases)
- [Commits](https://github.com/vuejs/router/compare/v4.5.1...v5.1.0)
---
updated-dependencies:
- dependency-name: vue-router
dependency-version: 5.0.6
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump requests from 2.34.0 to 2.34.2 in /src
Bumps [requests](https://github.com/psf/requests) from 2.34.0 to 2.34.2.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.34.0...v2.34.2)
---
updated-dependencies:
- dependency-name: requests
dependency-version: 2.34.2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump @vuepic/vue-datepicker in /src/static/app
Bumps [@vuepic/vue-datepicker](https://github.com/Vuepic/vue-datepicker) from 12.1.0 to 14.0.0.
- [Release notes](https://github.com/Vuepic/vue-datepicker/releases)
- [Changelog](https://github.com/Vuepic/vue-datepicker/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Vuepic/vue-datepicker/compare/v12.1.0...v14.0.0)
---
updated-dependencies:
- dependency-name: "@vuepic/vue-datepicker"
dependency-version: 14.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump flask-cors from 6.0.2 to 6.0.5 in /src
Bumps [flask-cors](https://github.com/corydolphin/flask-cors) from 6.0.2 to 6.0.5.
- [Release notes](https://github.com/corydolphin/flask-cors/releases)
- [Changelog](https://github.com/corydolphin/flask-cors/blob/main/CHANGELOG.md)
- [Commits](https://github.com/corydolphin/flask-cors/compare/6.0.2...6.0.5)
---
updated-dependencies:
- dependency-name: flask-cors
dependency-version: 6.0.5
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump pymysql from 1.1.3 to 1.2.0 in /src
Bumps [pymysql](https://github.com/PyMySQL/PyMySQL) from 1.1.3 to 1.2.0.
- [Release notes](https://github.com/PyMySQL/PyMySQL/releases)
- [Changelog](https://github.com/PyMySQL/PyMySQL/blob/main/CHANGELOG.md)
- [Commits](https://github.com/PyMySQL/PyMySQL/compare/v1.1.3...v1.2.0)
---
updated-dependencies:
- dependency-name: pymysql
dependency-version: 1.2.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 8.0.10 to 8.0.16 in /src/static/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.0.10 to 8.0.16.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.16/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.16
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump cidr-tools from 11.3.5 to 12.0.2 in /src/static/app
Bumps [cidr-tools](https://github.com/silverwind/cidr-tools) from 11.3.5 to 12.0.2.
- [Release notes](https://github.com/silverwind/cidr-tools/releases)
- [Commits](https://github.com/silverwind/cidr-tools/compare/11.3.5...12.0.2)
---
updated-dependencies:
- dependency-name: cidr-tools
dependency-version: 12.0.2
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps-dev): bump vite from 8.0.12 to 8.0.16 in /src/static/client
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.0.12 to 8.0.16.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.16/packages/vite)
---
updated-dependencies:
- dependency-name: vite
dependency-version: 8.0.16
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump dayjs from 1.11.20 to 1.11.21 in /src/static/client
Bumps [dayjs](https://github.com/iamkun/dayjs) from 1.11.20 to 1.11.21.
- [Release notes](https://github.com/iamkun/dayjs/releases)
- [Changelog](https://github.com/iamkun/dayjs/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/iamkun/dayjs/compare/v1.11.20...v1.11.21)
---
updated-dependencies:
- dependency-name: dayjs
dependency-version: 1.11.21
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump pyotp from 2.9.0 to 2.10.0 in /src
Bumps [pyotp](https://github.com/pyauth/pyotp) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/pyauth/pyotp/releases)
- [Changelog](https://github.com/pyauth/pyotp/blob/main/Changes.rst)
- [Commits](https://github.com/pyauth/pyotp/compare/v2.9.0...v2.10.0)
---
updated-dependencies:
- dependency-name: pyotp
dependency-version: 2.10.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump alpine from 3.23 to 3.24 in /docker
Bumps alpine from 3.23 to 3.24.
---
updated-dependencies:
- dependency-name: alpine
dependency-version: '3.24'
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump sqlalchemy from 2.0.49 to 2.0.51 in /src
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.49 to 2.0.51.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)
---
updated-dependencies:
- dependency-name: sqlalchemy
dependency-version: 2.0.51
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
* build(deps): bump axios from 1.16.0 to 1.18.0 in /src/static/client
Bumps [axios](https://github.com/axios/axios) from 1.16.0 to 1.18.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.16.0...v1.18.0)
---
updated-dependencies:
- dependency-name: axios
dependency-version: 1.18.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* Added OIDC for admin side
* Updated OIDC Algorithm Fallback
* chore: remove dist
---------
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Truffle <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daan Selen <[email protected]>
Co-authored-by: neolegshishov <[email protected]>
Co-authored-by: Tom Mills <[email protected]>
Co-authored-by: Giuseppe Marinelli <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: freetushkan <[email protected]>
Co-authored-by: sneds91 <[email protected]>
Co-authored-by: sgtdeagle <[email protected]>
Co-authored-by: Truffle <[email protected]>
336 lines
14 KiB
Python
336 lines
14 KiB
Python
"""
|
|
Dashboard Configuration
|
|
"""
|
|
import configparser, secrets, os, pyotp, ipaddress, bcrypt
|
|
from sqlalchemy_utils import database_exists, create_database
|
|
import sqlalchemy as db
|
|
from datetime import datetime
|
|
from typing import Any
|
|
from flask import current_app
|
|
from .DatabaseConnection import ConnectionString
|
|
from .Utilities import (GetRemoteEndpoint, ValidateDNSAddress)
|
|
from .DashboardAPIKey import DashboardAPIKey
|
|
|
|
class DashboardConfig:
|
|
DashboardVersion = 'v4.3.4'
|
|
ConfigurationPath = os.getenv('CONFIGURATION_PATH', '.')
|
|
ConfigurationFilePath = os.path.join(ConfigurationPath, 'wg-dashboard.ini')
|
|
|
|
def __init__(self):
|
|
if not os.path.exists(DashboardConfig.ConfigurationFilePath):
|
|
open(DashboardConfig.ConfigurationFilePath, "x")
|
|
self.__config = configparser.RawConfigParser(strict=False)
|
|
self.__config.read_file(open(DashboardConfig.ConfigurationFilePath, "r+"))
|
|
self.hiddenAttribute = ["totp_key", "auth_req"]
|
|
self.__default = {
|
|
"Account": {
|
|
"username": "admin",
|
|
"password": "admin",
|
|
"enable_totp": "false",
|
|
"totp_verified": "false",
|
|
"totp_key": pyotp.random_base32()
|
|
},
|
|
"Server": {
|
|
"wg_conf_path": "/etc/wireguard",
|
|
"awg_conf_path": "/etc/amnezia/amneziawg",
|
|
"app_prefix": "",
|
|
"app_ip": "0.0.0.0",
|
|
"app_port": "10086",
|
|
"auth_req": "true",
|
|
"version": DashboardConfig.DashboardVersion,
|
|
"dashboard_refresh_interval": "60000",
|
|
"dashboard_peer_list_display": "grid",
|
|
"dashboard_sort": "status",
|
|
"dashboard_theme": "dark",
|
|
"dashboard_api_key": "false",
|
|
"dashboard_language": "en-US"
|
|
},
|
|
"Peers": {
|
|
"peer_global_DNS": "1.1.1.1",
|
|
"peer_endpoint_allowed_ip": "0.0.0.0/0",
|
|
"peer_display_mode": "grid",
|
|
"remote_endpoint": GetRemoteEndpoint(),
|
|
"peer_MTU": "1420",
|
|
"peer_keep_alive": "21",
|
|
"peer_preshared_key_default": "false"
|
|
},
|
|
"Other": {
|
|
"welcome_session": "true"
|
|
},
|
|
"Database":{
|
|
"type": "sqlite",
|
|
"host": "",
|
|
"port": "",
|
|
"username": "",
|
|
"password": ""
|
|
},
|
|
"Email":{
|
|
"server": "",
|
|
"port": "",
|
|
"encryption": "",
|
|
"username": "",
|
|
"email_password": "",
|
|
"authentication_required": "true",
|
|
"send_from": "",
|
|
"email_template": ""
|
|
},
|
|
"OIDC": {
|
|
"admin_enable": "false",
|
|
"client_enable": "false"
|
|
},
|
|
"Clients": {
|
|
"enable": "true",
|
|
"sign_up": "true"
|
|
},
|
|
"WireGuardConfiguration": {
|
|
"autostart": "",
|
|
"peer_tracking": "false"
|
|
}
|
|
}
|
|
|
|
for section, keys in self.__default.items():
|
|
for key, value in keys.items():
|
|
exist, currentData = self.GetConfig(section, key)
|
|
if not exist:
|
|
self.SetConfig(section, key, value, True)
|
|
|
|
self.engine = db.create_engine(ConnectionString('wgdashboard'))
|
|
self.dbMetadata = db.MetaData()
|
|
self.__createAPIKeyTable()
|
|
self.DashboardAPIKeys = self.__getAPIKeys()
|
|
self.APIAccessed = False
|
|
self.SetConfig("Server", "version", DashboardConfig.DashboardVersion)
|
|
|
|
def EnsureDatabaseIntegrity(self, wireguardConfigurations):
|
|
expected_columns = {
|
|
'id': db.String(255),
|
|
'private_key': db.String(255),
|
|
'DNS': db.Text,
|
|
'endpoint_allowed_ip': db.Text,
|
|
'name': db.Text,
|
|
'total_receive': db.Float,
|
|
'total_sent': db.Float,
|
|
'total_data': db.Float,
|
|
'endpoint': db.String(255),
|
|
'status': db.String(255),
|
|
'latest_handshake': db.String(255),
|
|
'allowed_ip': db.String(255),
|
|
'cumu_receive': db.Float,
|
|
'cumu_sent': db.Float,
|
|
'cumu_data': db.Float,
|
|
'mtu': db.Integer,
|
|
'keepalive': db.Integer,
|
|
'notes': db.Text,
|
|
'remote_endpoint': db.String(255),
|
|
'preshared_key': db.String(255)
|
|
}
|
|
|
|
inspector = db.inspect(self.engine)
|
|
|
|
with self.engine.begin() as conn:
|
|
for cfg_name, cfg_obj in wireguardConfigurations.items():
|
|
tables_to_check = [
|
|
cfg_name,
|
|
f'{cfg_name}_restrict_access',
|
|
f'{cfg_name}_deleted'
|
|
]
|
|
|
|
for table_name in tables_to_check:
|
|
if not table_name:
|
|
continue
|
|
if not inspector.has_table(table_name):
|
|
continue
|
|
|
|
existing_columns = [c['name'] for c in inspector.get_columns(table_name)]
|
|
|
|
for col_name, col_type in expected_columns.items():
|
|
if col_name not in existing_columns:
|
|
type_str = col_type().compile(dialect=self.engine.dialect)
|
|
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
|
|
preparer = self.engine.dialect.identifier_preparer
|
|
quoted_table = preparer.quote_identifier(table_name)
|
|
quoted_column = preparer.quote_identifier(col_name)
|
|
conn.execute(db.text(f"ALTER TABLE {quoted_table} ADD COLUMN {quoted_column} {type_str}"))
|
|
|
|
def getConnectionString(self, database) -> str or None:
|
|
sqlitePath = os.path.join(DashboardConfig.ConfigurationPath, "db")
|
|
|
|
if not os.path.isdir(sqlitePath):
|
|
os.mkdir(sqlitePath)
|
|
|
|
if self.GetConfig("Database", "type")[1] == "postgresql":
|
|
cn = f'postgresql+psycopg2://{self.GetConfig("Database", "username")[1]}:{self.GetConfig("Database", "password")[1]}@{self.GetConfig("Database", "host")[1]}/{database}'
|
|
elif self.GetConfig("Database", "type")[1] == "mysql":
|
|
cn = f'mysql+mysqldb://{self.GetConfig("Database", "username")[1]}:{self.GetConfig("Database", "password")[1]}@{self.GetConfig("Database", "host")[1]}/{database}'
|
|
else:
|
|
cn = f'sqlite:///{os.path.join(sqlitePath, f"{database}.db")}'
|
|
if not database_exists(cn):
|
|
create_database(cn)
|
|
return cn
|
|
|
|
def __createAPIKeyTable(self):
|
|
self.apiKeyTable = db.Table('DashboardAPIKeys', self.dbMetadata,
|
|
db.Column("Key", db.String(255), nullable=False, primary_key=True),
|
|
db.Column("CreatedAt",
|
|
(db.DATETIME if self.GetConfig('Database', 'type')[1] == 'sqlite' else db.TIMESTAMP),
|
|
server_default=db.func.now()
|
|
),
|
|
db.Column("ExpiredAt",
|
|
(db.DATETIME if self.GetConfig('Database', 'type')[1] == 'sqlite' else db.TIMESTAMP)
|
|
)
|
|
)
|
|
self.dbMetadata.create_all(self.engine)
|
|
def __getAPIKeys(self) -> list[DashboardAPIKey]:
|
|
try:
|
|
with self.engine.connect() as conn:
|
|
keys = conn.execute(self.apiKeyTable.select().where(
|
|
db.or_(self.apiKeyTable.columns.ExpiredAt.is_(None), self.apiKeyTable.columns.ExpiredAt > datetime.now())
|
|
)).fetchall()
|
|
fKeys = []
|
|
for k in keys:
|
|
fKeys.append(DashboardAPIKey(k[0], k[1].strftime("%Y-%m-%d %H:%M:%S"), (k[2].strftime("%Y-%m-%d %H:%M:%S") if k[2] else None)))
|
|
return fKeys
|
|
except Exception as e:
|
|
current_app.logger.error("API Keys error", e)
|
|
return []
|
|
|
|
def createAPIKeys(self, ExpiredAt = None):
|
|
newKey = secrets.token_urlsafe(32)
|
|
with self.engine.begin() as conn:
|
|
conn.execute(
|
|
self.apiKeyTable.insert().values({
|
|
"Key": newKey,
|
|
"ExpiredAt": ExpiredAt
|
|
})
|
|
)
|
|
|
|
self.DashboardAPIKeys = self.__getAPIKeys()
|
|
|
|
def deleteAPIKey(self, key):
|
|
with self.engine.begin() as conn:
|
|
conn.execute(
|
|
self.apiKeyTable.update().values({
|
|
"ExpiredAt": datetime.now(),
|
|
}).where(self.apiKeyTable.columns.Key == key)
|
|
)
|
|
|
|
self.DashboardAPIKeys = self.__getAPIKeys()
|
|
|
|
def __configValidation(self, section : str, key: str, value: Any) -> tuple[bool, str]:
|
|
if (type(value) is str and len(value) == 0
|
|
and section not in ['Email', 'WireGuardConfiguration'] and
|
|
(section == 'Peer' and key == 'peer_global_dns')):
|
|
return False, "Field cannot be empty!"
|
|
if section == "Peers" and key == "peer_global_dns" and len(value) > 0:
|
|
return ValidateDNSAddress(value)
|
|
if section == "Peers" and key == "peer_endpoint_allowed_ip":
|
|
value = value.split(",")
|
|
for i in value:
|
|
i = i.strip()
|
|
try:
|
|
ipaddress.ip_network(i, strict=False)
|
|
except Exception as e:
|
|
return False, str(e)
|
|
if section == "Server" and key == "wg_conf_path":
|
|
if not os.path.exists(value):
|
|
return False, f"{value} is not a valid path"
|
|
if section == "Account" and key == "password":
|
|
if self.GetConfig("Account", "password")[0]:
|
|
if not self.__checkPassword(
|
|
value["currentPassword"], self.GetConfig("Account", "password")[1].encode("utf-8")):
|
|
return False, "Current password does not match."
|
|
if value["newPassword"] != value["repeatNewPassword"]:
|
|
return False, "New passwords does not match"
|
|
return True, ""
|
|
|
|
def generatePassword(self, plainTextPassword: str):
|
|
return bcrypt.hashpw(plainTextPassword.encode("utf-8"), bcrypt.gensalt())
|
|
|
|
def __checkPassword(self, plainTextPassword: str, hashedPassword: bytes):
|
|
return bcrypt.checkpw(plainTextPassword.encode("utf-8"), hashedPassword)
|
|
|
|
def SetConfig(self, section: str, key: str, value: str | bool | list[str] | dict[str, str], init: bool = False) -> tuple[bool, str] | tuple[bool, None]:
|
|
if key in self.hiddenAttribute and not init:
|
|
return False, None
|
|
|
|
if not init:
|
|
valid, msg = self.__configValidation(section, key, value)
|
|
if not valid:
|
|
return False, msg
|
|
|
|
if section == "Account" and key == "password":
|
|
if not init:
|
|
value = self.generatePassword(value["newPassword"]).decode("utf-8")
|
|
else:
|
|
value = self.generatePassword(value).decode("utf-8")
|
|
|
|
if section == "Email" and key == "email_template":
|
|
value = value.encode('unicode_escape').decode('utf-8')
|
|
|
|
if section == "Server" and key == "wg_conf_path":
|
|
if not os.path.exists(value):
|
|
return False, "Path does not exist"
|
|
|
|
if section not in self.__config:
|
|
if init:
|
|
self.__config[section] = {}
|
|
else:
|
|
return False, "Section does not exist"
|
|
|
|
if ((key not in self.__config[section].keys() and init) or
|
|
(key in self.__config[section].keys())):
|
|
if type(value) is bool:
|
|
if value:
|
|
self.__config[section][key] = "true"
|
|
else:
|
|
self.__config[section][key] = "false"
|
|
elif type(value) in [int, float]:
|
|
self.__config[section][key] = str(value)
|
|
elif type(value) is list:
|
|
self.__config[section][key] = "||".join(value).strip("||")
|
|
else:
|
|
self.__config[section][key] = fr"{value}"
|
|
return self.SaveConfig(), ""
|
|
else:
|
|
return False, f"{key} does not exist under {section}"
|
|
|
|
def SaveConfig(self) -> bool:
|
|
try:
|
|
with open(DashboardConfig.ConfigurationFilePath, "w+", encoding='utf-8') as configFile:
|
|
self.__config.write(configFile)
|
|
return True
|
|
except Exception as e:
|
|
return False
|
|
|
|
def GetConfig(self, section, key) ->tuple[bool, bool] | tuple[bool, str] | tuple[bool, list[str]] | tuple[bool, None]:
|
|
if section not in self.__config:
|
|
return False, None
|
|
|
|
if key not in self.__config[section]:
|
|
return False, None
|
|
|
|
if section == "Email" and key == "email_template":
|
|
return True, self.__config[section][key].encode('utf-8').decode('unicode_escape')
|
|
|
|
if section == "WireGuardConfiguration" and key == "autostart":
|
|
return True, list(filter(lambda x: len(x) > 0, self.__config[section][key].split("||")))
|
|
|
|
if self.__config[section][key] in ["1", "yes", "true", "on"]:
|
|
return True, True
|
|
|
|
if self.__config[section][key] in ["0", "no", "false", "off"]:
|
|
return True, False
|
|
|
|
|
|
return True, self.__config[section][key]
|
|
|
|
def toJson(self) -> dict[str, dict[Any, Any]]:
|
|
the_dict = {}
|
|
|
|
for section in self.__config.sections():
|
|
the_dict[section] = {}
|
|
for key, val in self.__config.items(section):
|
|
if key not in self.hiddenAttribute:
|
|
the_dict[section][key] = self.GetConfig(section, key)[1]
|
|
return the_dict
|