From 409e6d49b21196181bfae5a384f6ad075ee651be Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Tue, 31 Dec 2024 10:33:28 +0800 Subject: [PATCH 1/3] Update dashboard.py - Fixed `WGDashboard_Backup` not being created and caused crash --- src/dashboard.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dashboard.py b/src/dashboard.py index 5f1851e..01ef711 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -479,6 +479,9 @@ class WireguardConfiguration: self.__parseConfigurationFile() self.__initPeersList() + + if not os.path.exists(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')): + os.mkdir(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')) else: self.Name = data["ConfigurationName"] From 2ed49abb1b02af21eae1c1646b0ea2b7564b6f8f Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Tue, 31 Dec 2024 10:44:27 +0800 Subject: [PATCH 2/3] Update dashboard.py Minor issue --- src/dashboard.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 01ef711..739e03b 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -467,6 +467,9 @@ class WireguardConfiguration: self.Name = name self.__configPath = os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], f'{self.Name}.conf') + if not os.path.exists(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')): + os.mkdir(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')) + if name is not None: if data is not None and "Backup" in data.keys(): db = self.__importDatabase( @@ -480,8 +483,6 @@ class WireguardConfiguration: self.__parseConfigurationFile() self.__initPeersList() - if not os.path.exists(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')): - os.mkdir(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')) else: self.Name = data["ConfigurationName"] @@ -2434,8 +2435,7 @@ def API_traceroute_execute(): data=json.dumps([x['ip'] for x in result])) d = r.json() for i in range(len(result)): - result[i]['geo'] = d[i] - + result[i]['geo'] = d[i] except Exception as e: print(e) return ResponseObject(data=result) From a85a8668a78ff48c5d98e4da2d27c519986ce9f5 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Wed, 1 Jan 2025 10:36:44 +0800 Subject: [PATCH 3/3] Update dashboard.py --- src/dashboard.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 739e03b..40a5eeb 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -467,8 +467,10 @@ class WireguardConfiguration: self.Name = name self.__configPath = os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], f'{self.Name}.conf') - if not os.path.exists(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')): - os.mkdir(os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup')) + + backupPath = os.path.join(DashboardConfig.GetConfig("Server", "wg_conf_path")[1], 'WGDashboard_Backup') + if not os.path.exists(backupPath): + os.mkdir(backupPath) if name is not None: if data is not None and "Backup" in data.keys():