From e69e7ff3c1cb06751b4aad99ec25f5a2f85f20ae Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Wed, 25 Jun 2025 23:16:51 +0800 Subject: [PATCH] Fixed runJob --- src/modules/DashboardClients.py | 2 +- src/modules/PeerJobs.py | 15 ++-- src/static/client/src/App.vue | 4 +- src/static/client/src/assets/main.css | 5 +- .../Configuration/configuration.vue | 67 ++++++++--------- .../src/components/SignIn/signInForm.vue | 10 ++- .../client/src/components/SignIn/totpForm.vue | 2 +- src/static/client/src/stores/clientStore.js | 16 ++++ src/static/client/src/views/signup.vue | 74 ++++++++++--------- 9 files changed, 108 insertions(+), 87 deletions(-) diff --git a/src/modules/DashboardClients.py b/src/modules/DashboardClients.py index fafbf72..3ac8873 100644 --- a/src/modules/DashboardClients.py +++ b/src/modules/DashboardClients.py @@ -95,7 +95,7 @@ class DashboardClients: if checkPwd: session['Email'] = Email session['ClientID'] = existingClient.get("ClientID") - return True, self.DashboardClientsTOTP.GenerateToken(existingClient.get("ClientID")) + return True, self.DashboardClientsTOTP.GenerateToken(existingClient.get("ClientID")) return False, "Email or Password is incorrect" def SignIn_GetTotp(self, Token: str, UserProvidedTotp: str = None) -> tuple[bool, str] or tuple[bool, None, str]: diff --git a/src/modules/PeerJobs.py b/src/modules/PeerJobs.py index c8584f2..2daad20 100644 --- a/src/modules/PeerJobs.py +++ b/src/modules/PeerJobs.py @@ -138,6 +138,7 @@ class PeerJobs: def runJob(self): + print("[WGDashboard] Running scheduled jobs") needToDelete = [] self.__getJobs() for job in self.Jobs: @@ -156,24 +157,28 @@ class PeerJobs: if runAction: s = False if job.Action == "restrict": - s = c.restrictPeers([fp.id]).get_json() + s, msg = c.restrictPeers([fp.id]) elif job.Action == "delete": - s = c.deletePeers([fp.id]).get_json() + s, msg = c.deletePeers([fp.id]) - if s['status'] is True: - self.JobLogger.log(job.JobID, s["status"], + if s is True: + self.JobLogger.log(job.JobID, s, f"Peer {fp.id} from {c.Name} is successfully {job.Action}ed." ) + print(f"[WGDashboard] Peer {fp.id} from {c.Name} is successfully {job.Action}ed.") needToDelete.append(job) else: - self.JobLogger.log(job.JobID, s["status"], + print(f"[WGDashboard] Peer {fp.id} from {c.Name} is failed {job.Action}ed.") + self.JobLogger.log(job.JobID, s, f"Peer {fp.id} from {c.Name} failed {job.Action}ed." ) else: + print(f"[WGDashboard] Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed.") self.JobLogger.log(job.JobID, False, f"Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed." ) else: + print(f"[WGDashboard] Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed.") self.JobLogger.log(job.JobID, False, f"Somehow can't find this peer {job.Peer} from {job.Configuration} failed {job.Action}ed." ) diff --git a/src/static/client/src/App.vue b/src/static/client/src/App.vue index 2d32448..edb5fef 100644 --- a/src/static/client/src/App.vue +++ b/src/static/client/src/App.vue @@ -4,9 +4,9 @@ import NotificationList from "@/components/Notification/notificationList.vue";