From 88f40b244a7df97bba6609c8950e6e70a64b162d Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Sat, 16 Aug 2025 01:51:18 +0800 Subject: [PATCH] Still need to work on validation --- src/modules/DashboardConfig.py | 2 +- src/modules/WireguardConfiguration.py | 7 + .../editConfiguration.vue | 17 ++- .../editPeerSettingsOverride.vue | 136 ++++++++++++++++++ 4 files changed, 152 insertions(+), 10 deletions(-) create mode 100644 src/static/app/src/components/configurationComponents/editConfigurationComponents/editPeerSettingsOverride.vue diff --git a/src/modules/DashboardConfig.py b/src/modules/DashboardConfig.py index 798638d3..d1c6d688 100644 --- a/src/modules/DashboardConfig.py +++ b/src/modules/DashboardConfig.py @@ -170,7 +170,7 @@ class DashboardConfig: self.DashboardAPIKeys = self.__getAPIKeys() - def __configValidation(self, section : str, key: str, value: Any) -> [bool, str]: + 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')): diff --git a/src/modules/WireguardConfiguration.py b/src/modules/WireguardConfiguration.py index 4c0e753a..71e2a45f 100644 --- a/src/modules/WireguardConfiguration.py +++ b/src/modules/WireguardConfiguration.py @@ -1109,6 +1109,13 @@ class WireguardConfiguration: def updateConfigurationInfo(self, key: str, value) -> tuple[bool, str] | tuple[bool, None]: if key == "Description": self.configurationInfo.Description = value + elif key == "OverridePeerSettings": + for key in value.keys(): + if key == "DNS" and value.get("DNS"): + pass + + self.configurationInfo.OverridePeerSettings = ( + self.configurationInfo.OverridePeerSettings.model_validate(value)) else: return False, "Key does not exist" diff --git a/src/static/app/src/components/configurationComponents/editConfiguration.vue b/src/static/app/src/components/configurationComponents/editConfiguration.vue index b302e601..164af07e 100644 --- a/src/static/app/src/components/configurationComponents/editConfiguration.vue +++ b/src/static/app/src/components/configurationComponents/editConfiguration.vue @@ -1,6 +1,6 @@ + + + + \ No newline at end of file